This commit is contained in:
2024-03-31 13:23:55 +08:00
parent a1b9f7a32d
commit a08eb9c220
11 changed files with 804 additions and 233 deletions

View File

@@ -150,3 +150,20 @@ public:
static DWORD Motify_memory_attributes(int address, DWORD attributes = PAGE_EXECUTE_READWRITE);
};
static char* GBKTOUTF8(std::string& strGBK)//转码 GBK编码转成UTF8编码
{
int len = MultiByteToWideChar(CP_ACP, 0, strGBK.c_str(), -1, NULL, 0);
wchar_t* wszUtf8 = new wchar_t[len];
memset(wszUtf8, 0, len);
MultiByteToWideChar(CP_ACP, 0, strGBK.c_str(), -1, wszUtf8, len);
len = WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, NULL, 0, NULL, NULL);
char* szUtf8 = new char[len + 1];
memset(szUtf8, 0, len + 1);
WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, szUtf8, len, NULL, NULL);
strGBK = szUtf8;
delete[] szUtf8;
delete[] wszUtf8;
return (char*)strGBK.c_str();
}