[BUGFIX] Fixed registry writes

This commit is contained in:
hasherezade
2026-10-07 17:56:52 +02:00
parent 9e054c18a7
commit c1dbceefcf
+6 -6
View File
@@ -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;
}