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