| 84 | } |
| 85 | |
| 86 | static std::string WstringToString(const std::wstring& wstr) { |
| 87 | if (wstr.empty()) { |
| 88 | return ""; |
| 89 | } |
| 90 | |
| 91 | auto size = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), static_cast<int>(wstr.length()), |
| 92 | nullptr, 0, nullptr, nullptr); |
| 93 | if (size <= 0) { |
| 94 | return std::string(); |
| 95 | } |
| 96 | std::string result(size, 0); |
| 97 | WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), static_cast<int>(wstr.length()), &result[0], size, |
| 98 | nullptr, nullptr); |
| 99 | return result; |
| 100 | } |
| 101 | |
| 102 | static std::string ReadRegistryStringValue(const RegistryKey& key, const std::wstring& valueName) { |
| 103 | if (!key.isValid()) { |
no test coverage detected