MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / DeleteAllRegisteryValues

Function DeleteAllRegisteryValues

cppcryptfs/ui/uiutil.cpp:53–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53bool DeleteAllRegisteryValues(LPCWSTR regPath, wstring& mes)
54{
55 mes.clear();
56
57 HKEY hkey;
58 LSTATUS status = ::RegOpenKeyEx(HKEY_CURRENT_USER, regPath, 0, KEY_ALL_ACCESS, &hkey);
59 if (status != ERROR_SUCCESS) {
60 if (status != ERROR_FILE_NOT_FOUND) {
61 mes = LocUtils::GetStringFromResources(IDS_UNABLE_OPEN_HISTORY);
62 }
63 return false;
64 }
65 DWORD index = 0;
66 DWORD type;
67 WCHAR val[256];
68 DWORD val_len = _countof(val);
69 list<std::wstring> values;
70 while ((status = ::RegEnumValue(hkey, index, val, &val_len, NULL, &type, NULL, NULL)) == ERROR_SUCCESS) {
71 index++;
72 val_len = _countof(val);
73 values.push_back(val);
74 }
75
76 if (status != ERROR_NO_MORE_ITEMS) {
77 ::RegCloseKey(hkey);
78 mes = LocUtils::GetStringFromResources(IDS_ERR_DELETING_HISTORY);
79 return false;
80 }
81
82 for (auto it : values) {
83 status = RegDeleteValue(hkey, it.c_str());
84 if (status != ERROR_SUCCESS) {
85 ::RegCloseKey(hkey);
86 mes = LocUtils::GetStringFromResources(IDS_ERR_DELETING_REG_VALUE);
87 return false;
88 }
89 }
90
91 ::RegCloseKey(hkey);
92
93 return true;
94}
95
96bool NeverSaveHistory()
97{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected