Fix the boot issue for some WinPE iso.

This commit is contained in:
longpanda
2026-05-07 11:17:57 +08:00
parent dba7530b21
commit 12387fff81
4 changed files with 141 additions and 63 deletions

Binary file not shown.

Binary file not shown.

58
vtoyjump/build.bat Normal file
View File

@@ -0,0 +1,58 @@
@echo off
chcp 65001
echo ==============================================
echo VS 命令行双架构编译脚本
echo ==============================================
:: ====================== 【必须改这里】======================
:: 1. 你的 VS 版本对应的 VsDevCmd.bat 路径(看下面的路径对照表)
set "VS_DEV_CMD=%VS120COMNTOOLS%VsDevCmd.bat"
:: 2. 你的 VS 解决方案文件名(.sln
set "SLN_FILE=vtoyjump.sln"
:: ==========================================================
:: 初始化VS编译环境必须第一步
echo 正在初始化 VS 编译环境...
call "%VS_DEV_CMD%" -no_logo
if %errorlevel% neq 0 (
echo 错误VS环境初始化失败检查路径是否正确
pause
exit /b 1
)
:: ============== 编译 Release Win32 (x86) ==============
echo.
echo 正在编译Release Win32
MSBuild "%SLN_FILE%" /t:Build /p:Configuration=Release;Platform=Win32 /m
if %errorlevel% neq 0 (
echo 编译 Release Win32 失败!
pause
exit /b 1
)
:: ============== 编译 Release x64 ==============
echo.
echo 正在编译Release x64
MSBuild "%SLN_FILE%" /t:Build /p:Configuration=Release;Platform=x64 /m
if %errorlevel% neq 0 (
echo 编译 Release x64 失败!
pause
exit /b 1
)
del ..\INSTALL\ventoy\vtoyjump32.exe
del ..\INSTALL\ventoy\vtoyjump64.exe
copy Release\vtoyjump32.exe ..\INSTALL\ventoy\vtoyjump32.exe
copy x64\Release\vtoyjump64.exe ..\INSTALL\ventoy\vtoyjump64.exe
echo.
echo ==============================================
echo ✅ 2架构编译完成
echo ==============================================
echo.
pause

View File

@@ -2849,7 +2849,7 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
goto End; goto End;
} }
// convert / to \\ // convert '/'
for (Pos = 0; Pos < sizeof(g_os_param.vtoy_img_path) && g_os_param.vtoy_img_path[Pos]; Pos++) for (Pos = 0; Pos < sizeof(g_os_param.vtoy_img_path) && g_os_param.vtoy_img_path[Pos]; Pos++)
{ {
if (g_os_param.vtoy_img_path[Pos] == '/') if (g_os_param.vtoy_img_path[Pos] == '/')
@@ -2902,6 +2902,26 @@ End:
return rc; return rc;
} }
static BOOL is_exe_need_recover(const char *prog_name)
{
if (_stricmp(g_prog_name, "winpeshl.exe") == 0)
{
// if setup.exe not exist, it's not a standard Windows ISO, maybe PE.
if (!IsFileExist("X:\\setup.exe") && IsFileExist("ventoy\\%s", g_prog_name))
{
return TRUE;
}
}
else
{
if (IsFileExist("ventoy\\%s", g_prog_name))
{
return TRUE;
}
}
return FALSE;
}
int real_main(int argc, char **argv) int real_main(int argc, char **argv)
{ {
@@ -2936,7 +2956,7 @@ int real_main(int argc, char **argv)
Log("LunchFile=<%s> CallParam=<%s>", LunchFile, CallParam); Log("LunchFile=<%s> CallParam=<%s>", LunchFile, CallParam);
if (_stricmp(g_prog_name, "winpeshl.exe") != 0 && IsFileExist("ventoy\\%s", g_prog_name)) if (is_exe_need_recover(g_prog_name))
{ {
sprintf_s(NewFile, sizeof(NewFile), "%s\\VTOYJUMP.EXE", g_prog_dir); sprintf_s(NewFile, sizeof(NewFile), "%s\\VTOYJUMP.EXE", g_prog_dir);
MoveFileA(g_prog_full_path, NewFile); MoveFileA(g_prog_full_path, NewFile);