mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
(Windows) Set the Registry functions to explicitly use the widestring variants
This commit is contained in:
parent
6c03688f8e
commit
3c9c031b1c
|
@ -1731,15 +1731,15 @@ const std::string FileData::findEmulatorPath(std::string& command)
|
|||
DWORD pathSize {1024};
|
||||
|
||||
// First look in HKEY_CURRENT_USER.
|
||||
keyStatus = RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||
Utils::String::stringToWideString(registryKeyPath).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
keyStatus = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
Utils::String::stringToWideString(registryKeyPath).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
|
||||
// If not found, then try in HKEY_LOCAL_MACHINE.
|
||||
if (keyStatus != ERROR_SUCCESS) {
|
||||
keyStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
Utils::String::stringToWideString(registryKeyPath).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
keyStatus = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
Utils::String::stringToWideString(registryKeyPath).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
}
|
||||
|
||||
// If the key exists, then try to retrieve its default value.
|
||||
|
@ -1792,22 +1792,22 @@ const std::string FileData::findEmulatorPath(std::string& command)
|
|||
DWORD pathSize {1024};
|
||||
|
||||
// First look in HKEY_CURRENT_USER.
|
||||
keyStatus = RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||
Utils::String::stringToWideString(registryValueKey).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
keyStatus = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
Utils::String::stringToWideString(registryValueKey).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
|
||||
// If not found, then try in HKEY_LOCAL_MACHINE.
|
||||
if (keyStatus != ERROR_SUCCESS) {
|
||||
keyStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
Utils::String::stringToWideString(registryValueKey).c_str(), 0,
|
||||
KEY_QUERY_VALUE, ®istryKey);
|
||||
keyStatus = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
Utils::String::stringToWideString(registryValueKey).c_str(),
|
||||
0, KEY_QUERY_VALUE, ®istryKey);
|
||||
}
|
||||
|
||||
// If the key exists, then try to retrieve the defined value.
|
||||
if (keyStatus == ERROR_SUCCESS) {
|
||||
pathStatus = RegGetValue(registryKey, nullptr,
|
||||
Utils::String::stringToWideString(registryValue).c_str(),
|
||||
RRF_RT_REG_SZ, nullptr, &path[0], &pathSize);
|
||||
pathStatus = RegGetValueW(registryKey, nullptr,
|
||||
Utils::String::stringToWideString(registryValue).c_str(),
|
||||
RRF_RT_REG_SZ, nullptr, &path[0], &pathSize);
|
||||
path.erase(std::find(path.begin(), path.end(), '\0'), path.end());
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue