This commit is contained in:
love-code-yeyixiao 2024-06-23 15:38:47 +08:00
parent 77947120af
commit 10ed66bdd4
1 changed files with 3 additions and 3 deletions

View File

@ -475,19 +475,19 @@ const wchar_t* GetWC(const char* c)
const size_t cSize = strlen(c) + 1; const size_t cSize = strlen(c) + 1;
wchar_t* wc=(wchar_t*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(wchar_t) * cSize); wchar_t* wc=(wchar_t*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(wchar_t) * cSize);
mbstowcs(wc, c, cSize); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, c, cSize, wc, cSize);
return wc; return wc;
} }
_FX int Kernel_GetUserDefaultGeoName( _FX int Kernel_GetUserDefaultGeoName(
LPWSTR geoName, LPWSTR geoName,
int geoNameCount int geoNameCount
) { ) {
char* buf = malloc(sizeof(char) * geoNameCount); char* buf = (char*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(char) * geoNameCount);
itoa2(SbieApi_QueryConfNumber(NULL, L"FalseAreaNumber", 840),buf,10); itoa2(SbieApi_QueryConfNumber(NULL, L"FalseAreaNumber", 840),buf,10);
wchar_t* tmp = GetWC(buf); wchar_t* tmp = GetWC(buf);
int length = sizeof(GetWC(buf)); int length = sizeof(GetWC(buf));
lstrcpy(geoName, tmp); lstrcpy(geoName, tmp);
GlobalFree(buf);
GlobalFree(tmp); GlobalFree(tmp);
return length; return length;
} }