Compare commits

...

21 Commits

Author SHA1 Message Date
longpanda
d71514f23e 1.0.51 release 2021-08-27 20:36:32 +08:00
longpanda
c5af17e04e experimental support for chromium os (fydeos/cloudready) 2021-08-26 14:17:44 +08:00
longpanda
05e208ea2a Support Lenovo EasyStartup 2021-08-23 16:56:17 +08:00
longpanda
112c557428 Show a warning message if the path of /ventoy/ventoy.json case mismatch. 2021-08-19 11:40:23 +08:00
longpanda
92db873b5c misc update 2021-08-18 23:00:11 +08:00
longpanda
3c01eec4af Add F4-->Search and boot xorboot 2021-08-17 14:44:43 +08:00
Vladimir Ulianitsky
5c6d18fcd4 Fix for PATH with spaces (#1060) 2021-08-17 10:01:42 +08:00
longpanda
84ec4b0de4 Support escaped quotes (\") in ventoy.json. (#1062) 2021-08-17 09:25:00 +08:00
longpanda
9615e7eaa0 Support 2k10 PE x86 series 2021-08-16 00:39:26 +08:00
longpanda
6a244ff260 Fix the mount issue for 2K10 Win7x64 PE 2021-08-16 00:00:21 +08:00
longpanda
b5503a7375 1.0.50 release 2021-08-14 20:30:28 +08:00
longpanda
0b7fa630a4 Support some special Win7PE 2021-08-14 11:49:51 +08:00
longpanda
7babe823d6 Add F5-->Tools-->Ventoy UEFI Utilities-->Show EFI Drivers feature. 2021-08-12 19:47:43 +08:00
longpanda
6db513a067 Fix the boot issue for Windows UEFI on some Dell server. (introduced since 1.0.48) 2021-08-12 14:26:47 +08:00
longpanda
bafac7479d Fix the boot issue for Untangle ISO in legacy bios mode. (#1054) 2021-08-11 09:44:09 +08:00
longpanda
d3138479d7 Fixe the boot issue for Untangle ISO (#1054) 2021-08-10 09:18:35 +08:00
longpanda
56a1543f7d Fix an issue when install some Lite Windows version with special file name.
We need to wrap the file name in quotation marks when use imdisk to mount the iso file.
2021-08-07 10:55:41 +08:00
longpanda
659ac1cfe3 Fix "Failed to open random seed file" error message for arch linux 2021-08-04 18:53:09 +08:00
longpanda
c83daa86b6 Fix the check media issue for SUSE/openSUSE 2021-08-04 11:24:50 +08:00
longpanda
dfcfaa9967 issue template update 2021-08-04 09:20:02 +08:00
longpanda
188f9e707c Change rufus 3.15beta+ to 3.15+ 2021-08-04 09:14:18 +08:00
39 changed files with 1948 additions and 114 deletions

View File

@@ -21,7 +21,7 @@ body:
attributes:
label: Ventoy Version
description: What version of ventoy are you running?
placeholder: 1.0.48
placeholder: 1.0.51
validations:
required: true
- type: dropdown

View File

@@ -809,11 +809,6 @@ STATIC BOOLEAN ventoy_filesystem_need_wrapper(IN CONST CHAR16 *DrvName)
*
*/
if (StrStr(UpperDrvName, L"ISO9660") || StrStr(UpperDrvName, L"UDF"))
{
return TRUE;
}
if (StrStr(UpperDrvName, L"REFIND") && StrStr(UpperDrvName, L"FILE SYSTEM"))
{
return TRUE;
@@ -915,7 +910,6 @@ STATIC EFI_STATUS ventoy_find_filesystem_driverbind(VOID)
Status = gBS->HandleProtocol(Handles[i], &gEfiComponentNameProtocolGuid, (VOID **)&NameProtocol);
if (EFI_ERROR(Status))
{
debug();
continue;
}
@@ -1144,14 +1138,15 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
{
gBlockData.Media.BlockSize = 512;
gBlockData.Media.LastBlock = ImgSize / 512 - 1;
gBlockData.Media.ReadOnly = FALSE;
}
else
{
gBlockData.Media.BlockSize = 2048;
gBlockData.Media.LastBlock = ImgSize / 2048 - 1;
gBlockData.Media.ReadOnly = TRUE;
}
gBlockData.Media.ReadOnly = TRUE;
gBlockData.Media.MediaPresent = 1;
gBlockData.Media.LogicalBlocksPerPhysicalBlock = 1;
@@ -1406,6 +1401,16 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
debug("## ventoy_wrapper_file_open <%s> ", Name);
if ((Mode & EFI_FILE_MODE_WRITE) > 0 && StrCmp(Name, L"\\loader\\random-seed") == 0)
{
if (gDebugPrint)
{
debug("## ventoy_wrapper_file_open return NOT_FOUND for random-seed %lx", Mode);
sleep(3);
}
return EFI_NOT_FOUND;
}
Status = g_original_fopen(This, New, Name, Mode, Attributes);
if (EFI_ERROR(Status))
{

View File

@@ -0,0 +1,140 @@
/******************************************************************************
* VtoyDrv.c
*
* Copyright (c) 2020, longpanda <admin@ventoy.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Protocol/LoadedImage.h>
#include <Guid/FileInfo.h>
#include <Guid/FileSystemInfo.h>
#include <Protocol/BlockIo.h>
#include <Protocol/RamDisk.h>
#include <Protocol/SimpleFileSystem.h>
#include <VtoyUtil.h>
STATIC UINTN g_EfiDriverNameCnt = 0;
STATIC CHAR16 *g_EfiDriverNameList[1024] = { NULL };
STATIC EFI_STATUS AddEfiDriverName(IN CHAR16 *DriverName)
{
UINTN i = 0;
if (g_EfiDriverNameCnt >= 1024)
{
return EFI_OUT_OF_RESOURCES;
}
for (i = 0; i < g_EfiDriverNameCnt; i++)
{
if (g_EfiDriverNameList[i] && StrCmp(g_EfiDriverNameList[i], DriverName) == 0)
{
break;
}
}
if (i >= g_EfiDriverNameCnt)
{
g_EfiDriverNameList[g_EfiDriverNameCnt] = DriverName;
g_EfiDriverNameCnt++;
}
return EFI_SUCCESS;
}
EFI_STATUS ShowEfiDrivers(IN EFI_HANDLE ImageHandle, IN CONST CHAR16 *CmdLine)
{
UINTN i = 0;
UINTN Count = 0;
CHAR16 *DriverName = NULL;
EFI_HANDLE *Handles = NULL;
EFI_STATUS Status = EFI_SUCCESS;
EFI_COMPONENT_NAME_PROTOCOL *NameProtocol = NULL;
EFI_COMPONENT_NAME2_PROTOCOL *Name2Protocol = NULL;
(VOID)ImageHandle;
(VOID)CmdLine;
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiComponentName2ProtocolGuid,
NULL, &Count, &Handles);
if (EFI_ERROR(Status))
{
return Status;
}
for (i = 0; i < Count; i++)
{
Status = gBS->HandleProtocol(Handles[i], &gEfiComponentName2ProtocolGuid, (VOID **)&Name2Protocol);
if (EFI_ERROR(Status))
{
continue;
}
DriverName = NULL;
Status = VtoyGetComponentName(2, Name2Protocol, &DriverName);
if ((!EFI_ERROR(Status)) && (DriverName))
{
AddEfiDriverName(DriverName);
}
}
Count = 0;
FreePool(Handles);
Handles = NULL;
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiComponentNameProtocolGuid,
NULL, &Count, &Handles);
if (EFI_ERROR(Status))
{
return Status;
}
for (i = 0; i < Count; i++)
{
Status = gBS->HandleProtocol(Handles[i], &gEfiComponentNameProtocolGuid, (VOID **)&NameProtocol);
if (EFI_ERROR(Status))
{
continue;
}
DriverName = NULL;
Status = VtoyGetComponentName(1, Name2Protocol, &DriverName);
if ((!EFI_ERROR(Status)) && (DriverName))
{
AddEfiDriverName(DriverName);
}
}
FreePool(Handles);
for (i = 0; i < g_EfiDriverNameCnt; i++)
{
Printf("%2d %s\n", i, g_EfiDriverNameList[i]);
}
return EFI_SUCCESS;
}

View File

@@ -44,8 +44,39 @@ STATIC grub_env_printf_pf g_env_printf = NULL;
STATIC VtoyUtilFeature gFeatureList[] =
{
{ L"fix_windows_mmap", FixWindowsMemhole },
{ L"show_efi_drivers", ShowEfiDrivers },
};
EFI_STATUS VtoyGetComponentName(IN UINTN Ver, IN VOID *Protocol, OUT CHAR16 **DriverName)
{
EFI_STATUS Status = EFI_SUCCESS;
CHAR16 *DrvName = NULL;
EFI_COMPONENT_NAME_PROTOCOL *NameProtocol = NULL;
EFI_COMPONENT_NAME2_PROTOCOL *Name2Protocol = NULL;
if (1 == Ver)
{
NameProtocol = (EFI_COMPONENT_NAME_PROTOCOL *)Protocol;
Status = NameProtocol->GetDriverName(Protocol, "en", &DrvName);
if (EFI_ERROR(Status) || NULL == DrvName)
{
Status = NameProtocol->GetDriverName(Protocol, "eng", &DrvName);
}
}
else
{
Name2Protocol = (EFI_COMPONENT_NAME2_PROTOCOL *)Protocol;
Status = Name2Protocol->GetDriverName(Protocol, "en", &DrvName);
if (EFI_ERROR(Status) || NULL == DrvName)
{
Status = Name2Protocol->GetDriverName(Protocol, "eng", &DrvName);
}
}
*DriverName = DrvName;
return Status;
}
VOID EFIAPI VtoyUtilDebug(IN CONST CHAR8 *Format, ...)
{
VA_LIST Marker;

View File

@@ -57,7 +57,9 @@ VOID EFIAPI VtoyUtilDebug(IN CONST CHAR8 *Format, ...);
#define debug(expr, ...) if (gVtoyDebugPrint) VtoyUtilDebug("[VTOY] "expr"\n", ##__VA_ARGS__)
#define Printf VtoyUtilDebug
EFI_STATUS VtoyGetComponentName(IN UINTN Ver, IN VOID *Protocol, OUT CHAR16 **DriverName);
EFI_STATUS FixWindowsMemhole(IN EFI_HANDLE ImageHandle, IN CONST CHAR16 *CmdLine);
EFI_STATUS ShowEfiDrivers(IN EFI_HANDLE ImageHandle, IN CONST CHAR16 *CmdLine);
#endif

View File

@@ -28,6 +28,7 @@
[Sources]
VtoyUtil.h
VtoyUtil.c
VtoyDrv.c
Memhole.c
[Packages]

View File

@@ -33,6 +33,7 @@
GRUB_MOD_LICENSE ("GPLv3+");
static int g_ventoy_no_joliet = 0;
static int g_ventoy_cur_joliet = 0;
static grub_uint64_t g_ventoy_last_read_pos = 0;
static grub_uint64_t g_ventoy_last_read_offset = 0;
static grub_uint64_t g_ventoy_last_read_dirent_pos = 0;
@@ -451,6 +452,7 @@ grub_iso9660_mount (grub_disk_t disk)
data->disk = disk;
g_ventoy_cur_joliet = 0;
block = 16;
do
{
@@ -484,6 +486,7 @@ grub_iso9660_mount (grub_disk_t disk)
if (0 == g_ventoy_no_joliet) {
copy_voldesc = 1;
data->joliet = 1;
g_ventoy_cur_joliet = 1;
}
}
@@ -1118,6 +1121,11 @@ void grub_iso9660_set_nojoliet(int nojoliet)
g_ventoy_no_joliet = nojoliet;
}
int grub_iso9660_is_joliet(void)
{
return g_ventoy_cur_joliet;
}
grub_uint64_t grub_iso9660_get_last_read_pos(grub_file_t file)
{
(void)file;

View File

@@ -279,6 +279,13 @@ static int ventoy_boot_opt_filter(char *opt)
opt[1] = 't';
return 0;
}
if (grub_strncmp(opt, "dm=", 3) == 0)
{
opt[0] = 'D';
opt[1] = 'M';
return 0;
}
if (ventoy_debug)
{

View File

@@ -506,6 +506,13 @@ static int ventoy_boot_opt_filter(char *opt)
return 0;
}
if (grub_strncmp(opt, "dm=", 3) == 0)
{
opt[0] = 'D';
opt[1] = 'M';
return 0;
}
if (ventoy_debug)
{
if (grub_strcmp(opt, "quiet") == 0)

View File

@@ -228,6 +228,13 @@ static int ventoy_boot_opt_filter(char *opt)
return 0;
}
if (grub_strncmp(opt, "dm=", 3) == 0)
{
opt[0] = 'D';
opt[1] = 'M';
return 0;
}
if (ventoy_debug)
{
if (grub_strcmp(opt, "quiet") == 0)

View File

@@ -0,0 +1,232 @@
/* gpt.c - Read GUID Partition Tables (GPT). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/disk.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/partition.h>
#include <grub/dl.h>
#include <grub/msdos_partition.h>
#include <grub/gpt_partition.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_uint8_t grub_gpt_magic[8] =
{
0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54
};
static const grub_gpt_part_guid_t grub_gpt_partition_type_empty = GRUB_GPT_PARTITION_TYPE_EMPTY;
#ifdef GRUB_UTIL
static const grub_gpt_part_guid_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
#endif
/* 512 << 7 = 65536 byte sectors. */
#define MAX_SECTOR_LOG 7
static struct grub_partition_map grub_gpt_partition_map;
grub_err_t
grub_gpt_partition_map_iterate (grub_disk_t disk,
grub_partition_iterate_hook_t hook,
void *hook_data)
{
struct grub_partition part;
struct grub_gpt_header gpt;
struct grub_gpt_partentry entry;
struct grub_msdos_partition_mbr mbr;
grub_uint64_t entries;
unsigned int i;
int last_offset = 0;
int sector_log = 0;
/* Read the protective MBR. */
if (grub_disk_read (disk, 0, 0, sizeof (mbr), &mbr))
return grub_errno;
/* Check if it is valid. */
if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
/* Make sure the MBR is a protective MBR and not a normal MBR. */
for (i = 0; i < 4; i++)
if (mbr.entries[i].type == GRUB_PC_PARTITION_TYPE_GPT_DISK)
break;
if (i == 4)
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
/* Read the GPT header. */
for (sector_log = 0; sector_log < MAX_SECTOR_LOG; sector_log++)
{
if (grub_disk_read (disk, 1 << sector_log, 0, sizeof (gpt), &gpt))
return grub_errno;
if (grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)) == 0)
break;
}
if (sector_log == MAX_SECTOR_LOG)
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no valid GPT header");
grub_dprintf ("gpt", "Read a valid GPT header\n");
entries = grub_le_to_cpu64 (gpt.partitions) << sector_log;
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
{
if (grub_disk_read (disk, entries, last_offset,
sizeof (entry), &entry))
return grub_errno;
if (grub_memcmp (&grub_gpt_partition_type_empty, &entry.type,
sizeof (grub_gpt_partition_type_empty)))
{
/* Calculate the first block and the size of the partition. */
part.start = grub_le_to_cpu64 (entry.start) << sector_log;
part.len = (grub_le_to_cpu64 (entry.end)
- grub_le_to_cpu64 (entry.start) + 1) << sector_log;
part.offset = entries;
part.number = i;
part.index = last_offset;
part.partmap = &grub_gpt_partition_map;
part.parent = disk->partition;
part.gpt_attrib = entry.attrib;
grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n", i,
(unsigned long long) part.start,
(unsigned long long) part.len);
if (hook (disk, &part, hook_data))
return grub_errno;
}
last_offset += grub_le_to_cpu32 (gpt.partentry_size);
if (last_offset == GRUB_DISK_SECTOR_SIZE)
{
last_offset = 0;
entries++;
}
}
return GRUB_ERR_NONE;
}
#ifdef GRUB_UTIL
/* Context for gpt_partition_map_embed. */
struct gpt_partition_map_embed_ctx
{
grub_disk_addr_t start, len;
};
/* Helper for gpt_partition_map_embed. */
static int
find_usable_region (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p, void *data)
{
struct gpt_partition_map_embed_ctx *ctx = data;
struct grub_gpt_partentry gptdata;
grub_partition_t p2;
p2 = disk->partition;
disk->partition = p->parent;
if (grub_disk_read (disk, p->offset, p->index,
sizeof (gptdata), &gptdata))
{
disk->partition = p2;
return 0;
}
disk->partition = p2;
/* If there's an embed region, it is in a dedicated partition. */
if (! grub_memcmp (&gptdata.type, &grub_gpt_partition_type_bios_boot, 16))
{
ctx->start = p->start;
ctx->len = p->len;
return 1;
}
return 0;
}
static grub_err_t
gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
unsigned int max_nsectors,
grub_embed_type_t embed_type,
grub_disk_addr_t **sectors)
{
struct gpt_partition_map_embed_ctx ctx = {
.start = 0,
.len = 0
};
unsigned i;
grub_err_t err;
if (embed_type != GRUB_EMBED_PCBIOS)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"GPT currently supports only PC-BIOS embedding");
err = grub_gpt_partition_map_iterate (disk, find_usable_region, &ctx);
if (err)
return err;
if (ctx.len == 0)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
N_("this GPT partition label contains no BIOS Boot Partition;"
" embedding won't be possible"));
if (ctx.len < *nsectors)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
N_("your BIOS Boot Partition is too small;"
" embedding won't be possible"));
*nsectors = ctx.len;
if (*nsectors > max_nsectors)
*nsectors = max_nsectors;
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
if (!*sectors)
return grub_errno;
for (i = 0; i < *nsectors; i++)
(*sectors)[i] = ctx.start + i;
return GRUB_ERR_NONE;
}
#endif
/* Partition map type. */
static struct grub_partition_map grub_gpt_partition_map =
{
.name = "gpt",
.iterate = grub_gpt_partition_map_iterate,
#ifdef GRUB_UTIL
.embed = gpt_partition_map_embed
#endif
};
GRUB_MOD_INIT(part_gpt)
{
grub_partition_map_register (&grub_gpt_partition_map);
}
GRUB_MOD_FINI(part_gpt)
{
grub_partition_map_unregister (&grub_gpt_partition_map);
}

