mirror of
https://github.com/ventoy/Ventoy.git
synced 2024-12-25 22:55:58 -05:00
1.0.05 release
1. Add backup thread in vtoyjump.exe 2. New iso support MXLinux 19.1 (Legacy + UEFI) KNOPPIX_V8.6-2019-08-08-EN.iso (Legacy) Puppy Linux, bionicpup64-8.0-uefi.iso (Legacy + UEFI) tails-amd64-4.5.iso (Legacy) slax-64bit-9.11.0.iso (Legacy) Kaspersky Rescue Disk 18 (Legacy + UEFI) Parted Magic 2018 Bootable ISO (Legacy + UEFI) veket_20.iso (Legacy) ZeroShell-3.9.3-X86.iso (Legacy) SuperGrub2Disk rescatux-0.73.iso (Legacy + UEFI) Some WinPE iso (Legacy + UEFI)
This commit is contained in:
parent
277b134bf6
commit
cd4a5fcb06
@ -15,7 +15,7 @@ fi
|
||||
export C_INCLUDE_PATH=$LIBFUSE_DIR/include
|
||||
|
||||
rm -f $name
|
||||
gcc -O2 -D_FILE_OFFSET_BITS=64 vtoy_fuse_iso.c -o $name $LIBFUSE_DIR/lib/libfuse.a -lpthread -ldl $opt
|
||||
gcc -static -O2 -D_FILE_OFFSET_BITS=64 vtoy_fuse_iso.c -o $name $LIBFUSE_DIR/lib/libfuse.a -lpthread -ldl $opt
|
||||
|
||||
if [ -e $name ]; then
|
||||
echo -e "\n############### SUCCESS $name ##################\n"
|
||||
|
@ -1197,6 +1197,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_linux_clear_initrd", ventoy_cmd_clear_initrd_list, 0, NULL, "", "", NULL },
|
||||
{ "vt_linux_dump_initrd", ventoy_cmd_dump_initrd_list, 0, NULL, "", "", NULL },
|
||||
{ "vt_linux_initrd_count", ventoy_cmd_initrd_count, 0, NULL, "", "", NULL },
|
||||
{ "vt_linux_valid_initrd_count", ventoy_cmd_valid_initrd_count, 0, NULL, "", "", NULL },
|
||||
{ "vt_linux_locate_initrd", ventoy_cmd_linux_locate_initrd, 0, NULL, "", "", NULL },
|
||||
{ "vt_linux_chain_data", ventoy_cmd_linux_chain_data, 0, NULL, "", "", NULL },
|
||||
|
||||
|
@ -398,6 +398,7 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
|
||||
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_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);
|
||||
int ventoy_cpio_newc_fill_head(void *buf, int filesize, void *filedata, const char *name);
|
||||
grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
|
||||
|
@ -543,6 +543,7 @@ grub_err_t ventoy_cmd_specify_initrd_file(grub_extcmd_context_t ctxt, int argc,
|
||||
grub_strncpy(img->name, args[0], sizeof(img->name));
|
||||
if (ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
|
||||
{
|
||||
debug("%s is already exist\n", args[0]);
|
||||
grub_free(img);
|
||||
}
|
||||
else
|
||||
@ -738,6 +739,23 @@ grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
grub_snprintf(buf, sizeof(buf), "%d", g_initrd_img_count);
|
||||
grub_env_set(args[0], buf);
|
||||
}
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
char buf[32] = {0};
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
grub_snprintf(buf, sizeof(buf), "%d", g_valid_initrd_count);
|
||||
@ -750,6 +768,7 @@ grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **
|
||||
static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
||||
{
|
||||
int data;
|
||||
int filtbysize = 1;
|
||||
int sizefilt = 0;
|
||||
grub_file_t file;
|
||||
initrd_info *node;
|
||||
@ -758,6 +777,11 @@ static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
||||
|
||||
g_valid_initrd_count = 0;
|
||||
|
||||
if (grub_env_get("INITRD_NO_SIZE_FILT"))
|
||||
{
|
||||
filtbysize = 0;
|
||||
}
|
||||
|
||||
for (node = g_initrd_img_list; node; node = node->next)
|
||||
{
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(loop)%s", node->name);
|
||||
@ -769,12 +793,18 @@ static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
||||
debug("file <%s> size:%d\n", node->name, (int)file->size);
|
||||
|
||||
/* initrd file too small */
|
||||
if (filt > 0 && file->size <= g_ventoy_cpio_size + 2048)
|
||||
if (filtbysize
|
||||
&& (NULL == grub_strstr(node->name, "minirt.gz"))
|
||||
&& (NULL == grub_strstr(node->name, "initrd.xz"))
|
||||
)
|
||||
{
|
||||
debug("file size too small %d\n", (int)g_ventoy_cpio_size);
|
||||
grub_file_close(file);
|
||||
sizefilt++;
|
||||
continue;
|
||||
if (filt > 0 && file->size <= g_ventoy_cpio_size + 2048)
|
||||
{
|
||||
debug("file size too small %d\n", (int)g_ventoy_cpio_size);
|
||||
grub_file_close(file);
|
||||
sizefilt++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (grub_strcmp(file->fs->name, "iso9660") == 0)
|
||||
|
@ -97,6 +97,9 @@ ventoy_os_install_dmsetup() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
|
@ -21,11 +21,36 @@
|
||||
|
||||
DISTRO='default'
|
||||
|
||||
if [ -e /etc/initrd-release ]; then
|
||||
if [ -d /KNOPPIX ]; then
|
||||
DISTRO='knoppix'
|
||||
elif [ -e /etc/initrd-release ]; then
|
||||
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
|
||||
DISTRO='antix'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /init ]; then
|
||||
if $GREP -q PUPPYSFS /init; then
|
||||
if $GREP -q VEKETSFS /init; then
|
||||
DISTRO='veket'
|
||||
else
|
||||
DISTRO='puppy'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /etc/os-release ]; then
|
||||
if $GREP -q 'Tails' /etc/os-release; then
|
||||
DISTRO='tails'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DISTRO"="default" ]; then
|
||||
if $GREP -q 'slax/' /proc/cmdline; then
|
||||
DISTRO='slax'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo "##### distribution = $DISTRO ######" >> $VTLOG
|
||||
. $VTOY_PATH/hook/debian/${DISTRO}-hook.sh
|
||||
|
@ -23,5 +23,9 @@ if [ -d /etc/udev/rules.d ]; then
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
|
||||
else
|
||||
$SED "/mdev *-s/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
||||
if $GREP -q kaspersky /proc/version; then
|
||||
$SED "/sysresccd_stage1_normal[^(]*$/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
||||
else
|
||||
$SED "/mdev *-s/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
||||
fi
|
||||
fi
|
||||
|
@ -29,7 +29,7 @@ SED=$BUSYBOX_PATH/sed
|
||||
SLEEP=$BUSYBOX_PATH/sleep
|
||||
HEAD=$BUSYBOX_PATH/head
|
||||
VTOY_DM_PATH=/dev/mapper/ventoy
|
||||
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 430 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||
|
||||
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
|
||||
if [ -e /dev/console ]; then
|
||||
|
@ -23,7 +23,7 @@
|
||||
# Step 1 : parse kernel debug parameter #
|
||||
# #
|
||||
####################################################################
|
||||
mkdir /proc; mount -t proc proc /proc
|
||||
[ -d /proc ] || mkdir /proc; mount -t proc proc /proc
|
||||
vtcmdline=$(cat /proc/cmdline)
|
||||
vtkerver=$(cat /proc/version)
|
||||
umount /proc; rm -rf /proc
|
||||
@ -71,9 +71,9 @@ ventoy_unpack_initramfs() {
|
||||
if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
|
||||
echo "vtx=$vtx" >> $VTLOG
|
||||
if [ $vtskip -eq 0 ]; then
|
||||
${vtx:5} $vtfile | (cpio -idm 2>>$VTLOG; cat > $vttmp)
|
||||
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
else
|
||||
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idm 2>>$VTLOG; cat > $vttmp)
|
||||
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
fi
|
||||
break
|
||||
fi
|
||||
@ -98,36 +98,57 @@ ventoy_unpack_initrd() {
|
||||
# This export is for busybox cpio command
|
||||
export EXTRACT_UNSAFE_SYMLINKS=1
|
||||
|
||||
for vtfile in $(ls /initrd*); do
|
||||
#decompress first initrd
|
||||
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $vtfile)
|
||||
|
||||
if ventoy_is_initrd_ramdisk; then
|
||||
ventoy_unpack_initrd $vtfile $vtmagic ${vtfile}_tmp
|
||||
mv ${vtfile}_tmp $vtfile
|
||||
break
|
||||
# special process
|
||||
need_xzminidec() {
|
||||
testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001)
|
||||
if [ "FD37" = "${testmagic:0:4}" ]; then
|
||||
if echo $vtkerver | grep -q 'kaspersky'; then
|
||||
true
|
||||
elif echo $vtkerver | grep -q 'kiosk.*Gentoo'; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
else
|
||||
ventoy_unpack_initramfs $vtfile 0 $vtmagic ${vtfile}_tmp
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
#only for cpio,cpio,...,initrd sequence, initrd,cpio or initrd,initrd sequence is not supported
|
||||
while [ -e ${vtfile}_tmp ] && [ $(stat -c '%s' ${vtfile}_tmp) -gt 512 ]; do
|
||||
mv ${vtfile}_tmp $vtfile
|
||||
vtdump=$(hexdump -n 512 -e '512/1 "%02X"' $vtfile)
|
||||
vtmagic=$(echo $vtdump | sed 's/^\(00\)*//')
|
||||
let vtoffset="(${#vtdump}-${#vtmagic})/2"
|
||||
if need_xzminidec; then
|
||||
echo "use xzminidec" >> $VTLOG
|
||||
cat /initrd001 | xzminidec | cpio -idmu 2>>$VTLOG
|
||||
rm -f /initrd001
|
||||
else
|
||||
for vtfile in $(ls /initrd*); do
|
||||
#decompress first initrd
|
||||
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $vtfile)
|
||||
|
||||
if [ -z "$vtmagic" ]; then
|
||||
echo "terminate with all zero data file" >> $VTLOG
|
||||
if ventoy_is_initrd_ramdisk; then
|
||||
ventoy_unpack_initrd $vtfile $vtmagic ${vtfile}_tmp
|
||||
mv ${vtfile}_tmp $vtfile
|
||||
break
|
||||
else
|
||||
ventoy_unpack_initramfs $vtfile 0 $vtmagic ${vtfile}_tmp
|
||||
fi
|
||||
|
||||
ventoy_unpack_initramfs $vtfile $vtoffset ${vtmagic:0:4} ${vtfile}_tmp
|
||||
#only for cpio,cpio,...,initrd sequence, initrd,cpio or initrd,initrd sequence is not supported
|
||||
while [ -e ${vtfile}_tmp ] && [ $(stat -c '%s' ${vtfile}_tmp) -gt 512 ]; do
|
||||
mv ${vtfile}_tmp $vtfile
|
||||
vtdump=$(hexdump -n 512 -e '512/1 "%02X"' $vtfile)
|
||||
vtmagic=$(echo $vtdump | sed 's/^\(00\)*//')
|
||||
let vtoffset="(${#vtdump}-${#vtmagic})/2"
|
||||
|
||||
if [ -z "$vtmagic" ]; then
|
||||
echo "terminate with all zero data file" >> $VTLOG
|
||||
break
|
||||
fi
|
||||
|
||||
ventoy_unpack_initramfs $vtfile $vtoffset ${vtmagic:0:4} ${vtfile}_tmp
|
||||
done
|
||||
|
||||
rm -f $vtfile ${vtfile}_tmp
|
||||
done
|
||||
|
||||
rm -f $vtfile ${vtfile}_tmp
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
#break here for debug
|
||||
if [ "$VTOY_BREAK_LEVEL" = "02" ] || [ "$VTOY_BREAK_LEVEL" = "12" ]; then
|
||||
|
@ -142,6 +142,12 @@ ventoy_get_os_type() {
|
||||
echo 'slackware'; return
|
||||
fi
|
||||
|
||||
if [ -e /init ]; then
|
||||
if $GREP -i -q zeroshell /init; then
|
||||
echo 'zeroshell'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo "default"
|
||||
}
|
||||
|
Binary file not shown.
@ -64,6 +64,16 @@ function distro_specify_initrd_file {
|
||||
if [ -e (loop)/casper/initrd-oem ]; then
|
||||
vt_linux_specify_initrd_file /casper/initrd-oem
|
||||
fi
|
||||
elif [ -e (loop)/boot/grub/initrd.xz ]; then
|
||||
vt_linux_specify_initrd_file /boot/grub/initrd.xz
|
||||
elif [ -e (loop)/initrd.gz ]; then
|
||||
vt_linux_specify_initrd_file /initrd.gz
|
||||
elif [ -e (loop)/slax/boot/initrfs.img ]; then
|
||||
vt_linux_specify_initrd_file /slax/boot/initrfs.img
|
||||
elif [ -e (loop)/pmagic/initrd.img ]; then
|
||||
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||
elif [ -e (loop)/boot/initrd.xz ]; then
|
||||
vt_linux_specify_initrd_file /boot/initrd.xz
|
||||
fi
|
||||
}
|
||||
|
||||
@ -99,28 +109,25 @@ function uefi_linux_menu_func {
|
||||
|
||||
vt_linux_clear_initrd
|
||||
|
||||
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||
if [ -e (loop)/$file ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/$file
|
||||
fi
|
||||
done
|
||||
|
||||
vt_linux_initrd_count initrd_count
|
||||
if [ -d (loop)/pmagic ]; then
|
||||
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||
else
|
||||
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||
if [ -e (loop)/$file ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/$file
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# special process for special distros
|
||||
if vt_cmp $initrd_count eq 0; then
|
||||
if [ -d (loop)/loader/entries ]; then
|
||||
set LoadIsoEfiDriver=on
|
||||
vt_linux_parse_initrd_grub dir (loop)/loader/entries/
|
||||
elif [ -d (loop)/boot/grub ]; then
|
||||
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
|
||||
fi
|
||||
if [ -d (loop)/loader/entries ]; then
|
||||
set LoadIsoEfiDriver=on
|
||||
vt_linux_parse_initrd_grub dir (loop)/loader/entries/
|
||||
elif [ -d (loop)/boot/grub ]; then
|
||||
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
|
||||
fi
|
||||
|
||||
vt_linux_initrd_count initrd_count
|
||||
if vt_cmp $initrd_count eq 0; then
|
||||
distro_specify_initrd_file
|
||||
fi
|
||||
distro_specify_initrd_file
|
||||
|
||||
locate_initrd
|
||||
fi
|
||||
@ -238,35 +245,32 @@ function legacy_linux_menu_func {
|
||||
|
||||
vt_linux_clear_initrd
|
||||
|
||||
for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
|
||||
if [ -d (loop)/$dir ]; then
|
||||
vt_linux_parse_initrd_isolinux (loop)/$dir/
|
||||
fi
|
||||
done
|
||||
|
||||
vt_linux_initrd_count initrd_count
|
||||
if [ -d (loop)/pmagic ]; then
|
||||
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||
else
|
||||
for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
|
||||
if [ -d (loop)/$dir ]; then
|
||||
vt_linux_parse_initrd_isolinux (loop)/$dir/
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# special process for special distros
|
||||
if vt_cmp $initrd_count eq 0; then
|
||||
#archlinux
|
||||
if [ -d (loop)/arch/boot/syslinux ]; then
|
||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
|
||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
|
||||
#archlinux
|
||||
if [ -d (loop)/arch/boot/syslinux ]; then
|
||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
|
||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
|
||||
|
||||
#manjaro
|
||||
elif [ -d (loop)/manjaro ]; then
|
||||
if [ -e (loop)/boot/grub/kernels.cfg ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
|
||||
fi
|
||||
elif [ -e (loop)/boot/grub/grub.cfg ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
|
||||
#manjaro
|
||||
elif [ -d (loop)/manjaro ]; then
|
||||
if [ -e (loop)/boot/grub/kernels.cfg ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
|
||||
fi
|
||||
elif [ -e (loop)/boot/grub/grub.cfg ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
|
||||
fi
|
||||
|
||||
vt_linux_initrd_count initrd_count
|
||||
if vt_cmp $initrd_count eq 0; then
|
||||
distro_specify_initrd_file
|
||||
fi
|
||||
distro_specify_initrd_file
|
||||
|
||||
locate_initrd
|
||||
fi
|
||||
@ -344,7 +348,7 @@ function legacy_iso_memdisk {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.04"
|
||||
set VENTOY_VERSION="1.0.05"
|
||||
|
||||
#disable timeout
|
||||
unset timeout
|
||||
@ -358,7 +362,7 @@ vt_device $root vtoy_dev
|
||||
if [ "$vtoy_dev" = "tftp" ]; then
|
||||
set vtoy_path=($root)
|
||||
for vtid in 0 1 2 3; do
|
||||
if [ -d (hd$vtid,2)/grub ]; then
|
||||
if [ -d (hd$vtid,2)/ventoy ]; then
|
||||
set iso_path=(hd$vtid,1)
|
||||
break
|
||||
fi
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -28,6 +28,7 @@
|
||||
#include "vtoyjump.h"
|
||||
#include "fat_filelib.h"
|
||||
|
||||
static ventoy_os_param g_os_param;
|
||||
static UINT8 g_os_param_reserved[32];
|
||||
static BOOL g_64bit_system = FALSE;
|
||||
static ventoy_guid g_ventoy_guid = VENTOY_GUID;
|
||||
@ -784,7 +785,6 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
||||
DWORD PeStart;
|
||||
DWORD FileSize;
|
||||
BYTE *Buffer = NULL;
|
||||
ventoy_os_param os_param;
|
||||
CHAR ExeFileName[MAX_PATH];
|
||||
|
||||
sprintf_s(ExeFileName, sizeof(ExeFileName), "%s", argv[0]);
|
||||
@ -818,9 +818,9 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
||||
CheckPeHead(Buffer + PeStart + sizeof(ventoy_os_param)))
|
||||
{
|
||||
Log("Find os pararm at %u", PeStart);
|
||||
memcpy(&os_param, Buffer + PeStart, sizeof(ventoy_os_param));
|
||||
|
||||
memcpy(g_os_param_reserved, os_param.vtoy_reserved, sizeof(g_os_param_reserved));
|
||||
memcpy(&g_os_param, Buffer + PeStart, sizeof(ventoy_os_param));
|
||||
memcpy(g_os_param_reserved, g_os_param.vtoy_reserved, sizeof(g_os_param_reserved));
|
||||
|
||||
if (g_os_param_reserved[0] == 1)
|
||||
{
|
||||
@ -829,11 +829,11 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
||||
}
|
||||
|
||||
// convert / to \\
|
||||
for (Pos = 0; Pos < sizeof(os_param.vtoy_img_path) && os_param.vtoy_img_path[Pos]; Pos++)
|
||||
for (Pos = 0; Pos < sizeof(g_os_param.vtoy_img_path) && g_os_param.vtoy_img_path[Pos]; Pos++)
|
||||
{
|
||||
if (os_param.vtoy_img_path[Pos] == '/')
|
||||
if (g_os_param.vtoy_img_path[Pos] == '/')
|
||||
{
|
||||
os_param.vtoy_img_path[Pos] = '\\';
|
||||
g_os_param.vtoy_img_path[Pos] = '\\';
|
||||
}
|
||||
}
|
||||
|
||||
@ -857,7 +857,7 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
||||
goto End;
|
||||
}
|
||||
|
||||
rc = VentoyHook(&os_param);
|
||||
rc = VentoyHook(&g_os_param);
|
||||
|
||||
End:
|
||||
|
||||
@ -912,35 +912,31 @@ int main(int argc, char **argv)
|
||||
|
||||
GetStartupInfoA(&Si);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
memset(LunchFile, 0, sizeof(LunchFile));
|
||||
rc = VentoyJump(argc, argv, LunchFile);
|
||||
|
||||
if (g_os_param_reserved[0] == 3)
|
||||
{
|
||||
Log("VentoyJump loop %d", i + 1);
|
||||
|
||||
memset(LunchFile, 0, sizeof(LunchFile));
|
||||
rc = VentoyJump(argc, argv, LunchFile);
|
||||
|
||||
if (g_os_param_reserved[0] == 3)
|
||||
{
|
||||
Log("Open log for debug ...");
|
||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "notepad.exe ventoy.log");
|
||||
break;
|
||||
}
|
||||
else if (rc == 0)
|
||||
{
|
||||
Log("Ventoy jump success ...");
|
||||
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||
Si.wShowWindow = SW_HIDE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Ventoy jump fail, now wait ...");
|
||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
|
||||
Sleep(3000);
|
||||
}
|
||||
Log("Open log for debug ...");
|
||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "notepad.exe ventoy.log");
|
||||
}
|
||||
else
|
||||
{
|
||||
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||
Si.wShowWindow = SW_HIDE;
|
||||
Log("Ventoy jump %s ...", rc == 0 ? "success" : "failed");
|
||||
}
|
||||
|
||||
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||
|
||||
while (rc)
|
||||
{
|
||||
Log("Ventoy hook failed, now wait and retry ...");
|
||||
Sleep(1000);
|
||||
|
||||
rc = VentoyHook(&g_os_param);
|
||||
}
|
||||
|
||||
WaitForSingleObject(Pi.hProcess, INFINITE);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user