Commit 849dfb46 authored by longpanda's avatar longpanda
Browse files

1. Change the UTF-16 languages.ini to UTF-8 languages.json

2. The update button is available even if data corrupted in VTOYEFI partition.
3. Set the default focus to No when you click Install button in Ventoy2Disk.exe.
4. Fix a BUG when booting Windows VHD(x) with the latest ventoy_vhdboot.img.
5. Support boot Windows VHD(x) files in local disk.
parent 7715bd70
...@@ -1603,6 +1603,7 @@ module = { ...@@ -1603,6 +1603,7 @@ module = {
module = { module = {
name = ventoy; name = ventoy;
common = ventoy/ventoy.c; common = ventoy/ventoy.c;
common = ventoy/ventoy_cmd.c;
common = ventoy/ventoy_linux.c; common = ventoy/ventoy_linux.c;
common = ventoy/ventoy_unix.c; common = ventoy/ventoy_unix.c;
common = ventoy/ventoy_windows.c; common = ventoy/ventoy_windows.c;
......
This diff is collapsed.
...@@ -140,6 +140,7 @@ typedef struct cpio_newc_header ...@@ -140,6 +140,7 @@ typedef struct cpio_newc_header
typedef int (*grub_char_check_func)(int c); typedef int (*grub_char_check_func)(int c);
#define ventoy_is_decimal(str) ventoy_string_check(str, grub_isdigit) #define ventoy_is_decimal(str) ventoy_string_check(str, grub_isdigit)
#define OFFSET_OF(TYPE, MEMBER) ((grub_size_t) &((TYPE *)0)->MEMBER)
#pragma pack(1) #pragma pack(1)
typedef struct ventoy_patch_vhd typedef struct ventoy_patch_vhd
...@@ -932,6 +933,8 @@ extern grub_uint8_t *g_conf_replace_new_buf; ...@@ -932,6 +933,8 @@ extern grub_uint8_t *g_conf_replace_new_buf;
extern int g_conf_replace_new_len; extern int g_conf_replace_new_len;
extern int g_conf_replace_new_len_align; extern int g_conf_replace_new_len_align;
extern grub_uint64_t g_ventoy_disk_size; extern grub_uint64_t g_ventoy_disk_size;
extern grub_uint64_t g_ventoy_disk_part_size[2];
extern grub_uint32_t g_ventoy_plat_data;
#define ventoy_unix_fill_virt(new_data, new_len) \ #define ventoy_unix_fill_virt(new_data, new_len) \
{ \ { \
...@@ -949,12 +952,16 @@ extern grub_uint64_t g_ventoy_disk_size; ...@@ -949,12 +952,16 @@ extern grub_uint64_t g_ventoy_disk_size;
chain->virt_img_size_in_bytes += data_secs * 2048; \ chain->virt_img_size_in_bytes += data_secs * 2048; \
} }
#define ventoy_syscall0(name) grub_##name()
#define ventoy_syscall1(name, a) grub_##name(a)
char * ventoy_get_line(char *start); char * ventoy_get_line(char *start);
int ventoy_cmp_img(img_info *img1, img_info *img2); int ventoy_cmp_img(img_info *img1, img_info *img2);
void ventoy_swap_img(img_info *img1, img_info *img2); void ventoy_swap_img(img_info *img1, img_info *img2);
char * ventoy_plugin_get_cur_install_template(const char *isopath); char * ventoy_plugin_get_cur_install_template(const char *isopath);
install_template * ventoy_plugin_find_install_template(const char *isopath); install_template * ventoy_plugin_find_install_template(const char *isopath);
persistence_config * ventoy_plugin_find_persistent(const char *isopath); persistence_config * ventoy_plugin_find_persistent(const char *isopath);
grub_uint64_t ventoy_get_vtoy_partsize(int part);
void ventoy_plugin_dump_injection(void); void ventoy_plugin_dump_injection(void);
void ventoy_plugin_dump_auto_install(void); void ventoy_plugin_dump_auto_install(void);
int ventoy_fill_windows_rtdata(void *buf, char *isopath); int ventoy_fill_windows_rtdata(void *buf, char *isopath);
...@@ -994,11 +1001,16 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char * ...@@ -994,11 +1001,16 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_check_password(const vtoy_password *pwd, int retry); int ventoy_check_password(const vtoy_password *pwd, int retry);
int ventoy_gzip_compress(void *mem_in, int mem_in_len, void *mem_out, int mem_out_len);
grub_uint64_t ventoy_get_part1_size(ventoy_gpt_info *gpt);
int ventoy_plugin_add_custom_boot(const char *vcfgpath); int ventoy_plugin_add_custom_boot(const char *vcfgpath);
const char * ventoy_plugin_get_custom_boot(const char *isopath); const char * ventoy_plugin_get_custom_boot(const char *isopath);
grub_err_t ventoy_cmd_dump_custom_boot(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_dump_custom_boot(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_gzip_compress(void *mem_in, int mem_in_len, void *mem_out, int mem_out_len);
int ventoy_load_part_table(const char *diskname);
int ventoy_env_init(void);
int ventoy_register_all_cmd(void);
int ventoy_unregister_all_cmd(void);
#define VTOY_CMD_CHECK(a) if (33554432 != g_ventoy_disk_part_size[a]) ventoy_syscall0(exit)
#endif /* __VENTOY_DEF_H__ */ #endif /* __VENTOY_DEF_H__ */
...@@ -720,7 +720,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc, ...@@ -720,7 +720,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc,
desc = (ventoy_image_desc *)(byte + i); desc = (ventoy_image_desc *)(byte + i);
desc->disk_size = g_ventoy_disk_size; desc->disk_size = g_ventoy_disk_size;
desc->part1_size = ventoy_get_part1_size(g_ventoy_part_info); desc->part1_size = g_ventoy_disk_part_size[0];
grub_memcpy(desc->disk_uuid, g_ventoy_part_info->MBR.BootCode + 0x180, 16); grub_memcpy(desc->disk_uuid, g_ventoy_part_info->MBR.BootCode + 0x180, 16);
grub_memcpy(desc->disk_signature, g_ventoy_part_info->MBR.BootCode + 0x1B8, 4); grub_memcpy(desc->disk_signature, g_ventoy_part_info->MBR.BootCode + 0x1B8, 4);
......
...@@ -44,14 +44,12 @@ ...@@ -44,14 +44,12 @@
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
static int g_vhdboot_bcd_offset = 0;
static int g_vhdboot_bcd_len = 0;
static int g_vhdboot_isolen = 0; static int g_vhdboot_isolen = 0;
static char *g_vhdboot_totbuf = NULL; static char *g_vhdboot_totbuf = NULL;
static char *g_vhdboot_isobuf = NULL; static char *g_vhdboot_isobuf = NULL;
static grub_uint64_t g_img_trim_head_secnum = 0; static grub_uint64_t g_img_trim_head_secnum = 0;
static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen) static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen, const char *path)
{ {
grub_uint32_t offset; grub_uint32_t offset;
grub_file_t file; grub_file_t file;
...@@ -61,10 +59,9 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen) ...@@ -61,10 +59,9 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
grub_script_execute_sourcecode(cmdbuf); grub_script_execute_sourcecode(cmdbuf);
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", "(vhdiso)/boot/bcd"); file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(vhdiso)%s", path);
if (!file) if (!file)
{ {
grub_printf("Failed to open bcd file in the image file\n");
return 1; return 1;
} }
...@@ -83,13 +80,15 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen) ...@@ -83,13 +80,15 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
return 0; return 0;
} }
static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2) static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2,
int bcdoffset, int bcdlen)
{ {
int i; int i;
int cnt = 0; int cnt = 0;
char *pos; char *pos;
grub_size_t pathlen; grub_size_t pathlen;
const char *plat; const char *plat;
char *newpath = NULL;
grub_uint16_t *unicode_path; grub_uint16_t *unicode_path;
const grub_uint8_t winloadexe[] = const grub_uint8_t winloadexe[] =
{ {
...@@ -97,6 +96,11 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy ...@@ -97,6 +96,11 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
0x65, 0x00, 0x78, 0x00, 0x65, 0x00 0x65, 0x00, 0x78, 0x00, 0x65, 0x00
}; };
while ((*vhdpath) != '/')
{
vhdpath++;
}
pathlen = sizeof(grub_uint16_t) * (grub_strlen(vhdpath) + 1); pathlen = sizeof(grub_uint16_t) * (grub_strlen(vhdpath) + 1);
debug("unicode path for <%s> len:%d\n", vhdpath, (int)pathlen); debug("unicode path for <%s> len:%d\n", vhdpath, (int)pathlen);
...@@ -110,10 +114,10 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy ...@@ -110,10 +114,10 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
if (plat && (plat[0] == 'e')) /* UEFI */ if (plat && (plat[0] == 'e')) /* UEFI */
{ {
pos = g_vhdboot_isobuf + g_vhdboot_bcd_offset; pos = g_vhdboot_isobuf + bcdoffset;
/* winload.exe ==> winload.efi */ /* winload.exe ==> winload.efi */
for (i = 0; i + (int)sizeof(winloadexe) < g_vhdboot_bcd_len; i++) for (i = 0; i + (int)sizeof(winloadexe) < bcdlen; i++)
{ {
if (*((grub_uint32_t *)(pos + i)) == 0x00690077 && if (*((grub_uint32_t *)(pos + i)) == 0x00690077 &&
grub_memcmp(pos + i, winloadexe, sizeof(winloadexe)) == 0) grub_memcmp(pos + i, winloadexe, sizeof(winloadexe)) == 0)
...@@ -127,7 +131,8 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy ...@@ -127,7 +131,8 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
debug("winload patch %d times\n", cnt); debug("winload patch %d times\n", cnt);
} }
for (pos = vhdpath; *pos; pos++) newpath = grub_strdup(vhdpath);
for (pos = newpath; *pos; pos++)
{ {
if (*pos == '/') if (*pos == '/')
{ {
...@@ -135,40 +140,127 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy ...@@ -135,40 +140,127 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
} }
} }
grub_utf8_to_utf16(unicode_path, pathlen, (grub_uint8_t *)vhdpath, -1, NULL); grub_utf8_to_utf16(unicode_path, pathlen, (grub_uint8_t *)newpath, -1, NULL);
grub_memcpy(patch1->vhd_file_path, unicode_path, pathlen); grub_memcpy(patch1->vhd_file_path, unicode_path, pathlen);
grub_memcpy(patch2->vhd_file_path, unicode_path, pathlen); grub_memcpy(patch2->vhd_file_path, unicode_path, pathlen);
grub_free(newpath);
return 0; return 0;
} }
static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2) static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, int *index)
{ {
int ret = 1;
grub_file_t file = NULL;
grub_disk_t disk = NULL;
file = grub_file_open(filename, VENTOY_FILE_TYPE);
if (!file)
{
goto end;
}
disk = grub_disk_open(file->device->disk->name);
if (!disk)
{
goto end;
}
*index = file->device->disk->partition->index;
grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), gpt);
ret = 0;
end:
check_free(file, grub_file_close);
check_free(disk, grub_disk_close);
return ret;
}
static int ventoy_vhd_patch_disk(const char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
{
int partIndex = 0;
grub_uint64_t offset = 0;
char efipart[16] = {0}; char efipart[16] = {0};
ventoy_gpt_info *gpt = NULL;
grub_memcpy(efipart, g_ventoy_part_info->Head.Signature, sizeof(g_ventoy_part_info->Head.Signature)); if (vhdpath[0] == '/')
{
gpt = g_ventoy_part_info;
partIndex = 0;
debug("This is Ventoy ISO partIndex %d %s\n", partIndex, vhdpath);
}
else
{
gpt = grub_zalloc(sizeof(ventoy_gpt_info));
ventoy_vhd_read_parttbl(vhdpath, gpt, &partIndex);
debug("This is HDD partIndex %d %s\n", partIndex, vhdpath);
}
debug("part1 type: 0x%x <%s>\n", g_ventoy_part_info->MBR.PartTbl[0].FsFlag, efipart); grub_memcpy(efipart, gpt->Head.Signature, sizeof(gpt->Head.Signature));
grub_memset(patch1, 0, OFFSET_OF(ventoy_patch_vhd, vhd_file_path));
grub_memset(patch2, 0, OFFSET_OF(ventoy_patch_vhd, vhd_file_path));
if (grub_strncmp(efipart, "EFI PART", 8) == 0) if (grub_strncmp(efipart, "EFI PART", 8) == 0)
{ {
ventoy_debug_dump_guid("GPT disk GUID: ", g_ventoy_part_info->Head.DiskGuid); ventoy_debug_dump_guid("GPT disk GUID: ", gpt->Head.DiskGuid);
ventoy_debug_dump_guid("GPT part GUID: ", g_ventoy_part_info->PartTbl[0].PartGuid); ventoy_debug_dump_guid("GPT partIndex GUID: ", gpt->PartTbl[partIndex].PartGuid);
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16); grub_memcpy(patch1->disk_signature_or_guid, gpt->Head.DiskGuid, 16);
grub_memcpy(patch1->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16); grub_memcpy(patch1->part_offset_or_guid, gpt->PartTbl[partIndex].PartGuid, 16);
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16); grub_memcpy(patch2->disk_signature_or_guid, gpt->Head.DiskGuid, 16);
grub_memcpy(patch2->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16); grub_memcpy(patch2->part_offset_or_guid, gpt->PartTbl[partIndex].PartGuid, 16);
patch1->part_type = patch2->part_type = 0; patch1->part_type = patch2->part_type = 0;
} }
else else
{ {
debug("MBR disk signature: %02x%02x%02x%02x\n", offset = gpt->MBR.PartTbl[partIndex].StartSectorId;
g_ventoy_part_info->MBR.BootCode[0x1b8 + 0], g_ventoy_part_info->MBR.BootCode[0x1b8 + 1], offset *= 512;
g_ventoy_part_info->MBR.BootCode[0x1b8 + 2], g_ventoy_part_info->MBR.BootCode[0x1b8 + 3]);
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4); debug("MBR disk signature: %02x%02x%02x%02x Part(%d) offset:%llu\n",
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4); gpt->MBR.BootCode[0x1b8 + 0], gpt->MBR.BootCode[0x1b8 + 1],
gpt->MBR.BootCode[0x1b8 + 2], gpt->MBR.BootCode[0x1b8 + 3],
partIndex + 1, offset);
grub_memcpy(patch1->part_offset_or_guid, &offset, 8);
grub_memcpy(patch2->part_offset_or_guid, &offset, 8);
grub_memcpy(patch1->disk_signature_or_guid, gpt->MBR.BootCode + 0x1b8, 4);
grub_memcpy(patch2->disk_signature_or_guid, gpt->MBR.BootCode + 0x1b8, 4);
patch1->part_type = patch2->part_type = 1;
}
if (gpt != g_ventoy_part_info)
{
grub_free(gpt);
}
return 0;
}
static int ventoy_find_vhdpatch_offset(int bcdoffset, int bcdlen, int *offset)
{
int i;
int cnt = 0;
grub_uint8_t *buf = (grub_uint8_t *)(g_vhdboot_isobuf + bcdoffset);
grub_uint8_t magic[16] = {
0x5C, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00
};
for (i = 0; i < bcdlen - 16 && cnt < 2; i++)
{
if (*(grub_uint32_t *)(buf + i) == 0x0058005C)
{
if (grub_memcmp(magic, buf + i, 16) == 0)
{
*offset++ = i - (int)OFFSET_OF(ventoy_patch_vhd, vhd_file_path);
cnt++;
}
}
} }
return 0; return 0;
...@@ -177,6 +269,8 @@ static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *pat ...@@ -177,6 +269,8 @@ static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *pat
grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int rc; int rc;
int bcdoffset, bcdlen;
int patchoffset[2];
ventoy_patch_vhd *patch1; ventoy_patch_vhd *patch1;
ventoy_patch_vhd *patch2; ventoy_patch_vhd *patch2;
char envbuf[64]; char envbuf[64];
...@@ -194,18 +288,39 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char * ...@@ -194,18 +288,39 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
return 0; return 0;
} }
rc = ventoy_vhd_find_bcd(&g_vhdboot_bcd_offset, &g_vhdboot_bcd_len); rc = ventoy_vhd_find_bcd(&bcdoffset, &bcdlen, "/boot/bcd");
if (rc) if (rc)
{ {
debug("failed to get bcd location %d\n", rc); debug("failed to get bcd location %d\n", rc);
return 0; }
else
{
ventoy_find_vhdpatch_offset(bcdoffset, bcdlen, patchoffset);
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[0]);
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[1]);
debug("Find /boot/bcd (%d %d) now patch it (offset: 0x%x 0x%x) ...\n",
bcdoffset, bcdlen, patchoffset[0], patchoffset[1]);
ventoy_vhd_patch_disk(args[0], patch1, patch2);
ventoy_vhd_patch_path(args[0], patch1, patch2, bcdoffset, bcdlen);
} }
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x495a); rc = ventoy_vhd_find_bcd(&bcdoffset, &bcdlen, "/boot/BCD");
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x50aa); if (rc)
{
ventoy_vhd_patch_disk(patch1, patch2); debug("No file /boot/BCD \n");
ventoy_vhd_patch_path(args[0], patch1, patch2); }
else
{
ventoy_find_vhdpatch_offset(bcdoffset, bcdlen, patchoffset);
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[0]);
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[1]);
debug("Find /boot/BCD (%d %d) now patch it (offset: 0x%x 0x%x) ...\n",
bcdoffset, bcdlen, patchoffset[0], patchoffset[1]);
ventoy_vhd_patch_disk(args[0], patch1, patch2);
ventoy_vhd_patch_path(args[0], patch1, patch2, bcdoffset, bcdlen);
}
/* set buffer and size */ /* set buffer and size */
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
...@@ -220,7 +335,7 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char * ...@@ -220,7 +335,7 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
grub_env_set("vtoy_vhd_buf_size", envbuf); grub_env_set("vtoy_vhd_buf_size", envbuf);
#endif #endif
return 0; VENTOY_CMD_RETURN(GRUB_ERR_NONE);
} }
grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args)
......
No preview for this file type
...@@ -131,7 +131,7 @@ function get_os_type { ...@@ -131,7 +131,7 @@ function get_os_type {
function vt_check_compatible_pe { function vt_check_compatible_pe {
#Check for PE without external tools #Check for PE without external tools
if [ -f "$1/HBCD_PE.ini" ]; then if [ -f "$1/HBCD_PE.ini" ]; then
set ventoy_compatible=YES set ventoy_compatible=YES
fi fi
} }
...@@ -1230,6 +1230,30 @@ function efi_unsupport_menuentry { ...@@ -1230,6 +1230,30 @@ function efi_unsupport_menuentry {
common_unsupport_menuentry common_unsupport_menuentry
} }
function vhdboot_common_func {
vt_patch_vhdboot "$1"
ventoy_debug_pause
if [ -n "$vtoy_vhd_buf_addr" ]; then
if [ "$grub_platform" = "pc" ]; then
ventoy_cli_console
linux16 $vtoy_path/memdisk iso raw
initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
boot
ventoy_gui_console
else
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
boot
ventoy_gui_console
fi
else
echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
ventoy_pause
fi
}
function vhd_common_menuentry { function vhd_common_menuentry {
if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
...@@ -1252,25 +1276,7 @@ function vhd_common_menuentry { ...@@ -1252,25 +1276,7 @@ function vhd_common_menuentry {
return return
fi fi
vt_patch_vhdboot "$vt_chosen_path" vhdboot_common_func "${vt_chosen_path}"
ventoy_debug_pause
if [ -n "$vtoy_vhd_buf_addr" ]; then
if [ "$grub_platform" = "pc" ]; then
linux16 $vtoy_path/memdisk iso raw
initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
boot
else
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
boot
ventoy_gui_console
fi
else
echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
ventoy_pause
fi
} }
function vhd_unsupport_menuentry { function vhd_unsupport_menuentry {
......
...@@ -365,11 +365,15 @@ else ...@@ -365,11 +365,15 @@ else
oldver=$(get_disk_ventoy_version $DISK) oldver=$(get_disk_ventoy_version $DISK)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
vtwarn "$DISK does not contain Ventoy or data corrupted" if is_disk_contains_ventoy $DISK; then
echo "" oldver="Unknown"
vtwarn "Please use -i option if you want to install ventoy to $DISK" else
echo "" vtwarn "$DISK does not contain Ventoy or data corrupted"
exit 1 echo ""
vtwarn "Please use -i option if you want to install ventoy to $DISK"
echo ""
exit 1
fi
fi fi
#reserve secure boot option #reserve secure boot option
......
...@@ -151,7 +151,7 @@ tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir ...@@ -151,7 +151,7 @@ tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
rm -f ventoy-${curver}-windows.zip rm -f ventoy-${curver}-windows.zip
cp $OPT Ventoy2Disk*.exe $tmpdir/ cp $OPT Ventoy2Disk*.exe $tmpdir/
cp $OPT $LANG_DIR/languages.ini $tmpdir/ventoy/ cp $OPT $LANG_DIR/languages.json $tmpdir/ventoy/
rm -rf $tmpdir/tool rm -rf $tmpdir/tool
rm -f $tmpdir/*.sh rm -f $tmpdir/*.sh
rm -rf $tmpdir/WebUI rm -rf $tmpdir/WebUI
......
File encoding: UTF-8
language name must in the format: "Language-XXX (YYY)"
1. Language- fixed 9 characters
2. XXX: name in English
3. a space (ASCII: 0x20)
4. a left brace (ASCII: 0x28)
5. YYY: name in the specified language
6. a right brace (ASCII: 0x29)
string translation:
all the String Define
#@ will be replaced with \r\n
All the languages will be sorted by the name
#!/bin/sh
VTOY_PATH=$1
if [ ! -f $VTOY_PATH/LANGUAGES/languages.json ]; then
exit 1
fi
gcc -DFOR_VTOY_JSON_CHECK $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/VentoyJson.c -I $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/ -o checkjson
./checkjson $VTOY_PATH/LANGUAGES/languages.json
ret=$?
rm -f ./checkjson
[ $ret -eq 0 ]
Binary files a/LANGUAGES/languages.ini and /dev/null differ Binary files a/LANGUAGES/languages.ini and /dev/null differ
This diff is collapsed.
This diff is collapsed.
...@@ -101,13 +101,19 @@ typedef enum OPT_SUBMENU ...@@ -101,13 +101,19 @@ typedef enum OPT_SUBMENU
#define VTOY_MENU_LANGUAGE_BEGIN 0xB000 #define VTOY_MENU_LANGUAGE_BEGIN 0xB000
#define VENTOY_LANGUAGE_INI TEXT(".\\ventoy\\languages.ini") #define VENTOY_LANGUAGE_INI TEXT(".\\ventoy\\languages.ini")
#define VENTOY_LANGUAGE_JSON TEXT(".\\ventoy\\languages.json")
#define VENTOY_LANGUAGE_INI_A ".\\ventoy\\languages.ini"
#define VENTOY_LANGUAGE_JSON_A ".\\ventoy\\languages.json"
#define VENTOY_CFG_INI TEXT(".\\Ventoy2Disk.ini") #define VENTOY_CFG_INI TEXT(".\\Ventoy2Disk.ini")
#define VENTOY_CFG_INI_A ".\\Ventoy2Disk.ini" #define VENTOY_CFG_INI_A ".\\Ventoy2Disk.ini"
#define VENTOY_MAX_LANGUAGE 200 #define VENTOY_MAX_LANGUAGE 200
#define GET_INI_STRING(Section, Key, Buf) GetPrivateProfileString(Section, Key, TEXT("#"), Buf, sizeof(Buf), VENTOY_LANGUAGE_INI) #define GET_INI_STRING(Section, Key, Buf) GetPrivateProfileString(Section, Key, TEXT("#"), Buf, sizeof(Buf), VENTOY_LANGUAGE_INI)
typedef struct VENTOY_LANGUAGE typedef struct VENTOY_LANGUAGE
{ {
WCHAR Name[128]; WCHAR Name[128];
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment