diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c
index 3fd1390a..5e448d27 100644
--- a/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c
+++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c
@@ -29,6 +29,7 @@
extern int g_ventoy_memdisk_mode;
extern int g_ventoy_iso_raw;
extern int g_ventoy_grub2_mode;
+extern int g_ventoy_wimboot_mode;
extern int g_ventoy_iso_uefi_drv;
static const char *align_options[] =
@@ -209,6 +210,9 @@ label_set_property (void *vself, const char *name, const char *value)
else if (grub_strcmp (value, "@VTOY_GRUB2_MODE@") == 0) {
value = g_ventoy_grub2_mode ? grub_env_get("VTOY_GRUB2_MODE_STR") : " ";
}
+ else if (grub_strcmp (value, "@VTOY_WIMBOOT_MODE@") == 0) {
+ value = g_ventoy_wimboot_mode ? grub_env_get("VTOY_WIMBOOT_MODE_STR") : " ";
+ }
else if (grub_strcmp (value, "@VTOY_ISO_UEFI_DRV@") == 0) {
value = g_ventoy_iso_uefi_drv ? grub_env_get("VTOY_ISO_UEFI_DRV_STR") : " ";
}
diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
index f682fa8a..14e3dac5 100644
--- a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
+++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
@@ -38,6 +38,7 @@ int g_ventoy_menu_refresh = 0;
int g_ventoy_memdisk_mode = 0;
int g_ventoy_iso_raw = 0;
int g_ventoy_grub2_mode = 0;
+int g_ventoy_wimboot_mode = 0;
int g_ventoy_iso_uefi_drv = 0;
int g_ventoy_last_entry = -1;
int g_ventoy_suppress_esc = 0;
@@ -904,6 +905,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
g_ventoy_menu_refresh = 1;
goto refresh;
+ case (GRUB_TERM_CTRL | 'w'):
+ menu_fini ();
+ g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_mode;
+ g_ventoy_menu_refresh = 1;
+ goto refresh;
+
case (GRUB_TERM_CTRL | 'u'):
menu_fini ();
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
index 9f0a8b8f..3a9b7718 100644
--- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
+++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
@@ -3163,6 +3163,10 @@ static grub_err_t ventoy_cmd_check_mode(grub_extcmd_context_t ctxt, int argc, ch
{
return g_ventoy_grub2_mode ? 0 : 1;
}
+ else if (args[0][0] == '4')
+ {
+ return g_ventoy_wimboot_mode ? 0 : 1;
+ }
return 1;
}
@@ -4426,6 +4430,7 @@ static cmd_para ventoy_cmds[] =
{ "vt_windows_reset", ventoy_cmd_wimdows_reset, 0, NULL, "", "", NULL },
{ "vt_windows_chain_data", ventoy_cmd_windows_chain_data, 0, NULL, "", "", NULL },
+ { "vt_windows_wimboot_data", ventoy_cmd_windows_wimboot_data, 0, NULL, "", "", NULL },
{ "vt_windows_collect_wim_patch", ventoy_cmd_collect_wim_patch, 0, NULL, "", "", NULL },
{ "vt_windows_locate_wim_patch", ventoy_cmd_locate_wim_patch, 0, NULL, "", "", NULL },
{ "vt_windows_count_wim_patch", ventoy_cmd_wim_patch_count, 0, NULL, "", "", NULL },
diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
index 5e7e11d2..3aff72b2 100644
--- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
@@ -555,6 +555,7 @@ int ventoy_fill_data(grub_uint32_t buflen, char *buffer);
grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wimdows_reset(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
+grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
@@ -916,6 +917,7 @@ extern int g_ventoy_last_entry;
extern int g_ventoy_memdisk_mode;
extern int g_ventoy_iso_raw;
extern int g_ventoy_grub2_mode;
+extern int g_ventoy_wimboot_mode;
extern int g_ventoy_iso_uefi_drv;
extern int g_ventoy_case_insensitive;
extern grub_uint8_t g_ventoy_chain_type;
diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
index f6d4d26a..d21533a5 100644
--- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
+++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
@@ -1330,6 +1330,54 @@ end:
return rc;
}
+grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ grub_uint32_t size = 0;
+ const char *addr = NULL;
+ ventoy_chain_head *chain = NULL;
+ ventoy_os_param *param = NULL;
+ char envbuf[64];
+
+ (void)ctxt;
+ (void)argc;
+ (void)args;
+
+ addr = grub_env_get("vtoy_chain_mem_addr");
+ if (!addr)
+ {
+ debug("Failed to find vtoy_chain_mem_addr\n");
+ return 1;
+ }
+
+ chain = (ventoy_chain_head *)(void *)grub_strtoul(addr, NULL, 16);
+
+ if (grub_memcmp(&g_ventoy_guid, &chain->os_param.guid, 16) != 0)
+ {
+ debug("os_param.guid not match\n");
+ return 1;
+ }
+
+ size = sizeof(ventoy_os_param) + sizeof(ventoy_windows_data);
+ param = (ventoy_os_param *)grub_zalloc(size);
+ if (!param)
+ {
+ return 1;
+ }
+
+ grub_memcpy(param, &chain->os_param, sizeof(ventoy_os_param));
+ ventoy_fill_windows_rtdata(param + 1, param->vtoy_img_path);
+
+ grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)param);
+ grub_env_set("vtoy_wimboot_mem_addr", envbuf);
+ debug("vtoy_wimboot_mem_addr: %s\n", envbuf);
+
+ grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
+ grub_env_set("vtoy_wimboot_mem_size", envbuf);
+ debug("vtoy_wimboot_mem_size: %s\n", envbuf);
+
+ VENTOY_CMD_RETURN(GRUB_ERR_NONE);
+}
+
grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
{
int unknown_image = 0;
diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg
index a8f70b2b..f57a20c9 100644
--- a/INSTALL/grub/grub.cfg
+++ b/INSTALL/grub/grub.cfg
@@ -805,6 +805,25 @@ function uefi_iso_memdisk {
}
+function legacy_windows_wimboot_func {
+ set wimbootfile=(loop)/sources/boot.wim
+ set wimbit=64
+
+ vt_windows_wimboot_data
+
+ linux16 $vtoy_efi_part/ventoy/wimboot quiet
+ ventoy_debug_pause
+
+ echo Loading files...... (This may take a few minutes, please wait.)
+ initrd16 newc:vtoyjump.exe:$vtoy_efi_part/ventoy/vtoyjump${wimbit}.exe \
+ newc:wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
+ newc:winpeshl.ini:$vtoy_efi_part/ventoy/winpeshl.ini \
+ newc:bcd:(loop)/boot/bcd \
+ newc:boot.sdi:(loop)/boot/boot.sdi \
+ newc:boot.wim:$wimbootfile
+ boot
+}
+
function legacy_windows_menu_func {
vt_windows_reset
@@ -833,7 +852,11 @@ function legacy_windows_menu_func {
vt_windows_chain_data "${1}${chosen_path}"
ventoy_debug_pause
-
+
+ if vt_check_mode 4; then
+ legacy_windows_wimboot_func
+ fi
+
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
@@ -1721,6 +1744,7 @@ set VTOY_DEFAULT_MENU_MODE=0
set VTOY_MEM_DISK_STR="[Memdisk]"
set VTOY_ISO_RAW_STR="Compatible Mode"
set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
+set VTOY_WIMBOOT_MODE_STR="WIMBOOT Mode"
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
set VTOY_F2_CMD="ventoy_power"
diff --git a/INSTALL/grub/themes/ventoy/theme.txt b/INSTALL/grub/themes/ventoy/theme.txt
index 708acd25..f8815065 100644
--- a/INSTALL/grub/themes/ventoy/theme.txt
+++ b/INSTALL/grub/themes/ventoy/theme.txt
@@ -78,6 +78,14 @@ terminal-box: "terminal_box_*.png"
+ label {text = "@VTOY_GRUB2_MODE@" color = "red" align = "left"}
}
++ hbox{
+ left = 30%+200
+ top = 95%-25
+ width = 10%
+ height = 25
+ + label {text = "@VTOY_WIMBOOT_MODE@" color = "red" align = "left"}
+}
+
+ hbox{
left = 90%
top = 55
diff --git a/INSTALL/ventoy/vtoyjump32.exe b/INSTALL/ventoy/vtoyjump32.exe
index bcff9240..6019aa44 100644
Binary files a/INSTALL/ventoy/vtoyjump32.exe and b/INSTALL/ventoy/vtoyjump32.exe differ
diff --git a/INSTALL/ventoy/vtoyjump64.exe b/INSTALL/ventoy/vtoyjump64.exe
index 4edb6de3..c2e80a77 100644
Binary files a/INSTALL/ventoy/vtoyjump64.exe and b/INSTALL/ventoy/vtoyjump64.exe differ
diff --git a/INSTALL/ventoy/wimboot b/INSTALL/ventoy/wimboot
new file mode 100644
index 00000000..e02ed655
Binary files /dev/null and b/INSTALL/ventoy/wimboot differ
diff --git a/INSTALL/ventoy/winpeshl.ini b/INSTALL/ventoy/winpeshl.ini
new file mode 100644
index 00000000..2302fea9
--- /dev/null
+++ b/INSTALL/ventoy/winpeshl.ini
@@ -0,0 +1,2 @@
+[LaunchApps]
+vtoyjump.exe
\ No newline at end of file
diff --git a/License/license-wimboot.txt b/License/license-wimboot.txt
index 9179d035..8ab4754e 100644
--- a/License/license-wimboot.txt
+++ b/License/license-wimboot.txt
@@ -1,5 +1,4 @@
wimboot follows GPLv2+ license (see gpl-2.0.txt)
-Ventoy use the lzx decompress file from wimboot. These code follow the same license as wimboot.
-
+Ventoy modified the code and follow the same license as wimboot.
diff --git a/vtoyjump/vtoyjump/vtoyjump.c b/vtoyjump/vtoyjump/vtoyjump.c
index f5e40416..e8f9f5a8 100644
--- a/vtoyjump/vtoyjump/vtoyjump.c
+++ b/vtoyjump/vtoyjump/vtoyjump.c
@@ -1105,6 +1105,64 @@ const char * GetFileNameInPath(const char *fullpath)
return fullpath;
}
+int VentoyJumpWimboot(INT argc, CHAR **argv, CHAR *LunchFile)
+{
+ int rc = 1;
+ char *buf = NULL;
+ DWORD size = 0;
+ DWORD Pos;
+
+#ifdef VTOY_32
+ g_64bit_system = FALSE;
+#else
+ g_64bit_system = TRUE;
+#endif
+
+ Log("VentoyJumpWimboot 64bit:%u", g_64bit_system);
+
+ sprintf_s(LunchFile, MAX_PATH, "X:\\setup.exe");
+
+ ReadWholeFile2Buf("wimboot.data", &buf, &size);
+ Log("wimboot.data size:%d", size);
+
+ memcpy(&g_os_param, buf, sizeof(ventoy_os_param));
+ memcpy(&g_windows_data, buf + sizeof(ventoy_os_param), sizeof(ventoy_windows_data));
+ memcpy(g_os_param_reserved, g_os_param.vtoy_reserved, sizeof(g_os_param_reserved));
+
+ if (g_os_param_reserved[0] == 1)
+ {
+ Log("break here for debug .....");
+ goto End;
+ }
+
+ // convert / to \\
+ 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] == '/')
+ {
+ g_os_param.vtoy_img_path[Pos] = '\\';
+ }
+ }
+
+ if (g_os_param_reserved[0] == 2)
+ {
+ Log("skip hook for debug .....");
+ rc = 0;
+ goto End;
+ }
+
+ rc = VentoyHook(&g_os_param);
+
+End:
+
+ if (buf)
+ {
+ free(buf);
+ }
+
+ return rc;
+}
+
int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
{
int rc = 1;
@@ -1241,7 +1299,15 @@ int main(int argc, char **argv)
GetStartupInfoA(&Si);
memset(LunchFile, 0, sizeof(LunchFile));
- rc = VentoyJump(argc, argv, LunchFile);
+
+ if (strstr(argv[0], "vtoyjump.exe"))
+ {
+ rc = VentoyJumpWimboot(argc, argv, LunchFile);
+ }
+ else
+ {
+ rc = VentoyJump(argc, argv, LunchFile);
+ }
if (g_os_param_reserved[0] == 3)
{
@@ -1250,11 +1316,17 @@ int main(int argc, char **argv)
}
else
{
- Si.dwFlags |= STARTF_USESHOWWINDOW;
- Si.wShowWindow = SW_HIDE;
+ if (NULL == strstr(LunchFile, "setup.exe"))
+ {
+ Log("Not setup.exe, hide windows.");
+ Si.dwFlags |= STARTF_USESHOWWINDOW;
+ Si.wShowWindow = SW_HIDE;
+ }
+
Log("Ventoy jump %s ...", rc == 0 ? "success" : "failed");
}
-
+
+ Log("Now launch <%s> ...", LunchFile);
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
while (rc)
diff --git a/vtoyjump/vtoyjump/vtoyjump.vcxproj b/vtoyjump/vtoyjump/vtoyjump.vcxproj
index a0a67b1f..eeef6d98 100644
--- a/vtoyjump/vtoyjump/vtoyjump.vcxproj
+++ b/vtoyjump/vtoyjump/vtoyjump.vcxproj
@@ -92,7 +92,7 @@
Level3
Disabled
- FATFS_INC_FORMAT_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ VTOY_32;FATFS_INC_FORMAT_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
true
MultiThreadedDebug
@@ -108,7 +108,7 @@
Level3
Disabled
- FATFS_INC_FORMAT_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ VTOY_64;FATFS_INC_FORMAT_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
true
MultiThreadedDebug
@@ -126,7 +126,7 @@
MaxSpeed
true
true
- FATFS_INC_FORMAT_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ VTOY_32;FATFS_INC_FORMAT_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
true
MultiThreaded
@@ -146,7 +146,7 @@
MaxSpeed
true
true
- FATFS_INC_FORMAT_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ VTOY_64;FATFS_INC_FORMAT_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
true
MultiThreaded