diff --git a/INSTALL/Ventoy2Disk.exe b/INSTALL/Ventoy2Disk.exe index 80161e20..a50ab469 100644 Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ diff --git a/INSTALL/Ventoy2Disk_ARM.exe b/INSTALL/Ventoy2Disk_ARM.exe index 2ded2129..0a062955 100644 Binary files a/INSTALL/Ventoy2Disk_ARM.exe and b/INSTALL/Ventoy2Disk_ARM.exe differ diff --git a/INSTALL/Ventoy2Disk_ARM64.exe b/INSTALL/Ventoy2Disk_ARM64.exe index 49031c83..bd2c1466 100644 Binary files a/INSTALL/Ventoy2Disk_ARM64.exe and b/INSTALL/Ventoy2Disk_ARM64.exe differ diff --git a/INSTALL/Ventoy2Disk_X64.exe b/INSTALL/Ventoy2Disk_X64.exe index 4271cf07..abeeea6a 100644 Binary files a/INSTALL/Ventoy2Disk_X64.exe and b/INSTALL/Ventoy2Disk_X64.exe differ diff --git a/Plugson/src/Core/ventoy_log.c b/Plugson/src/Core/ventoy_log.c index 68bd50c0..2e089f7a 100644 --- a/Plugson/src/Core/ventoy_log.c +++ b/Plugson/src/Core/ventoy_log.c @@ -54,8 +54,6 @@ void ventoy_set_loglevel(int level) g_ventoy_log_level = level; } - - void ventoy_syslog_printf(const char *Fmt, ...) { char log[512]; diff --git a/Plugson/src/main_windows.c b/Plugson/src/main_windows.c index 7eea9762..49e89c3f 100644 --- a/Plugson/src/main_windows.c +++ b/Plugson/src/main_windows.c @@ -82,6 +82,14 @@ const WCHAR *g_msg_en[MSGID_BUTT] = L"ventoy\\plugson.tar.xz does not exist, please run under the correct directory!", }; +#define UTF8_Log(fmt, wstr) \ +{\ + memset(TmpPathA, 0, sizeof(TmpPathA));\ + WideCharToMultiByte(CP_UTF8, 0, wstr, -1, TmpPathA, sizeof(TmpPathA), NULL, NULL);\ + vlog(fmt, TmpPathA);\ +} + + const WCHAR **g_msg_lang = NULL; HINSTANCE g_hInst; @@ -399,7 +407,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lPara { InitDialog(hWnd, wParam, lParam); break; - } + } case WM_CLOSE: { if (g_running) @@ -414,6 +422,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lPara OnDestroyDialog(); EndDialog(hWnd, 0); + break; } } @@ -527,8 +536,14 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi { int i; int rc; + int status = 0; HANDLE hMutex; + WCHAR* Pos = NULL; WCHAR CurDir[MAX_PATH]; + WCHAR ExePath[MAX_PATH]; + WCHAR CurDirBk[MAX_PATH]; + WCHAR ExePathBk[MAX_PATH]; + CHAR TmpPathA[MAX_PATH]; UNREFERENCED_PARAMETER(hPrevInstance); @@ -562,12 +577,67 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi } GetCurrentDirectoryW(MAX_PATH, CurDir); + GetCurrentDirectoryW(MAX_PATH, CurDirBk); + GetModuleFileNameW(NULL, ExePath, MAX_PATH); + GetModuleFileNameW(NULL, ExePathBk, MAX_PATH); + + for (Pos = NULL, i = 0; i < MAX_PATH && ExePath[i]; i++) + { + if (ExePath[i] == '\\' || ExePath[i] == '/') + { + Pos = ExePath + i; + } + } + + if (Pos) + { + *Pos = 0; + if (wcscmp(CurDir, ExePath)) + { + status |= 1; + SetCurrentDirectoryW(ExePath); + GetCurrentDirectoryW(MAX_PATH, CurDir); + } + else + { + status |= 2; + } + } + + Pos = wcsstr(CurDir, L"\\altexe"); + if (Pos) + { + *Pos = 0; + status |= 4; + SetCurrentDirectoryW(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); + sprintf_s(g_log_file, sizeof(g_log_file), "%s", LOG_FILE); ventoy_log_init(); + vlog("====================== Ventoy Plugson =========================\n"); + + UTF8_Log("Current Directory <%s>\n", CurDirBk); + UTF8_Log("Exe file path <%s>\n", ExePathBk); + + if (status & 1) + { + UTF8_Log("Change current dir to exe <%s>\n", ExePath); + } + if (status & 2) + { + vlog("Current directory check OK.\n"); + } + if (status & 4) + { + UTF8_Log("altexe detected, change current dir to <%s>\n", CurDir); + } + + if (!ventoy_is_file_exist("%s\\ventoy\\%s", g_ventoy_dir, PLUGSON_TXZ)) { MessageBoxW(NULL, g_msg_lang[MSGID_NO_TARXZ_TIP], g_msg_lang[MSGID_ERROR], MB_OK | MB_ICONERROR); @@ -585,7 +655,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi } vlog("===============================================\n"); - vlog("===== Ventoy Plugson %s:%s =====\n", g_sysinfo.ip, g_sysinfo.port); + vlog("========= Ventoy Plugson %s:%s =========\n", g_sysinfo.ip, g_sysinfo.port); vlog("===============================================\n"); @@ -605,7 +675,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi ventoy_http_init(); g_hInst = hInstance; - DialogBoxA(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc); + DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc); return 0; } diff --git a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe index 9e0f0263..ad3baf81 100644 Binary files a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe and b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe differ diff --git a/Plugson/vs/VentoyPlugson/VentoyPlugson/Res/Plugson64.manifest b/Plugson/vs/VentoyPlugson/VentoyPlugson/Res/Plugson64.manifest index a0559d75..c073523e 100644 --- a/Plugson/vs/VentoyPlugson/VentoyPlugson/Res/Plugson64.manifest +++ b/Plugson/vs/VentoyPlugson/VentoyPlugson/Res/Plugson64.manifest @@ -27,5 +27,11 @@ - + + + + + + + \ No newline at end of file diff --git a/Plugson/vs/VentoyPlugson/VentoyPlugson/VentoyPlugson.vcxproj b/Plugson/vs/VentoyPlugson/VentoyPlugson/VentoyPlugson.vcxproj index c1a19798..34611fdf 100644 --- a/Plugson/vs/VentoyPlugson/VentoyPlugson/VentoyPlugson.vcxproj +++ b/Plugson/vs/VentoyPlugson/VentoyPlugson/VentoyPlugson.vcxproj @@ -169,7 +169,7 @@ gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll - $(ProjectDir)\Res\Plugson32.manifest %(AdditionalManifestFiles) + $(ProjectDir)\Res\Plugson64.manifest %(AdditionalManifestFiles) diff --git a/Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe b/Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe index 0f51ab03..35940301 100644 Binary files a/Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe and b/Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe differ diff --git a/Ventoy2Disk/Ventoy2Disk/WinDialog.c b/Ventoy2Disk/Ventoy2Disk/WinDialog.c index 7ae91958..cfebec9c 100644 Binary files a/Ventoy2Disk/Ventoy2Disk/WinDialog.c and b/Ventoy2Disk/Ventoy2Disk/WinDialog.c differ diff --git a/Ventoy2Disk/Ventoy2Disk/ventoy_cli.c b/Ventoy2Disk/Ventoy2Disk/ventoy_cli.c index 8adffcae..55ffbd23 100644 --- a/Ventoy2Disk/Ventoy2Disk/ventoy_cli.c +++ b/Ventoy2Disk/Ventoy2Disk/ventoy_cli.c @@ -233,6 +233,10 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C { fstype = VTOY_FS_FAT32; } + else if (_stricmp(opt + 4, "UDF") == 0) + { + fstype = VTOY_FS_UDF; + } } }