1.0.80 release

pull/1865/head v1.0.80
longpanda 2 years ago
parent 6b22a6200e
commit 17f9e2fd09

@ -3659,12 +3659,12 @@ static grub_err_t ventoy_cmd_sel_auto_install(grub_extcmd_context_t ctxt, int ar
vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout); vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout);
} }
vtoy_ssprintf(buf, pos, "menuentry \"Boot without auto installation template\" {\n" vtoy_ssprintf(buf, pos, "menuentry \"Boot without auto installation template\" --class=\"sel_auto_install\" {\n"
" echo %s\n}\n", ""); " echo %s\n}\n", "");
for (i = 0; i < node->templatenum; i++) for (i = 0; i < node->templatenum; i++)
{ {
vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\"{\n" vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" --class=\"sel_auto_install\" {\n"
" echo \"\"\n}\n", " echo \"\"\n}\n",
node->templatepath[i].path); node->templatepath[i].path);
} }
@ -3765,12 +3765,12 @@ static grub_err_t ventoy_cmd_sel_persistence(grub_extcmd_context_t ctxt, int arg
vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout); vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout);
} }
vtoy_ssprintf(buf, pos, "menuentry \"Boot without persistence\" {\n" vtoy_ssprintf(buf, pos, "menuentry \"Boot without persistence\" --class=\"sel_persistence\" {\n"
" echo %s\n}\n", ""); " echo %s\n}\n", "");
for (i = 0; i < node->backendnum; i++) for (i = 0; i < node->backendnum; i++)
{ {
vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" {\n" vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" --class=\"sel_persistence\" {\n"
" echo \"\"\n}\n", " echo \"\"\n}\n",
node->backendpath[i].path); node->backendpath[i].path);
@ -5958,6 +5958,145 @@ static grub_err_t ventoy_cmd_dump_rsv_page(grub_extcmd_context_t ctxt, int argc,
VENTOY_CMD_RETURN(GRUB_ERR_NONE); VENTOY_CMD_RETURN(GRUB_ERR_NONE);
} }
static grub_err_t ventoy_cmd_need_secondary_menu(grub_extcmd_context_t ctxt, int argc, char **args)
{
const char *env = NULL;
(void)ctxt;
(void)argc;
if (g_ventoy_memdisk_mode || g_ventoy_grub2_mode || g_ventoy_wimboot_mode || g_ventoy_iso_raw)
{
return 1;
}
if (ventoy_check_mode_by_name(args[0], "vtmemdisk") ||
ventoy_check_mode_by_name(args[0], "vtgrub2") ||
ventoy_check_mode_by_name(args[0], "vtwimboot"))
{
return 1;
}
env = grub_env_get("VTOY_SECONDARY_BOOT_MENU");
if (env && env[0] == '0' && env[1] == 0)
{
return 1;
}
return 0;
}
static grub_err_t ventoy_cmd_show_secondary_menu(grub_extcmd_context_t ctxt, int argc, char **args)
{
int n = 0;
int pos = 0;
int len = 0;
int select = 0;
int timeout = 0;
char *cmd = NULL;
const char *env = NULL;
ulonglong fsize = 0;
char cfgfile[128];
int seldata[16] = {0};
(void)ctxt;
(void)argc;
len = 8 * VTOY_SIZE_1KB;
cmd = (char *)grub_malloc(len);
if (!cmd)
{
return 1;
}
grub_env_unset("VTOY_CHKSUM_FILE_PATH");
env = grub_env_get("VTOY_SECONDARY_TIMEOUT");
if (env)
{
timeout = (int)grub_strtol(env, NULL, 10);
}
if (timeout > 0)
{
vtoy_len_ssprintf(cmd, pos, len, "set timeout=%d\n", timeout);
}
fsize = grub_strtoull(args[2], NULL, 10);
vtoy_dummy_menuentry(cmd, pos, len, "Boot in normal mode", "second_normal"); seldata[n++] = 1;
if (grub_strcmp(args[1], "Unix") != 0)
{
if (grub_strcmp(args[1], "Windows") == 0)
{
vtoy_dummy_menuentry(cmd, pos, len, "Boot in wimboot mode", "second_wimboot"); seldata[n++] = 2;
}
else
{
vtoy_dummy_menuentry(cmd, pos, len, "Boot in grub2 mode", "second_grub2"); seldata[n++] = 3;
}
if (fsize <= VTOY_SIZE_1GB)
{
vtoy_dummy_menuentry(cmd, pos, len, "Boot in memdisk mode", "second_memdisk"); seldata[n++] = 4;
}
}
vtoy_dummy_menuentry(cmd, pos, len, "File checksum", "second_checksum"); seldata[n++] = 5;
do {
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
g_ventoy_suppress_esc_default = 0;
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)cmd, pos);
grub_script_execute_sourcecode(cfgfile);
g_ventoy_menu_esc = 0;
g_ventoy_suppress_esc = 0;
g_ventoy_suppress_esc_default = 1;
select = seldata[g_ventoy_last_entry];
if (select == 2)
{
g_ventoy_wimboot_mode = 1;
}
else if (select == 3)
{
g_ventoy_grub2_mode = 1;
}
else if (select == 4)
{
g_ventoy_memdisk_mode = 1;
}
else if (select == 5)
{
grub_env_set("VTOY_CHKSUM_FILE_PATH", args[0]);
grub_script_execute_sourcecode("configfile $vtoy_efi_part/grub/checksum.cfg");
}
}while (select == 5);
grub_free(cmd);
return 0;
}
static grub_err_t ventoy_cmd_fs_ignore_case(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
if (args[0][0] == '0')
{
g_ventoy_case_insensitive = 0;
}
else
{
g_ventoy_case_insensitive = 1;
}
return 0;
}
int ventoy_env_init(void) int ventoy_env_init(void)
{ {
int i; int i;
@ -6158,6 +6297,12 @@ static cmd_para ventoy_cmds[] =
{ "vt_iso_vd_id_begin", ventoy_cmd_iso_vd_id_begin, 0, NULL, "", "", NULL }, { "vt_iso_vd_id_begin", ventoy_cmd_iso_vd_id_begin, 0, NULL, "", "", NULL },
{ "vt_fn_mutex_lock", ventoy_cmd_fn_mutex_lock, 0, NULL, "", "", NULL }, { "vt_fn_mutex_lock", ventoy_cmd_fn_mutex_lock, 0, NULL, "", "", NULL },
{ "vt_efi_dump_rsv_page", ventoy_cmd_dump_rsv_page, 0, NULL, "", "", NULL }, { "vt_efi_dump_rsv_page", ventoy_cmd_dump_rsv_page, 0, NULL, "", "", NULL },
{ "vt_is_standard_winiso", ventoy_cmd_is_standard_winiso, 0, NULL, "", "", NULL },
{ "vt_sel_winpe_wim", ventoy_cmd_sel_winpe_wim, 0, NULL, "", "", NULL },
{ "vt_need_secondary_menu", ventoy_cmd_need_secondary_menu, 0, NULL, "", "", NULL },
{ "vt_show_secondary_menu", ventoy_cmd_show_secondary_menu, 0, NULL, "", "", NULL },
{ "vt_fs_ignore_case", ventoy_cmd_fs_ignore_case, 0, NULL, "", "", NULL },
{ "vt_systemd_menu", ventoy_cmd_linux_systemd_menu, 0, NULL, "", "", NULL },
}; };
int ventoy_register_all_cmd(void) int ventoy_register_all_cmd(void)

