From 3c9c031b1cc16e870217228e51a920f591dfaeab Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 10 Aug 2023 20:36:15 +0200 Subject: [PATCH] (Windows) Set the Registry functions to explicitly use the widestring variants --- es-app/src/FileData.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 29db60e65..86c459e3b 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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 {