farfella
01/17/2020, 10:29 PMstd::codecvt_utf8_utf16
? I put my comments on the issue, with what i found reversing RegQueryValueExA
*theopolis
01/17/2020, 11:21 PMfarfella
01/17/2020, 11:29 PMstd::string to_bytes(const std::wstring& str) {
std::string result;
if (str.length() > 0) {
char* buffer = new (std::nothrow) char[str.length() * 4];
if (nullptr != buffer) {
if (0 != WideCharToMultiByte(CP_ACP,
0,
str.c_str(),
-1,
buffer,
str.length() * 4,
NULL,
NULL)) {
result = buffer;
delete[] buffer;
}
}
}
return result;
}
//
// Code Page Default Values.
// Please Use Unicode, either UTF-16 (as in WCHAR) or UTF-8 (code page CP_ACP)
//
#define CP_ACP 0 // default to ANSI code page