mirror of
https://github.com/hasherezade/pe-bear.git
synced 2026-10-11 21:49:54 +00:00
[BUGFIX] Fixed registry writes
This commit is contained in:
@@ -26,7 +26,7 @@ bool RegKeyManager::removeRegPath(const std::string &extension, const std::strin
|
||||
res1 = RegDeleteKeyA(hKey, "command");
|
||||
res2 = RegDeleteKeyA(hKey, "");
|
||||
|
||||
res = RegCloseKey(HKEY_CLASSES_ROOT);
|
||||
res = RegCloseKey(hKey);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
@@ -54,8 +54,8 @@ bool RegKeyManager::addRegPath(const std::string &extension, const std::string &
|
||||
if (res != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
res1 = RegSetValueExA(hKey, NULL, 0, REG_SZ, (BYTE*)cmdPath.c_str(), cmdPath.length());
|
||||
res = RegCloseKey(HKEY_CLASSES_ROOT);
|
||||
res1 = RegSetValueExA(hKey, NULL, 0, REG_SZ, reinterpret_cast<const BYTE*>(cmdPath.c_str()), static_cast<DWORD>(cmdPath.length() + 1));
|
||||
res = RegCloseKey(hKey);
|
||||
if (res1 != ERROR_SUCCESS || res != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
@@ -68,9 +68,9 @@ bool RegKeyManager::addRegPath(const std::string &extension, const std::string &
|
||||
}
|
||||
|
||||
const std::string iconPath = path + ",0";
|
||||
res1 = RegSetValueExA(hKey, "Icon", 0, REG_SZ, (BYTE*)iconPath.c_str(), iconPath.length());
|
||||
res1 = RegSetValueExA(hKey, "Icon", 0, REG_SZ, reinterpret_cast<const BYTE*>(iconPath.c_str()), static_cast<DWORD>(iconPath.length() + 1));
|
||||
|
||||
res = RegCloseKey(HKEY_CLASSES_ROOT);
|
||||
res = RegCloseKey(hKey);
|
||||
if (res1 != ERROR_SUCCESS || res != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ bool RegKeyManager::isKeySet(const std::string &extension, const std::string &ap
|
||||
if (res != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
res = RegCloseKey(HKEY_CLASSES_ROOT);
|
||||
res = RegCloseKey(hKey);
|
||||
if (res == ERROR_SUCCESS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user