Compare commits

..

24 Commits

Author SHA1 Message Date
longpanda
537f0eaa7e 1.0.47 release 2021-07-17 17:42:06 +08:00
longpanda
c8cf9b7ce2 Speedup md5sum/sha1sum/sha256sum/sha512sum command 2021-07-16 01:36:10 +08:00
longpanda
4c71d7c190 Support WinPE which contains pecmd.exe 2021-07-16 01:03:01 +08:00
longpanda
47f9f2c42c Add support for MocaccinoOS distro 2021-07-15 17:48:03 +08:00
longpanda
fc3a5fae36 Fixed HBCD boot issue. (#992) 2021-07-11 10:14:16 +08:00
longpanda
b3982d4930 Fixed a bug when booting big boot.wim file. 2021-07-11 01:02:00 +08:00
longpanda
c280baae27 Add Ventoy Sparse Image Option 2021-07-10 09:41:52 +08:00
longpanda
425d640480 Fixed a bug for ventoy_openwrt.xz check. 2021-07-10 09:20:54 +08:00
longpanda
07d4140cf4 Optimization for booting openwrt 2021-07-09 17:35:19 +08:00
longpanda
90ae07d227 Update README.md 2021-07-08 16:39:32 +08:00
longpanda
e3e21eb6e6 issue template 2021-07-06 22:52:26 +08:00
longpanda
c8ce2ae85a issue template 2021-07-06 22:51:27 +08:00
longpanda
c02a6955c3 Add check for the built-in browser in WebDeepin.sh 2021-07-06 10:10:59 +08:00
David P
6b78603dd3 fix Parabola rEFInd booting (#989)
newer Parabola rEFInd ISOs need to run vt_linux_get_main_initrd_index to actually work, just like the systemd-boot ISOs
2021-07-06 10:07:21 +08:00
longpanda
07a386c963 Add issue template 2021-07-05 16:49:31 +08:00
longpanda
eb048c0075 Remove the 2TB limit for the reserved space in Ventoy2Disk.exe 2021-07-05 13:40:19 +08:00
longpanda
37ac3f312f Optimization for booting openwrt 2021-06-28 15:15:39 +08:00
longpanda
092cff8429 Support some floppy image in Memdisk mode 2021-06-25 12:34:28 +08:00
longpanda
b347c1b5da Optimization for booting OpenWrt 2021-06-25 11:49:45 +08:00
longpanda
da746c608f Set hidden attribute for VTOYEFI part in GPT partition style 2021-06-21 13:27:41 +08:00
longpanda
81aa56955a optimization for boot openwrt 2021-06-20 21:44:37 +08:00
longpanda
d1679871a6 optimization for booting openwrt 2021-06-20 20:20:17 +08:00
longpanda
f383052013 add debug info 2021-06-20 11:28:19 +08:00
longpanda
667f5bcc1b Fix the Memdisk/WIMBOOT mode/... tip message display error
When VTOY_DEFAULT_IMAGE was set to F6>xxxx, if you press F1 or ctrl+w, the tip message will show ??
2021-06-18 10:41:41 +08:00
37 changed files with 1263 additions and 155 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View File

@@ -0,0 +1,85 @@
name: Issue Report
description: File an issue report
title: "[issue]: "
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this issue report!
- type: checkboxes
id: faq
attributes:
label: Official FAQ
description: Have you checked the official FAQ at [https://www.ventoy.net/en/faq.html](https://www.ventoy.net/en/faq.html) ?
options:
- label: I have checked the official FAQ.
required: true
- type: input
id: version
attributes:
label: Ventoy Version
description: What version of ventoy are you running?
placeholder: 1.0.46
validations:
required: true
- type: dropdown
id: latestrelease
attributes:
label: What about latest release
description: Have you tried with the latest release of Ventoy?
options:
- Yes. I have tried the latest release, but the bug still exist.
- No. I didn't try the latest release.
validations:
required: true
- type: dropdown
id: bios
attributes:
label: BIOS Mode
description: In which BIOS mode did you find the bug?
options:
- Legacy BIOS Mode
- UEFI Mode
- Both
validations:
required: true
- type: dropdown
id: partstyle
attributes:
label: Partition Style
description: Which partition style did you select when you install Ventoy?
options:
- MBR
- GPT
validations:
required: true
- type: input
id: capacity
attributes:
label: Disk Capacity
description: What is the capacity of the disk installed with Ventoy?
placeholder: 32GB
validations:
required: true
- type: dropdown
id: checksum
attributes:
label: Image file checksum (if applicable)
description: Have you checked the image file in Ventoy's menu as [https://www.ventoy.net/en/faq.html#faq_boot_checksum](https://www.ventoy.net/en/faq.html#faq_boot_checksum) ?
options:
- Yes.
- No.
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Tell me what happened. It's highly recommended to include some photo or video about the bug.
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true

View File

@@ -483,6 +483,8 @@ EFI_STATUS EFIAPI ventoy_block_io_read_real
secNum = VirtSec - Lba;
}
debug("XXX block_io_read_real sector:%u count:%u Buffer:%p", (UINT32)Lba, (UINT32)BufferSize / 2048, Buffer);
if (secNum > g_sector_flag_num)
{
cur_flag = AllocatePool(secNum * sizeof(ventoy_sector_flag));

View File

@@ -69,7 +69,7 @@ hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
grub_uint64_t total = 0;
void *context;
grub_uint8_t *readbuf;
#define BUF_SIZE 4096
#define BUF_SIZE 1024 * 1024
readbuf = grub_malloc (BUF_SIZE);
if (!readbuf)
return grub_errno;

View File

@@ -462,6 +462,8 @@ static int lzx_uncompressed ( struct lzx *lzx ) {
if ( len % 2 )
lzx->input.offset++;
lzx->output.offset += len;
return 0;
}
@@ -614,7 +616,7 @@ ssize_t lzx_decompress ( const void *data, size_t len, void *buf ) {
/* Sanity check */
if ( len % 2 ) {
DBG ( "LZX cannot handle odd-length input data\n" );
return -1;
//return -1;
}
/* Initialise global state, if required */

View File

@@ -4204,8 +4204,18 @@ static int ventoy_fs_enum_1st_file(const char *filename, const struct grub_dirho
return 0;
}
static int ventoy_fs_enum_1st_dir(const char *filename, const struct grub_dirhook_info *info, void *data)
{
if (info->dir && filename && filename[0] != '.')
{
grub_snprintf((char *)data, 256, "%s", filename);
return 1;
}
static grub_err_t ventoy_cmd_fs_enum_1st_file(grub_extcmd_context_t ctxt, int argc, char **args)
return 0;
}
static grub_err_t ventoy_fs_enum_1st_child(int argc, char **args, grub_fs_dir_hook_t hook)
{
int rc = 1;
char *device_name = NULL;
@@ -4213,11 +4223,9 @@ static grub_err_t ventoy_cmd_fs_enum_1st_file(grub_extcmd_context_t ctxt, int ar
grub_fs_t fs = NULL;
char name[256] ={0};
(void)ctxt;
if (argc != 3)
{
debug("ventoy_cmd_fs_enum_1st_file, invalid param num %d\n", argc);
debug("ventoy_fs_enum_1st_child, invalid param num %d\n", argc);
return 1;
}
@@ -4242,7 +4250,7 @@ static grub_err_t ventoy_cmd_fs_enum_1st_file(grub_extcmd_context_t ctxt, int ar
goto end;
}
fs->fs_dir(dev, args[1], ventoy_fs_enum_1st_file, name);
fs->fs_dir(dev, args[1], hook, name);
if (name[0])
{
ventoy_set_env(args[2], name);
@@ -4258,6 +4266,18 @@ end:
return rc;
}
static grub_err_t ventoy_cmd_fs_enum_1st_file(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
return ventoy_fs_enum_1st_child(argc, args, ventoy_fs_enum_1st_file);
}
static grub_err_t ventoy_cmd_fs_enum_1st_dir(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
return ventoy_fs_enum_1st_child(argc, args, ventoy_fs_enum_1st_dir);
}
static grub_err_t ventoy_cmd_basename(grub_extcmd_context_t ctxt, int argc, char **args)
{
char c;
@@ -4491,6 +4511,7 @@ static cmd_para ventoy_cmds[] =
{ "vt_check_part_exist", ventoy_cmd_part_exist, 0, NULL, "", "", NULL },
{ "vt_get_fs_label", ventoy_cmd_get_fs_label, 0, NULL, "", "", NULL },
{ "vt_fs_enum_1st_file", ventoy_cmd_fs_enum_1st_file, 0, NULL, "", "", NULL },
{ "vt_fs_enum_1st_dir", ventoy_cmd_fs_enum_1st_dir, 0, NULL, "", "", NULL },
{ "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },
{ "vt_file_basefile", ventoy_cmd_basefile, 0, NULL, "", "", NULL },
{ "vt_enum_video_mode", ventoy_cmd_enum_video_mode, 0, NULL, "", "", NULL },

View File

@@ -548,6 +548,8 @@ static int ventoy_read_resource(grub_file_t fp, wim_header *wimhdr, wim_resource
chunk_num = (head->raw_size + WIM_CHUNK_LEN - 1) / WIM_CHUNK_LEN;
cur_offset = (chunk_num - 1) * 4;
chunk_offset = (grub_uint32_t *)buffer_compress;
//debug("%llu %llu chunk_num=%lu", (ulonglong)head->size_in_wim, (ulonglong)head->raw_size, chunk_num);
cur_dst = buffer_decompress;
@@ -600,9 +602,11 @@ static int ventoy_read_resource(grub_file_t fp, wim_header *wimhdr, wim_resource
decompress_len = (int)lzx_decompress(buffer_compress + cur_offset, head->size_in_wim - cur_offset, cur_dst);
}
}
cur_dst += decompress_len;
total_decompress += decompress_len;
//debug("last chunk_size:%u decompresslen:%d tot:%d\n", last_chunk_size, decompress_len, total_decompress);
if (cur_dst != buffer_decompress + head->raw_size)
{
@@ -656,25 +660,31 @@ static wim_directory_entry * search_full_wim_dirent
static wim_directory_entry * search_replace_wim_dirent(void *meta_data, wim_directory_entry *dir)
{
wim_directory_entry *wim_dirent = NULL;
wim_directory_entry *wim_dirent1 = NULL;
wim_directory_entry *wim_dirent2 = NULL;
const char *pecmd_path[] = { "Windows", "System32", "pecmd.exe", NULL };
const char *wpeinit_path[] = { "Windows", "System32", "wpeinit.exe", NULL };
const char *winpeshl_path[] = { "Windows", "System32", "winpeshl.exe", NULL };
//const char *native_path[] = { "Windows", "System32", "native.exe", NULL };
wim_dirent = search_full_wim_dirent(meta_data, dir, winpeshl_path);
debug("search winpeshl.exe %p\n", wim_dirent);
if (wim_dirent)
wim_dirent1 = search_full_wim_dirent(meta_data, dir, pecmd_path);
debug("search pecmd.exe %p\n", wim_dirent1);
if (wim_dirent1)
{
return wim_dirent;
wim_dirent2 = search_full_wim_dirent(meta_data, dir, wpeinit_path);
debug("search wpeinit.exe %p\n", wim_dirent1);
if (wim_dirent2)
{
return wim_dirent2;
}
return wim_dirent1;
}
#if 0
wim_dirent = search_full_wim_dirent(meta_data, dir, native_path);
debug("search native.exe %p\n", wim_dirent);
if (wim_dirent)
wim_dirent1 = search_full_wim_dirent(meta_data, dir, winpeshl_path);
debug("search winpeshl.exe %p\n", wim_dirent1);
if (wim_dirent1)
{
return wim_dirent;
return wim_dirent1;
}
#endif
return NULL;
}
@@ -882,7 +892,14 @@ static int ventoy_update_before_chain(ventoy_os_param *param, char *isopath)
grub_crypto_hash(GRUB_MD_SHA1, wim_data->bin_hash.sha1, wim_data->jump_bin_data, wim_data->bin_raw_len);
security = (wim_security_header *)wim_data->new_meta_data;
rootdir = (wim_directory_entry *)(wim_data->new_meta_data + ((security->len + 7) & 0xFFFFFFF8U));
if (security->len > 0)
{
rootdir = (wim_directory_entry *)(wim_data->new_meta_data + ((security->len + 7) & 0xFFFFFFF8U));
}
else
{
rootdir = (wim_directory_entry *)(wim_data->new_meta_data + 8);
}
/* update all winpeshl.exe dirent entry's hash */
ventoy_update_all_hash(node, wim_data->new_meta_data, rootdir);
@@ -1167,7 +1184,48 @@ static void ventoy_windows_fill_override_data_iso9660( grub_uint64_t isosize,
return;
}
static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, void *override)
static int ventoy_windows_fill_udf_short_ad(grub_file_t isofile, grub_uint32_t curpos,
wim_tail *wim_data, grub_uint32_t new_wim_size)
{
int i;
grub_uint32_t total = 0;
grub_uint32_t left_size = 0;
ventoy_udf_override *udf = NULL;
ventoy_udf_override tmp[4];
grub_memset(tmp, 0, sizeof(tmp));
grub_file_seek(isofile, wim_data->override_offset);
grub_file_read(isofile, tmp, sizeof(tmp));
left_size = new_wim_size;
udf = (ventoy_udf_override *)wim_data->override_data;
for (i = 0; i < 4; i++)
{
total += tmp[i].length;
if (total >= wim_data->wim_raw_size)
{
udf->length = left_size;
udf->position = curpos;
return 0;
}
else
{
udf->length = tmp[i].length;
udf->position = curpos;
}
left_size -= tmp[i].length;
curpos += udf->length / 2048;
udf++;
wim_data->override_len += sizeof(ventoy_udf_override);
}
debug("######## Too many udf ad ######\n");
return 1;
}
static void ventoy_windows_fill_override_data_udf(grub_file_t isofile, void *override)
{
grub_uint32_t data32;
grub_uint64_t data64;
@@ -1178,9 +1236,8 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
ventoy_override_chunk *cur;
wim_patch *node = NULL;
wim_tail *wim_data = NULL;
ventoy_udf_override *udf = NULL;
sector = (isosize + 2047) / 2048;
sector = (isofile->size + 2047) / 2048;
cur = (ventoy_override_chunk *)override;
@@ -1190,7 +1247,7 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
cur++;
}
debug("ventoy_windows_fill_override_data_udf %lu\n", (ulong)isosize);
debug("ventoy_windows_fill_override_data_udf %lu\n", (ulong)isofile->size);
for (node = g_wim_patch_head; node; node = node->next)
{
@@ -1231,13 +1288,11 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
data64 = new_wim_size;
grub_memcpy(cur->override_data, &(data64), 8);
udf = (ventoy_udf_override *)wim_data->override_data;
udf->length = new_wim_size;
udf->position = (grub_uint32_t)sector - udf_start_block;
/* override 3: position and length in extend data */
ventoy_windows_fill_udf_short_ad(isofile, (grub_uint32_t)sector - udf_start_block, wim_data, new_wim_size);
sector += (new_wim_size / 2048);
/* override 3: position and length in extend data */
cur++;
cur->img_offset = wim_data->override_offset;
cur->override_size = wim_data->override_len;
@@ -1631,7 +1686,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
}
else
{
ventoy_windows_fill_override_data_udf(isosize, (char *)chain + chain->override_chunk_offset);
ventoy_windows_fill_override_data_udf(file, (char *)chain + chain->override_chunk_offset);
}
/* part 5: virt chunk */

View File

@@ -0,0 +1,47 @@
#!/ventoy/busybox/sh
#************************************************************************************
# 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/>.
#
#************************************************************************************
. /ventoy/hook/ventoy-hook-lib.sh
if is_ventoy_hook_finished; then
exit 0
fi
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
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})
vtlog "/dev/$vtDM"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -0,0 +1,20 @@
#!/ventoy/busybox/sh
#************************************************************************************
# 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/>.
#
#************************************************************************************
$SED "/mount_system *$/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/mocaccino-disk.sh" -i /loader

View File

@@ -90,6 +90,9 @@ ventoy_get_debian_distro() {
echo 'kerio'; return
fi
if $GREP -q 'mocaccino' /proc/version; then
echo 'mocaccino'; return
fi
echo 'default'
}

View File

@@ -57,14 +57,14 @@ vterr() {
is_ventoy_hook_finished() {
[ -e $VTOY_PATH/hook_finish ]
[ -e $VTOY_PATH/hook_finish ]
}
set_ventoy_hook_finish() {
echo 'Y' > $VTOY_PATH/hook_finish
echo 'Y' > $VTOY_PATH/hook_finish
}
get_ventoy_disk_name() {
get_ventoy_disk_name() {
line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
if [ $? -eq 0 ]; then
echo ${line%%#*}
@@ -74,7 +74,7 @@ get_ventoy_disk_name() {
}
get_ventoy_iso_name() {
line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
if [ $? -eq 0 ]; then
echo ${line##*#}
else
@@ -83,8 +83,9 @@ get_ventoy_iso_name() {
}
wait_for_usb_disk_ready() {
while [ -n "Y" ]; do
usb_disk=$(get_ventoy_disk_name)
vtloop=0
while [ -n "Y" ]; do
usb_disk=$(get_ventoy_disk_name)
vtlog "wait_for_usb_disk_ready $usb_disk ..."
if echo $usb_disk | $EGREP -q "nvme|mmc|nbd"; then
@@ -95,13 +96,20 @@ wait_for_usb_disk_ready() {
if [ -e "${vtpart2}" ]; then
vtlog "wait_for_usb_disk_ready $usb_disk finish"
break
else
$SLEEP 0.3
fi
done
break
else
let vtloop=vtloop+1
if [ $vtloop -gt 2 ]; then
if [ "$VTLOG" != "$VTOY_PATH/log" ]; then
$VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param -v > $VTLOG
fi
fi
$SLEEP 0.3
fi
done
}
check_usb_disk_ready() {
if echo $1 | $EGREP -q "nvme|mmc|nbd"; then
vtpart2=${1}p2

View File

@@ -27,7 +27,83 @@ vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
check_mkdev_node() {
for i in $(ls /sys/class/block/); do
if ! [ -e /dev/$i ]; then
blkdev_num=$(sed 's/:/ /g' /sys/class/block/$i/dev)
vtlog "mknod -m 0666 /dev/$i b $blkdev_num"
mknod -m 0666 /dev/$i b $blkdev_num
fi
done
}
check_insmod() {
if [ -f "$1" ]; then
vtlog "insmod $1"
insmod "$1" >> $VTOY_PATH/log 2>&1
else
vtlog "$1 not exist"
fi
}
wrt_insmod() {
kbit=$1
kv=$(uname -r)
vtlog "insmod $kv $kbit"
check_insmod /ventoy_openwrt/$kv/$kbit/dax.ko
check_insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko
}
insmod_dm_mod() {
if grep -q "device-mapper" /proc/devices; then
vtlog "device-mapper enabled by system 0"
return
fi
check_insmod /ventoy/modules/dax.ko
check_insmod /ventoy/modules/dm-mod.ko
if grep -q "device-mapper" /proc/devices; then
vtlog "device-mapper enabled by system 1"
return
fi
if [ -f /ventoy_openwrt.xz ]; then
tar xf /ventoy_openwrt.xz -C /
rm -f /ventoy_openwrt.xz
fi
if uname -m | egrep -q "amd64|x86_64"; then
wrt_insmod 64
else
wrt_insmod generic
if lsmod | grep -q 'dm-mod'; then
vterr "insmod generic failed"
else
wrt_insmod legacy
fi
fi
}
insmod_dm_mod
check_mkdev_node
sleep 1
while [ -n "Y" ]; do
vtusb_disk=$(get_ventoy_disk_name)
if check_usb_disk_ready "$vtusb_disk"; then
vtlog "get_ventoy_disk_name $vtusb_disk ready"
break;
else
vtlog "get_ventoy_disk_name $vtusb_disk not ready"
sleep 2
check_mkdev_node
fi
done
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
@@ -44,6 +120,8 @@ echo -n $vtDM > /ventoy/vtDM
ventoy_create_dev_ventoy_part
mdev -s
check_mkdev_node
mkdir /ventoy_rdroot
mount /dev/ventoy2 /ventoy_rdroot

View File

@@ -21,37 +21,8 @@
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wrt_insmod() {
kbit=$1
kv=$(uname -r)
echo "insmod $kv $kbit" >> $VTOY_PATH/log
[ -f /ventoy_openwrt/$kv/$kbit/dax.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dax.ko > /dev/null 2>&1
[ -f /ventoy_openwrt/$kv/$kbit/dm-mod.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko > /dev/null 2>&1
}
mkdir /sys
mount -t sysfs sys /sys
mdev -s
if [ -f /ventoy_openwrt.xz ]; then
tar xf /ventoy_openwrt.xz -C /
rm -f /ventoy_openwrt.xz
fi
if uname -m | egrep -q "amd64|x86_64"; then
wrt_insmod 64
else
wrt_insmod generic
if lsmod | grep -q 'dm-mod'; then
echo "insmod generic failed" >> $VTOY_PATH/log
else
wrt_insmod legacy
fi
fi
sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh

Binary file not shown.

View File

@@ -130,9 +130,7 @@ function get_os_type {
function vt_check_compatible_pe {
#Check for PE without external tools
if [ -f "$1/HBCD_PE.ini" ]; then
set ventoy_compatible=YES
fi
return
}
function locate_initrd {
@@ -638,6 +636,8 @@ function uefi_linux_menu_func {
vt_add_replace_file 0 "EFI\\hyperiso\\hyperiso.img"
fi
elif [ -d (loop)/EFI/BOOT/entries ]; then
vt_linux_get_main_initrd_index vtindex
if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
@@ -1399,7 +1399,7 @@ function vtoyboot_common_func {
ventoy_pause
fi
fi
vt_img_sector "${1}"
vt_raw_chain_data "${1}"
@@ -1626,14 +1626,25 @@ function ventoy_img_openwrt {
set ventoy_busybox_ver=64
fi
if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
ventoy_gui_console
echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
read vtInputKey
ventoy_cli_console
return
vt_fs_enum_1st_dir (vtimghd,2) /lib/modules/ vt_dir_name
if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko ]; then
set openwrt_plugin_need=0
vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko
if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko ]; then
vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko
fi
else
set openwrt_plugin_need=1
if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
ventoy_gui_console
echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
read vtInputKey
ventoy_cli_console
return
fi
fi
if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
@@ -1648,12 +1659,14 @@ function ventoy_img_openwrt {
return
fi
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
if [ $openwrt_plugin_need -eq 1 ]; then
if [ -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
fi
fi
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
@@ -1695,6 +1708,15 @@ function img_unsupport_tip {
read vtInputKey
}
function legacy_img_memdisk {
linux16 $vtoy_path/memdisk
echo "Loading img file to memory ..."
initrd16 "${1}${2}"
ventoy_cli_console
boot
}
function img_common_menuentry {
set ventoy_compatible=YES
set ventoy_busybox_ver=32
@@ -1709,8 +1731,11 @@ function img_common_menuentry {
return
fi
if [ -d (vtimghd)/ ]; then
loopback -d vtimghd
if [ "$grub_platform" = "pc" ]; then
if vt_check_mode 0; then
legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
return
fi
fi
loopback vtimghd "${vtoy_iso_part}${vt_chosen_path}"
@@ -1777,6 +1802,8 @@ function img_common_menuentry {
fi
fi
loopback -d vtimghd
set root=$vtback_root
vt_pop_last_entry
set theme=$vtback_theme
@@ -1796,7 +1823,7 @@ function img_unsupport_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.46"
set VENTOY_VERSION="1.0.47"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1
@@ -1977,6 +2004,12 @@ export vtoy_efi_part
export VENTOY_VERSION
export VTOY_CUR_VIDEO_MODE
export VTOY_EFI_ARCH
export VTOY_MEM_DISK_STR
export VTOY_ISO_RAW_STR
export VTOY_GRUB2_MODE_STR
export VTOY_WIMBOOT_MODE_STR
export VTOY_ISO_UEFI_DRV_STR
#special VTOY_DEFAULT_IMAGE process
if [ -n "$VTOY_DEFAULT_IMAGE" ]; then

View File

@@ -3,6 +3,18 @@
LOGFILE=log.txt
VUSER=$(get_user)
if which browser >/dev/null 2>&1; then
:
else
if [ "$LANG" = "zh_CN.UTF-8" ]; then
echo " Built-in browser not found in the system, please use VentoyWeb.sh ..."
else
echo " 未找到系统内置的 browser (卸载了?)请使用 VentoyWeb.sh ..."
fi
exit 1
fi
if [ -e $LOGFILE ]; then
chown $VUSER $LOGFILE
else

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -146,6 +146,7 @@ chmod +x $tmpdir/VentoyWeb.sh
chmod +x $tmpdir/VentoyWebDeepin.sh
#chmod +x $tmpdir/Ventoy.desktop
chmod +x $tmpdir/CreatePersistentImg.sh
chmod +x $tmpdir/ExtendPersistentImg.sh
tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir

View File

@@ -44,6 +44,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"خطأ في الاتصال: الخدمة غير متوفرة",
"STR_WEB_TOKEN_MISMATCH":"تم تحديث حالة البرنامج الخفي ، يرجى إعادة المحاولة لاحقًا.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -91,6 +95,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"통신 오류: 서비스를 사용할 수 없음",
"STR_WEB_TOKEN_MISMATCH":"데몬 상태가 업데이트되었습니다. 나중에 다시 시도하십시오.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -138,6 +146,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"通信失败:服务不可用",
"STR_WEB_TOKEN_MISMATCH":"后台服务状态更新,请稍后重试",
"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":""
},
{
@@ -185,6 +197,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -232,6 +248,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"خطای ارتباطی: سرویس موجود نیست",
"STR_WEB_TOKEN_MISMATCH":"وضعیت Daemon به روز شد ، لطفاً بعداً دوباره امتحان کنید.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -279,6 +299,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Błąd komunikacji: usługa niedostępna",
"STR_WEB_TOKEN_MISMATCH":"Stan daemona został zaktualizowany, spróbuj ponownie później.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -326,6 +350,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Erro de comunicação: Serviço indisponível",
"STR_WEB_TOKEN_MISMATCH":"Status daemon atualizado, por favor, tente novamente mais tarde.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -373,6 +401,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Iletişim hatası: Uzaktan web erişim hizmeti erişilemez durumda",
"STR_WEB_TOKEN_MISMATCH":"Daemon durumu güncellendi,lütfen daha sonra tekrar deneyiniz.",
"STR_WEB_SERVICE_BUSY":"Hizmet meşgul, lütfen daha sonra tekrar deneyin.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -420,6 +452,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Kommunikationsfehler: Dienst nicht verfügbar",
"STR_WEB_TOKEN_MISMATCH":"Daemon-Status aktualisiert, bitte später erneut versuchen.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -467,6 +503,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Error de comunicacion : servici pas disponible",
"STR_WEB_TOKEN_MISMATCH":"Estat del Daemon actualizat, tornatz ensajar mai tard.",
"STR_WEB_SERVICE_BUSY":"Lo servici es ocupat, tornatz ensajar mai 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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -514,6 +554,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Erreur de communication : service inaccessible",
"STR_WEB_TOKEN_MISMATCH":"Statut du démon mis à jour, veuillez réessayer plus tard.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -561,6 +605,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -608,6 +656,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Error de comunicación: Servicio No Disponible",
"STR_WEB_TOKEN_MISMATCH":" Estado del daemon actualizado, por favor reintenta más tarde.",
"STR_WEB_SERVICE_BUSY":" El servicio está ocupado, por favor reintenta más 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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -655,6 +707,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Ошибка связи: Служба недоступна",
"STR_WEB_TOKEN_MISMATCH":"Статус демона обновлен. Повторите попытку позже.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -702,6 +758,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -749,6 +809,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -796,6 +860,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communicatiefout: service niet beschikbaar",
"STR_WEB_TOKEN_MISMATCH":"Daemon-status bijgewerkt, probeer het later opnieuw.",
"STR_WEB_SERVICE_BUSY":"Service is bezet, probeer het later opnieuw.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -843,6 +911,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -890,6 +962,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"デーモンのステータスが更新されました。しばらくしてから再試行してください。",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -937,6 +1013,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -984,6 +1064,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1031,6 +1115,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1078,6 +1166,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"通信錯誤: 服務不可用",
"STR_WEB_TOKEN_MISMATCH":"服務狀態已更新",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1125,6 +1217,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Greška u komunikaciji: Servis nije dostupan",
"STR_WEB_TOKEN_MISMATCH":"Status demona ažuriran, pokušajte ponovo kasnije.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1172,6 +1268,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Комуникациона грешка: Сервис је недоступан",
"STR_WEB_TOKEN_MISMATCH":"Статус демона ажуриран, покушајте поново касније.",
"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.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,6 +1319,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1266,6 +1370,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Kommunikasjonsfeil: Tjeneste utilgjengelig",
"STR_WEB_TOKEN_MISMATCH":"Daemon status er oppdatert, vennligst prøv igjen senere.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1313,6 +1421,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Lỗi giao tiếp: Dịch vụ không sẵn có",
"STR_WEB_TOKEN_MISMATCH":"Đã cập nhật trạng thái Daemon, vui lòng thử lại sau.",
"STR_WEB_SERVICE_BUSY":"Dịch vụ bận, vui lòng thử lại sau.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1360,6 +1472,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1407,6 +1523,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Комуникациска грешка: Недостапен сервис",
"STR_WEB_TOKEN_MISMATCH":"Ажуриран статус на даемонот, молиме обидете се подоцна.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1454,6 +1574,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1501,6 +1625,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1548,6 +1676,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Communication error: Service Unavailable",
"STR_WEB_TOKEN_MISMATCH":"Daemon status updated, please retry later.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1595,6 +1727,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Помилка зв'язку: Служба недоступна",
"STR_WEB_TOKEN_MISMATCH":"Статус демона оновлено. Повторіть спробу пізніше.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1642,6 +1778,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Σφάλμα επικοινωνίας: υπηρεσία μη διαθέσιμη",
"STR_WEB_TOKEN_MISMATCH":"Η κατάσταση του δαίμονα επικαιροποιήθηκε. Παρακαλώ δοκιμάστε αργότερα.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1689,6 +1829,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Kommunikationsfel: Tjänsten är inte tillgänglig",
"STR_WEB_TOKEN_MISMATCH":"Daemon-status uppdaterad. Försök igen senare.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
},
{
@@ -1736,6 +1880,10 @@
"STR_WEB_SERVICE_UNAVAILABLE":"Napaka v komunikaciji: storitev ni na voljo",
"STR_WEB_TOKEN_MISMATCH":"Zahteva storitve je potekla, prosim poskusite kasneje.",
"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.15+) to write it to the device so as to complete the installation of Ventoy.",
"STR_VTSI_CREATE_FAILED":"VTSI file created failed.",
"STRXXX":""
}
]
]

View File

@@ -412,7 +412,7 @@ int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO
ventoy_gen_preudo_uuid(&(Table[1].PartGuid));
Table[1].StartLBA = Table[0].LastLBA + 1;
Table[1].LastLBA = Table[1].StartLBA + VTOYEFI_PART_BYTES / 512 - 1;
Table[1].Attr = 0x8000000000000001ULL;
Table[1].Attr = 0xC000000000000001ULL;
ventoy_fill_gpt_partname(Table[1].Name, "VTOYEFI");
#if 0

View File

@@ -16,7 +16,8 @@ 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/>
700+ ISO files are tested. 90%+ distros in distrowatch.com supported. <br/>
700+ 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>
# Features

View File

@@ -72,6 +72,11 @@ typedef enum STR_ID
STR_WEB_TOKEN_MISMATCH, //37
STR_WEB_SERVICE_BUSY, //38
STR_MENU_VTSI_CREATE, //39
STR_VTSI_CREATE_TIP, //40
STR_VTSI_CREATE_SUCCESS, //41
STR_VTSI_CREATE_FAILED, //42
STR_ID_MAX
}STR_ID;
@@ -83,7 +88,8 @@ extern BOOL g_SecureBoot;
#define VTOY_MENU_PART_STYLE 0xA003
#define VTOY_MENU_PART_MBR 0xA004
#define VTOY_MENU_PART_GPT 0xA005
#define VTOY_MENU_ALL_DEV 0xA006
#define VTOY_MENU_ALL_DEV 0xA006
#define VTOY_MENU_VTSI 0xA007
typedef enum OPT_SUBMENU
@@ -93,6 +99,7 @@ typedef enum OPT_SUBMENU
OPT_SUBMENU_PART_CFG,
OPT_SUBMENU_CLEAR,
OPT_SUBMENU_ALL_DEV,
OPT_SUBMENU_VTSI,
OPT_SUBMENU_MAX
}OPT_SUBMENU;

Binary file not shown.

View File

@@ -1268,7 +1268,6 @@ static int FormatPart1exFAT(UINT64 DiskSizeBytes)
{
MKFS_PARM Option;
FRESULT Ret;
FATFS fs;
Option.fmt = FM_EXFAT;
Option.n_fat = 1;
@@ -1289,28 +1288,10 @@ static int FormatPart1exFAT(UINT64 DiskSizeBytes)
Log("Formatting Part1 exFAT ...");
Ret = f_mkfs(TEXT("0:"), &Option, 0, 8 * 1024 * 1024);
if (FR_OK == Ret)
{
Log("Formatting Part1 exFAT success");
Ret = f_mount(&fs, TEXT("0:"), 1);
Log("mount part %d", Ret);
if (FR_OK == Ret)
{
Ret = f_setlabel(TEXT("Ventoy"));
Log("f_setlabel %d", Ret);
Ret = f_mount(0, TEXT("0:"), 1);
Log("umount part %d", Ret);
return 0;
}
else
{
Log("mount exfat failed %d", Ret);
return 1;
}
return 0;
}
else
{
@@ -1556,6 +1537,225 @@ End:
return rc;
}
int InstallVentoy2FileImage(PHY_DRIVE_INFO *pPhyDrive, int PartStyle)
{
int i;
int rc = 1;
int Len = 0;
int dataLen = 0;
UINT size = 0;
UINT segnum = 0;
UINT32 chksum = 0;
UINT64 data_offset = 0;
UINT64 Part2StartSector = 0;
UINT64 Part1StartSector = 0;
UINT64 Part1SectorCount = 0;
UINT8 *pData = NULL;
UINT8 *pBkGptPartTbl = NULL;
BYTE *ImgBuf = NULL;
MBR_HEAD *pMBR = NULL;
VTSI_FOOTER *pImgFooter = NULL;
VTSI_SEGMENT *pSegment = NULL;
VTOY_GPT_INFO *pGptInfo = NULL;
VTOY_GPT_HDR *pBkGptHdr = NULL;
FILE *fp = NULL;
Log("InstallVentoy2FileImage %s PhyDrive%d <<%s %s %dGB>>",
PartStyle ? "GPT" : "MBR", pPhyDrive->PhyDrive, pPhyDrive->VendorId, pPhyDrive->ProductId,
GetHumanReadableGBSize(pPhyDrive->SizeInBytes));
PROGRESS_BAR_SET_POS(PT_LOCK_FOR_CLEAN);
size = SIZE_1MB + VENTOY_EFI_PART_SIZE + 33 * 512 + VTSI_IMG_MAX_SEG * sizeof(VTSI_SEGMENT) + sizeof(VTSI_FOOTER);
pData = (UINT8 *)malloc(size);
if (!pData)
{
Log("malloc image buffer failed %d.", size);
goto End;
}
pImgFooter = (VTSI_FOOTER *)(pData + size - sizeof(VTSI_FOOTER));
pSegment = (VTSI_SEGMENT *)((UINT8 *)pImgFooter - VTSI_IMG_MAX_SEG * sizeof(VTSI_SEGMENT));
memset(pImgFooter, 0, sizeof(VTSI_FOOTER));
memset(pSegment, 0, VTSI_IMG_MAX_SEG * sizeof(VTSI_SEGMENT));
PROGRESS_BAR_SET_POS(PT_WRITE_VENTOY_START);
Log("Writing Boot Image ............................. ");
if (ReadWholeFileToBuf(VENTOY_FILE_STG1_IMG, 0, (void **)&ImgBuf, &Len))
{
Log("Failed to read stage1 img");
goto End;
}
unxz(ImgBuf, Len, NULL, NULL, pData, &dataLen, unxz_error);
SAFE_FREE(ImgBuf);
if (PartStyle)
{
pGptInfo = (VTOY_GPT_INFO *)pData;
memset(pGptInfo, 0, sizeof(VTOY_GPT_INFO));
VentoyFillGpt(pPhyDrive->SizeInBytes, pGptInfo);
pBkGptPartTbl = pData + SIZE_1MB + VENTOY_EFI_PART_SIZE;
memset(pBkGptPartTbl, 0, 33 * 512);
memcpy(pBkGptPartTbl, pGptInfo->PartTbl, 32 * 512);
pBkGptHdr = (VTOY_GPT_HDR *)(pBkGptPartTbl + 32 * 512);
VentoyFillBackupGptHead(pGptInfo, pBkGptHdr);
Part1StartSector = pGptInfo->PartTbl[0].StartLBA;
Part1SectorCount = pGptInfo->PartTbl[0].LastLBA - Part1StartSector + 1;
Part2StartSector = pGptInfo->PartTbl[1].StartLBA;
Log("Write GPT Info OK ...");
}
else
{
pMBR = (MBR_HEAD *)pData;
VentoyFillMBR(pPhyDrive->SizeInBytes, pMBR, PartStyle);
Part1StartSector = pMBR->PartTbl[0].StartSectorId;
Part1SectorCount = pMBR->PartTbl[0].SectorCount;
Part2StartSector = pMBR->PartTbl[1].StartSectorId;
Log("Write MBR OK ...");
}
Log("Writing EFI part Image ............................. ");
rc = ReadWholeFileToBuf(VENTOY_FILE_DISK_IMG, 0, (void **)&ImgBuf, &Len);
if (rc)
{
Log("Failed to read img file %p %u", ImgBuf, Len);
goto End;
}
PROGRESS_BAR_SET_POS(PT_WRITE_VENTOY_START + 28);
memset(g_part_img_buf, 0, sizeof(g_part_img_buf));
unxz(ImgBuf, Len, NULL, NULL, pData + SIZE_1MB, &dataLen, unxz_error);
if (dataLen == Len)
{
Log("decompress finished success");
g_part_img_buf[0] = pData + SIZE_1MB;
VentoyProcSecureBoot(g_SecureBoot);
}
else
{
Log("decompress finished failed");
goto End;
}
fopen_s(&fp, "VentoySparseImg.vtsi", "wb+");
if (!fp)
{
Log("Failed to create Ventoy img file");
goto End;
}
Log("Writing stage1 data ............................. ");
fwrite(pData, 1, SIZE_1MB, fp);
pSegment[0].disk_start_sector = 0;
pSegment[0].sector_num = SIZE_1MB / 512;
pSegment[0].data_offset = data_offset;
data_offset += pSegment[0].sector_num * 512;
disk_io_set_param(INVALID_HANDLE_VALUE, Part1StartSector + Part1SectorCount);// include the 2048 sector gap
disk_io_set_imghook(fp, pSegment + 1, VTSI_IMG_MAX_SEG - 1, data_offset);
Log("Formatting part1 exFAT ...");
if (0 != FormatPart1exFAT(pPhyDrive->SizeInBytes))
{
Log("FormatPart1exFAT failed.");
disk_io_reset_imghook(&segnum, &data_offset);
goto End;
}
disk_io_reset_imghook(&segnum, &data_offset);
segnum++;
Log("current segment number:%d dataoff:%ld", segnum, (long)data_offset);
//write data
Log("Writing part2 data ............................. ");
fwrite(pData + SIZE_1MB, 1, VENTOY_EFI_PART_SIZE, fp);
pSegment[segnum].disk_start_sector = Part2StartSector;
pSegment[segnum].sector_num = VENTOY_EFI_PART_SIZE / 512;
pSegment[segnum].data_offset = data_offset;
data_offset += pSegment[segnum].sector_num * 512;
segnum++;
if (PartStyle)
{
Log("Writing backup gpt table ............................. ");
fwrite(pBkGptPartTbl, 1, 33 * 512, fp);
pSegment[segnum].disk_start_sector = pPhyDrive->SizeInBytes / 512 - 33;
pSegment[segnum].sector_num = 33;
pSegment[segnum].data_offset = data_offset;
data_offset += pSegment[segnum].sector_num * 512;
segnum++;
}
Log("Writing segment metadata ............................. ");
for (i = 0; i < (int)segnum; i++)
{
Log("SEG[%d]: PhySector:%llu SectorNum:%llu DataOffset:%llu(sector:%llu)", i, pSegment[i].disk_start_sector, pSegment[i].sector_num,
pSegment[i].data_offset, pSegment[i].data_offset / 512);
}
dataLen = segnum * sizeof(VTSI_SEGMENT);
fwrite(pSegment, 1, dataLen, fp);
if (dataLen % 512)
{
//pData + SIZE_1MB - 8192 is a temp data buffer with zero
fwrite(pData + SIZE_1MB - 8192, 1, 512 - (dataLen % 512), fp);
}
//Fill footer
pImgFooter->magic = VTSI_IMG_MAGIC;
pImgFooter->version = 1;
pImgFooter->disk_size = pPhyDrive->SizeInBytes;
memcpy(&pImgFooter->disk_signature, pPhyDrive->MBR.BootCode + 0x1b8, 4);
pImgFooter->segment_num = segnum;
pImgFooter->segment_offset = data_offset;
for (i = 0, chksum = 0; i < (int)(segnum * sizeof(VTSI_SEGMENT)); i++)
{
chksum += *((UINT8 *)pSegment + i);
}
pImgFooter->segment_chksum = ~chksum;
for (i = 0, chksum = 0; i < sizeof(VTSI_FOOTER); i++)
{
chksum += *((UINT8 *)pImgFooter + i);
}
pImgFooter->foot_chksum = ~chksum;
Log("Writing footer segnum(%u) segoffset(%llu) ......................", segnum, data_offset);
Log("disk_size=%llu disk_signature=%lx segment_offset=%llu", pImgFooter->disk_size, pImgFooter->disk_signature, pImgFooter->segment_offset);
fwrite(pImgFooter, 1, sizeof(VTSI_FOOTER), fp);
fclose(fp);
Log("Writing Ventoy image file finished, the file size should be %llu .", data_offset + 512 + ((dataLen + 511) / 512 * 512));
rc = 0;
End:
PROGRESS_BAR_SET_POS(PT_MOUNT_VOLUME);
Log("retcode:%d\n", rc);
SAFE_FREE(pData);
SAFE_FREE(ImgBuf);
return rc;
}
int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle)
{
int i;
@@ -1573,7 +1773,6 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle)
UINT64 Part1SectorCount = 0;
UINT64 Part2StartSector = 0;
Log("InstallVentoy2PhyDrive %s PhyDrive%d <<%s %s %dGB>>",
PartStyle ? "GPT" : "MBR", pPhyDrive->PhyDrive, pPhyDrive->VendorId, pPhyDrive->ProductId,
GetHumanReadableGBSize(pPhyDrive->SizeInBytes));
@@ -1680,8 +1879,6 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle)
goto End;
}
PROGRESS_BAR_SET_POS(PT_FORMAT_PART2);
Log("Writing part2 FAT img ...");

View File

@@ -659,7 +659,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
CoCreateGuid(&(Table[1].PartGuid));
Table[1].StartLBA = Table[0].LastLBA + 1;
Table[1].LastLBA = Table[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
Table[1].Attr = 0x8000000000000001ULL;
Table[1].Attr = 0xC000000000000001ULL;
memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
#if 0

View File

@@ -28,6 +28,7 @@ DWORD g_PhyDriveCount = 0;
static int g_FilterRemovable = 0;
int g_FilterUSB = 1;
int g_ForceOperation = 1;
int g_WriteImage = 0;
int ParseCmdLineOption(LPSTR lpCmdLine)
{

View File

@@ -233,4 +233,65 @@ UINT32 VentoyCrc32(void *Buffer, UINT32 Length);
#define SECURE_ICON_STRING _UICON(UNICODE_LOCK)
extern int g_WriteImage;
#define VTSI_IMG_MAGIC 0x0000594F544E4556ULL // "VENTOY\0\0"
#pragma pack(1)
/*
+---------------------------------
+ sector 0 ~ sector N-1
+ data area
+---------------------------------
+ sector N ~
+ segment[0]
+ segment[1]
+ segment[2]
+ ......
+ segment[M-1]
+ align data (aligned with 512)
+---------------------------------
+ footer
+---------------------------------
*
* All the integers are in little endian
* The sector size is fixed 512 for ventoy image file.
*
*/
#define VTSI_IMG_MAX_SEG 128
typedef struct {
UINT64 disk_start_sector;
UINT64 sector_num;
UINT64 data_offset;
}VTSI_SEGMENT;
typedef struct {
UINT64 magic;
UINT32 version;
UINT64 disk_size;
UINT32 disk_signature;
UINT32 foot_chksum;
UINT32 segment_num;
UINT32 segment_chksum;
UINT64 segment_offset;
UINT8 reserved[512 - 44];
}VTSI_FOOTER;
#pragma pack()
extern int __static_assert__[sizeof(VTSI_FOOTER) == 512 ? 1 : -1];
#define SAFE_FREE(ptr) if (ptr) { free(ptr); (ptr) = NULL; }
int InstallVentoy2FileImage(PHY_DRIVE_INFO *pPhyDrive, int PartStyle);
void disk_io_set_imghook(FILE *fp, VTSI_SEGMENT *segment, int maxseg, UINT64 data_offset);
void disk_io_reset_imghook(int *psegnum, UINT64 *pDataOffset);
#define VTSI_SUPPORT 0
#endif

Binary file not shown.

View File

@@ -11,6 +11,8 @@
#include "ff.h" /* Obtains integer types */
#include "diskio.h" /* Declarations of disk functions */
#include "../Ventoy2Disk.h"
/* Definitions of physical drive number for each drive */
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
@@ -23,12 +25,41 @@ static UINT8 g_MbrSector[512];
HANDLE g_hPhyDrive;
UINT64 g_SectorCount;
FILE *g_VentoyImgFp = NULL;
VTSI_SEGMENT *g_VentoySegment = NULL;
int g_VentoyMaxSeg = 0;
int g_VentoyCurSeg = -1;
UINT64 g_VentoyDataOffset = 0;
void disk_io_set_param(HANDLE Handle, UINT64 SectorCount)
{
g_hPhyDrive = Handle;
g_SectorCount = SectorCount;
}
void disk_io_set_imghook(FILE *fp, VTSI_SEGMENT *segment, int maxseg, UINT64 data_offset)
{
g_VentoyImgFp = fp;
g_VentoySegment = segment;
g_VentoyMaxSeg = maxseg;
memset(segment, 0, maxseg * sizeof(VTSI_SEGMENT));
g_VentoyCurSeg = -1;
g_VentoyDataOffset = data_offset;
}
void disk_io_reset_imghook(int *psegnum, UINT64 *pDataOffset)
{
*psegnum = g_VentoyCurSeg + 1;
*pDataOffset = g_VentoyDataOffset;
g_VentoyImgFp = NULL;
g_VentoySegment = NULL;
g_VentoyMaxSeg = 0;
g_VentoyCurSeg = -1;
g_VentoyDataOffset = 0;
}
/*-----------------------------------------------------------------------*/
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
@@ -126,6 +157,13 @@ DRESULT disk_read (
BOOL bRet;
LARGE_INTEGER liCurrentPosition;
//Log("xxx disk_read: sector:%ld count:%ld", (long)sector, (long)count);
if (g_VentoyImgFp)
{
return RES_OK;
}
liCurrentPosition.QuadPart = sector * 512;
SetFilePointerEx(g_hPhyDrive, liCurrentPosition, &liCurrentPosition, FILE_BEGIN);
@@ -162,6 +200,9 @@ DRESULT disk_write (
DWORD dwSize;
BOOL bRet;
LARGE_INTEGER liCurrentPosition;
VTSI_SEGMENT *CurSeg = NULL;
Log("==== disk_write: sector:%ld count:%ld", (long)sector, (long)count);
// skip MBR
if (sector == 0)
@@ -177,6 +218,31 @@ DRESULT disk_write (
count--;
}
if (g_VentoyImgFp)
{
CurSeg = g_VentoySegment + g_VentoyCurSeg;
if (g_VentoyCurSeg >= 0 && CurSeg->sector_num > 0 && sector == CurSeg->disk_start_sector + CurSeg->sector_num)
{
CurSeg->sector_num += count; //merge
}
else
{
g_VentoyCurSeg++;
CurSeg++;
CurSeg->disk_start_sector = sector;
CurSeg->data_offset = g_VentoyDataOffset;
CurSeg->sector_num = count;
}
g_VentoyDataOffset += count * 512;
fwrite(buff, 1, count * 512, g_VentoyImgFp);
return RES_OK;
}
liCurrentPosition.QuadPart = sector * 512;
SetFilePointerEx(g_hPhyDrive, liCurrentPosition, &liCurrentPosition, FILE_BEGIN);

View File

@@ -6067,6 +6067,11 @@ FRESULT f_mkfs (
/* Initialize the root directory */
mem_set(buf, 0, sz_buf * ss);
buf[SZDIRE * 0 + 0] = ET_VLABEL; /* Volume label entry (no label) */
//default label: Ventoy (unicode)
buf[1] = 6; //label length
memcpy(buf + 2, L"Ventoy", 2 * buf[1]);
buf[SZDIRE * 1 + 0] = ET_BITMAP; /* Bitmap entry */
st_dword(buf + SZDIRE * 1 + 20, 2); /* cluster */
st_dword(buf + SZDIRE * 1 + 24, szb_bit); /* size */

View File

@@ -244,7 +244,7 @@ int DumpGptInfo(VTOY_GPT_INFO *pGptInfo)
return 0;
}
#define VENTOY_EFI_PART_ATTR 0x8000000000000001ULL
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
int main(int argc, const char **argv)
{

View File

@@ -309,11 +309,44 @@ static int Utf8ToUtf16(const char* src, WCHAR * dst)
return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, size + 1);
}
static BOOL IsPathExist(BOOL Dir, const char *Fmt, ...)
static BOOL IsDirExist(const char *Fmt, ...)
{
va_list Arg;
DWORD Attr;
int UTF8 = 0;
CHAR FilePathA[MAX_PATH];
WCHAR FilePathW[MAX_PATH];
va_start(Arg, Fmt);
vsnprintf_s(FilePathA, sizeof(FilePathA), sizeof(FilePathA), Fmt, Arg);
va_end(Arg);
UTF8 = IsUTF8Encode(FilePathA);
if (UTF8)
{
Utf8ToUtf16(FilePathA, FilePathW);
Attr = GetFileAttributesW(FilePathW);
}
else
{
Attr = GetFileAttributesA(FilePathA);
}
if (Attr != INVALID_FILE_ATTRIBUTES && (Attr & FILE_ATTRIBUTE_DIRECTORY))
{
return TRUE;
}
return FALSE;
}
static BOOL IsFileExist(const char *Fmt, ...)
{
va_list Arg;
HANDLE hFile;
DWORD Attr;
BOOL bRet = FALSE;
int UTF8 = 0;
CHAR FilePathA[MAX_PATH];
WCHAR FilePathW[MAX_PATH];
@@ -335,7 +368,7 @@ static BOOL IsPathExist(BOOL Dir, const char *Fmt, ...)
}
if (INVALID_HANDLE_VALUE == hFile)
{
return FALSE;
goto out;
}
CloseHandle(hFile);
@@ -349,22 +382,16 @@ static BOOL IsPathExist(BOOL Dir, const char *Fmt, ...)
Attr = GetFileAttributesA(FilePathA);
}
if (Dir)
{
if ((Attr & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
return FALSE;
}
}
else
{
if (Attr & FILE_ATTRIBUTE_DIRECTORY)
{
return FALSE;
}
}
if (Attr & FILE_ATTRIBUTE_DIRECTORY)
{
goto out;
}
return TRUE;
bRet = TRUE;
out:
Log("File <%s> %s", FilePathA, (bRet ? "exist" : "NOT exist"));
return bRet;
}
static int GetPhyDiskUUID(const char LogicalDrive, UINT8 *UUID, DISK_EXTENT *DiskExtent)
@@ -425,6 +452,121 @@ static int GetPhyDiskUUID(const char LogicalDrive, UINT8 *UUID, DISK_EXTENT *Dis
return 0;
}
static int VentoyMountAnywhere(HANDLE Handle)
{
DWORD Status;
ATTACH_VIRTUAL_DISK_PARAMETERS AttachParameters;
Log("VentoyMountAnywhere");
memset(&AttachParameters, 0, sizeof(AttachParameters));
AttachParameters.Version = ATTACH_VIRTUAL_DISK_VERSION_1;
Status = AttachVirtualDisk(Handle, NULL, ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY | ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, 0, &AttachParameters, NULL);
if (Status != ERROR_SUCCESS)
{
Log("Failed to attach virtual disk ErrorCode:%u", Status);
return 1;
}
return 0;
}
int VentoyMountY(HANDLE Handle)
{
int i;
BOOL bRet = FALSE;
DWORD Status;
DWORD physicalDriveNameSize;
CHAR *Pos = NULL;
WCHAR physicalDriveName[MAX_PATH];
CHAR physicalDriveNameA[MAX_PATH];
CHAR cdromDriveName[MAX_PATH];
ATTACH_VIRTUAL_DISK_PARAMETERS AttachParameters;
Log("VentoyMountY");
memset(&AttachParameters, 0, sizeof(AttachParameters));
AttachParameters.Version = ATTACH_VIRTUAL_DISK_VERSION_1;
Status = AttachVirtualDisk(Handle, NULL, ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY | ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER | ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, 0, &AttachParameters, NULL);
if (Status != ERROR_SUCCESS)
{
Log("Failed to attach virtual disk ErrorCode:%u", Status);
return 1;
}
memset(physicalDriveName, 0, sizeof(physicalDriveName));
memset(physicalDriveNameA, 0, sizeof(physicalDriveNameA));
physicalDriveNameSize = MAX_PATH;
Status = GetVirtualDiskPhysicalPath(Handle, &physicalDriveNameSize, physicalDriveName);
if (Status != ERROR_SUCCESS)
{
Log("Failed GetVirtualDiskPhysicalPath ErrorCode:%u", Status);
return 1;
}
for (i = 0; physicalDriveName[i]; i++)
{
physicalDriveNameA[i] = toupper((CHAR)(physicalDriveName[i]));
}
Log("physicalDriveNameA=<%s>", physicalDriveNameA);
Pos = strstr(physicalDriveNameA, "CDROM");
if (!Pos)
{
Log("Not cdrom phy drive");
return 1;
}
sprintf_s(cdromDriveName, sizeof(cdromDriveName), "\\Device\\%s", Pos);
Log("cdromDriveName=<%s>", cdromDriveName);
for (i = 0; i < 3 && (bRet == FALSE); i++)
{
Sleep(1000);
bRet = DefineDosDeviceA(DDD_RAW_TARGET_PATH, "Y:", cdromDriveName);
Log("DefineDosDeviceA %s", bRet ? "success" : "failed");
}
return bRet ? 0 : 1;
}
static BOOL VentoyNeedMountY(const char *IsoPath)
{
/* TBD */
return FALSE;
}
static int VentoyAttachVirtualDisk(HANDLE Handle, const char *IsoPath)
{
int DriveYFree;
DWORD Drives;
Drives = GetLogicalDrives();
if ((1 << 24) & Drives)
{
Log("Y: is occupied");
DriveYFree = 0;
}
else
{
Log("Y: is free now");
DriveYFree = 1;
}
if (DriveYFree && VentoyNeedMountY(IsoPath))
{
return VentoyMountY(Handle);
}
else
{
return VentoyMountAnywhere(Handle);
}
}
int VentoyMountISOByAPI(const char *IsoPath)
{
HANDLE Handle;
@@ -432,7 +574,6 @@ int VentoyMountISOByAPI(const char *IsoPath)
WCHAR wFilePath[512] = { 0 };
VIRTUAL_STORAGE_TYPE StorageType;
OPEN_VIRTUAL_DISK_PARAMETERS OpenParameters;
ATTACH_VIRTUAL_DISK_PARAMETERS AttachParameters;
Log("VentoyMountISOByAPI <%s>", IsoPath);
@@ -447,10 +588,8 @@ int VentoyMountISOByAPI(const char *IsoPath)
memset(&StorageType, 0, sizeof(StorageType));
memset(&OpenParameters, 0, sizeof(OpenParameters));
memset(&AttachParameters, 0, sizeof(AttachParameters));
OpenParameters.Version = OPEN_VIRTUAL_DISK_VERSION_1;
AttachParameters.Version = ATTACH_VIRTUAL_DISK_VERSION_1;
Status = OpenVirtualDisk(&StorageType, wFilePath, VIRTUAL_DISK_ACCESS_READ, 0, &OpenParameters, &Handle);
if (Status != ERROR_SUCCESS)
@@ -468,7 +607,7 @@ int VentoyMountISOByAPI(const char *IsoPath)
Log("OpenVirtualDisk success");
Status = AttachVirtualDisk(Handle, NULL, ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY | ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, 0, &AttachParameters, NULL);
Status = VentoyAttachVirtualDisk(Handle, IsoPath);
if (Status != ERROR_SUCCESS)
{
Log("Failed to attach virtual disk ErrorCode:%u", Status);
@@ -476,6 +615,8 @@ int VentoyMountISOByAPI(const char *IsoPath)
return 1;
}
Log("VentoyAttachVirtualDisk success");
CloseHandle(Handle);
return 0;
}
@@ -789,7 +930,7 @@ static int DeleteVentoyPart2MountPoint(DWORD PhyDrive)
Drives = GetLogicalDrives();
while (Drives)
{
if ((Drives & 0x01) && IsPathExist(FALSE, "%C:\\ventoy\\ventoy.cpio", Letter))
if ((Drives & 0x01) && IsFileExist("%C:\\ventoy\\ventoy.cpio", Letter))
{
Log("File %C:\\ventoy\\ventoy.cpio exist", Letter);
@@ -1010,7 +1151,7 @@ static int VentoyHook(ventoy_os_param *param)
if (Drives & 0x01)
{
sprintf_s(IsoPath, sizeof(IsoPath), "%C:\\%s", Letter, param->vtoy_img_path);
if (IsPathExist(FALSE, "%s", IsoPath))
if (IsFileExist("%s", IsoPath))
{
Log("File exist under %C:", Letter);
if (GetPhyDiskUUID(Letter, UUID, &DiskExtent) == 0)
@@ -1050,7 +1191,7 @@ static int VentoyHook(ventoy_os_param *param)
if (g_windows_data.auto_install_script[0])
{
sprintf_s(IsoPath, sizeof(IsoPath), "%C:%s", Letter, g_windows_data.auto_install_script);
if (IsPathExist(FALSE, "%s", IsoPath))
if (IsFileExist("%s", IsoPath))
{
Log("use auto install script %s...", IsoPath);
ProcessUnattendedInstallation(IsoPath);
@@ -1068,7 +1209,7 @@ static int VentoyHook(ventoy_os_param *param)
if (g_windows_data.injection_archive[0])
{
sprintf_s(IsoPath, sizeof(IsoPath), "%C:%s", Letter, g_windows_data.injection_archive);
if (IsPathExist(FALSE, "%s", IsoPath))
if (IsFileExist("%s", IsoPath))
{
Log("decompress injection archive %s...", IsoPath);
DecompressInjectionArchive(IsoPath, DiskExtent.DiskNumber);
@@ -1173,12 +1314,12 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
CHAR ExeFileName[MAX_PATH];
sprintf_s(ExeFileName, sizeof(ExeFileName), "%s", argv[0]);
if (!IsPathExist(FALSE, "%s", ExeFileName))
if (!IsFileExist("%s", ExeFileName))
{
Log("File %s NOT exist, now try %s.exe", ExeFileName, ExeFileName);
sprintf_s(ExeFileName, sizeof(ExeFileName), "%s.exe", argv[0]);
Log("File %s exist ? %s", ExeFileName, IsPathExist(FALSE, "%s", ExeFileName) ? "YES" : "NO");
Log("File %s exist ? %s", ExeFileName, IsFileExist("%s", ExeFileName) ? "YES" : "NO");
}
if (ReadWholeFile2Buf(ExeFileName, (void **)&Buffer, &FileSize))
@@ -1189,8 +1330,13 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
g_64bit_system = IsPe64(Buffer);
Log("VentoyJump %dbit", g_64bit_system ? 64 : 32);
if (!IsPathExist(TRUE, "ventoy"))
if (IsDirExist("ventoy"))
{
Log("ventoy directory already exist");
}
else
{
Log("ventoy directory not exist, now create it.");
if (!CreateDirectoryA("ventoy", NULL))
{
Log("Failed to create ventoy directory err:%u", GetLastError());
@@ -1226,6 +1372,14 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
PeStart += sizeof(ventoy_os_param) + sizeof(ventoy_windows_data);
sprintf_s(LunchFile, MAX_PATH, "ventoy\\%s", GetFileNameInPath(ExeFileName));
if (IsFileExist("%s", LunchFile))
{
Log("vtoyjump multiple call...");
rc = 0;
goto End;
}
SaveBuffer2File(LunchFile, Buffer + PeStart, FileSize - PeStart);
break;
}
@@ -1256,6 +1410,120 @@ End:
return rc;
}
static int GetPecmdParam(const char *argv, char *CallParamBuf, DWORD BufLen)
{
HKEY hKey;
LSTATUS Ret;
DWORD dw;
DWORD Type;
CHAR *Pos = NULL;
CHAR CallParam[256] = { 0 };
CHAR FileName[MAX_PATH];
Log("GetPecmdParam <%s>", argv);
*CallParamBuf = 0;
strcpy_s(FileName, sizeof(FileName), argv);
for (dw = 0, Pos = FileName; *Pos; Pos++)
{
dw++;
*Pos = toupper(*Pos);
}
Log("dw=%lu argv=<%s>", dw, FileName);
if (dw >= 9 && strcmp(FileName + dw - 9, "PECMD.EXE") == 0)
{
Log("Get parameters for pecmd.exe");
Ret = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "System\\Setup", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dw);
if (ERROR_SUCCESS == Ret)
{
memset(FileName, 0, sizeof(FileName));
dw = sizeof(FileName);
Ret = RegQueryValueEx(hKey, "CmdLine", NULL, &Type, FileName, &dw);
if (ERROR_SUCCESS == Ret && Type == REG_SZ)
{
strcpy_s(CallParam, sizeof(CallParam), FileName);
Log("CmdLine:<%s>", CallParam);
if (_strnicmp(CallParam, "PECMD.EXE", 9) == 0)
{
Pos = CallParam + 9;
if (*Pos == ' ' || *Pos == '\t')
{
Pos++;
}
}
else
{
Pos = CallParam;
}
Log("CmdLine2:<%s>", Pos);
sprintf_s(CallParamBuf, BufLen, " %s", Pos);
}
else
{
Log("Failed to RegQueryValueEx %lu %lu", Ret, Type);
}
RegCloseKey(hKey);
return 1;
}
else
{
Log("Failed to create reg key %lu", Ret);
}
}
else
{
Log("This is NOT pecmd.exe");
}
return 0;
}
static int GetWpeInitParam(char **argv, int argc, char *CallParamBuf, DWORD BufLen)
{
int i;
DWORD dw;
CHAR *Pos = NULL;
CHAR FileName[MAX_PATH];
Log("GetWpeInitParam argc=%d", argc);
*CallParamBuf = 0;
strcpy_s(FileName, sizeof(FileName), argv[0]);
for (dw = 0, Pos = FileName; *Pos; Pos++)
{
dw++;
*Pos = toupper(*Pos);
}
Log("dw=%lu argv=<%s>", dw, FileName);
if (dw >= 11 && strcmp(FileName + dw - 11, "WPEINIT.EXE") == 0)
{
Log("Get parameters for WPEINIT.EXE");
for (i = 1; i < argc; i++)
{
strcat_s(CallParamBuf, BufLen, " ");
strcat_s(CallParamBuf, BufLen, argv[i]);
}
return 1;
}
else
{
Log("This is NOT wpeinit.exe");
}
return 0;
}
int main(int argc, char **argv)
{
int i = 0;
@@ -1263,6 +1531,7 @@ int main(int argc, char **argv)
CHAR *Pos = NULL;
CHAR CurDir[MAX_PATH];
CHAR LunchFile[MAX_PATH];
CHAR CallParam[1024] = { 0 };
STARTUPINFOA Si;
PROCESS_INFORMATION Pi;
@@ -1297,6 +1566,11 @@ int main(int argc, char **argv)
Log("Current directory = <%s>", CurDir);
}
if (0 == GetWpeInitParam(argv, argc, CallParam, sizeof(CallParam)))
{
GetPecmdParam(argv[0], CallParam, sizeof(CallParam));
}
GetStartupInfoA(&Si);
memset(LunchFile, 0, sizeof(LunchFile));
@@ -1310,6 +1584,8 @@ int main(int argc, char **argv)
rc = VentoyJump(argc, argv, LunchFile);
}
Log("LunchFile=<%s> CallParam=<%s>", LunchFile, CallParam);
if (g_os_param_reserved[0] == 3)
{
Log("Open log for debug ...");
@@ -1317,28 +1593,35 @@ int main(int argc, char **argv)
}
else
{
if (NULL == strstr(LunchFile, "setup.exe"))
if (CallParam[0])
{
strcat_s(LunchFile, sizeof(LunchFile), CallParam);
}
else if (NULL == strstr(LunchFile, "setup.exe"))
{
Log("Not setup.exe, hide windows.");
Si.dwFlags |= STARTF_USESHOWWINDOW;
Si.wShowWindow = SW_HIDE;
}
}
Log("Ventoy jump %s ...", rc == 0 ? "success" : "failed");
}
Log("Now launch <%s> ...", LunchFile);
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
while (rc)
//sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
for (i = 0; rc && i < 10; i++)
{
Log("Ventoy hook failed, now wait and retry ...");
Sleep(1000);
rc = VentoyHook(&g_os_param);
}
WaitForSingleObject(Pi.hProcess, INFINITE);
Log("Wait process...");
WaitForSingleObject(Pi.hProcess, INFINITE);
Log("vtoyjump finished");
return 0;
}