@ -29,6 +29,8 @@
#define VTOY_FILT_MIN_FILE_SIZE 32768 #define VTOY_FILT_MIN_FILE_SIZE 32768
#define VTOY_LINUX_SYSTEMD_MENU_MAX_BUF 16384
#define VTOY_SIZE_1GB 1073741824 #define VTOY_SIZE_1GB 1073741824
#define VTOY_SIZE_1MB (1024 * 1024) #define VTOY_SIZE_1MB (1024 * 1024)
#define VTOY_SIZE_2MB (2 * 1024 * 1024) #define VTOY_SIZE_2MB (2 * 1024 * 1024)
@ -329,9 +331,16 @@ void ventoy_debug(const char *fmt, ...);
#define vtoy_ssprintf(buf, pos, fmt, args...) \ #define vtoy_ssprintf(buf, pos, fmt, args...) \
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, ##args) pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, ##args)
#define vtoy_len_ssprintf(buf, pos, len, fmt, args...) \
pos += grub_snprintf(buf + pos, len - pos, fmt, ##args)
#define browser_ssprintf(mbuf, fmt, args...) \ #define browser_ssprintf(mbuf, fmt, args...) \
(mbuf)->pos += grub_snprintf((mbuf)->buf + (mbuf)->pos, (mbuf)->max - (mbuf)->pos, fmt, ##args) (mbuf)->pos += grub_snprintf((mbuf)->buf + (mbuf)->pos, (mbuf)->max - (mbuf)->pos, fmt, ##args)
#define vtoy_dummy_menuentry(buf, pos, len, title, class) \
vtoy_len_ssprintf(buf, pos, len, "menuentry \"%s\" --class=\"%s\" {\n echo \"\"\n}\n", title, class)
#define FLAG_HEADER_RESERVED 0x00000001 #define FLAG_HEADER_RESERVED 0x00000001
#define FLAG_HEADER_COMPRESSION 0x00000002 #define FLAG_HEADER_COMPRESSION 0x00000002
#define FLAG_HEADER_READONLY 0x00000004 #define FLAG_HEADER_READONLY 0x00000004
@ -613,6 +622,7 @@ grub_err_t ventoy_cmd_clear_initrd_list(grub_extcmd_context_t ctxt, int argc, ch
grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file); grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file);
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector); int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
@ -633,6 +643,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
grub_err_t ventoy_cmd_windows_wimboot_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_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_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_is_standard_winiso(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); grub_err_t ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_sel_wimboot(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_sel_wimboot(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_set_wim_prompt(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_set_wim_prompt(grub_extcmd_context_t ctxt, int argc, char **args);
@ -1111,6 +1122,7 @@ grub_err_t ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt, in
grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_sel_winpe_wim(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid, grub_uint8_t *signature); int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid, grub_uint8_t *signature);
grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args);
@ -1218,6 +1230,16 @@ typedef struct var_node
struct var_node *next; struct var_node *next;
}var_node; }var_node;
typedef struct systemd_menu_ctx
{
char *dev;
char *buf;
int pos;
int len;
}systemd_menu_ctx;
#define vtoy_check_goto_out(p) if (!p) goto out
extern char *g_tree_script_buf; extern char *g_tree_script_buf;
extern int g_tree_script_pos; extern int g_tree_script_pos;
extern int g_tree_script_pre; extern int g_tree_script_pre;

@ -1811,3 +1811,173 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
VENTOY_CMD_RETURN(GRUB_ERR_NONE); VENTOY_CMD_RETURN(GRUB_ERR_NONE);
} }
static char *ventoy_systemd_conf_tag(char *buf, const char *tag, int optional)
{
int taglen = 0;
char *start = NULL;
char *nextline = NULL;
taglen = grub_strlen(tag);
for (start = buf; start; start = nextline)
{
nextline = ventoy_get_line(start);
while (ventoy_isspace(*start))
{
start++;
}
if (grub_strncmp(start, tag, taglen) == 0 && (start[taglen] == ' ' || start[taglen] == '\t'))
{
start += taglen;
while (ventoy_isspace(*start))
{
start++;
}
return start;
}
}
if (optional == 0)
{
debug("tag<%s> NOT found\n", tag);
}
return NULL;
}
static int ventoy_systemd_conf_hook(const char *filename, const struct grub_dirhook_info *info, void *data)
{
int oldpos = 0;
char *tag = NULL;
char *bkbuf = NULL;
char *filebuf = NULL;
grub_file_t file = NULL;
systemd_menu_ctx *ctx = (systemd_menu_ctx *)data;
debug("ventoy_systemd_conf_hook %s\n", filename);
if (info->dir || NULL == grub_strstr(filename, ".conf"))
{
return 0;
}
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s/loader/entries/%s", ctx->dev, filename);
if (!file)
{
return 0;
}
filebuf = grub_zalloc(2 * file->size + 8);
if (!filebuf)
{
goto out;
}
bkbuf = filebuf + file->size + 4;
grub_file_read(file, bkbuf, file->size);
oldpos = ctx->pos;
/* title --> menuentry */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "title", 0);
vtoy_check_goto_out(tag);
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "menuentry \"%s\" {\n", tag);
/* linux xxx */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "linux", 0);
if (!tag)
{
ctx->pos = oldpos;
goto out;
}
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading kernel ...\"\n linux %s ", tag);
/* kernel options */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "options", 0);
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "%s \n", tag ? tag : "");
/* initrd xxx xxx xxx */
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading initrd ...\"\n initrd ");
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "initrd", 1);
while (tag)
{
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "%s ", tag);
tag = ventoy_systemd_conf_tag(tag + grub_strlen(tag) + 1, "initrd", 1);
}
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "\n boot\n}\n");
out:
grub_check_free(filebuf);
grub_file_close(file);
return 0;
}
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
{
static char *buf = NULL;
char name[128];
char value[64];
grub_fs_t fs;
char *device_name = NULL;
grub_device_t dev = NULL;
systemd_menu_ctx ctx;
(void)ctxt;
(void)argc;
if (!buf)
{
buf = grub_malloc(VTOY_LINUX_SYSTEMD_MENU_MAX_BUF);
if (!buf)
{
goto end;
}
}
device_name = grub_file_get_device_name(args[0]);
if (!device_name)
{
debug("failed to get device name %s\n", args[0]);
goto end;
}
dev = grub_device_open(device_name);
if (!dev)
{
debug("failed to open device %s\n", device_name);
goto end;
}
fs = grub_fs_probe(dev);
if (!fs)
{
debug("failed to probe fs %d\n", grub_errno);
goto end;
}
ctx.dev = args[0];
ctx.buf = buf;
ctx.pos = 0;
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)buf);
grub_env_set(name, value);
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
grub_snprintf(value, sizeof(value), "%d", ctx.pos);
grub_env_set(name, value);
end:
grub_check_free(device_name);
check_free(dev, grub_device_close);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}

