This commit is contained in:
love-code-yeyixiao 2024-06-23 15:18:14 +08:00
parent 199876483a
commit f06ab092cc
1 changed files with 9 additions and 5 deletions

View File

@ -469,11 +469,12 @@ char* itoa2(int num, char* str, int radix)
return str; return str;
} }
#include<stdlib.h>
const wchar_t* GetWC(const char* c) 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*)malloc(sizeof(wchar_t)*cSize);
wchar_t* wc=(wchar_t*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(wchar_t) * cSize));
mbstowcs(wc, c, cSize); mbstowcs(wc, c, cSize);
return wc; return wc;
@ -484,8 +485,11 @@ _FX int Kernel_GetUserDefaultGeoName(
) { ) {
char* buf = malloc(sizeof(char) * geoNameCount); char* buf = malloc(sizeof(char) * geoNameCount);
itoa2(SbieApi_QueryConfNumber(NULL, L"FalseAreaNumber", 840),buf,10); itoa2(SbieApi_QueryConfNumber(NULL, L"FalseAreaNumber", 840),buf,10);
lstrcpy(geoName, GetWC(buf)); wchar_t* tmp = GetWC(buf);
return sizeof(GetWC(buf)); int length = sizeof(GetWC(buf));
lstrcpy(geoName, tmp);
GlobalFree(tmp);
return length;
} }
_FX LANGID Kernel_GetSystemDefaultUILanguage() { _FX LANGID Kernel_GetSystemDefaultUILanguage() {