use wideStringToString

This commit is contained in:
rjkiv
2025-08-06 11:47:04 -07:00
parent ca647d32e7
commit 3f5b1c3767

View File

@@ -899,20 +899,10 @@ namespace kernel32 {
} }
unsigned int WIN_FUNC GetFileAttributesW(const wchar_t* lpFileName) { unsigned int WIN_FUNC GetFileAttributesW(const wchar_t* lpFileName) {
DEBUG_LOG("GetFileAttributesW\n"); DEBUG_LOG("GetFileAttributesW(");
size_t len = std::wcstombs(nullptr, lpFileName, 0); std::string str = wideStringToString((const unsigned short*)lpFileName, wcslen(lpFileName));
if(len != (size_t)-1){ DEBUG_LOG("%s)\n", str.c_str());
char* converted = new char[len + 1]; return GetFileAttributesA(str.c_str());
std::wcstombs(converted, lpFileName, len + 1);
unsigned int ret = GetFileAttributesA(converted);
delete [] converted;
return ret;
}
else {
DEBUG_LOG("Could not convert filename for GetFileAttributesW!\n");
wibo::lastError = 2;
return 0xFFFFFFFF;
}
} }
unsigned short WIN_FUNC GetUserDefaultUILanguage(){ unsigned short WIN_FUNC GetUserDefaultUILanguage(){