View File

@@ -127,6 +127,9 @@ static grub_uint64_t g_enumerate_start_time_ms;
static grub_uint64_t g_enumerate_finish_time_ms;
static int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT] = {0};
static int g_pager_flag = 0;
static char g_old_pager[32];
static const char *g_vtoy_winpeshl_ini = "[LaunchApps]\r\nvtoyjump.exe";
static const char *g_menu_class[] =
@@ -142,6 +145,8 @@ const char *g_menu_prefix[img_type_max] =
static int g_vtoy_load_prompt = 0;
static char g_vtoy_prompt_msg[64];
static char g_json_case_mis_path[32];
static int ventoy_get_fs_type(const char *fs)
{
if (NULL == fs)
@@ -1221,6 +1226,23 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
return rc;
}
static grub_err_t ventoy_cmd_iso9660_is_joliet(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
(void)args;
if (grub_iso9660_is_joliet())
{
debug("This time has joliet process\n");
return 0;
}
else
{
return 1;
}
}
static grub_err_t ventoy_cmd_iso9660_nojoliet(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
@@ -3469,9 +3491,11 @@ end:
static int ventoy_img_partition_callback (struct grub_disk *disk, const grub_partition_t partition, void *data)
{
int *pCnt = (int *)data;
(void)disk;
(void)data;
(*pCnt)++;
g_part_list_pos += grub_snprintf(g_part_list_buf + g_part_list_pos, VTOY_MAX_SCRIPT_BUF - g_part_list_pos,
"0 %llu linear /dev/ventoy %llu\n",
(ulonglong)partition->len, (ulonglong)partition->start);
@@ -3481,6 +3505,7 @@ static int ventoy_img_partition_callback (struct grub_disk *disk, const grub_par
static grub_err_t ventoy_cmd_img_part_info(grub_extcmd_context_t ctxt, int argc, char **args)
{
int cnt = 0;
char *device_name = NULL;
grub_device_t dev = NULL;
char buf[64];
@@ -3509,11 +3534,14 @@ static grub_err_t ventoy_cmd_img_part_info(grub_extcmd_context_t ctxt, int argc,
goto end;
}
grub_partition_iterate(dev->disk, ventoy_img_partition_callback, NULL);
grub_partition_iterate(dev->disk, ventoy_img_partition_callback, &cnt);
grub_snprintf(buf, sizeof(buf), "newc:vtoy_dm_table:mem:0x%llx:size:%d", (ulonglong)(ulong)g_part_list_buf, g_part_list_pos);
grub_env_set("vtoy_img_part_file", buf);
grub_snprintf(buf, sizeof(buf), "%d", cnt);
grub_env_set("vtoy_img_part_cnt", buf);
end:
check_free(device_name, grub_free);
@@ -4629,6 +4657,200 @@ fail:
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static grub_err_t ventoy_cmd_push_pager(grub_extcmd_context_t ctxt, int argc, char **args)
{
const char *pager = NULL;
(void)ctxt;
(void)argc;
(void)args;
pager = grub_env_get("pager");
if (NULL == pager)
{
g_pager_flag = 1;
grub_env_set("pager", "1");
}
else if (pager[0] == '1')
{
g_pager_flag = 0;
}
else
{
grub_snprintf(g_old_pager, sizeof(g_old_pager), "%s", pager);
g_pager_flag = 2;
grub_env_set("pager", "1");
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static grub_err_t ventoy_cmd_pop_pager(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
(void)args;
if (g_pager_flag == 1)
{
grub_env_unset("pager");
}
else if (g_pager_flag == 2)
{
grub_env_set("pager", g_old_pager);
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static int ventoy_chk_case_file(const char *filename, const struct grub_dirhook_info *info, void *data)
{
if (g_json_case_mis_path[0])
{
return 1;
}
if (0 == info->dir && grub_strncasecmp(filename, "ventoy.json", 11) == 0)
{
grub_snprintf(g_json_case_mis_path, 32, "%s/%s", (char *)data, filename);
return 1;
}
return 0;
}
static int ventoy_chk_case_dir(const char *filename, const struct grub_dirhook_info *info, void *data)
{
char path[16];
chk_case_fs_dir *fs_dir = (chk_case_fs_dir *)data;
if (g_json_case_mis_path[0])
{
return 1;
}
if (info->dir && (filename[0] == 'v' || filename[0] == 'V'))
{
if (grub_strncasecmp(filename, "ventoy", 6) == 0)
{
grub_snprintf(path, sizeof(path), "/%s", filename);
fs_dir->fs->fs_dir(fs_dir->dev, path, ventoy_chk_case_file, path);
if (g_json_case_mis_path[0])
{
return 1;
}
}
}
return 0;
}
static grub_err_t ventoy_cmd_chk_json_pathcase(grub_extcmd_context_t ctxt, int argc, char **args)
{
int fstype = 0;
char *device_name = NULL;
grub_device_t dev = NULL;
grub_fs_t fs = NULL;
chk_case_fs_dir fs_dir;
(void)ctxt;
(void)argc;
(void)args;
device_name = grub_file_get_device_name(args[0]);
if (!device_name)
{
goto out;
}
dev = grub_device_open(device_name);
if (!dev)
{
goto out;
}
fs = grub_fs_probe(dev);
if (!fs)
{
goto out;
}
fstype = ventoy_get_fs_type(fs->name);
if (fstype == ventoy_fs_fat || fstype == ventoy_fs_exfat || fstype >= ventoy_fs_max)
{
goto out;
}
g_json_case_mis_path[0] = 0;
fs_dir.dev = dev;
fs_dir.fs = fs;
fs->fs_dir(dev, "/", ventoy_chk_case_dir, &fs_dir);
if (g_json_case_mis_path[0])
{
grub_env_set("VTOY_PLUGIN_PATH_CASE_MISMATCH", g_json_case_mis_path);
}
out:
grub_check_free(device_name);
check_free(dev, grub_device_close);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static grub_err_t grub_cmd_gptpriority(grub_extcmd_context_t ctxt, int argc, char **args)
{
grub_disk_t disk;
grub_partition_t part;
char priority_str[3]; /* Maximum value 15 */
(void)ctxt;
if (argc < 2 || argc > 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"gptpriority DISKNAME PARTITIONNUM [VARNAME]");
/* Open the disk if it exists */
disk = grub_disk_open (args[0]);
if (!disk)
{
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"Not a disk");
}
part = grub_partition_probe (disk, args[1]);
if (!part)
{
grub_disk_close (disk);
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"No such partition");
}
if (grub_strcmp (part->partmap->name, "gpt"))
{
grub_disk_close (disk);
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Not a GPT partition");
}
grub_snprintf (priority_str, sizeof(priority_str), "%u",
(grub_uint32_t)((part->gpt_attrib >> 48) & 0xfULL));
if (argc == 3)
{
grub_env_set (args[2], priority_str);
grub_env_export (args[2]);
}
else
{
grub_printf ("Priority is %s\n", priority_str);
}
grub_disk_close (disk);
return GRUB_ERR_NONE;
}
int ventoy_env_init(void)
{
char buf[64];
@@ -4676,6 +4898,8 @@ int ventoy_env_init(void)
return 0;
}
static cmd_para ventoy_cmds[] =
{
{ "vt_incr", ventoy_cmd_incr, 0, NULL, "{Var} {INT}", "Increase integer variable", NULL },
@@ -4736,6 +4960,7 @@ static cmd_para ventoy_cmds[] =
{ "vt_select_conf_replace", ventoy_select_conf_replace, 0, NULL, "", "", NULL },
{ "vt_iso9660_nojoliet", ventoy_cmd_iso9660_nojoliet, 0, NULL, "", "", NULL },
{ "vt_iso9660_isjoliet", ventoy_cmd_iso9660_is_joliet, 0, NULL, "", "", NULL },
{ "vt_is_udf", ventoy_cmd_is_udf, 0, NULL, "", "", NULL },
{ "vt_file_size", ventoy_cmd_file_size, 0, NULL, "", "", NULL },
{ "vt_load_file_to_mem", ventoy_cmd_load_file_to_mem, 0, NULL, "", "", NULL },
@@ -4803,6 +5028,11 @@ static cmd_para ventoy_cmds[] =
{ "vt_get_efi_vdisk_offset", ventoy_cmd_get_efivdisk_offset, 0, NULL, "", "", NULL },
{ "vt_search_replace_initrd", ventoy_cmd_search_replace_initrd, 0, NULL, "", "", NULL },
{ "vt_push_pager", ventoy_cmd_push_pager, 0, NULL, "", "", NULL },
{ "vt_pop_pager", ventoy_cmd_pop_pager, 0, NULL, "", "", NULL },
{ "vt_check_json_path_case", ventoy_cmd_chk_json_pathcase, 0, NULL, "", "", NULL },
{ "vt_append_extra_sector", ventoy_cmd_append_ext_sector, 0, NULL, "", "", NULL },
{ "gptpriority", grub_cmd_gptpriority, 0, NULL, "", "", NULL },
};
int ventoy_register_all_cmd(void)

View File

@@ -547,6 +547,12 @@ typedef struct replace_fs_dir
int filecnt;
}replace_fs_dir;
typedef struct chk_case_fs_dir
{
grub_device_t dev;
grub_fs_t fs;
}chk_case_fs_dir;
int ventoy_strcmp(const char *pattern, const char *str);
int ventoy_strncmp (const char *pattern, const char *str, grub_size_t n);
void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param);
@@ -562,6 +568,7 @@ grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc,
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_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_append_ext_sector(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_skip_svd(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_cpio_busybox_64(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **args);

View File

@@ -152,6 +152,23 @@ static int vtoy_json_parse_string
return JSON_FAILED;
}
if (*(pcPos - 1) == '\\')
{
for (pcPos++; *pcPos; pcPos++)
{
if (*pcPos == '"' && *(pcPos - 1) != '\\')
{
break;
}
}
if (*pcPos == 0 || pcPos < pcTmp)
{
json_debug("Invalid quotes string %s.", pcData);
return JSON_FAILED;
}
}
*ppcEnd = pcPos + 1;
uiLen = (grub_uint32_t)(unsigned long)(pcPos - pcTmp);

View File

@@ -38,6 +38,9 @@
GRUB_MOD_LICENSE ("GPLv3+");
#define VTOY_APPEND_EXT_SIZE 4096
static int g_append_ext_sector = 0;
char * ventoy_get_line(char *start)
{
if (start == NULL)
@@ -658,6 +661,11 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
count++;
}
if (g_append_ext_sector > 0)
{
count++;
}
return count;
}
@@ -671,6 +679,11 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
{
size += sizeof(ventoy_virt_chunk) + g_conf_replace_new_len_align;
}
if (g_append_ext_sector > 0)
{
size += sizeof(ventoy_virt_chunk) + VTOY_APPEND_EXT_SIZE;
}
return size;
}
@@ -727,6 +740,27 @@ static void ventoy_linux_fill_virt_data( grub_uint64_t isosize, ventoy_chain_
cur++;
}
/* Lenovo EasyStartup need an addional sector for boundary check */
if (g_append_ext_sector > 0)
{
cpio_secs = VTOY_APPEND_EXT_SIZE / 2048;
cur->mem_sector_start = sector;
cur->mem_sector_end = cur->mem_sector_start + cpio_secs;
cur->mem_sector_offset = offset;
cur->remap_sector_start = 0;
cur->remap_sector_end = 0;
cur->org_sector_start = 0;
grub_memset(override + offset, 0, VTOY_APPEND_EXT_SIZE);
chain->virt_img_size_in_bytes += VTOY_APPEND_EXT_SIZE;
offset += VTOY_APPEND_EXT_SIZE;
sector += cpio_secs;
cur++;
}
if (g_conf_replace_offset > 0)
{
cpio_secs = g_conf_replace_new_len_align / 2048;
@@ -1119,6 +1153,24 @@ grub_err_t ventoy_cmd_skip_svd(grub_extcmd_context_t ctxt, int argc, char **args
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
grub_err_t ventoy_cmd_append_ext_sector(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
(void)args;
if (args[0][0] == '1')
{
g_append_ext_sector = 1;
}
else
{
g_append_ext_sector = 0;
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args)
{
int i;
@@ -1459,9 +1511,9 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
{
int len = 0;
int ventoy_compatible = 0;
grub_uint32_t size = 0;
grub_uint64_t isosize = 0;
@@ -1501,23 +1553,31 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
isosize = file->size;
boot_catlog = ventoy_get_iso_boot_catlog(file);
if (boot_catlog)
len = (int)grub_strlen(args[0]);
if (len >= 4 && 0 == grub_strcasecmp(args[0] + len - 4, ".img"))
{
if (ventoy_is_efi_os() && (!ventoy_has_efi_eltorito(file, boot_catlog)))
{
grub_env_set("LoadIsoEfiDriver", "on");
}
debug("boot catlog %u for img file\n", boot_catlog);
}
else
{
if (ventoy_is_efi_os())
boot_catlog = ventoy_get_iso_boot_catlog(file);
if (boot_catlog)
{
grub_env_set("LoadIsoEfiDriver", "on");
if (ventoy_is_efi_os() && (!ventoy_has_efi_eltorito(file, boot_catlog)))
{
grub_env_set("LoadIsoEfiDriver", "on");
}
}
else
{
return grub_error(GRUB_ERR_BAD_ARGUMENT, "File %s is not bootable", args[0]);
if (ventoy_is_efi_os())
{
grub_env_set("LoadIsoEfiDriver", "on");
}
else
{
return grub_error(GRUB_ERR_BAD_ARGUMENT, "File %s is not bootable", args[0]);
}
}
}

View File

@@ -0,0 +1,141 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2004,2006,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_PART_HEADER
#define GRUB_PART_HEADER 1
#include <grub/dl.h>
#include <grub/list.h>
struct grub_disk;
typedef struct grub_partition *grub_partition_t;
#ifdef GRUB_UTIL
typedef enum
{
GRUB_EMBED_PCBIOS
} grub_embed_type_t;
#endif
typedef int (*grub_partition_iterate_hook_t) (struct grub_disk *disk,
const grub_partition_t partition,
void *data);
/* Partition map type. */
struct grub_partition_map
{
/* The next partition map type. */
struct grub_partition_map *next;
struct grub_partition_map **prev;
/* The name of the partition map type. */
const char *name;
/* Call HOOK with each partition, until HOOK returns non-zero. */
grub_err_t (*iterate) (struct grub_disk *disk,
grub_partition_iterate_hook_t hook, void *hook_data);
#ifdef GRUB_UTIL
/* Determine sectors available for embedding. */
grub_err_t (*embed) (struct grub_disk *disk, unsigned int *nsectors,
unsigned int max_nsectors,
grub_embed_type_t embed_type,
grub_disk_addr_t **sectors);
#endif
};
typedef struct grub_partition_map *grub_partition_map_t;
/* Partition description. */
struct grub_partition
{
/* The partition number. */
int number;
/* The start sector (relative to parent). */
grub_disk_addr_t start;
/* The length in sector units. */
grub_uint64_t len;
/* The offset of the partition table. */
grub_disk_addr_t offset;
/* The index of this partition in the partition table. */
int index;
/* Parent partition (physically contains this partition). */
struct grub_partition *parent;
/* The type partition map. */
grub_partition_map_t partmap;
/* The type of partition whne it's on MSDOS.
Used for embedding detection. */
grub_uint8_t msdostype;
/* The attrib field for GPT. Needed for priority detection. */
grub_uint64_t gpt_attrib;
};
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
const char *str);
int EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
grub_partition_iterate_hook_t hook,
void *hook_data);
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
#ifndef GRUB_LST_GENERATOR
static inline void
grub_partition_map_register (grub_partition_map_t partmap)
{
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
GRUB_AS_LIST (partmap));
}
#endif
static inline void
grub_partition_map_unregister (grub_partition_map_t partmap)
{
grub_list_remove (GRUB_AS_LIST (partmap));
}
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
static inline grub_disk_addr_t
grub_partition_get_start (const grub_partition_t p)
{
grub_partition_t part;
grub_uint64_t part_start = 0;
for (part = p; part; part = part->parent)
part_start += part->start;
return part_start;
}
static inline grub_uint64_t
grub_partition_get_len (const grub_partition_t p)
{
return p->len;
}
#endif /* ! GRUB_PART_HEADER */

View File

@@ -267,6 +267,7 @@ typedef struct ventoy_grub_param
int grub_ext_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
int grub_fat_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
void grub_iso9660_set_nojoliet(int nojoliet);
int grub_iso9660_is_joliet(void);
grub_uint64_t grub_iso9660_get_last_read_pos(grub_file_t file);
grub_uint64_t grub_iso9660_get_last_file_dirent_pos(grub_file_t file);
grub_uint64_t grub_udf_get_file_offset(grub_file_t file);

View File

@@ -97,6 +97,8 @@ elif [ "$1" = "arm64" ]; then
if ! echo $all_modules | grep -q " ${line%.mod} "; then
echo "Copy $line ..."
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/arm64-efi/$line $VT_DIR/INSTALL/grub/arm64-efi/
xz $VT_DIR/INSTALL/grub/arm64-efi/$line
mv $VT_DIR/INSTALL/grub/arm64-efi/${line}.xz $VT_DIR/INSTALL/grub/arm64-efi/${line}
fi
done
elif [ "$1" = "mips64el" ]; then

View File

@@ -41,18 +41,18 @@ ventoy_os_install_dmsetup() {
fi
# install md-modules
LINE=$($GREP ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
LINTCNT=$($GREP -c ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
LINTCNT=$($GREP -i -c ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $LINTCNT -gt 1 ]; then
vtlog "more than one pkgs, need to filter..."
VER=$($BUSYBOX_PATH/uname -r)
LINE=$($GREP ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP $VER)
LINTCNT=$($GREP ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -c $VER)
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i $VER)
LINTCNT=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -c $VER)
if [ $LINTCNT -gt 1 ]; then
vtlog "Still more than one pkgs, use the first one..."
LINE=$($GREP ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -m1 $VER)
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -m1 $VER)
fi
fi
install_udeb_from_line "$LINE" ${vt_usb_disk}

View File

@@ -0,0 +1,83 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2021, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
. /ventoy/hook/ventoy-hook-lib.sh
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
get_rhel_ver() {
if uname -m | grep -q '64'; then
machine='_X64'
fi
if grep -q '6[.]1' /etc/redhat-release; then
echo "RHAS6U1$machine"; return
fi
echo "RHAS6U1$machine"
}
install_dm_mod_ko() {
# dump iso file location
vtoydm -i -f $VTOY_PATH/ventoy_image_map -d ${vtdiskname} > $VTOY_PATH/iso_file_list
sysver=$(get_rhel_ver)
vtlog "sysver=$sysver"
LINE=$(grep "$sysver" -n -m1 $VTOY_PATH/iso_file_list | awk -F: '{print $1}')
vtlog "LINE=$LINE"
LINE=$(sed -n "$LINE,\$p" $VTOY_PATH/iso_file_list | grep -m1 'initrd.img')
vtlog "LINE=$LINE"
sector=$(echo $LINE | $AWK '{print $(NF-1)}')
length=$(echo $LINE | $AWK '{print $NF}')
vtlog "sector=$sector length=$length"
mkdir xxx
vtoydm -e -f $VTOY_PATH/ventoy_image_map -d ${vtdiskname} -s $sector -l $length -o ./xxx.img
cd xxx/
zcat ../xxx.img | cpio -idmu
ko=$(find -name dm-mod.ko*)
vtlog "ko=$ko ..."
insmod $ko
cd ../
rm -f xxx.img
rm -rf xxx
}
vtdiskname=$(get_ventoy_disk_name)
vtlog "vtdiskname=$vtdiskname ..."
if [ "$vtdiskname" = "unknown" ]; then
exit 0
fi
if grep -q 'device-mapper' /proc/devices; then
vtlog "device-mapper module check ko"
else
install_dm_mod_ko
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
ln -s /dev/dm-0 /dev/root
PATH=$VTPATH_OLD

View File

@@ -0,0 +1,23 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2021, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
. $VTOY_PATH/hook/ventoy-os-lib.sh
$SED "s#^CDROM=.*#CDROM=/dev/dm-0#" -i /init
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/easystartup/ventoy-initqueue.sh /initqueue/ventoy.sh

View File

@@ -0,0 +1,20 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2021, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
/ventoy/busybox/sh /ventoy/hook/easystartup/disk_hook.sh $*

View File

@@ -36,3 +36,7 @@ else
fi
/ventoy/busybox/sh /ventoy/hook/suse/udev_disk_hook.sh "${vtpart2#/dev/}"
if $GREP -q 'mediacheck=1' /proc/cmdline; then
ventoy_copy_device_mapper "${vtdiskname}"
fi

View File

@@ -562,6 +562,31 @@ ventoy_create_dev_ventoy_part() {
fi
}
ventoy_create_chromeos_ventoy_part() {
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
$BUSYBOX_PATH/mknod -m 0666 /dev/ventoy b $blkdev_num
if [ -e /vtoy_dm_table ]; then
vtPartid=1
$CAT /vtoy_dm_table | while read vtline; do
echo $vtline > /ventoy/dm_table_part${vtPartid}
if [ $vtPartid -eq $1 ]; then
$VTOY_PATH/tool/dmsetup create ventoy${vtPartid} /ventoy/dm_table_part${vtPartid} --readonly
else
$VTOY_PATH/tool/dmsetup create ventoy${vtPartid} /ventoy/dm_table_part${vtPartid}
fi
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy${vtPartid} | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
$BUSYBOX_PATH/mknod -m 0666 /dev/ventoy${vtPartid} b $blkdev_num
vtPartid=$(expr $vtPartid + 1)
done
fi
}
is_inotify_ventoy_part() {
if echo $1 | $GREP -q "2$"; then
if ! [ -e /sys/block/$1 ]; then

View File

@@ -0,0 +1,201 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2021, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
. /ventoy/hook/ventoy-hook-lib.sh
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
mkdir /sys
mount -t sysfs sys /sys
mdev -s
sleep 2
while [ -n "Y" ]; do
usb_disk=$(get_ventoy_disk_name)
if echo $usb_disk | egrep -q "nvme|mmc|nbd"; then
vtpart2=${usb_disk}p2
else
vtpart2=${usb_disk}2
fi
if [ -e "${vtpart2}" ]; then
break
else
sleep 2
mdev -s
fi
done
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
echo -n $vtDM > /ventoy/vtDM
ventoy_create_chromeos_ventoy_part 3
mdev -s
vtlog "copy out the e2fsck program ..."
copy_lib() {
cp -a /ventoy_rdroot/usr/lib64/$1 /usr/lib64/
cp -a /ventoy_rdroot/lib64/$1 /lib64/
}
mkdir /ventoy_rdroot
mkdir -p /lib /lib64 /usr/lib64 /sbin
mount -o ro /dev/ventoy3 /ventoy_rdroot >>$VTLOG 2>&1
cp -a /ventoy_rdroot/sbin/e2fsck /sbin/
cp -a /ventoy_rdroot/sbin/dmsetup /sbin/
copy_lib libext2fs*
copy_lib libcom_err*
copy_lib libe2p*
copy_lib libblk*
copy_lib libuuid*
copy_lib libdl.*
copy_lib libdl-*
copy_lib libc.*
copy_lib libc-*
copy_lib libpthread*
copy_lib ld-*
copy_lib libdevmapper*
copy_lib libudev*
copy_lib libm.*
copy_lib libm-*
copy_lib librt*
copy_lib libpopt*
copy_lib libgpg-error*
copy_lib libselinux*
copy_lib libsepol*
copy_lib libpcre*
copy_lib libcap*
copy_lib libdw*
copy_lib libgcc_s*
copy_lib libattr*
copy_lib libelf*
copy_lib libz.*
copy_lib libbz2*
copy_lib libgcrypt*
copy_lib liblvm*
ln -s /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.02.1
umount /ventoy_rdroot
vtlog "========================================="
vtlog "===== e2fsck -y -v /dev/ventoy1 ====="
e2fsck -y -v /dev/ventoy1 >>$VTLOG 2>&1
#vtlog "===== e2fsck -y -v /dev/ventoy3 ====="
#e2fsck -y -v /dev/ventoy3 >>$VTLOG 2>&1
vtlog "===== e2fsck -y -v /dev/ventoy8 ====="
e2fsck -y -v /dev/ventoy8 >>$VTLOG 2>&1
vtlog "========================================="
/sbin/dmsetup --version >>$VTLOG 2>&1
veritysetup --version >>$VTLOG 2>&1
vtlog "proc devtmpfs ..."
mkdir /newdev
mount -t devtmpfs dev /newdev
cp -a /dev/mapper/ventoy* /newdev/mapper/
cp -a /dev/ventoy* /newdev/
vtshortname="${vtdiskname#/dev/}"
mv /newdev/${vtshortname} /newdev/backup_${vtshortname}
cp -a /dev/ventoy /newdev/${vtshortname}
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
if [ -e /dev/ventoy${i} ]; then
if echo $vtdiskname | egrep -q "nvme|mmc|nbd"; then
vtpart=p$i
else
vtpart=$i
fi
if [ -e /newdev/${vtshortname}${vtpart} ]; then
mv /newdev/${vtshortname}${vtpart} /newdev/backup_${vtshortname}${vtpart}
fi
cp -a /dev/ventoy${i} /newdev/${vtshortname}${vtpart}
if [ $i -eq 3 ]; then
[ -e /dev/${vtshortname}${vtpart} ] && rm -f /dev/${vtshortname}${vtpart}
cp -a /dev/ventoy${i} /dev/${vtshortname}${vtpart}
vt_root_dev="/dev/${vtshortname}${vtpart}"
vtlog "vt_root_dev=$vt_root_dev"
fi
fi
done
# if grep -q 'DM=' /proc/cmdline; then
# vtlog "Boot verified image ..."
# dmP1=$(sed "s/.*\(0 [0-9]* verity\).*/\1/" /proc/cmdline)
# alg=$(sed "s/.*alg=\([^ ]*\).*/\1/" /proc/cmdline)
# hexdigest=$(sed "s/.*root_hexdigest=\([0-9a-fA-F][0-9a-fA-F]*\).*/\1/" /proc/cmdline)
# salt=$(sed "s/.*salt=\([0-9a-fA-F][0-9a-fA-F]*\).*/\1/" /proc/cmdline)
# hashstart=$(sed "s/.*hashstart=\([0-9][0-9]*\).*/\1/" /proc/cmdline)
#512 to 4096
# blocknum=$(expr $hashstart / 8)
# hashoffset=$(expr $hashstart \* 512)
# vtlog "veritysetup create vroot $vt_root_dev $vt_root_dev $hexdigest --data-block-size=4096 --hash-block-size=4096 --data-blocks=$blocknum --hash-offset=$hashoffset --salt=$salt --hash=$alg --no-superblock --format=0"
# veritysetup create vroot $vt_root_dev $vt_root_dev $hexdigest --data-block-size=4096 --hash-block-size=4096 --data-blocks=$blocknum --hash-offset=$hashoffset --salt=$salt --hash=$alg --no-superblock --format=0
# sleep 1
# mdev -s
# blkdev_num=$(dmsetup ls | grep vroot | sed 's/.*(\([0-9][0-9]*\),[^0-9]*\([0-9][0-9]*\).*/\1:\2/')
# vtDM=$(ventoy_find_dm_id ${blkdev_num})
# vtlog "blkdev_num=$blkdev_num vtDM=$vtDM"
# if [ -b /dev/$vtDM ]; then
# veritysetup status vroot >> $VTLOG 2>&1
# mount -o ro /dev/$vtDM /ventoy_rdroot
# else
# mount -o ro $vt_root_dev /ventoy_rdroot
# fi
# else
# vtlog "Boot normal image ..."
# mount -o ro $vt_root_dev /ventoy_rdroot
# fi
vtlog "Boot normal image ..."
mount -o ro $vt_root_dev /ventoy_rdroot
cp -a $VTLOG /newdev/ventoy.log
umount /newdev
mount -t devtmpfs dev /ventoy_rdroot/dev
PATH=$VTPATH_OLD

View File

@@ -0,0 +1,201 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2021, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
. /ventoy/hook/ventoy-hook-lib.sh
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
mkdir /sys
mount -t sysfs sys /sys
mdev -s
sleep 2
while [ -n "Y" ]; do
usb_disk=$(get_ventoy_disk_name)
if echo $usb_disk | egrep -q "nvme|mmc|nbd"; then
vtpart2=${usb_disk}p2
else
vtpart2=${usb_disk}2
fi
if [ -e "${vtpart2}" ]; then
break
else
sleep 2
mdev -s
fi
done
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
echo -n $vtDM > /ventoy/vtDM
ventoy_create_chromeos_ventoy_part 3
mdev -s
vtlog "copy out the e2fsck program ..."
copy_lib() {
cp -a /ventoy_rdroot/usr/lib64/$1 /usr/lib64/
cp -a /ventoy_rdroot/lib64/$1 /lib64/
}
mkdir /ventoy_rdroot
mkdir -p /lib /lib64 /usr/lib64 /sbin
mount -o ro /dev/ventoy3 /ventoy_rdroot >>$VTLOG 2>&1
cp -a /ventoy_rdroot/sbin/e2fsck /sbin/
cp -a /ventoy_rdroot/sbin/dmsetup /sbin/
copy_lib libext2fs*
copy_lib libcom_err*
copy_lib libe2p*
copy_lib libblk*
copy_lib libuuid*
copy_lib libdl.*
copy_lib libdl-*
copy_lib libc.*
copy_lib libc-*
copy_lib libpthread*
copy_lib ld-*
copy_lib libdevmapper*
copy_lib libudev*
copy_lib libm.*
copy_lib libm-*
copy_lib librt*
copy_lib libpopt*
copy_lib libgpg-error*
copy_lib libselinux*
copy_lib libsepol*
copy_lib libpcre*
copy_lib libcap*
copy_lib libdw*
copy_lib libgcc_s*
copy_lib libattr*
copy_lib libelf*
copy_lib libz.*
copy_lib libbz2*
copy_lib libgcrypt*
copy_lib liblvm*
ln -s /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.02.1
umount /ventoy_rdroot
vtlog "========================================="
vtlog "===== e2fsck -y -v /dev/ventoy1 ====="
e2fsck -y -v /dev/ventoy1 >>$VTLOG 2>&1
#vtlog "===== e2fsck -y -v /dev/ventoy3 ====="
#e2fsck -y -v /dev/ventoy3 >>$VTLOG 2>&1
vtlog "===== e2fsck -y -v /dev/ventoy8 ====="
e2fsck -y -v /dev/ventoy8 >>$VTLOG 2>&1
vtlog "========================================="
/sbin/dmsetup --version >>$VTLOG 2>&1
veritysetup --version >>$VTLOG 2>&1
vtlog "proc devtmpfs ..."
mkdir /newdev
mount -t devtmpfs dev /newdev
cp -a /dev/mapper/ventoy* /newdev/mapper/
cp -a /dev/ventoy* /newdev/
vtshortname="${vtdiskname#/dev/}"
mv /newdev/${vtshortname} /newdev/backup_${vtshortname}
cp -a /dev/ventoy /newdev/${vtshortname}
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
if [ -e /dev/ventoy${i} ]; then
if echo $vtdiskname | egrep -q "nvme|mmc|nbd"; then
vtpart=p$i
else
vtpart=$i
fi
if [ -e /newdev/${vtshortname}${vtpart} ]; then
mv /newdev/${vtshortname}${vtpart} /newdev/backup_${vtshortname}${vtpart}
fi
cp -a /dev/ventoy${i} /newdev/${vtshortname}${vtpart}
if [ $i -eq 3 ]; then
[ -e /dev/${vtshortname}${vtpart} ] && rm -f /dev/${vtshortname}${vtpart}
cp -a /dev/ventoy${i} /dev/${vtshortname}${vtpart}
vt_root_dev="/dev/${vtshortname}${vtpart}"
vtlog "vt_root_dev=$vt_root_dev"
fi
fi
done
# if grep -q 'DM=' /proc/cmdline; then
# vtlog "Boot verified image ..."
# dmP1=$(sed "s/.*\(0 [0-9]* verity\).*/\1/" /proc/cmdline)
# alg=$(sed "s/.*alg=\([^ ]*\).*/\1/" /proc/cmdline)
# hexdigest=$(sed "s/.*root_hexdigest=\([0-9a-fA-F][0-9a-fA-F]*\).*/\1/" /proc/cmdline)
# salt=$(sed "s/.*salt=\([0-9a-fA-F][0-9a-fA-F]*\).*/\1/" /proc/cmdline)
# hashstart=$(sed "s/.*hashstart=\([0-9][0-9]*\).*/\1/" /proc/cmdline)
#512 to 4096
# blocknum=$(expr $hashstart / 8)
# hashoffset=$(expr $hashstart \* 512)
# vtlog "veritysetup create vroot $vt_root_dev $vt_root_dev $hexdigest --data-block-size=4096 --hash-block-size=4096 --data-blocks=$blocknum --hash-offset=$hashoffset --salt=$salt --hash=$alg --no-superblock --format=0"
# veritysetup create vroot $vt_root_dev $vt_root_dev $hexdigest --data-block-size=4096 --hash-block-size=4096 --data-blocks=$blocknum --hash-offset=$hashoffset --salt=$salt --hash=$alg --no-superblock --format=0
# sleep 1
# mdev -s
# blkdev_num=$(dmsetup ls | grep vroot | sed 's/.*(\([0-9][0-9]*\),[^0-9]*\([0-9][0-9]*\).*/\1:\2/')
# vtDM=$(ventoy_find_dm_id ${blkdev_num})
# vtlog "blkdev_num=$blkdev_num vtDM=$vtDM"
# if [ -b /dev/$vtDM ]; then
# veritysetup status vroot >> $VTLOG 2>&1
# mount -o ro /dev/$vtDM /ventoy_rdroot
# else
# mount -o ro $vt_root_dev /ventoy_rdroot
# fi
# else
# vtlog "Boot normal image ..."
# mount -o ro $vt_root_dev /ventoy_rdroot
# fi
vtlog "Boot normal image ..."
mount -o ro $vt_root_dev /ventoy_rdroot
cp -a $VTLOG /newdev/ventoy.log
umount /newdev
mount -t devtmpfs dev /ventoy_rdroot/dev
PATH=$VTPATH_OLD

View File

@@ -58,6 +58,12 @@ ventoy_get_os_type() {
# rhel6/CentOS6 and all other distributions based on them
elif $GREP -q 'el6' /proc/version; then
if [ -f /sbin/detectcd ]; then
if $GREP -q -i 'LENOVO-EasyStartup' /sbin/detectcd; then
echo 'easystartup'; return
fi
fi
echo 'rhel6'; return
# rhel7/CentOS7/rhel8/CentOS8 and all other distributions based on them

View File

@@ -81,6 +81,13 @@ else
echo "use unsquashfs_32" >>$VTLOG
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/unsquashfs_32 $VTOY_PATH/tool/vtoy_unsquashfs
fi
if $GREP -q 64 $VTOY_PATH/ventoy_arch; then
echo "use veritysetup64" >>$VTLOG
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup64 $VTOY_PATH/tool/veritysetup
else
echo "use veritysetup32" >>$VTLOG
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup32 $VTOY_PATH/tool/veritysetup
fi
fi

View File

@@ -21,7 +21,7 @@ elif uname -m | egrep -q 'mips64'; then
else
export TOOLDIR=i386
fi
export PATH=./tool/$TOOLDIR:$PATH
export PATH="./tool/$TOOLDIR:$PATH"
echo ''

View File

@@ -40,6 +40,15 @@ submenu "Screen Display Mode" --class=debug_screen_mode --class=F5tool {
if [ "$grub_platform" != "pc" ]; then
submenu 'Ventoy UEFI Utilities' --class=debug_util --class=F5tool {
menuentry 'Show EFI Drivers' --class=debug_util_efidrv --class=debug_util --class=F5tool {
vt_push_pager
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=show_efi_drivers
boot
vt_pop_pager
echo -e "\npress ENTER to exit ..."
read vtInputKey
}
menuentry 'Fixup Windows BlinitializeLibrary Failure' --class=debug_util_blinit --class=debug_util --class=F5tool {
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=fix_windows_mmap
boot

View File

@@ -130,6 +130,11 @@ function get_os_type {
function vt_check_compatible_pe {
#Check for PE without external tools
#set compatible if ISO file is less than 80MB
if [ $vt_chosen_size -gt 33554432 -a $vt_chosen_size -le 83886080 ]; then
set ventoy_compatible=YES
fi
return
}
@@ -159,7 +164,11 @@ function distro_specify_wim_patch {
vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
fi
elif [ -d (loop)/2k10/winpe ]; then
vt_windows_collect_wim_patch wim /2k10/winpe/w1086pe.wim
vt_windows_collect_wim_patch wim /2k10/winpe/w8x86pe.wim
vt_windows_collect_wim_patch wim /2k10/winpe/w7x86pe.wim
fi
}
function distro_specify_wim_patch_phase2 {
@@ -752,6 +761,8 @@ function ventoy_reset_nojoliet {
else
vt_iso9660_nojoliet 0
fi
vt_append_extra_sector 0
}
function uefi_iso_menu_func {
@@ -778,6 +789,12 @@ function uefi_iso_menu_func {
else
set ventoy_fs_probe=iso9660
ventoy_reset_nojoliet
# Lenovo EasyStartup need an addional sector for boundary check
if vt_str_begin "$vt_volume_id" "EasyStartup"; then
vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
vt_append_extra_sector 1
fi
fi
loopback loop "${1}${chosen_path}"
@@ -961,6 +978,14 @@ function legacy_linux_menu_func {
set ventoy_fs_probe=iso9660
loopback loop "$1$2"
fi
if [ -f (loop)/isolinux/isolinux.cfg ]; then
if vt_iso9660_isjoliet; then
vt_iso9660_nojoliet 1
loopback -d loop
loopback loop "$1$2"
fi
fi
vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
@@ -1474,6 +1499,11 @@ function vtoy_unsupport_menuentry {
#============================================================#
#
function only_uefi_tip {
echo -e "\n This IMG file is only supported in UEFI mode. \n"
echo -e "\n press ENTER to exit ..."
read vtInputKey
}
function ventoy_img_easyos {
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
@@ -1717,6 +1747,74 @@ function ventoy_img_tails {
vt_unset_boot_opt
}
function ventoy_img_fydeos {
if [ "$grub_platform" = "pc" ]; then
only_uefi_tip
return
fi
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
ventoy_debug_pause
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fydeos
vt_img_hook_root
set grubdisk=vtimghd
set grubpartA=(vtimghd,3)
set grubpartB=(vtimghd,5)
set linuxpartA=(sda,3)
set linuxpartB=(sda,5)
set root=(vtimghd,12)
configfile (vtimghd,12)/efi/boot/grub.cfg
vt_img_unhook_root
vt_unset_boot_opt
unset grubdisk
unset grubpartA
unset grubpartB
unset linuxpartA
unset linuxpartB
}
function ventoy_img_cloudready {
if [ "$grub_platform" = "pc" ]; then
only_uefi_tip
return
fi
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
ventoy_debug_pause
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=cloudready
vt_img_hook_root
set grubdisk=vtimghd
set grubpartA=(vtimghd,3)
set grubpartB=(vtimghd,5)
set linuxpartA=(sda,3)
set linuxpartB=(sda,5)
set root=(vtimghd,12)
configfile (vtimghd,12)/efi/boot/grub.cfg
vt_img_unhook_root
vt_unset_boot_opt
unset grubdisk
unset grubpartA
unset grubpartB
unset linuxpartA
unset linuxpartB
}
function ventoy_img_memtest86 {
chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
boot
@@ -1741,6 +1839,7 @@ function legacy_img_memdisk {
function img_common_menuentry {
set ventoy_compatible=YES
set ventoy_busybox_ver=32
unset LoadIsoEfiDriver
vt_chosen_img_path vt_chosen_path vt_chosen_size
@@ -1774,19 +1873,26 @@ function img_common_menuentry {
vt_get_fs_label (vtimghd,1) vtImgHd1Label
if [ -d (vtimghd,2)/lib ]; then
if [ "$vtImgHd1Label" = "STATE" ]; then
vt_get_fs_label (vtimghd,3) vtImgHd3Label
elif [ -d (vtimghd,2)/lib ]; then
vt_get_fs_label (vtimghd,2) vtImgHd2Label
fi
if [ -e (vtimghd,1)/etc/hostname ]; then
vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
fi
if [ -e (vtimghd,1)/easy.sfs ]; then
ventoy_img_easyos
elif [ -e (vtimghd,1)/volumio.initrd ]; then
ventoy_img_volumio
if vt_str_begin "$vtImgHd3Label" "ROOT-"; then
if [ -f (vtimghd,3)/etc/os-release.d/ID ]; then
vt_1st_line (vtimghd,3)/etc/os-release.d/ID vt_release_line1
if [ vt_str_begin "$vt_release_line1" "FydeOS" ]; then
ventoy_img_fydeos
fi
elif [ -f (vtimghd,3)/etc/cloudready-release ]; then
ventoy_img_cloudready
fi
elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
ventoy_img_openelec lakka
elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
@@ -1801,6 +1907,10 @@ function img_common_menuentry {
ventoy_img_tails
elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
ventoy_img_recalbox
elif [ -e (vtimghd,1)/easy.sfs ]; then
ventoy_img_easyos
elif [ -e (vtimghd,1)/volumio.initrd ]; then
ventoy_img_volumio
elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
ventoy_img_ubos
elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
@@ -1810,7 +1920,7 @@ function img_common_menuentry {
img_unsupport_tip
else
ventoy_img_memtest86
fi
fi
else
vt_linux_chain_data "${vtoy_iso_part}${vt_chosen_path}"
ventoy_acpi_param ${vtoy_chain_mem_addr} 512
@@ -1844,7 +1954,7 @@ function img_unsupport_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.49"
set VENTOY_VERSION="1.0.51"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1
@@ -1922,9 +2032,11 @@ vt_load_part_table $vtoydev
#Load Plugin
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
clear
vt_load_plugin $vtoy_iso_part
clear
clear
vt_load_plugin $vtoy_iso_part
clear
else
vt_check_json_path_case $vtoy_iso_part
fi
if [ -n "$VTOY_MENU_TIMEOUT" ]; then
@@ -1991,6 +2103,15 @@ if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
fi
if [ -n "$VTOY_PLUGIN_PATH_CASE_MISMATCH" ]; then
clear
echo "$VTOY_PLUGIN_PATH_CASE_MISMATCH"
echo -e "\n\nPath case does not match! ventoy directory and ventoy.json MUST be all lowercase!"
echo -e "\n路径大小写不匹配ventoy 目录和 ventoy.json 文件的名字必须是全部小写,请修正!"
echo -e "\n\npress ENTER to continue (请按回车键继续) ..."
read vtInputKey
fi
if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
clear
echo -e "\n Syntax error detected in ventoy.json, please check! \n"

View File

@@ -105,6 +105,23 @@ else
echo "BOOTIA32.EFI NOT found ..."
fi
}
menuentry 'Search and boot xorboot' --class=boot_xorboot --class=F4boot {
set VTOY_SEARCH_NO_VTOYEFI=1
if search -n -s -f /efi/xorboot/xorboot32.xor; then
unset VTOY_SEARCH_NO_VTOYEFI
terminal_output console
if [ -f /efi/xorboot/bootia32.efi ]; then
chainloader /efi/xorboot/bootia32.efi
elif [ -f /efi/xorboot/xorboot.efi ]; then
chainloader /efi/xorboot/xorboot.efi
fi
boot
else
unset VTOY_SEARCH_NO_VTOYEFI
echo "xorboot NOT found ..."
fi
}
elif [ "$grub_cpu" = "arm64" ]; then
menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi --class=F4boot {
set VTOY_SEARCH_NO_VTOYEFI=1
@@ -131,9 +148,25 @@ else
echo "BOOTX64.EFI NOT found ..."
fi
}
menuentry 'Search and boot xorboot' --class=boot_xorboot --class=F4boot {
set VTOY_SEARCH_NO_VTOYEFI=1
if search -n -s -f /efi/xorboot/xorboot.xor; then
unset VTOY_SEARCH_NO_VTOYEFI
terminal_output console
if [ -f /efi/xorboot/bootx64.efi ]; then
chainloader /efi/xorboot/bootx64.efi
elif [ -f /efi/xorboot/xorboot.efi ]; then
chainloader /efi/xorboot/xorboot.efi
fi
boot
else
unset VTOY_SEARCH_NO_VTOYEFI
echo "xorboot NOT found ..."
fi
}
fi
fi

View File

@@ -320,7 +320,7 @@ EOF
for i in 0 1 2 3 4 5 6 7 8 9; do
check_umount_disk "$PART2"
if mkfs.vfat -F 16 -n VTOYEFI $PART2; then
if mkfs.vfat -F 16 -n VTOYEFI -s 1 $PART2; then
echo 'success'
break
else

Binary file not shown.

Binary file not shown.

View File

@@ -77,9 +77,13 @@ cp $OPT ./tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer $tmpmnt/
mkdir -p $tmpmnt/tool
cp $OPT ./tool/i386/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_i386
cp $OPT ./tool/x86_64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_x86_64
cp $OPT ./tool/aarch64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_aarch64
# cp $OPT ./tool/i386/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_i386
# cp $OPT ./tool/x86_64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_x86_64
# cp $OPT ./tool/aarch64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_aarch64
# to save space
cp $OPT ./tool/i386/vtoygpt $tmpmnt/tool/mount.exfat-fuse_i386
cp $OPT ./tool/x86_64/vtoygpt $tmpmnt/tool/mount.exfat-fuse_x86_64
cp $OPT ./tool/aarch64/vtoygpt $tmpmnt/tool/mount.exfat-fuse_aarch64
rm -f $tmpmnt/grub/i386-pc/*.img

View File

@@ -46,7 +46,7 @@
"STR_WEB_SERVICE_BUSY":"الخدمة مشغولة ، يرجى إعادة المحاولة لاحقًا.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -97,7 +97,7 @@
"STR_WEB_SERVICE_BUSY":"서비스가 사용 중입니다. 나중에 다시 시도하십시오.",
"STR_MENU_VTSI_CREATE":"VTSI 파일 생성",
"STR_VTSI_CREATE_TIP":"이번에는 장치에 쓰지 않고 VTSI 파일#@만 생성합니다.#@계속하시겠습니까?",
"STR_VTSI_CREATE_SUCCESS":"VTSI 파일이 성공적으로 생성되었습니다!#@Rufus(3.15Beta+)를 사용하여 장치에 기록하여 Ventoy 설치를 완료할 수 있습니다.",
"STR_VTSI_CREATE_SUCCESS":"VTSI 파일이 성공적으로 생성되었습니다!#@Rufus(3.15+)를 사용하여 장치에 기록하여 Ventoy 설치를 완료할 수 있습니다.",
"STR_VTSI_CREATE_FAILED":"VTSI 파일을 생성하지 못했습니다.",
"STRXXX":""
},
@@ -148,7 +148,7 @@
"STR_WEB_SERVICE_BUSY":"后台服务正忙,请稍后重试",
"STR_MENU_VTSI_CREATE":"创建 VTSI 文件",
"STR_VTSI_CREATE_TIP":"本操作不会向设备中写入数据,而只会生成一个 VTSI 文件#@是否继续?",
"STR_VTSI_CREATE_SUCCESS":"VTSI 文件创建成功你可以使用Rufus(3.15Beta+)将其写入对应设备从而完成Ventoy的安装",
"STR_VTSI_CREATE_SUCCESS":"VTSI 文件创建成功你可以使用Rufus(3.15+)将其写入对应设备从而完成Ventoy的安装",
"STR_VTSI_CREATE_FAILED":"VTSI 文件创建失败",
"STRXXX":""
},
@@ -199,7 +199,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -250,7 +250,7 @@
"STR_WEB_SERVICE_BUSY":"سرویس شلوغ است ، لطفاً بعداً دوباره امتحان کنید.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -301,7 +301,7 @@
"STR_WEB_SERVICE_BUSY":"Usługa jest zajęta, spróbuj ponownie później.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -352,7 +352,7 @@
"STR_WEB_SERVICE_BUSY":"O serviço está ocupado, por favor, tente novamente mais tarde.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -403,7 +403,7 @@
"STR_WEB_SERVICE_BUSY":"Hizmet meşgul, lütfen daha sonra tekrar deneyin.",
"STR_MENU_VTSI_CREATE":"VTSI dosyası oluştur",
"STR_VTSI_CREATE_TIP":"Şu an cihaza yazılmayacak,sadece bir VTSI dosyası oluşturulacak#@Devam edilsin mi?",
"STR_VTSI_CREATE_SUCCESS":"VTSI dosyası başarılı bi şekilde oluşturuldu!#@Ventoy un cihaza kurulumunu tamamlamak için Rufus(3.15Beta+) programını kullanabilirsiniz.",
"STR_VTSI_CREATE_SUCCESS":"VTSI dosyası başarılı bi şekilde oluşturuldu!#@Ventoy un cihaza kurulumunu tamamlamak için Rufus(3.15+) programını kullanabilirsiniz.",
"STR_VTSI_CREATE_FAILED":"VTSI dosyası oluşturma Başarısız!",
"STRXXX":""
},
@@ -454,7 +454,7 @@
"STR_WEB_SERVICE_BUSY":"Dienst ist ausgelastet, bitte später erneut versuchen.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -505,7 +505,7 @@
"STR_WEB_SERVICE_BUSY":"Lo servici es ocupat, tornatz ensajar mai tard.",
"STR_MENU_VTSI_CREATE":"Generar lo fichièr VTSI",
"STR_VTSI_CREATE_TIP":"Aqueste còp cap descritura al disc, generacion del fichiet VTSI sonque#@Contunhar?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"Fracàs de la creacion del fichièr VTSI.",
"STRXXX":""
},
@@ -556,7 +556,7 @@
"STR_WEB_SERVICE_BUSY":"Service surchargé, veuillez réessayer plus tard.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -607,7 +607,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -658,7 +658,7 @@
"STR_WEB_SERVICE_BUSY":" El servicio está ocupado, por favor reintenta más tarde.",
"STR_MENU_VTSI_CREATE":"Generar Archivo VTSI",
"STR_VTSI_CREATE_TIP":"Esta vez no se escribirá al dispositivo, pero solo generará un archivo VTSI#@¿Continuar?",
"STR_VTSI_CREATE_SUCCESS":"¡Archivo VTSI creado exitosamente!#@Puedes usar Rufus(3.15Beta+) para escribirlo al dispositivo a fin de completar la instalación de Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"¡Archivo VTSI creado exitosamente!#@Puedes usar Rufus(3.15+) para escribirlo al dispositivo a fin de completar la instalación de Ventoy.",
"STR_VTSI_CREATE_FAILED":"Fallo en el archivo VTSI creado.",
"STRXXX":""
},
@@ -709,7 +709,7 @@
"STR_WEB_SERVICE_BUSY":"Служба занята, повторите попытку позже.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -760,7 +760,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -811,7 +811,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -862,7 +862,7 @@
"STR_WEB_SERVICE_BUSY":"Service is bezet, probeer het later opnieuw.",
"STR_MENU_VTSI_CREATE":"VTSI-bestand genereren",
"STR_VTSI_CREATE_TIP":"Deze keer wordt er niet naar het apparaat geschreven, maar wordt er alleen een VTSI-bestand gegenereerd#@Doorgaan?",
"STR_VTSI_CREATE_SUCCESS":"VTSI-bestand met succes aangemaakt!#@U kunt Rufus(3.15Beta+) gebruiken om het bestand naar het apparaat te schrijven om de installatie van Ventoy te voltooien.",
"STR_VTSI_CREATE_SUCCESS":"VTSI-bestand met succes aangemaakt!#@U kunt Rufus(3.15+) gebruiken om het bestand naar het apparaat te schrijven om de installatie van Ventoy te voltooien.",
"STR_VTSI_CREATE_FAILED":"Aanmaken van VTSI-bestand mislukt.",
"STRXXX":""
},
@@ -913,7 +913,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -964,7 +964,7 @@
"STR_WEB_SERVICE_BUSY":"サービスがビジーです。後で再試行してください。",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1015,7 +1015,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1066,7 +1066,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1117,7 +1117,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1168,7 +1168,7 @@
"STR_WEB_SERVICE_BUSY":"服務正忙,請稍後重試",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1219,7 +1219,7 @@
"STR_WEB_SERVICE_BUSY":"Servis je zauzet, pokušajte ponovo kasnije.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1270,7 +1270,7 @@
"STR_WEB_SERVICE_BUSY":"Севис је заузет, покушајте поново касније.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1321,7 +1321,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1372,7 +1372,7 @@
"STR_WEB_SERVICE_BUSY":"Tjenesten er opptatt, vennligst prøv igjen senere.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1423,7 +1423,7 @@
"STR_WEB_SERVICE_BUSY":"Dịch vụ bận, vui lòng thử lại sau.",
"STR_MENU_VTSI_CREATE":"Tạo tệp VTSI",
"STR_VTSI_CREATE_TIP":"Lần này sẽ không ghi vào thiết bị, chỉ tạo một tệp VTSI#@Bạn muốn tiếp tục?",
"STR_VTSI_CREATE_SUCCESS":"Tạo tệp VTSI thành công!#@Để hoàn thành cài đặt Ventoy, bạn có thể dùng Rufus (3.15 Beta+) để ghi tệp này vào thiết bị.",
"STR_VTSI_CREATE_SUCCESS":"Tạo tệp VTSI thành công!#@Để hoàn thành cài đặt Ventoy, bạn có thể dùng Rufus (3.15+) để ghi tệp này vào thiết bị.",
"STR_VTSI_CREATE_FAILED":"Tạo tệp VTSI đã gặp lỗi.",
"STRXXX":""
},
@@ -1474,7 +1474,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1525,7 +1525,7 @@
"STR_WEB_SERVICE_BUSY":"Сервисот е зафатен, молиме обидете се подоцна.",
"STR_MENU_VTSI_CREATE":"Генерирај VTSI датотека",
"STR_VTSI_CREATE_TIP":"Овој пат ништо нема да се запише на уредот туку само ќе се генерира VTSI датотека#@Продолжи?",
"STR_VTSI_CREATE_SUCCESS":"Успешно креирана VTSI датотека!#@Можете да го користите Rufus(3.15Beta+) за да ја запишете на уредот како и да ја комплетирате инсталацијата на Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"Успешно креирана VTSI датотека!#@Можете да го користите Rufus(3.15+) за да ја запишете на уредот како и да ја комплетирате инсталацијата на Ventoy.",
"STR_VTSI_CREATE_FAILED":"Креирањето на VTSI датотека е неуспешно.",
"STRXXX":""
},
@@ -1576,7 +1576,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1627,7 +1627,7 @@
"STR_WEB_SERVICE_BUSY":"Service is busy, please retry later.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1678,7 +1678,7 @@
"STR_WEB_SERVICE_BUSY":"Layanan sedang sibuk, silakan coba lagi nanti.",
"STR_MENU_VTSI_CREATE":"Membuat berkas VTSI",
"STR_VTSI_CREATE_TIP":"Saat ini tidak akan menuliskan di perangkat, tetapi hanya membuat berkas VTSI #@Lanjutkan?",
"STR_VTSI_CREATE_SUCCESS":"Berkas VTSI berhasil dibuat#@Anda bisa menggunakan Rufus(3.15Beta+) untuk menulisnya ke perangkat untuk menyelesaikan instalasi Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"Berkas VTSI berhasil dibuat#@Anda bisa menggunakan Rufus(3.15+) untuk menulisnya ke perangkat untuk menyelesaikan instalasi Ventoy.",
"STR_VTSI_CREATE_FAILED":"Berkas VTSI gagal dibuat.",
"STRXXX":""
},
@@ -1729,7 +1729,7 @@
"STR_WEB_SERVICE_BUSY":"Служба зайнята, повторіть спробу пізніше.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1780,7 +1780,7 @@
"STR_WEB_SERVICE_BUSY":"Η υπηρεσία είναι απασχολημένη. Παρακαλώ δοκιμάστε αργότερα.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1831,7 +1831,7 @@
"STR_WEB_SERVICE_BUSY":"Tjänster är upptagen. Försök igen senare.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1882,7 +1882,7 @@
"STR_WEB_SERVICE_BUSY":"Storitev je zasedena, prosim poskusite kasneje.",
"STR_MENU_VTSI_CREATE":"Generate VTSI File",
"STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15Beta+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
@@ -1936,5 +1936,56 @@
"STR_VTSI_CREATE_SUCCESS":"VTSI файла бе създаден успешно!#@Може да използвате Rufus(3.15+) да го запишете на устройството за инсталацията с Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI файла създаване се провали.",
"STRXXX":""
},
{
"name":"Armenian (Հայերեն)",
"FontFamily":"Courier New",
"FontSize":16,
"Author":"Egho",
"STR_ERROR":"Սխալ",
"STR_WARNING":"Զգուշացում",
"STR_INFO":"Տեղեկություն",
"STR_INCORRECT_DIR":"Խնդրում ենք գործարկել ճիշտ թղթախանակում!",
"STR_INCORRECT_TREE_DIR":"Չգործարկել այստեղ, խնդրում եմ ներբեռնեք թողարկված տեղադրման փաթեթը և գործարկել այնտեղ:",
"STR_DEVICE":"Կրիչը",
"STR_LOCAL_VER":"Ventoy-ը փաթեթում",
"STR_DISK_VER":"Ventoy-ը կրիչում",
"STR_STATUS":"Կարգավիճակ - ՊԱՏՐԱՍՏ",
"STR_INSTALL":"Տեղադրել",
"STR_UPDATE":"Թարմացնել",
"STR_UPDATE_TIP":"Թարմացման գործողությունը անվտանգ է, ISO ֆայլերը կմնան անփոփոխ.#@Շարունակել?",
"STR_INSTALL_TIP":"Սկավառակը կձևաչափվի և բոլոր տվյալները կկորչեն.#@Շարունակել?",
"STR_INSTALL_TIP2":"Սկավառակը կձևաչափվի և բոլոր տվյալները կկորչեն:#@Դուք համոզված եք, մաքրել կրիչը? (Double Check)",
"STR_INSTALL_SUCCESS":"Շնորհավորում ենք!#@Ventoy- ը հաջողությամբ տեղադրվել է կրիչում:",
"STR_INSTALL_FAILED":"Տեղադրման ընթացքում տեղի ունեցավ սխալ: Կարող եք նորից միացնել USB- կրիչը և կրկին փորձել: Մանրամասների համար ստուգել log.txt-ը ",
"STR_UPDATE_SUCCESS":"Շնորհավորում ենք!#@Ventoy-ը հաջողությամբ թարմացվեց կրիչում:",
"STR_UPDATE_FAILED":"Թարմացման ընթացքում տեղի ունեցավ սխալ: Կարող եք նորից միացնել USB- կրիչը և կրկին փորձել: Մանրամասների համար ստուգել log.txt-ը ",
"STR_WAIT_PROCESS":"Աշխատանքն ընթանում, խնդրում ենք սպասել...",
"STR_MENU_OPTION":"Ընտրանքներ",
"STR_MENU_SECURE_BOOT":"Secure Boot աջակցություն",
"STR_MENU_PART_CFG":"Partition կազմաձևում",
"STR_BTN_OK":"Այո",
"STR_BTN_CANCEL":"Չեղարկել",
"STR_PRESERVE_SPACE":"Պահպանեք որոշակի տարածք կրիչի վերջում",
"STR_SPACE_VAL_INVALID":"Պահված տարածքի անվավեր արժեք",
"STR_MENU_CLEAR":"Մաքրել Ventoy-ը",
"STR_CLEAR_SUCCESS":"Ventoy-ը հաջողությամբ հեռացված է կրիչից:",
"STR_CLEAR_FAILED":"Ventoy-ը կրիչից մաքրելիս տեղի ունեցավ սխալ: Կարող եք նորից միացնել USB-կրիչը և կրկին փորձել: Մանրամասների համար ստուգել log.txt-ը",
"STR_MENU_PART_STYLE":"Partition-ի տեսակը",
"STR_DISK_2TB_MBR_ERROR":"Խնդրում ենք ընտրել GPT 2TB-ից մեծ կրիչի դեպքում",
"STR_SHOW_ALL_DEV":"Ցուցադրել բոլոր կրիչները",
"STR_PART_ALIGN_4KB":"partition-երը գծանշել 4KB-ով",
"STR_WEB_COMMUNICATION_ERR":"Համակցման սխալ․",
"STR_WEB_REMOTE_ABNORMAL":"Համակցման սխալ․ Հեռահար համակցումն չստացվեց",
"STR_WEB_REQUEST_TIMEOUT":"Համակցման սխալ․: Սպասման ժամանակը սպառվեց",
"STR_WEB_SERVICE_UNAVAILABLE":"Համակցման սխալ․: Ծառայությունը անհասանելի է",
"STR_WEB_TOKEN_MISMATCH":"Թարմացվել է Demon-ի կարգավիճակը, խնդրում եմ նորից փորձել ավելի ուշ:",
"STR_WEB_SERVICE_BUSY":"Ծառայությունը զբաղված է, խնդրում եմ նորից փորձել ավելի ուշ:",
"STR_MENU_VTSI_CREATE":"Ստեղծել VTSI ֆայլ",
"STR_VTSI_CREATE_TIP":"Այս անգամ չի գրվի կրիչի վրա, այլ միայն կստեղծվի VTSI ֆայլ#@Շարունակել?",
"STR_VTSI_CREATE_SUCCESS":"VTSI ֆայլը հաջողությամբ ստեղծվեց!#@Դուք կարող եք օգտագործել Rufus (3.15+) կրիչում ձայնագրելու համար, որպեսզի ավարտեք Ventoy-ի տեղադրումը:",
"STR_VTSI_CREATE_FAILED":"VTSI ֆայլի ստեղծումը ձախողվեց։",
"STRXXX":""
}
]

View File

@@ -16,7 +16,7 @@ You can copy many image files at a time and ventoy will give you a boot menu to
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/>
Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
720+ 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. <br/>
730+ 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. <br/>
<br/>Official Website: <a href=https://www.ventoy.net>https://www.ventoy.net</a>
</h4>
@@ -36,7 +36,7 @@ Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
* ISO files larger than 4GB supported
* Native boot menu style for Legacy & UEFI
* Most type of OS supported, 720+ iso files tested
* Most type of OS supported, 730+ iso files tested
* Linux vDisk boot supported
* Not only boot but also complete installation process
* Menu dynamically switchable between List/TreeView mode

View File

@@ -36,6 +36,13 @@ static ventoy_guid g_ventoy_guid = VENTOY_GUID;
static HANDLE g_vtoylog_mutex = NULL;
static HANDLE g_vtoyins_mutex = NULL;
//Unicode "CmdLine"
static BOOL g_PecmdHasCmdLine = FALSE;
static UCHAR g_aucCmdLineHex[] =
{
0x43, 0x00, 0x6D, 0x00, 0x64, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00
};
#define VTOY_PID_FILE "X:\\Windows\\System32\\pidventoy"
#define MUTEX_LOCK(hmutex) if (hmutex != NULL) LockStatus = WaitForSingleObject(hmutex, INFINITE)
#define MUTEX_UNLOCK(hmutex) if (hmutex != NULL && WAIT_OBJECT_0 == LockStatus) ReleaseMutex(hmutex)
@@ -691,12 +698,45 @@ static int VentoyFatDiskRead(uint32 Sector, uint8 *Buffer, uint32 SectorCount)
return 1;
}
static BOOL Is2K10PE(void)
{
BOOL bRet = FALSE;
FILE *fp = NULL;
CHAR szLine[1024];
fopen_s(&fp, "X:\\Windows\\System32\\PECMD.INI", "r");
if (!fp)
{
return FALSE;
}
memset(szLine, 0, sizeof(szLine));
while (fgets(szLine, sizeof(szLine) - 1, fp))
{
if (strstr(szLine, "2k10\\"))
{
bRet = TRUE;
break;
}
}
fclose(fp);
return bRet;
}
static CHAR GetMountLogicalDrive(void)
{
CHAR Letter = 'Y';
DWORD Drives;
DWORD Mask = 0x1000000;
// fixed use M as mountpoint for 2K10 PE
if (Is2K10PE())
{
Log("Use M: for 2K10 PE");
return 'M';
}
Drives = GetLogicalDrives();
Log("Drives=0x%x", Drives);
@@ -763,32 +803,70 @@ UINT64 GetVentoyEfiPartStartSector(HANDLE hDrive)
return StartSector;
}
static int VentoyRunImdisk(const char *IsoPath, const char *imdiskexe)
{
CHAR Letter;
CHAR Cmdline[512];
WCHAR CmdlineW[512];
PROCESS_INFORMATION Pi;
Log("VentoyRunImdisk <%s> <%s>", IsoPath, imdiskexe);
Letter = GetMountLogicalDrive();
sprintf_s(Cmdline, sizeof(Cmdline), "%s -a -o ro -f \"%s\" -m %C:", imdiskexe, IsoPath, Letter);
Log("mount iso to %C: use imdisk cmd <%s>", Letter, Cmdline);
if (IsUTF8Encode(IsoPath))
{
STARTUPINFOW Si;
GetStartupInfoW(&Si);
Si.dwFlags |= STARTF_USESHOWWINDOW;
Si.wShowWindow = SW_HIDE;
Utf8ToUtf16(Cmdline, CmdlineW);
CreateProcessW(NULL, CmdlineW, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
Log("This is UTF8 encoding");
}
else
{
STARTUPINFOA Si;
GetStartupInfoA(&Si);
Si.dwFlags |= STARTF_USESHOWWINDOW;
Si.wShowWindow = SW_HIDE;
CreateProcessA(NULL, Cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
Log("This is ANSI encoding");
}
Log("Wait for imdisk process ...");
WaitForSingleObject(Pi.hProcess, INFINITE);
Log("imdisk process finished");
return 0;
}
int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
{
int rc = 1;
BOOL bRet;
CHAR Letter;
DWORD dwBytes;
HANDLE hDrive;
CHAR PhyPath[MAX_PATH];
WCHAR PhyPathW[MAX_PATH];
STARTUPINFOA Si;
PROCESS_INFORMATION Pi;
GET_LENGTH_INFORMATION LengthInfo;
Log("VentoyMountISOByImdisk %s", IsoPath);
if (IsFileExist("X:\\Windows\\System32\\imdisk.exe"))
{
Log("imdisk.exe exist, use it directly...");
VentoyRunImdisk(IsoPath, "imdisk.exe");
return 0;
}
sprintf_s(PhyPath, sizeof(PhyPath), "\\\\.\\PhysicalDrive%d", PhyDrive);
if (IsUTF8Encode(PhyPath))
{
Utf8ToUtf16(PhyPath, PhyPathW);
hDrive = CreateFileW(PhyPathW, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
}
else
{
hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
}
hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (hDrive == INVALID_HANDLE_VALUE)
{
Log("Could not open the disk<%s>, error:%u", PhyPath, GetLastError());
@@ -829,20 +907,8 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
if (LoadNtDriver(PhyPath) == 0)
{
VentoyRunImdisk(IsoPath, "ventoy\\imdisk.exe");
rc = 0;
Letter = GetMountLogicalDrive();
sprintf_s(PhyPath, sizeof(PhyPath), "ventoy\\imdisk.exe -a -o ro -f %s -m %C:", IsoPath, Letter);
Log("mount iso to %C: use imdisk cmd <%s>", Letter, PhyPath);
GetStartupInfoA(&Si);
Si.dwFlags |= STARTF_USESHOWWINDOW;
Si.wShowWindow = SW_HIDE;
CreateProcessA(NULL, PhyPath, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
WaitForSingleObject(Pi.hProcess, INFINITE);
}
}
fl_shutdown();
@@ -1335,6 +1401,24 @@ static int ventoy_check_create_directory(void)
return 0;
}
static BOOL VentoyFindCmdLineStr(BYTE *buf, DWORD size)
{
DWORD i = 0;
UINT32 uiDataChk;
UINT32 uiDataHex = *(UINT32 *)(g_aucCmdLineHex);
for (i = 0; i < size - sizeof(g_aucCmdLineHex); i += 16)
{
uiDataChk = *(UINT32 *)(buf + i);
if (uiDataChk == uiDataHex && memcmp(buf + i, g_aucCmdLineHex, sizeof(g_aucCmdLineHex)) == 0)
{
return TRUE;
}
}
return FALSE;
}
int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
{
int rc = 1;
@@ -1413,6 +1497,13 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
SaveBuffer2File(LunchFile, Buffer + PeStart, FileSize - PeStart);
MUTEX_UNLOCK(g_vtoyins_mutex);
#ifdef VTOY_REJUMP_SUPPORTED
if (_stricmp(LunchFile, "ventoy\\PECMD.EXE") == 0)
{
g_PecmdHasCmdLine = VentoyFindCmdLineStr(Buffer + PeStart, FileSize - PeStart);
}
#endif
break;
}
}
@@ -1489,6 +1580,7 @@ int main(int argc, char **argv)
int i = 0;
int rc = 0;
int id = 0;
BOOL ReJump = FALSE;
CHAR *Pos = NULL;
CHAR CurDir[MAX_PATH];
CHAR LunchFile[MAX_PATH];
@@ -1497,6 +1589,27 @@ int main(int argc, char **argv)
STARTUPINFOA Si;
PROCESS_INFORMATION Pi;
#ifdef VTOY_REJUMP_SUPPORTED
if (argv[0] && strcmp(argv[0], "ventoy\\WinLogon.exe") == 0)
{
GetStartupInfoA(&Si);
Si.dwFlags |= STARTF_USESHOWWINDOW;
Si.wShowWindow = SW_HIDE;
sprintf_s(LunchFile, sizeof(LunchFile), "PECMD.EXE");
for (i = 1; i < argc; i++)
{
strcat_s(LunchFile, sizeof(LunchFile), " ");
strcat_s(LunchFile, sizeof(LunchFile), argv[i]);
}
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
WaitForSingleObject(Pi.hProcess, INFINITE);
return 0;
}
#endif
g_PecmdHasCmdLine = 0;
g_vtoylog_mutex = CreateMutexA(NULL, FALSE, "VTOYLOG_LOCK");
g_vtoyins_mutex = CreateMutexA(NULL, FALSE, "VTOYINS_LOCK");
@@ -1529,7 +1642,12 @@ int main(int argc, char **argv)
}
}
Log("######## VentoyJump [%d] ##########", id);
#ifdef VTOY_32
Log("######## VentoyJump 32bit [%d] ##########", id);
#else
Log("######## VentoyJump 64bit [%d] ##########", id);
#endif
Log("argc = %d", argc);
for (i = 0; i < argc; i++)
{
@@ -1577,6 +1695,14 @@ int main(int argc, char **argv)
if (id == 2)
{
#ifdef VTOY_REJUMP_SUPPORTED
if (g_PecmdHasCmdLine)
{
ReJump = TRUE;
CopyFileA("PECMD.EXE", "ventoy\\WinLogon.exe", TRUE);
}
#endif
MoveFileA("PECMD.EXE", "PECMD_BACK.EXE");
CopyFileA("ventoy\\PECMD.EXE", "PECMD.EXE", TRUE);
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "PECMD.EXE");
@@ -1611,7 +1737,29 @@ int main(int argc, char **argv)
Log("Now launch <%s> ...", LunchFile);
//sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
if (g_os_param_reserved[0] == 4)
{
Log("Open cmd for debug ...");
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
}
#ifdef VTOY_REJUMP_SUPPORTED
if (ReJump)
{
sprintf_s(CallParam, sizeof(CallParam), "ventoy\\WinLogon.exe%s", LunchFile + strlen("PECMD.EXE"));
Log("Now rejump to pecmd.exe <%s> ...", CallParam);
CreateProcessA(NULL, CallParam, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
Log("Wait rejump process...");
WaitForSingleObject(Pi.hProcess, INFINITE);
Log("rejump finished");
return 0;
}
#else
(void)ReJump;
#endif
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
for (i = 0; rc && i < 1800; i++)