@ -1364,6 +1364,110 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch, int win
return 0; return 0;
} }
grub_err_t ventoy_cmd_sel_winpe_wim(grub_extcmd_context_t ctxt, int argc, char **args)
{
int i = 0;
int pos = 0;
int len = 0;
int find = 0;
char *cmd = NULL;
wim_patch *node = NULL;
wim_patch *tmp = NULL;
grub_file_t file = NULL;
wim_header *head = NULL;
char cfgfile[128];
(void)ctxt;
(void)argc;
len = 8 * VTOY_SIZE_1KB;
cmd = (char *)grub_malloc(len + sizeof(wim_header));
if (!cmd)
{
return 1;
}
head = (wim_header *)(cmd + len);
grub_env_unset("vtoy_pe_wim_path");
for (node = g_wim_patch_head; node; node = node->next)
{
find = 0;
for (tmp = g_wim_patch_head; tmp != node; tmp = tmp->next)
{
if (tmp->valid && grub_strcasecmp(tmp->path, node->path) == 0)
{
find = 1;
break;
}
}
if (find)
{
continue;
}
g_ventoy_case_insensitive = 1;
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[0], node->path);
g_ventoy_case_insensitive = 0;
if (!file)
{
debug("File %s%s NOT exist\n", args[0], node->path);
continue;
}
grub_file_read(file, head, sizeof(wim_header));
if (grub_memcmp(head->signature, WIM_HEAD_SIGNATURE, sizeof(head->signature)))
{
debug("Not a valid wim file %s\n", (char *)head->signature);
grub_file_close(file);
continue;
}
if (head->flags & FLAG_HEADER_COMPRESS_LZMS)
{
debug("LZMS compress is not supported 0x%x\n", head->flags);
grub_file_close(file);
continue;
}
grub_file_close(file);
node->valid = 1;
vtoy_len_ssprintf(cmd, pos, len, "menuentry \"%s\" --class=\"sel_wim\" {\n echo \"\"\n}\n", node->path);
}
if (pos > 0)
{
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
g_ventoy_suppress_esc_default = 0;
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)cmd, pos);
grub_script_execute_sourcecode(cfgfile);
g_ventoy_menu_esc = 0;
g_ventoy_suppress_esc = 0;
g_ventoy_suppress_esc_default = 1;
for (node = g_wim_patch_head; node; node = node->next)
{
if (node->valid)
{
if (i == g_ventoy_last_entry)
{
grub_env_set("vtoy_pe_wim_path", node->path);
break;
}
i++;
}
}
}
grub_free(cmd);
return 0;
}
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int datalen = 0; int datalen = 0;
@ -1919,6 +2023,7 @@ out:
grub_err_t ventoy_cmd_windows_wimboot_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)
{ {
int rc = 0; int rc = 0;
int wim64 = 0;
int datalen = 0; int datalen = 0;
int dataflag = 0; int dataflag = 0;
grub_uint32_t exe_len = 0; grub_uint32_t exe_len = 0;
@ -1957,6 +2062,7 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
{ {
return 1; return 1;
} }
wim64 = ventoy_is_pe64(exe_data);
grub_memset(&wim_data, 0, sizeof(wim_data)); grub_memset(&wim_data, 0, sizeof(wim_data));
ventoy_cat_exe_file_data(&wim_data, exe_len, exe_data, datalen); ventoy_cat_exe_file_data(&wim_data, exe_len, exe_data, datalen);
@ -1979,6 +2085,7 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
debug("vtoy_wimboot_mem_size: %s\n", envbuf); debug("vtoy_wimboot_mem_size: %s\n", envbuf);
grub_env_set(args[1], exename); grub_env_set(args[1], exename);
grub_env_set(args[2], wim64 ? "64" : "32");
VENTOY_CMD_RETURN(GRUB_ERR_NONE); VENTOY_CMD_RETURN(GRUB_ERR_NONE);
} }
@ -2020,7 +2127,10 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
if (0 == ventoy_compatible && g_wim_valid_patch_count == 0) if (0 == ventoy_compatible && g_wim_valid_patch_count == 0)
{ {
unknown_image = 1; unknown_image = 1;
debug("Warning: %s was not recognized by Ventoy\n", args[0]); if (!g_ventoy_wimboot_mode)
{
debug("Warning: %s was not recognized by Ventoy\n", args[0]);
}
} }
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]); file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
@ -2212,6 +2322,67 @@ static int ventoy_get_wim_chunklist(grub_file_t wimfile, ventoy_img_chunk_list *
return 0; return 0;
} }
grub_err_t ventoy_cmd_is_standard_winiso(grub_extcmd_context_t ctxt, int argc, char **args)
{
int i;
int ret = 1;
char prefix[32] = {0};
const char *chkfile[] =
{
"boot/bcd", "boot/boot.sdi", NULL
};
(void)ctxt;
(void)argc;
if (ventoy_check_file_exist("%s/sources/boot.wim", args[0]))
{
prefix[0] = 0;
}
else if (ventoy_check_file_exist("%s/x86/sources/boot.wim", args[0]))
{
grub_snprintf(prefix, sizeof(prefix), "/x86");
}
else if (ventoy_check_file_exist("%s/x64/sources/boot.wim", args[0]))
{
grub_snprintf(prefix, sizeof(prefix), "/x64");
}
else
{
debug("No boot.wim found.\n");
goto out;
}
for (i = 0; chkfile[i]; i++)
{
if (!ventoy_check_file_exist("%s%s/%s", args[0], prefix, chkfile[i]))
{
debug("%s not found.\n", chkfile[i]);
goto out;
}
}
if ((!ventoy_check_file_exist("%s%s/sources/install.wim", args[0], prefix)) &&
(!ventoy_check_file_exist("%s%s/sources/install.esd", args[0], prefix)))
{
debug("No install.wim(esd) found.\n");
goto out;
}
if (!ventoy_check_file_exist("%s/setup.exe", args[0]))
{
debug("No setup.exe found.\n");
goto out;
}
ret = 0;
debug("This is standard Windows ISO.\n");
out:
return ret;
}
grub_err_t ventoy_cmd_wim_check_bootable(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_uint32_t boot_index; grub_uint32_t boot_index;

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
print_usage() { print_usage() {
echo 'Usage: ExtendPersistentImg.sh file size' echo 'Usage: ExtendPersistentImg.sh file size'
@ -19,6 +19,18 @@ if [ -z "$2" ]; then
exit 1 exit 1
fi fi
if [ "$1" = "__vbash__" ]; then
shift
else
if readlink /bin/sh | grep -q bash; then
:
else
exec /bin/bash $0 "__vbash__" "$@"
fi
fi
file=$1 file=$1
size=$2 size=$2

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/bash
. ./tool/ventoy_lib.sh . ./tool/ventoy_lib.sh
print_usage() { print_usage() {
echo 'Usage: sudo sh VentoyPlugson.sh [OPTION] /dev/sdX' echo 'Usage: sudo bash VentoyPlugson.sh [OPTION] /dev/sdX'
echo ' OPTION: (optional)' echo ' OPTION: (optional)'
echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)' echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)'
echo ' -P PORT http server PORT (default is 24681)' echo ' -P PORT http server PORT (default is 24681)'

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
print_usage() { print_usage() {
echo 'Usage: VentoyWeb.sh [ OPTION ]' echo 'Usage: VentoyWeb.sh [ OPTION ]'

Binary file not shown.

@ -599,33 +599,36 @@ function ventoy_unix_comm_proc {
function uefi_windows_menu_func { function uefi_windows_menu_func {
vt_windows_reset vt_windows_reset
unset vt_cur_wimboot_mode
if vt_check_mode 4 "$vt_chosen_name"; then if vt_check_mode 4 "$vt_chosen_name"; then
vt_windows_chain_data "${1}${chosen_path}" set vt_cur_wimboot_mode=1
ventoy_debug_pause fi
vtoy_wimboot_func
else
if [ "$ventoy_compatible" = "NO" ]; then
if [ "$ventoy_fs_probe" = "iso9660" ]; then
loopback -d loop
vt_iso9660_nojoliet 1
loopback loop "$1$2"
fi
for file in "efi/microsoft/boot/bcd"; do
vt_windows_collect_wim_patch bcd (loop)/$file
done
vt_windows_count_wim_patch vt_wim_cnt if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
if [ $vt_wim_cnt -eq 0 ]; then if [ "$ventoy_fs_probe" = "iso9660" ]; then
distro_specify_wim_patch_phase2 loopback -d loop
fi vt_iso9660_nojoliet 1
loopback loop "$1$2"
ventoy_debug_pause
locate_wim "${chosen_path}"
fi fi
vt_windows_chain_data "${1}${chosen_path}"
ventoy_debug_pause for file in "efi/microsoft/boot/bcd"; do
vt_windows_collect_wim_patch bcd (loop)/$file
done
vt_windows_count_wim_patch vt_wim_cnt
if [ $vt_wim_cnt -eq 0 ]; then
distro_specify_wim_patch_phase2
fi
ventoy_debug_pause
locate_wim "${chosen_path}"
fi
vt_windows_chain_data "${1}${chosen_path}"
ventoy_debug_pause
if [ "$vt_cur_wimboot_mode" = "1" ]; then
vtoy_wimboot_func
fi fi
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
@ -784,6 +787,10 @@ function uefi_linux_menu_func {
unset vtGrub2Mode unset vtGrub2Mode
if vt_check_mode 3 "$vt_chosen_name"; then if vt_check_mode 3 "$vt_chosen_name"; then
set vtGrub2Mode=1 set vtGrub2Mode=1
elif vt_str_begin "$vt_volume_id" "HOLO_"; then
if [ -d (loop)/loader/entries ]; then
set vtGrub2Mode=1
fi
elif vt_str_begin "$vt_volume_id" "KRD"; then elif vt_str_begin "$vt_volume_id" "KRD"; then
if [ -f (loop)/boot/grub/grub.cfg.sig ]; then if [ -f (loop)/boot/grub/grub.cfg.sig ]; then
set vtGrub2Mode=1 set vtGrub2Mode=1
@ -817,6 +824,18 @@ function uefi_linux_menu_func {
break break
fi fi
done done
if [ $vtback_cfg_find -eq 0 ]; then
if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
if vt_str_begin "$vt_volume_id" "HOLO_"; then
set root=(loop,2)
vt_systemd_menu (loop,2) vt_sys_menu_mem
else
vt_systemd_menu (loop) vt_sys_menu_mem
fi
set vtback_cfg_find=1
configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
fi
fi
if [ "$vtback_cfg_find" = "0" ]; then if [ "$vtback_cfg_find" = "0" ]; then
echo " " echo " "
@ -913,6 +932,14 @@ function uefi_iso_menu_func {
vt_check_compatible (loop) vt_check_compatible (loop)
fi fi
if vt_need_secondary_menu "$vt_chosen_name"; then
vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
if vt_check_mode 0 "$vt_chosen_name"; then
uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
return
fi
fi
vt_img_sector "${1}${chosen_path}" vt_img_sector "${1}${chosen_path}"
if [ "$ventoy_fs_probe" = "iso9660" ]; then if [ "$ventoy_fs_probe" = "iso9660" ]; then
@ -964,17 +991,7 @@ function vtoy_windows_wimboot {
echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel
fi fi
for wmfile in sources/boot.wim boot/bcd boot/boot.sdi; do vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe vtoy_wim_bit
if [ ! -f $vtoy_wimboot_prefix/$wmfile ]; then
return
fi
done
if [ -f $vtoy_wimboot_prefix/sources/install.wim -o -f $vtoy_wimboot_prefix/sources/install.esd ]; then
vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe
else
return
fi
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
linux16 "$vtoy_path/$vt_wimkernel" quiet linux16 "$vtoy_path/$vt_wimkernel" quiet
@ -1014,39 +1031,42 @@ function vtoy_windows_wimboot {
} }
function vtoy_winpe_wimboot { function vtoy_winpe_wimboot {
unset vtoy_boot_mgr_exe unset vtoy_boot_sdi_legacy
unset vtoy_boot_mgr_efi unset vtoy_boot_sdi_efi
set vtoy_wimboot_prefix=(loop)
set vtoy_bcd_path="$1" set vtoy_wimboot_prefix=(loop)
set vtoy_sdi_path="$2" set vtoy_wim_path="$1"
set vtoy_wim_path="$3"
set vtoy_mgr_flag="$4"
if [ $vtoy_mgr_flag -eq 1 ]; then if [ -n "${vtdebug_flag}" ]; then
set vtoy_boot_mgr_exe="newc:bootmgr.exe:$vtoy_wimboot_prefix/$5" echo "winpe_wimboot $1 $2 $3"
elif [ $vtoy_mgr_flag -eq 2 ]; then fi
set vtoy_boot_mgr_efi="vf=bootmgr.efi:$vtoy_wimboot_prefix/$5"
elif [ $vtoy_mgr_flag -eq 3 ]; then if [ "$2" != "0" ]; then
set vtoy_boot_mgr_exe="newc:bootmgr.exe:$vtoy_wimboot_prefix/$5" set vtoy_boot_sdi_legacy="newc:boot.sdi:$vtoy_wimboot_prefix/$2"
set vtoy_boot_mgr_efi="vf=bootmgr.efi:$vtoy_wimboot_prefix/$6" set vtoy_boot_sdi_efi="vf=boot.sdi:$vtoy_wimboot_prefix/$2"
fi fi
vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe vtoy_wim_bit
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
linux16 "$vtoy_path/$vt_wimkernel" quiet linux16 "$vtoy_path/$vt_wimkernel" quiet
ventoy_debug_pause ventoy_debug_pause
vt_set_wim_load_prompt 1 "Loading files......" vt_set_wim_load_prompt 1 "Loading files......"
initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \ initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
$vtoy_boot_mgr_exe \ newc:vtoy_wimboot:$vtoy_path/$vt_wimkernel \
newc:vtoy_wimboot:$vtoy_wimboot_prefix/$vtoy_bcd_path \ newc:bootmgr.exe:mem:${vtoy_pe_bootmgr_mem_addr}:size:${vtoy_pe_bootmgr_mem_size} \
newc:bcd:$vtoy_wimboot_prefix/$vtoy_bcd_path \ newc:bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size} \
newc:boot.sdi:$vtoy_wimboot_prefix/$vtoy_sdi_path \ $vtoy_boot_sdi_legacy \
newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path
vt_set_wim_load_prompt 0 vt_set_wim_load_prompt 0
boot boot
else else
if [ "$VTOY_EFI_ARCH" = "x64" -a "$vtoy_wim_bit" = "32" ]; then
echo -e "\nThis is 32bit Windows and does NOT support x86_64 UEFI firmware.\n"
echo -e "这是32位的 Windows 系统不支持当前的64位 UEFI 环境。\n"
fi
vt_set_wim_load_prompt 1 "Loading files......" vt_set_wim_load_prompt 1 "Loading files......"
vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem
vt_set_wim_load_prompt 0 vt_set_wim_load_prompt 0
@ -1056,14 +1076,19 @@ function vtoy_winpe_wimboot {
else else
set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path
fi fi
unset vtoy_boot_efi_path
if [ -F (loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi ]; then
set vtoy_boot_efi_path="vf=bootx64.efi:(loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi"
fi
ventoy_cli_console ventoy_cli_console
chainloader "$vtoy_path/$vt_wimkernel" quiet \ chainloader "$vtoy_path/$vt_wimkernel" quiet \
"vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \ "vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
"vf=vtoy_wimboot:$vtoy_wimboot_prefix/$vtoy_bcd_path" \ "vf=vtoy_wimboot:$vtoy_path/$vt_wimkernel" \
"$vtoy_boot_mgr_efi" \ "vf=bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size}" \
"vf=bcd:$vtoy_wimboot_prefix/$vtoy_bcd_path" \ "$vtoy_boot_sdi_efi" \
"vf=boot.sdi:$vtoy_wimboot_prefix/$vtoy_sdi_path" \ "$vtoy_boot_efi_path" \
"vf=boot.wim:$vtoy_wimfile_path" \ "vf=boot.wim:$vtoy_wimfile_path" \
pfsize=$vtoy_chain_file_size \ pfsize=$vtoy_chain_file_size \
pfread=$vtoy_chain_file_read pfread=$vtoy_chain_file_read
@ -1073,8 +1098,6 @@ function vtoy_winpe_wimboot {
} }
function vtoy_wimboot_func { function vtoy_wimboot_func {
echo -e "\n===================== VENTOY WIMBOOT ===================\n"
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
set vt_wimkernel=wimboot.x86_64.xz set vt_wimkernel=wimboot.x86_64.xz
else else
@ -1085,46 +1108,75 @@ function vtoy_wimboot_func {
fi fi
fi fi
if vt_str_begin "$vt_volume_id" "Modified-Win10PEx64"; then if vt_is_standard_winiso (loop); then
vtoy_winpe_wimboot 'Boot/bcd' 'Boot/boot.sdi' 'sources/boot.wim' 1 'bootmgr.exe' echo -e "\n==================== VENTOY WIMBOOT ==================\n"
else
vtoy_windows_wimboot vtoy_windows_wimboot
else
vt_sel_winpe_wim (loop)
if [ -n "$vtoy_pe_wim_path" ]; then
echo -e "\n==================== VENTOY WIMBOOT ==================\n"
vt_fs_ignore_case 1
vt_load_file_to_mem "auto" $vtoy_path/common_bcd.xz vtoy_pe_bcd_mem
set vt_sdi_path=0
for vsdi in "boot/boot.sdi" "2K10/FONTS/boot.sdi" "SSTR/boot.sdi" "ISPE/BOOT.SDI" \
"boot/uqi.sdi" "ISYL/boot.sdi" "WEPE/WEPE.SDI" ; do
if [ -F "(loop)/$vsdi" ]; then
set vt_sdi_path=$vsdi
break
fi
done
if [ "$grub_platform" = "pc" ]; then
vt_load_file_to_mem "auto" $vtoy_path/common_bootmgr.xz vtoy_pe_bootmgr_mem
vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 1
else
vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 0
fi
vt_fs_ignore_case 0
fi
fi fi
} }
function legacy_windows_menu_func { function legacy_windows_menu_func {
vt_windows_reset vt_windows_reset
unset vt_cur_wimboot_mode
if vt_check_mode 4 "$vt_chosen_name"; then if vt_check_mode 4 "$vt_chosen_name"; then
vt_windows_chain_data "${1}${chosen_path}" set vt_cur_wimboot_mode=1
ventoy_debug_pause fi
vtoy_wimboot_func
else if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
if [ "$ventoy_compatible" = "NO" ]; then if [ "$ventoy_fs_probe" = "iso9660" ]; then
loopback -d loop
if [ "$ventoy_fs_probe" = "iso9660" ]; then vt_iso9660_nojoliet 1
loopback -d loop loopback loop "$1$2"
vt_iso9660_nojoliet 1 fi
loopback loop "$1$2"
fi for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do
vt_windows_collect_wim_patch bcd (loop)/$file
for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do done
vt_windows_collect_wim_patch bcd (loop)/$file
done distro_specify_wim_patch
distro_specify_wim_patch
vt_windows_count_wim_patch vt_wim_cnt vt_windows_count_wim_patch vt_wim_cnt
if [ $vt_wim_cnt -eq 0 ]; then if [ $vt_wim_cnt -eq 0 ]; then
distro_specify_wim_patch_phase2 distro_specify_wim_patch_phase2
fi
ventoy_debug_pause
locate_wim "${chosen_path}"
fi fi
vt_windows_chain_data "${1}${chosen_path}"
ventoy_debug_pause ventoy_debug_pause
if [ -z "$vt_cur_wimboot_mode" ]; then
locate_wim "${chosen_path}"
fi
fi
vt_windows_chain_data "${1}${chosen_path}"
ventoy_debug_pause
if [ "$vt_cur_wimboot_mode" = "1" ]; then
vtoy_wimboot_func
fi fi
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
@ -1206,10 +1258,19 @@ function legacy_linux_menu_func {
ventoy_debug_pause ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
unset vtGrub2Mode
if vt_check_mode 3 "$vt_chosen_name"; then if vt_check_mode 3 "$vt_chosen_name"; then
set vtGrub2Mode=1
elif vt_str_begin "$vt_volume_id" "HOLO_"; then
if [ -d (loop)/loader/entries ]; then
set vtGrub2Mode=1
fi
fi
if [ -n "$vtGrub2Mode" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console ventoy_cli_console
# fallback # fallback
set vtback_root=$root set vtback_root=$root
vt_push_last_entry vt_push_last_entry
@ -1228,6 +1289,18 @@ function legacy_linux_menu_func {
break break
fi fi
done done
if [ $vtback_cfg_find -eq 0 ]; then
if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
if vt_str_begin "$vt_volume_id" "HOLO_"; then
set root=(loop,2)
vt_systemd_menu (loop,2) vt_sys_menu_mem
else
vt_systemd_menu (loop) vt_sys_menu_mem
fi
set vtback_cfg_find=1
configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
fi
fi
vt_unset_boot_opt vt_unset_boot_opt
set root=$vtback_root set root=$vtback_root
@ -1291,6 +1364,14 @@ function legacy_iso_menu_func {
vt_check_compatible (loop) vt_check_compatible (loop)
fi fi
if vt_need_secondary_menu "$vt_chosen_name"; then
vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
if vt_check_mode 0 "$vt_chosen_name"; then
legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
return
fi
fi
vt_img_sector "${1}${chosen_path}" vt_img_sector "${1}${chosen_path}"
if [ "$ventoy_fs_probe" = "iso9660" ]; then if [ "$ventoy_fs_probe" = "iso9660" ]; then
@ -2222,7 +2303,7 @@ function img_unsupport_menuentry {
############################################################# #############################################################
############################################################# #############################################################
set VENTOY_VERSION="1.0.79" set VENTOY_VERSION="1.0.80"
#ACPI not compatible with Window7/8, so disable by default #ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1 set VTOY_PARAM_NO_ACPI=1
@ -2280,6 +2361,11 @@ if [ "$vtoy_dev" = "tftp" ]; then
done done
loadfont ascii loadfont ascii
if [ -n "$vtoy_efi_part" ]; then
vt_load_file_to_mem "auto" $vtoy_efi_part/grub/fonts/unicode.pf2 vtoy_font_mem
loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
fi
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
set vt_plugin_path=$vtoy_iso_part set vt_plugin_path=$vtoy_iso_part
else else

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -486,9 +486,11 @@ void ventoy_data_default_control(data_control *data)
{ {
memset(data, 0, sizeof(data_control)); memset(data, 0, sizeof(data_control));
data->secondary_menu = 1;
data->filter_dot_underscore = 1; data->filter_dot_underscore = 1;
data->max_search_level = -1; data->max_search_level = -1;
data->menu_timeout = 0; data->menu_timeout = 0;
data->secondary_menu_timeout = 0;
strlcpy(data->default_kbd_layout, "QWERTY_USA"); strlcpy(data->default_kbd_layout, "QWERTY_USA");
strlcpy(data->help_text_language, "en_US"); strlcpy(data->help_text_language, "en_US");
@ -510,7 +512,9 @@ int ventoy_data_cmp_control(data_control *data1, data_control *data2)
data1->filter_vtoy != data2->filter_vtoy || data1->filter_vtoy != data2->filter_vtoy ||
data1->win11_bypass_check != data2->win11_bypass_check || data1->win11_bypass_check != data2->win11_bypass_check ||
data1->linux_remount != data2->linux_remount || data1->linux_remount != data2->linux_remount ||
data1->menu_timeout != data2->menu_timeout) data1->secondary_menu != data2->secondary_menu ||
data1->menu_timeout != data2->menu_timeout ||
data1->secondary_menu_timeout != data2->secondary_menu_timeout)
{ {
return 1; return 1;
} }
@ -555,7 +559,9 @@ int ventoy_data_save_control(data_control *data, const char *title, char *buf, i
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_FILE_FLT_VTOY", filter_vtoy); VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_FILE_FLT_VTOY", filter_vtoy);
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_WIN11_BYPASS_CHECK", win11_bypass_check); VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_WIN11_BYPASS_CHECK", win11_bypass_check);
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_LINUX_REMOUNT", linux_remount); VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_LINUX_REMOUNT", linux_remount);
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_SECONDARY_BOOT_MENU", secondary_menu);
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_MENU_TIMEOUT", menu_timeout); VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_MENU_TIMEOUT", menu_timeout);
VTOY_JSON_FMT_CTRL_INT(L2, "VTOY_SECONDARY_TIMEOUT", secondary_menu_timeout);
VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_DEFAULT_KBD_LAYOUT", default_kbd_layout); VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_DEFAULT_KBD_LAYOUT", default_kbd_layout);
VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_HELP_TXT_LANGUAGE", help_text_language); VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_HELP_TXT_LANGUAGE", help_text_language);
@ -600,7 +606,9 @@ int ventoy_data_json_control(data_control *ctrl, char *buf, int buflen)
VTOY_JSON_FMT_SINT("filter_vtoy", ctrl->filter_vtoy); VTOY_JSON_FMT_SINT("filter_vtoy", ctrl->filter_vtoy);
VTOY_JSON_FMT_SINT("win11_bypass_check", ctrl->win11_bypass_check); VTOY_JSON_FMT_SINT("win11_bypass_check", ctrl->win11_bypass_check);
VTOY_JSON_FMT_SINT("linux_remount", ctrl->linux_remount); VTOY_JSON_FMT_SINT("linux_remount", ctrl->linux_remount);
VTOY_JSON_FMT_SINT("secondary_menu", ctrl->secondary_menu);
VTOY_JSON_FMT_SINT("menu_timeout", ctrl->menu_timeout); VTOY_JSON_FMT_SINT("menu_timeout", ctrl->menu_timeout);
VTOY_JSON_FMT_SINT("secondary_menu_timeout", ctrl->secondary_menu_timeout);
VTOY_JSON_FMT_STRN("default_kbd_layout", ctrl->default_kbd_layout); VTOY_JSON_FMT_STRN("default_kbd_layout", ctrl->default_kbd_layout);
VTOY_JSON_FMT_STRN("help_text_language", ctrl->help_text_language); VTOY_JSON_FMT_STRN("help_text_language", ctrl->help_text_language);
@ -666,7 +674,9 @@ static int ventoy_api_save_control(struct mg_connection *conn, VTOY_JSON *json)
VTOY_JSON_INT("filter_vtoy", ctrl->filter_vtoy); VTOY_JSON_INT("filter_vtoy", ctrl->filter_vtoy);
VTOY_JSON_INT("win11_bypass_check", ctrl->win11_bypass_check); VTOY_JSON_INT("win11_bypass_check", ctrl->win11_bypass_check);
VTOY_JSON_INT("linux_remount", ctrl->linux_remount); VTOY_JSON_INT("linux_remount", ctrl->linux_remount);
VTOY_JSON_INT("secondary_menu", ctrl->secondary_menu);
VTOY_JSON_INT("menu_timeout", ctrl->menu_timeout); VTOY_JSON_INT("menu_timeout", ctrl->menu_timeout);
VTOY_JSON_INT("secondary_menu_timeout", ctrl->secondary_menu_timeout);
VTOY_JSON_STR("default_image", ctrl->default_image); VTOY_JSON_STR("default_image", ctrl->default_image);
VTOY_JSON_STR("default_search_root", ctrl->default_search_root); VTOY_JSON_STR("default_search_root", ctrl->default_search_root);
@ -3808,6 +3818,10 @@ static int ventoy_parse_control(VTOY_JSON *json, void *p)
{ {
CONTROL_PARSE_INT(child, data->linux_remount); CONTROL_PARSE_INT(child, data->linux_remount);
} }
else if (strcmp(child->pcName, "VTOY_SECONDARY_BOOT_MENU") == 0)
{
CONTROL_PARSE_INT(child, data->secondary_menu);
}
else if (strcmp(child->pcName, "VTOY_TREE_VIEW_MENU_STYLE") == 0) else if (strcmp(child->pcName, "VTOY_TREE_VIEW_MENU_STYLE") == 0)
{ {
CONTROL_PARSE_INT(child, data->treeview_style); CONTROL_PARSE_INT(child, data->treeview_style);
@ -3865,6 +3879,10 @@ static int ventoy_parse_control(VTOY_JSON *json, void *p)
{ {
data->menu_timeout = (int)strtol(child->unData.pcStrVal, NULL, 10); data->menu_timeout = (int)strtol(child->unData.pcStrVal, NULL, 10);
} }
else if (strcmp(child->pcName, "VTOY_SECONDARY_TIMEOUT") == 0)
{
data->secondary_menu_timeout = (int)strtol(child->unData.pcStrVal, NULL, 10);
}
else if (strcmp(child->pcName, "VTOY_VHD_NO_WARNING") == 0) else if (strcmp(child->pcName, "VTOY_VHD_NO_WARNING") == 0)
{ {
CONTROL_PARSE_INT(child, data->vhd_no_warning); CONTROL_PARSE_INT(child, data->vhd_no_warning);

@ -58,7 +58,9 @@ typedef struct data_control
int filter_vtoy; int filter_vtoy;
int win11_bypass_check; int win11_bypass_check;
int menu_timeout; int menu_timeout;
int secondary_menu_timeout;
int linux_remount; int linux_remount;
int secondary_menu;
char default_search_root[MAX_PATH]; char default_search_root[MAX_PATH];
char default_image[MAX_PATH]; char default_image[MAX_PATH];
char default_kbd_layout[32]; char default_kbd_layout[32];

@ -1 +1 @@
20220430 13:06:42 20220921 18:42:35

@ -723,7 +723,7 @@
<footer class="main-footer"> <footer class="main-footer">
<div class="pull-right hidden-xs"> <div class="pull-right hidden-xs">
<b id="plugson_build_date">20220430 13:06:42</b> <b id="plugson_build_date">20220921 18:42:35</b>
</div> </div>
<strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong> <strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong>
</footer> </footer>

@ -390,6 +390,85 @@
</div><!-- /.box --> </div><!-- /.box -->
<div class="box box-primary box-solid">
<div class="box-header with-border">
<h3 class="box-title" style="font-size: 14px;font-weight: bold;">VTOY_SECONDARY_BOOT_MENU
<span id="id_span_desc_cn"> —— 二级启动菜单显示开关</span></h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body no-padding">
<table class="table table-bordered no-padding">
<tr style="font-weight:bold;">
<td class="td_ctrl_col" id="td_title_setting">选项设置</td>
<td>
<label class="radio-inline">
<input type="radio" id="id_ctrl_secondary_radio0" name="id_ctrl_secondary_radio" data-type="0" value="0"> <span style="font-weight:bold;">0</span>
</label>&nbsp;&nbsp;&nbsp;&nbsp;
<label class="radio-inline">
<input type="radio" id="id_ctrl_secondary_radio1" name="id_ctrl_secondary_radio" data-type="1" value="1"> <span style="font-weight:bold;">1</span>
</label>
</td>
</tr>
<tr id="tr_title_desc_cn">
<td class="td_ctrl_col" id="td_title_desc">选项说明</td>
<td>二级启动菜单控制开关
<code style="font-weight: bold;">0</code> 不显示 &nbsp;&nbsp;
<code style="font-weight: bold;">1</code> 显示
</td>
</tr>
<tr id="tr_title_desc_en">
<td class="td_ctrl_col" id="td_title_desc">Option Description</td>
<td>
Secondary boot menu display option
<code style="font-weight: bold;">0</code> Don't display &nbsp;&nbsp;&nbsp;
<code style="font-weight: bold;">1</code> Display
</td>
</tr>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
<div class="box box-primary box-solid">
<div class="box-header with-border">
<h3 class="box-title" style="font-size: 14px;font-weight: bold;">VTOY_SECONDARY_TIMEOUT
<span id="id_span_desc_cn"> —— 二级启动菜单倒计时</span></h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body no-padding">
<table class="table table-bordered no-padding">
<tr style="font-weight:bold;">
<td class="td_ctrl_col" id="td_title_setting">选项设置</td>
<td>
<div class="col-sm-9" style="padding-left:0px;">
<input type="text" class="form-control" id="id_ctrl_text_secondary_timeout" name="name_ctrl_text_secondary_timeout"/>
</div>
</td>
</tr>
<tr id="tr_title_desc_cn">
<td class="td_ctrl_col">选项说明</td>
<td>
二级菜单倒计时(秒)。只有当 <code>VTOY_SECONDARY_BOOT_MENU</code> 设置为1时才有效。<br/>
默认不设置设置之后比如设置为10则在倒计时10秒之后会自动选择第一项<code>Boot in normal mode</code> <br/>
在倒计时的过程中按任意键会停止倒计时,等待用户操作。
</td>
</tr>
<tr id="tr_title_desc_en">
<td class="td_ctrl_col">Option Description</td>
<td>
Timeout seconds for the secondary boot menu. Only take effect when <code>VTOY_SECONDARY_BOOT_MENU</code> is 1.<br/>
By default no timeout is set. When you set it to 10 for example, the first entry (<code>Boot in normal mode</code>) will be selected an run after 10 seconds.
</td>
</tr>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
<div class="box box-primary box-solid"> <div class="box box-primary box-solid">
@ -906,7 +985,7 @@
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /.box --> </div><!-- /.box -->
</div> </div>
@ -935,8 +1014,10 @@
data.win11_bypass_check = parseInt($('input:radio[name=id_ctrl_bypass_win11_radio]:checked').val()); data.win11_bypass_check = parseInt($('input:radio[name=id_ctrl_bypass_win11_radio]:checked').val());
data.linux_remount = parseInt($('input:radio[name=id_ctrl_linux_remount_radio]:checked').val()); data.linux_remount = parseInt($('input:radio[name=id_ctrl_linux_remount_radio]:checked').val());
data.secondary_menu = parseInt($('input:radio[name=id_ctrl_secondary_radio]:checked').val());
data.default_search_root = $('input:text[id=id_ctrl_text_search_root]').val(); data.default_search_root = $('input:text[id=id_ctrl_text_search_root]').val();
data.menu_timeout = parseInt($('input:text[id=id_ctrl_text_timeout]').val()); data.menu_timeout = parseInt($('input:text[id=id_ctrl_text_timeout]').val());
data.secondary_menu_timeout = parseInt($('input:text[id=id_ctrl_text_secondary_timeout]').val());
data.default_image = $('input:text[id=id_ctrl_text_default_img]').val(); data.default_image = $('input:text[id=id_ctrl_text_default_img]').val();
level = $('select[id=id_ctrl_sel_max_depth').val(); level = $('select[id=id_ctrl_sel_max_depth').val();
@ -968,6 +1049,7 @@
//VTOY_WIN11_BYPASS_CHECK //VTOY_WIN11_BYPASS_CHECK
$('input:radio[name=id_ctrl_bypass_win11_radio]')[data.win11_bypass_check].checked = true; $('input:radio[name=id_ctrl_bypass_win11_radio]')[data.win11_bypass_check].checked = true;
$('input:radio[name=id_ctrl_linux_remount_radio]')[data.linux_remount].checked = true; $('input:radio[name=id_ctrl_linux_remount_radio]')[data.linux_remount].checked = true;
$('input:radio[name=id_ctrl_secondary_radio]')[data.secondary_menu].checked = true;
//VTOY_DEFAULT_SEARCH_ROOT //VTOY_DEFAULT_SEARCH_ROOT
$('input:text[id=id_ctrl_text_search_root]').val(data.default_search_root); $('input:text[id=id_ctrl_text_search_root]').val(data.default_search_root);
@ -986,6 +1068,9 @@
//VTOY_MENU_TIMEOUT //VTOY_MENU_TIMEOUT
$('input:text[id=id_ctrl_text_timeout]').val(data.menu_timeout); $('input:text[id=id_ctrl_text_timeout]').val(data.menu_timeout);
//VTOY_SECONDARY_TIMEOUT
$('input:text[id=id_ctrl_text_secondary_timeout]').val(data.secondary_menu_timeout);
//VTOY_DEFAULT_IMAGE //VTOY_DEFAULT_IMAGE
@ -1070,8 +1155,10 @@
index: current_tab_index, index: current_tab_index,
win11_bypass_check: data.win11_bypass_check, win11_bypass_check: data.win11_bypass_check,
linux_remount:data.linux_remount, linux_remount:data.linux_remount,
secondary_menu:data.secondary_menu,
default_search_root: data.default_search_root, default_search_root: data.default_search_root,
menu_timeout: data.menu_timeout, menu_timeout: data.menu_timeout,
secondary_menu_timeout: data.secondary_menu_timeout,
default_image: data.default_image, default_image: data.default_image,
max_search_level: data.max_search_level, max_search_level: data.max_search_level,
default_kbd_layout: data.default_kbd_layout, default_kbd_layout: data.default_kbd_layout,
@ -1200,6 +1287,15 @@
$('input:text[id=id_ctrl_text_timeout]').val(m_data_control[current_tab_index].menu_timeout); $('input:text[id=id_ctrl_text_timeout]').val(m_data_control[current_tab_index].menu_timeout);
} }
}); });
$('input[id=id_ctrl_text_secondary_timeout]').change(function() {
var value = $('input:text[id=id_ctrl_text_secondary_timeout]').val();
if (/^[0-9][0-9]*$/.test(value)) {
VtoySaveCurrentPage();
} else {
Message.error(g_vtoy_cur_language.STR_INVALID_TIMEOUT);
$('input:text[id=id_ctrl_text_secondary_timeout]').val(m_data_control[current_tab_index].secondary_menu_timeout);
}
});
$('#id_tab_control a[href="#tab_0"]').click(OnClickMultiModeTab); $('#id_tab_control a[href="#tab_0"]').click(OnClickMultiModeTab);
$('#id_tab_control a[href="#tab_1"]').click(OnClickMultiModeTab); $('#id_tab_control a[href="#tab_1"]').click(OnClickMultiModeTab);

@ -18,7 +18,7 @@ You can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.<br
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/> x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
Both MBR and GPT partition style are supported in the same way.<br/> Both MBR and GPT partition style are supported in the same way.<br/>
Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/> Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
940+ ISO files are tested (<a href="https://www.ventoy.net/en/isolist.html">List</a>). 90%+ distros in <a href="https://distrowatch.com/">distrowatch.com</a> supported (<a href="https://www.ventoy.net/en/distrowatch.html">Details</a>). <br/> 1000+ ISO files are tested (<a href="https://www.ventoy.net/en/isolist.html">List</a>). 90%+ distros in <a href="https://distrowatch.com/">distrowatch.com</a> supported (<a href="https://www.ventoy.net/en/distrowatch.html">Details</a>). <br/>
<br/>Official Website: <a href=https://www.ventoy.net>https://www.ventoy.net</a> <br/>Official Website: <a href=https://www.ventoy.net>https://www.ventoy.net</a>
</h4> </h4>
@ -27,7 +27,7 @@ Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019, Windows Server 2022, WinPE Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019, Windows Server 2022, WinPE
**Linux** **Linux**
Debian, Ubuntu, CentOS(6/7/8/9), RHEL(6/7/8/9), Deepin, Fedora, EuroLinux(6/7/8/9), Rocky Linux, AlmaLinux, openEuler, OpenAnolis, SLES, openSUSE, MX Linux, Manjaro, Linux Mint, Endless OS, Elementary OS, Solus, Linx, Zorin, antiX, PClinuxOS, Arch, ArcoLinux, ArchLabs, BlackArch, Obarun, Artix Linux, Puppy Linux, Tails, Slax, Kali, Mageia, Slackware, Q4OS, Archman, Gentoo, Pentoo, NixOS, Kylin, openKylin, Ubuntu Kylin, Lubuntu, Xubuntu, Kubuntu, Ubuntu MATE, Ubuntu Budgie, Ubuntu Studio, Bluestar, OpenMandriva, ExTiX, Netrunner, ALT Linux, Nitrux, Peppermint, KDE neon, Linux Lite, Parrot OS, Qubes, Pop OS, ROSA, Void Linux, Star Linux, EndeavourOS, MakuluLinux, Voyager, Feren, ArchBang, LXLE, Knoppix, Calculate Linux, Clear Linux, Pure OS, Oracle Linux, Trident, Septor, Porteus, Devuan, GoboLinux, 4MLinux, Simplicity Linux, Zeroshell, Android-x86, netboot.xyz, Slitaz, SuperGrub2Disk, Proxmox VE, Kaspersky Rescue, SystemRescueCD, MemTest86, MemTest86+, MiniTool Partition Wizard, Parted Magic, veket, Sabayon, Scientific, alpine, ClearOS, CloneZilla, Berry Linux, Trisquel, Ataraxia Linux, Minimal Linux Live, BackBox Linux, Emmabuntüs, ESET SysRescue Live,Nova Linux, AV Linux, RoboLinux, NuTyX, IPFire, SELKS, ZStack, Enso Linux, Security Onion, Network Security Toolkit, Absolute Linux, TinyCore, Springdale Linux, Frost Linux, Shark Linux, LinuxFX, Snail Linux, Astra Linux, Namib Linux, Resilient Linux, Virage Linux, Blackweb Security OS, R-DriveImage, O-O.DiskImage, Macrium, ToOpPy LINUX, GNU Guix, YunoHost, foxclone, siduction, Adelie Linux, Elive, Pardus, CDlinux, AcademiX, Austrumi, Zenwalk, Anarchy, DuZeru, BigLinux, OpenMediaVault, Ubuntu DP, Exe GNU/Linux, 3CX Phone System, KANOTIX, Grml, Karoshi, PrimTux, ArchStrike, CAELinux, Cucumber, Fatdog, ForLEx, Hanthana, Kwort, MiniNo, Redcore, Runtu, Asianux, Clu Linux Live, Uruk, OB2D, BlueOnyx, Finnix, HamoniKR, Parabola, LinHES, LinuxConsole, BEE free, Untangle, Pearl, Thinstation, TurnKey, tuxtrans, Neptune, HefftorLinux, GeckoLinux, Mabox Linux, Zentyal, Maui, Reborn OS, SereneLinux , SkyWave Linux, Kaisen Linux, Regata OS, TROM-Jaro, DRBL Linux, Chalet OS, Chapeau, Desa OS, BlankOn, OpenMamba, Frugalware, Kibojoe Linux, Revenge OS, Tsurugi Linux, Drauger OS, Hash Linux, gNewSense, Ikki Boot, SteamOS, Hyperbola, VyOS, EasyNAS, SuperGamer, Live Raizo, Swift Linux, RebeccaBlackOS, Daphile, CRUX, Univention, Ufficio Zero, Rescuezilla, Phoenix OS, Garuda Linux, Mll, NethServer, OSGeoLive, Easy OS, Volumio, FreedomBox, paldo, UBOS, Recalbox, batocera, Lakka, LibreELEC, Pardus Topluluk, Pinguy, KolibriOS, Elastix, Arya, Omoikane, Omarine, Endian Firewall, Hamara, Rocks Cluster, MorpheusArch, Redo, Slackel, SME Server, APODIO, Smoothwall, Dragora, Linspire, Secure-K OS, Peach OSI, Photon, Plamo, SuperX, Bicom, Ploplinux, HP SPP, LliureX, Freespire, DietPi, BOSS, Webconverger, Lunar, TENS, Source Mage, RancherOS, T2, Vine, Pisi, blackPanther, mAid, Acronis, Active.Boot, AOMEI, Boot.Repair, CAINE, DaRT, EasyUEFI, R-Drive, PrimeOS, Avira Rescue System, bitdefender, Checkra1n Linux, Lenovo Diagnostics, Clover, Bliss-OS, Lenovo BIOS Update, Arcabit Rescue Disk, MiyoLinux, TeLOS, Kerio Control, RED OS, OpenWrt, MocaccinoOS, EasyStartup, Pyabr, Refracta, Eset SysRescue, Linpack Xtreme, Archcraft, NHVBOOT, pearOS, SeaTools, Easy Recovery Essentional, iKuai, StorageCraft SCRE, ZFSBootMenu, TROMjaro, BunsenLabs, Todo en Uno, ...... Debian, Ubuntu, CentOS(6/7/8/9), RHEL(6/7/8/9), Deepin, Fedora, EuroLinux(6/7/8/9), Rocky Linux, AlmaLinux, openEuler, OpenAnolis, SLES, openSUSE, MX Linux, Manjaro, Linux Mint, Endless OS, Elementary OS, Solus, Linx, Zorin, antiX, PClinuxOS, Arch, ArcoLinux, ArchLabs, BlackArch, Obarun, Artix Linux, Puppy Linux, Tails, Slax, Kali, Mageia, Slackware, Q4OS, Archman, Gentoo, Pentoo, NixOS, Kylin, openKylin, Ubuntu Kylin, Lubuntu, Xubuntu, Kubuntu, Ubuntu MATE, Ubuntu Budgie, Ubuntu Studio, Bluestar, OpenMandriva, ExTiX, Netrunner, ALT Linux, Nitrux, Peppermint, KDE neon, Linux Lite, Parrot OS, Qubes, Pop OS, ROSA, Void Linux, Star Linux, EndeavourOS, MakuluLinux, Voyager, Feren, ArchBang, LXLE, Knoppix, Calculate Linux, Clear Linux, Pure OS, Oracle Linux, Trident, Septor, Porteus, Devuan, GoboLinux, 4MLinux, Simplicity Linux, Zeroshell, Android-x86, netboot.xyz, Slitaz, SuperGrub2Disk, Proxmox VE, Kaspersky Rescue, SystemRescueCD, MemTest86, MemTest86+, MiniTool Partition Wizard, Parted Magic, veket, Sabayon, Scientific, alpine, ClearOS, CloneZilla, Berry Linux, Trisquel, Ataraxia Linux, Minimal Linux Live, BackBox Linux, Emmabuntüs, ESET SysRescue Live,Nova Linux, AV Linux, RoboLinux, NuTyX, IPFire, SELKS, ZStack, Enso Linux, Security Onion, Network Security Toolkit, Absolute Linux, TinyCore, Springdale Linux, Frost Linux, Shark Linux, LinuxFX, Snail Linux, Astra Linux, Namib Linux, Resilient Linux, Virage Linux, Blackweb Security OS, R-DriveImage, O-O.DiskImage, Macrium, ToOpPy LINUX, GNU Guix, YunoHost, foxclone, siduction, Adelie Linux, Elive, Pardus, CDlinux, AcademiX, Austrumi, Zenwalk, Anarchy, DuZeru, BigLinux, OpenMediaVault, Ubuntu DP, Exe GNU/Linux, 3CX Phone System, KANOTIX, Grml, Karoshi, PrimTux, ArchStrike, CAELinux, Cucumber, Fatdog, ForLEx, Hanthana, Kwort, MiniNo, Redcore, Runtu, Asianux, Clu Linux Live, Uruk, OB2D, BlueOnyx, Finnix, HamoniKR, Parabola, LinHES, LinuxConsole, BEE free, Untangle, Pearl, Thinstation, TurnKey, tuxtrans, Neptune, HefftorLinux, GeckoLinux, Mabox Linux, Zentyal, Maui, Reborn OS, SereneLinux , SkyWave Linux, Kaisen Linux, Regata OS, TROM-Jaro, DRBL Linux, Chalet OS, Chapeau, Desa OS, BlankOn, OpenMamba, Frugalware, Kibojoe Linux, Revenge OS, Tsurugi Linux, Drauger OS, Hash Linux, gNewSense, Ikki Boot, SteamOS, Hyperbola, VyOS, EasyNAS, SuperGamer, Live Raizo, Swift Linux, RebeccaBlackOS, Daphile, CRUX, Univention, Ufficio Zero, Rescuezilla, Phoenix OS, Garuda Linux, Mll, NethServer, OSGeoLive, Easy OS, Volumio, FreedomBox, paldo, UBOS, Recalbox, batocera, Lakka, LibreELEC, Pardus Topluluk, Pinguy, KolibriOS, Elastix, Arya, Omoikane, Omarine, Endian Firewall, Hamara, Rocks Cluster, MorpheusArch, Redo, Slackel, SME Server, APODIO, Smoothwall, Dragora, Linspire, Secure-K OS, Peach OSI, Photon, Plamo, SuperX, Bicom, Ploplinux, HP SPP, LliureX, Freespire, DietPi, BOSS, Webconverger, Lunar, TENS, Source Mage, RancherOS, T2, Vine, Pisi, blackPanther, mAid, Acronis, Active.Boot, AOMEI, Boot.Repair, CAINE, DaRT, EasyUEFI, R-Drive, PrimeOS, Avira Rescue System, bitdefender, Checkra1n Linux, Lenovo Diagnostics, Clover, Bliss-OS, Lenovo BIOS Update, Arcabit Rescue Disk, MiyoLinux, TeLOS, Kerio Control, RED OS, OpenWrt, MocaccinoOS, EasyStartup, Pyabr, Refracta, Eset SysRescue, Linpack Xtreme, Archcraft, NHVBOOT, pearOS, SeaTools, Easy Recovery Essentional, iKuai, StorageCraft SCRE, ZFSBootMenu, TROMjaro, BunsenLabs, Todo en Uno, ChallengerOS, Nobara, Holo, ......
**Unix** **Unix**
DragonFly FreeBSD pfSense GhostBSD FreeNAS TrueNAS XigmaNAS FuryBSD OPNsense HardenedBSD MidnightBSD ClonOS EmergencyBootKit DragonFly FreeBSD pfSense GhostBSD FreeNAS TrueNAS XigmaNAS FuryBSD OPNsense HardenedBSD MidnightBSD ClonOS EmergencyBootKit
@ -70,7 +70,7 @@ A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plug
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition * FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
* ISO files larger than 4GB supported * ISO files larger than 4GB supported
* Native boot menu style for Legacy & UEFI * Native boot menu style for Legacy & UEFI
* Most types of OS supported, 940+ iso files tested * Most types of OS supported, 1000+ iso files tested
* Linux vDisk boot supported * Linux vDisk boot supported
* Not only boot but also complete installation process * Not only boot but also complete installation process
* Menu dynamically switchable between List/TreeView mode * Menu dynamically switchable between List/TreeView mode

@ -32,6 +32,7 @@
#include "wimboot.h" #include "wimboot.h"
#include "vdisk.h" #include "vdisk.h"
#include "lzx.h" #include "lzx.h"
#include "xca.h"
#include "wim.h" #include "wim.h"
/** WIM chunk buffer */ /** WIM chunk buffer */
@ -180,6 +181,8 @@ static int wim_chunk ( struct vdisk_file *file, struct wim_header *header,
/* Identify decompressor */ /* Identify decompressor */
if ( header->flags & WIM_HDR_LZX ) { if ( header->flags & WIM_HDR_LZX ) {
decompress = lzx_decompress; decompress = lzx_decompress;
} else if (header->flags & WIM_HDR_XPRESS) {
decompress = xca_decompress;
} else { } else {
DBG ( "Can't handle unknown compression scheme %#08x " DBG ( "Can't handle unknown compression scheme %#08x "
"for %#llx chunk %d at [%#llx+%#llx)\n", "for %#llx chunk %d at [%#llx+%#llx)\n",
@ -447,8 +450,10 @@ int wim_path ( struct vdisk_file *file, struct wim_header *header,
return rc; return rc;
/* Get root directory offset */ /* Get root directory offset */
direntry->subdir = ( ( security.len + sizeof ( uint64_t ) - 1 ) & if (security.len > 0)
~( sizeof ( uint64_t ) - 1 ) ); direntry->subdir = ( ( security.len + sizeof ( uint64_t ) - 1 ) & ~( sizeof ( uint64_t ) - 1 ) );
else
direntry->subdir = security.len + 8;
/* Find directory entry */ /* Find directory entry */
name = memcpy ( path_copy, path, sizeof ( path_copy ) ); name = memcpy ( path_copy, path, sizeof ( path_copy ) );

@ -42,7 +42,7 @@
*/ */
ssize_t xca_decompress ( const void *data, size_t len, void *buf ) { ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
const void *src = data; const void *src = data;
const void *end = ( src + len ); const void *end = ( uint8_t * ) src + len;
uint8_t *out = buf; uint8_t *out = buf;
size_t out_len = 0; size_t out_len = 0;
size_t out_len_threshold = 0; size_t out_len_threshold = 0;
@ -67,11 +67,9 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
/* Construct symbol lengths */ /* Construct symbol lengths */
lengths = src; lengths = src;
src += sizeof ( *lengths ); src = ( uint8_t * ) src + sizeof ( *lengths );
if ( src > end ) { if ( src > end ) {
DBG ( "XCA too short to hold Huffman lengths " DBG ( "XCA too short to hold Huffman lengths table.\n");
"table at input offset %#zx\n",
( src - data ) );
return -1; return -1;
} }
for ( raw = 0 ; raw < XCA_CODES ; raw++ ) for ( raw = 0 ; raw < XCA_CODES ; raw++ )
@ -113,7 +111,7 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
out_len++; out_len++;
} else if ( ( raw == XCA_END_MARKER ) && } else if ( ( raw == XCA_END_MARKER ) &&
( src >= ( end - 1 ) ) ) { ( (uint8_t *) src >= ( ( uint8_t * ) end - 1 ) ) ) {
/* End marker symbol */ /* End marker symbol */
return out_len; return out_len;
@ -157,6 +155,5 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
} }
} }
DBG ( "XCA input overrun at output length %#zx\n", out_len ); return out_len;
return -1;
} }

Loading…
Cancel
Save