Fix the "plugson.tar.xz not found" error, when the path contains unicode characters.

This commit is contained in:
longpanda
2021-12-03 14:21:47 +08:00
parent 73fabd0c65
commit 8c18f91ac1
5 changed files with 119 additions and 66 deletions

View File

@@ -468,6 +468,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
{
int rc;
HANDLE hMutex;
WCHAR CurDir[MAX_PATH];
UNREFERENCED_PARAMETER(hPrevInstance);
@@ -489,7 +490,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
return 1;
}
GetCurrentDirectoryA(MAX_PATH, g_cur_dir);
GetCurrentDirectoryW(MAX_PATH, CurDir);
WideCharToMultiByte(CP_UTF8, 0, CurDir, -1, g_cur_dir, MAX_PATH, NULL, 0);
sprintf_s(g_ventoy_dir, sizeof(g_ventoy_dir), "%s", g_cur_dir);
sprintf_s(g_log_file, sizeof(g_log_file), "%s\\%s", g_cur_dir, LOG_FILE);
ventoy_log_init();