]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
1.0.14 release v1.0.14
authorlongpanda <admin@ventoy.net>
Thu, 25 Jun 2020 15:01:48 +0000 (23:01 +0800)
committerlongpanda <admin@ventoy.net>
Thu, 25 Jun 2020 15:01:59 +0000 (23:01 +0800)
58 files changed:
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyDebug.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
GRUB2/MOD_SRC/grub-2.04/install.sh
IMG/cpio/ventoy/hook/adelie/disk-hook.sh [moved from IMG/cpio/ventoy/hook/guix/ventoy-waitdev.sh with 77% similarity]
IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/alt/udev_disk_hook.sh
IMG/cpio/ventoy/hook/arch/ovios-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/guix/ventoy-disk.sh
IMG/cpio/ventoy/hook/guix/ventoy-hook.sh
IMG/cpio/ventoy/hook/rhel6/udev_disk_hook.sh
IMG/cpio/ventoy/hook/rhel6/ventoy-hook.sh
IMG/cpio/ventoy/ventoy.sh
INSTALL/EFI/BOOT/grubx64_real.efi
INSTALL/Ventoy2Disk.exe
INSTALL/grub/debug.cfg
INSTALL/grub/grub.cfg
INSTALL/grub/i386-pc/core.img
INSTALL/grub/i386-pc/elf.mod [new file with mode: 0644]
INSTALL/grub/i386-pc/file.mod [new file with mode: 0644]
INSTALL/grub/i386-pc/macho.mod [new file with mode: 0644]
INSTALL/grub/i386-pc/offsetio.mod [new file with mode: 0644]
INSTALL/grub/i386-pc/regexp.mod [new file with mode: 0644]
INSTALL/grub/localboot.cfg
INSTALL/grub/power.cfg
INSTALL/grub/themes/ventoy/theme.txt
INSTALL/grub/x86_64-efi/normal.mod
INSTALL/tool/VentoyWorker.sh
INSTALL/tool/ventoy_lib.sh
INSTALL/ventoy/ipxe.krn
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/ventoy_x64.efi
IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/interface/pcbios/ventoy_int13.c
IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ipxe/sanboot.h
IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h
LANGUAGES/languages.ini
Ventoy2Disk/Ventoy2Disk/Language.h
Ventoy2Disk/Ventoy2Disk/PartDialog.c [new file with mode: 0644]
Ventoy2Disk/Ventoy2Disk/PhyDrive.c
Ventoy2Disk/Ventoy2Disk/Utility.c
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.vcxproj
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.vcxproj.filters
Ventoy2Disk/Ventoy2Disk/WinDialog.c
Ventoy2Disk/Ventoy2Disk/resource.h

index c05e772f16f1f87d7235e951f5539cc1879336a4..7c2267f5e017a4a6d24c457cc85086841038e117 100644 (file)
@@ -52,6 +52,8 @@ static grub_env_get_pf grub_env_get = NULL;
 ventoy_grub_param_file_replace *g_file_replace_list = NULL;
 ventoy_efi_file_replace g_efi_file_replace;
 
 ventoy_grub_param_file_replace *g_file_replace_list = NULL;
 ventoy_efi_file_replace g_efi_file_replace;
 
+STATIC BOOLEAN g_hook_keyboard = FALSE;
+
 CHAR16 gFirstTryBootFile[256] = {0};
 
 /* Boot filename */
 CHAR16 gFirstTryBootFile[256] = {0};
 
 /* Boot filename */
@@ -191,11 +193,12 @@ static void EFIAPI ventoy_dump_chain(ventoy_chain_head *chain)
     debug("os_param->vtoy_img_size=<%llu>",    chain->os_param.vtoy_img_size);
     debug("os_param->vtoy_img_location_addr=<0x%llx>", chain->os_param.vtoy_img_location_addr);
     debug("os_param->vtoy_img_location_len=<%u>",    chain->os_param.vtoy_img_location_len);
     debug("os_param->vtoy_img_size=<%llu>",    chain->os_param.vtoy_img_size);
     debug("os_param->vtoy_img_location_addr=<0x%llx>", chain->os_param.vtoy_img_location_addr);
     debug("os_param->vtoy_img_location_len=<%u>",    chain->os_param.vtoy_img_location_len);
-    debug("os_param->vtoy_reserved=<%u %u %u %u>",    
+    debug("os_param->vtoy_reserved=<%u %u %u %u %u>",    
           g_os_param_reserved[0], 
           g_os_param_reserved[1], 
           g_os_param_reserved[2], 
           g_os_param_reserved[0], 
           g_os_param_reserved[1], 
           g_os_param_reserved[2], 
-          g_os_param_reserved[3]
+          g_os_param_reserved[3],
+          g_os_param_reserved[4]
           );
 
     ventoy_debug_pause();
           );
 
     ventoy_debug_pause();
@@ -585,6 +588,13 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
             g_fixup_iso9660_secover_enable = TRUE;
         }
 
             g_fixup_iso9660_secover_enable = TRUE;
         }
 
+        if (g_os_param_reserved[2] == 1 && g_os_param_reserved[4] != 1)
+        {
+            g_hook_keyboard = TRUE;
+        }
+
+        debug("internal param: secover:%u keyboard:%u", g_fixup_iso9660_secover_enable, g_hook_keyboard);
+
         for (i = 0; i < sizeof(ventoy_os_param); i++)
         {
             chksum += *((UINT8 *)(&(g_chain->os_param)) + i);
         for (i = 0; i < sizeof(ventoy_os_param); i++)
         {
             chksum += *((UINT8 *)(&(g_chain->os_param)) + i);
@@ -707,16 +717,26 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
             if (gDebugPrint)
             {
                 gST->ConIn->Reset(gST->ConIn, FALSE);
             if (gDebugPrint)
             {
                 gST->ConIn->Reset(gST->ConIn, FALSE);
-                //ventoy_wrapper_system();
             }
             }
-
+            
             if (g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC)
             {
                 ventoy_wrapper_push_openvolume(pFile->OpenVolume);
                 pFile->OpenVolume = ventoy_wrapper_open_volume;
             }
             if (g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC)
             {
                 ventoy_wrapper_push_openvolume(pFile->OpenVolume);
                 pFile->OpenVolume = ventoy_wrapper_open_volume;
             }
-            
+
+            if (g_hook_keyboard)
+            {
+                ventoy_hook_keyboard_start();
+            }
+            /* can't add debug print here */
+            //ventoy_wrapper_system();
             Status = gBS->StartImage(Image, NULL, NULL);
             Status = gBS->StartImage(Image, NULL, NULL);
+            if (g_hook_keyboard)
+            {
+                ventoy_hook_keyboard_stop();
+            }
+            
             if (EFI_ERROR(Status))
             {
                 debug("Failed to start image %r", Status);
             if (EFI_ERROR(Status))
             {
                 debug("Failed to start image %r", Status);
@@ -743,7 +763,6 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
 
-
 EFI_STATUS EFIAPI VentoyEfiMain
 (
     IN EFI_HANDLE         ImageHandle,
 EFI_STATUS EFIAPI VentoyEfiMain
 (
     IN EFI_HANDLE         ImageHandle,
@@ -751,6 +770,7 @@ EFI_STATUS EFIAPI VentoyEfiMain
 )
 {
     EFI_STATUS Status = EFI_SUCCESS;
 )
 {
     EFI_STATUS Status = EFI_SUCCESS;
+    EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *Protocol;
     
     g_sector_flag_num = 512; /* initial value */
 
     
     g_sector_flag_num = 512; /* initial value */
 
@@ -760,6 +780,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
         return EFI_OUT_OF_RESOURCES;
     }
 
         return EFI_OUT_OF_RESOURCES;
     }
 
+    Status = gBS->HandleProtocol(gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **)&Protocol);
+    if (EFI_SUCCESS == Status)
+    {
+        g_con_simple_input_ex = Protocol;
+    }
+
     gST->ConOut->ClearScreen(gST->ConOut);
     ventoy_clear_input();
 
     gST->ConOut->ClearScreen(gST->ConOut);
     ventoy_clear_input();
 
index 48c68c8b21eca47d78a3296525462e7395bf500c..354496e76f36f89d1092ef484e9e1b8d0bcaf0e1 100644 (file)
@@ -291,7 +291,6 @@ typedef struct ventoy_system_wrapper
 extern BOOLEAN gDebugPrint;
 VOID EFIAPI VtoyDebug(IN CONST CHAR8  *Format, ...);
 EFI_STATUS EFIAPI ventoy_wrapper_system(VOID);
 extern BOOLEAN gDebugPrint;
 VOID EFIAPI VtoyDebug(IN CONST CHAR8  *Format, ...);
 EFI_STATUS EFIAPI ventoy_wrapper_system(VOID);
-EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File);
 EFI_STATUS EFIAPI ventoy_block_io_read 
 (
     IN EFI_BLOCK_IO_PROTOCOL          *This,
 EFI_STATUS EFIAPI ventoy_block_io_read 
 (
     IN EFI_BLOCK_IO_PROTOCOL          *This,
@@ -317,6 +316,7 @@ extern BOOLEAN gMemdiskMode;
 extern UINTN g_iso_buf_size;
 extern ventoy_grub_param_file_replace *g_file_replace_list;
 extern BOOLEAN g_fixup_iso9660_secover_enable;
 extern UINTN g_iso_buf_size;
 extern ventoy_grub_param_file_replace *g_file_replace_list;
 extern BOOLEAN g_fixup_iso9660_secover_enable;
+extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *g_con_simple_input_ex;
 
 EFI_STATUS EFIAPI ventoy_wrapper_open_volume
 (
 
 EFI_STATUS EFIAPI ventoy_wrapper_open_volume
 (
@@ -325,6 +325,8 @@ EFI_STATUS EFIAPI ventoy_wrapper_open_volume
 );
 EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 ImgSize);
 EFI_STATUS EFIAPI ventoy_wrapper_push_openvolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume);
 );
 EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 ImgSize);
 EFI_STATUS EFIAPI ventoy_wrapper_push_openvolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume);
+EFI_STATUS ventoy_hook_keyboard_start(VOID);
+EFI_STATUS ventoy_hook_keyboard_stop(VOID);
 
 #endif
 
 
 #endif
 
index 4c595b464fc8fb862cac87a4d7edde326bf1d1b7..d96c6b2e1694928c3b73ba09274ff30f8fbbd50d 100644 (file)
 #include <Protocol/SimpleFileSystem.h>
 #include <Ventoy.h>
 
 #include <Protocol/SimpleFileSystem.h>
 #include <Ventoy.h>
 
+#define PROCOTOL_SLEEP_SECONDS  0
+
+#define debug_sleep() if (PROCOTOL_SLEEP_SECONDS) sleep(PROCOTOL_SLEEP_SECONDS)
+
 STATIC ventoy_system_wrapper g_system_wrapper;
 
 static struct well_known_guid g_efi_well_known_guids[] = 
 STATIC ventoy_system_wrapper g_system_wrapper;
 
 static struct well_known_guid g_efi_well_known_guids[] = 
@@ -84,183 +88,6 @@ static const char * ventoy_get_guid_name(EFI_GUID *guid)
     return gEfiGuidName;
 }
 
     return gEfiGuidName;
 }
 
-EFI_STATUS EFIAPI
-ventoy_wrapper_fs_open(EFI_FILE_HANDLE This, EFI_FILE_HANDLE *New, CHAR16 *Name, UINT64 Mode, UINT64 Attributes)
-{
-    (VOID)This;
-    (VOID)New;
-    (VOID)Name;
-    (VOID)Mode;
-    (VOID)Attributes;
-    return EFI_SUCCESS;
-}
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_open_ex(EFI_FILE_HANDLE This, EFI_FILE_HANDLE *New, CHAR16 *Name, UINT64 Mode, UINT64 Attributes, EFI_FILE_IO_TOKEN *Token)
-{
-       return ventoy_wrapper_fs_open(This, New, Name, Mode, Attributes);
-}
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_delete(EFI_FILE_HANDLE This)
-{
-    (VOID)This;
-       return EFI_SUCCESS;
-}
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_set_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN Len, VOID *Data)
-{
-       return EFI_SUCCESS;
-}
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_flush(EFI_FILE_HANDLE This)
-{
-    (VOID)This;
-       return EFI_SUCCESS;
-}
-
-/* Ex version */
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_flush_ex(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
-{
-    (VOID)This;
-    (VOID)Token;
-       return EFI_SUCCESS;
-}
-
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_write(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
-{
-    (VOID)This;
-    (VOID)Len;
-    (VOID)Data;
-
-       return EFI_WRITE_PROTECTED;
-}
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_write_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN *Token)
-{
-       return ventoy_wrapper_file_write(This, &(Token->BufferSize), Token->Buffer);
-}
-
-
-static EFI_STATUS EFIAPI
-ventoy_wrapper_file_close(EFI_FILE_HANDLE This)
-{
-    (VOID)This;
-    return EFI_SUCCESS;
-}
-
-
-static EFI_STATUS EFIAPI
-ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
-{
-    (VOID)This;
-    
-    g_efi_file_replace.CurPos = Position;
-    return EFI_SUCCESS;
-}
-
-static EFI_STATUS EFIAPI
-ventoy_wrapper_file_get_pos(EFI_FILE_HANDLE This, UINT64 *Position)
-{
-    (VOID)This;
-
-    *Position = g_efi_file_replace.CurPos;
-
-    return EFI_SUCCESS;
-}
-
-
-static EFI_STATUS EFIAPI
-ventoy_wrapper_file_get_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN *Len, VOID *Data)
-{
-    EFI_FILE_INFO *Info = (EFI_FILE_INFO *) Data;
-
-    debug("ventoy_wrapper_file_get_info ... %u", *Len);
-
-    if (!CompareGuid(Type, &gEfiFileInfoGuid))
-    {
-        return EFI_INVALID_PARAMETER;
-    }
-
-    if (*Len == 0)
-    {
-        *Len = 384;
-        return EFI_BUFFER_TOO_SMALL;
-    }
-
-    ZeroMem(Data, sizeof(EFI_FILE_INFO));
-
-    Info->Size = sizeof(EFI_FILE_INFO);
-    Info->FileSize = g_efi_file_replace.FileSizeBytes;
-    Info->PhysicalSize = g_efi_file_replace.FileSizeBytes;
-    Info->Attribute = EFI_FILE_READ_ONLY;
-    //Info->FileName = EFI_FILE_READ_ONLY;
-
-    *Len = Info->Size;
-    
-    return EFI_SUCCESS;
-}
-
-static EFI_STATUS EFIAPI
-ventoy_wrapper_file_read(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
-{
-    EFI_LBA Lba;
-    UINTN ReadLen = *Len;
-    
-    (VOID)This;
-
-    debug("ventoy_wrapper_file_read ... %u", *Len);
-
-    if (g_efi_file_replace.CurPos + ReadLen > g_efi_file_replace.FileSizeBytes)
-    {
-        ReadLen = g_efi_file_replace.FileSizeBytes - g_efi_file_replace.CurPos;
-    }
-
-    Lba = g_efi_file_replace.CurPos / 2048 + g_efi_file_replace.BlockIoSectorStart;
-
-    ventoy_block_io_read(NULL, 0, Lba, ReadLen, Data);
-
-    *Len = ReadLen;
-
-    g_efi_file_replace.CurPos += ReadLen;
-
-    return EFI_SUCCESS;
-}
-
-
-EFI_STATUS EFIAPI
-ventoy_wrapper_file_read_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN *Token)
-{
-       return ventoy_wrapper_file_read(This, &(Token->BufferSize), Token->Buffer);
-}
-
-EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File)
-{
-    File->Revision    = EFI_FILE_PROTOCOL_REVISION2;
-    File->Open        = ventoy_wrapper_fs_open;
-    File->Close       = ventoy_wrapper_file_close;
-    File->Delete      = ventoy_wrapper_file_delete;
-    File->Read        = ventoy_wrapper_file_read;
-    File->Write       = ventoy_wrapper_file_write;
-    File->GetPosition = ventoy_wrapper_file_get_pos;
-    File->SetPosition = ventoy_wrapper_file_set_pos;
-    File->GetInfo     = ventoy_wrapper_file_get_info;
-    File->SetInfo     = ventoy_wrapper_file_set_info;
-    File->Flush       = ventoy_wrapper_file_flush;
-    File->OpenEx      = ventoy_wrapper_file_open_ex;
-    File->ReadEx      = ventoy_wrapper_file_read_ex;
-    File->WriteEx     = ventoy_wrapper_file_write_ex;
-    File->FlushEx     = ventoy_wrapper_file_flush_ex;
-
-    return EFI_SUCCESS;
-}
-
 STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
 (
     IN  EFI_HANDLE                Handle,
 STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
 (
     IN  EFI_HANDLE                Handle,
@@ -270,7 +97,7 @@ STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
 {
     EFI_STATUS Status = EFI_SUCCESS;
     
 {
     EFI_STATUS Status = EFI_SUCCESS;
     
-    debug("ventoy_handle_protocol:%a", ventoy_get_guid_name(Protocol)); 
+    debug("ventoy_handle_protocol:%a", ventoy_get_guid_name(Protocol)); debug_sleep();
     Status = g_system_wrapper.OriHandleProtocol(Handle, Protocol, Interface);
 
     if (CompareGuid(Protocol, &gEfiSimpleFileSystemProtocolGuid))
     Status = g_system_wrapper.OriHandleProtocol(Handle, Protocol, Interface);
 
     if (CompareGuid(Protocol, &gEfiSimpleFileSystemProtocolGuid))
@@ -280,7 +107,7 @@ STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
         
         pFile->OpenVolume(pFile, &FileProtocol);
         
         
         pFile->OpenVolume(pFile, &FileProtocol);
         
-        debug("Handle FS Protocol: %p OpenVolume:%p, FileProtocol:%p, Open:%p", 
+        trace("Handle FS Protocol: %p OpenVolume:%p, FileProtocol:%p, Open:%p", 
             pFile, pFile->OpenVolume, FileProtocol, FileProtocol->Open); 
 
         sleep(3);
             pFile, pFile->OpenVolume, FileProtocol, FileProtocol->Open); 
 
         sleep(3);
@@ -299,7 +126,7 @@ STATIC EFI_STATUS EFIAPI ventoy_open_protocol
     IN  UINT32                     Attributes
 )
 {
     IN  UINT32                     Attributes
 )
 {
-    debug("ventoy_open_protocol:%a", ventoy_get_guid_name(Protocol));
+    debug("ventoy_open_protocol:%a", ventoy_get_guid_name(Protocol));  debug_sleep();
     return g_system_wrapper.OriOpenProtocol(Handle, Protocol, Interface, AgentHandle, ControllerHandle, Attributes);
 }
 
     return g_system_wrapper.OriOpenProtocol(Handle, Protocol, Interface, AgentHandle, ControllerHandle, Attributes);
 }
 
@@ -310,7 +137,7 @@ STATIC EFI_STATUS EFIAPI ventoy_locate_protocol
     OUT VOID      **Interface
 )
 {
     OUT VOID      **Interface
 )
 {
-    debug("ventoy_locate_protocol:%a", ventoy_get_guid_name(Protocol));
+    debug("ventoy_locate_protocol:%a", ventoy_get_guid_name(Protocol));  debug_sleep();
     return g_system_wrapper.OriLocateProtocol(Protocol, Registration, Interface);
 }
 
     return g_system_wrapper.OriLocateProtocol(Protocol, Registration, Interface);
 }
 
@@ -318,7 +145,7 @@ EFI_STATUS EFIAPI ventoy_wrapper_system(VOID)
 {
     ventoy_wrapper(gBS, g_system_wrapper, LocateProtocol, ventoy_locate_protocol);
     ventoy_wrapper(gBS, g_system_wrapper, HandleProtocol, ventoy_handle_protocol);
 {
     ventoy_wrapper(gBS, g_system_wrapper, LocateProtocol, ventoy_locate_protocol);
     ventoy_wrapper(gBS, g_system_wrapper, HandleProtocol, ventoy_handle_protocol);
-    ventoy_wrapper(gBS, g_system_wrapper, OpenProtocol,    ventoy_open_protocol);
+    ventoy_wrapper(gBS, g_system_wrapper, OpenProtocol,   ventoy_open_protocol);
 
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
index 624055dff974f57be556da592344f77a8b17198b..0e19153ceaf08de9adcf7659708601c861ecb2a3 100644 (file)
@@ -57,6 +57,18 @@ UINT64  g_fixup_iso9660_secover_1st_secs = 0;
 UINT64  g_fixup_iso9660_secover_cur_secs = 0;
 UINT64  g_fixup_iso9660_secover_tot_secs = 0;
 
 UINT64  g_fixup_iso9660_secover_cur_secs = 0;
 UINT64  g_fixup_iso9660_secover_tot_secs = 0;
 
+STATIC UINTN g_keyboard_hook_count = 0;
+STATIC BOOLEAN g_blockio_start_record_bcd = FALSE;
+STATIC BOOLEAN g_blockio_bcd_read_done = FALSE;
+
+EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *g_con_simple_input_ex = NULL;
+STATIC EFI_INPUT_READ_KEY_EX g_org_read_key_ex = NULL;
+STATIC EFI_INPUT_READ_KEY g_org_read_key = NULL;
+
+#if 0
+/* Block IO procotol */
+#endif
+
 EFI_STATUS EFIAPI ventoy_block_io_reset 
 (
     IN EFI_BLOCK_IO_PROTOCOL          *This,
 EFI_STATUS EFIAPI ventoy_block_io_reset 
 (
     IN EFI_BLOCK_IO_PROTOCOL          *This,
@@ -176,6 +188,14 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
         }
     }
 
         }
     }
 
+    if (g_blockio_start_record_bcd && FALSE == g_blockio_bcd_read_done)
+    {
+        if (*(UINT32 *)Buffer == 0x66676572)
+        {
+            g_blockio_bcd_read_done = TRUE;
+        }
+    }
+
     return EFI_SUCCESS;    
 }
 
     return EFI_SUCCESS;    
 }
 
@@ -194,6 +214,14 @@ EFI_STATUS EFIAPI ventoy_block_io_ramdisk_read
     (VOID)MediaId;
 
     CopyMem(Buffer, (char *)g_chain + (Lba * 2048), BufferSize);
     (VOID)MediaId;
 
     CopyMem(Buffer, (char *)g_chain + (Lba * 2048), BufferSize);
+    
+    if (g_blockio_start_record_bcd && FALSE == g_blockio_bcd_read_done)
+    {
+        if (*(UINT32 *)Buffer == 0x66676572)
+        {
+            g_blockio_bcd_read_done = TRUE;            
+        }
+    }
 
        return EFI_SUCCESS;
 }
 
        return EFI_SUCCESS;
 }
@@ -548,7 +576,187 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
 
-EFI_STATUS EFIAPI ventoy_wrapper_file_open
+#if 0
+/* For file replace */
+#endif
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_fs_open(EFI_FILE_HANDLE This, EFI_FILE_HANDLE *New, CHAR16 *Name, UINT64 Mode, UINT64 Attributes)
+{
+    (VOID)This;
+    (VOID)New;
+    (VOID)Name;
+    (VOID)Mode;
+    (VOID)Attributes;
+    return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_open_ex(EFI_FILE_HANDLE This, EFI_FILE_HANDLE *New, CHAR16 *Name, UINT64 Mode, UINT64 Attributes, EFI_FILE_IO_TOKEN *Token)
+{
+       return ventoy_wrapper_fs_open(This, New, Name, Mode, Attributes);
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_delete(EFI_FILE_HANDLE This)
+{
+    (VOID)This;
+       return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_set_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN Len, VOID *Data)
+{
+       return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_flush(EFI_FILE_HANDLE This)
+{
+    (VOID)This;
+       return EFI_SUCCESS;
+}
+
+/* Ex version */
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_flush_ex(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
+{
+    (VOID)This;
+    (VOID)Token;
+       return EFI_SUCCESS;
+}
+
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_write(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
+{
+    (VOID)This;
+    (VOID)Len;
+    (VOID)Data;
+
+       return EFI_WRITE_PROTECTED;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_write_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN *Token)
+{
+       return ventoy_wrapper_file_write(This, &(Token->BufferSize), Token->Buffer);
+}
+
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_close(EFI_FILE_HANDLE This)
+{
+    (VOID)This;
+    return EFI_SUCCESS;
+}
+
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
+{
+    (VOID)This;
+    
+    g_efi_file_replace.CurPos = Position;
+    return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_get_pos(EFI_FILE_HANDLE This, UINT64 *Position)
+{
+    (VOID)This;
+
+    *Position = g_efi_file_replace.CurPos;
+
+    return EFI_SUCCESS;
+}
+
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_get_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN *Len, VOID *Data)
+{
+    EFI_FILE_INFO *Info = (EFI_FILE_INFO *) Data;
+
+    debug("ventoy_wrapper_file_get_info ... %u", *Len);
+
+    if (!CompareGuid(Type, &gEfiFileInfoGuid))
+    {
+        return EFI_INVALID_PARAMETER;
+    }
+
+    if (*Len == 0)
+    {
+        *Len = 384;
+        return EFI_BUFFER_TOO_SMALL;
+    }
+
+    ZeroMem(Data, sizeof(EFI_FILE_INFO));
+
+    Info->Size = sizeof(EFI_FILE_INFO);
+    Info->FileSize = g_efi_file_replace.FileSizeBytes;
+    Info->PhysicalSize = g_efi_file_replace.FileSizeBytes;
+    Info->Attribute = EFI_FILE_READ_ONLY;
+    //Info->FileName = EFI_FILE_READ_ONLY;
+
+    *Len = Info->Size;
+    
+    return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_read(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
+{
+    EFI_LBA Lba;
+    UINTN ReadLen = *Len;
+    
+    (VOID)This;
+
+    debug("ventoy_wrapper_file_read ... %u", *Len);
+
+    if (g_efi_file_replace.CurPos + ReadLen > g_efi_file_replace.FileSizeBytes)
+    {
+        ReadLen = g_efi_file_replace.FileSizeBytes - g_efi_file_replace.CurPos;
+    }
+
+    Lba = g_efi_file_replace.CurPos / 2048 + g_efi_file_replace.BlockIoSectorStart;
+
+    ventoy_block_io_read(NULL, 0, Lba, ReadLen, Data);
+
+    *Len = ReadLen;
+
+    g_efi_file_replace.CurPos += ReadLen;
+
+    return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_read_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN *Token)
+{
+       return ventoy_wrapper_file_read(This, &(Token->BufferSize), Token->Buffer);
+}
+
+STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File)
+{
+    File->Revision    = EFI_FILE_PROTOCOL_REVISION2;
+    File->Open        = ventoy_wrapper_fs_open;
+    File->Close       = ventoy_wrapper_file_close;
+    File->Delete      = ventoy_wrapper_file_delete;
+    File->Read        = ventoy_wrapper_file_read;
+    File->Write       = ventoy_wrapper_file_write;
+    File->GetPosition = ventoy_wrapper_file_get_pos;
+    File->SetPosition = ventoy_wrapper_file_set_pos;
+    File->GetInfo     = ventoy_wrapper_file_get_info;
+    File->SetInfo     = ventoy_wrapper_file_set_info;
+    File->Flush       = ventoy_wrapper_file_flush;
+    File->OpenEx      = ventoy_wrapper_file_open_ex;
+    File->ReadEx      = ventoy_wrapper_file_read_ex;
+    File->WriteEx     = ventoy_wrapper_file_write_ex;
+    File->FlushEx     = ventoy_wrapper_file_flush_ex;
+
+    return EFI_SUCCESS;
+}
+
+STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
 (
     EFI_FILE_HANDLE This, 
     EFI_FILE_HANDLE *New,
 (
     EFI_FILE_HANDLE This, 
     EFI_FILE_HANDLE *New,
@@ -629,3 +837,82 @@ EFI_STATUS EFIAPI ventoy_wrapper_push_openvolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTO
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
 
+#if 0
+/* For auto skip Windows 'Press any key to boot from CD or DVD ...' */
+#endif
+
+STATIC EFI_STATUS EFIAPI ventoy_wrapper_read_key_ex
+(
+    IN  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+    OUT EFI_KEY_DATA                      *KeyData
+)
+{
+    /* only hook once before BCD file read */
+    if (g_keyboard_hook_count == 0 && g_blockio_bcd_read_done == FALSE)
+    {
+        g_keyboard_hook_count++;
+
+        KeyData->Key.ScanCode = SCAN_DELETE;
+        KeyData->Key.UnicodeChar = 0;
+        KeyData->KeyState.KeyShiftState = 0;
+        KeyData->KeyState.KeyToggleState = 0;
+        
+        return EFI_SUCCESS;
+    }
+    
+    return g_org_read_key_ex(This, KeyData);
+}
+
+EFI_STATUS EFIAPI ventoy_wrapper_read_key
+(
+    IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
+    OUT EFI_INPUT_KEY                       *Key
+)
+{
+    /* only hook once before BCD file read */
+    if (g_keyboard_hook_count == 0 && g_blockio_bcd_read_done == FALSE)
+    {
+        g_keyboard_hook_count++;
+
+        Key->ScanCode = SCAN_DELETE;
+        Key->UnicodeChar = 0;
+        return EFI_SUCCESS;
+    }
+
+    return g_org_read_key(This, Key);
+}
+
+EFI_STATUS ventoy_hook_keyboard_start(VOID)
+{
+    g_blockio_start_record_bcd = TRUE;
+    g_blockio_bcd_read_done = FALSE;
+    g_keyboard_hook_count = 0;
+
+    if (g_con_simple_input_ex)
+    {
+        g_org_read_key_ex = g_con_simple_input_ex->ReadKeyStrokeEx;
+        g_con_simple_input_ex->ReadKeyStrokeEx = ventoy_wrapper_read_key_ex;
+    }
+
+    g_org_read_key = gST->ConIn->ReadKeyStroke;
+    gST->ConIn->ReadKeyStroke = ventoy_wrapper_read_key;
+    
+    return EFI_SUCCESS;
+}
+
+EFI_STATUS ventoy_hook_keyboard_stop(VOID)
+{
+    g_blockio_start_record_bcd = FALSE;
+    g_blockio_bcd_read_done = FALSE;
+    g_keyboard_hook_count = 0;
+
+    if (g_con_simple_input_ex)
+    {
+        g_con_simple_input_ex->ReadKeyStrokeEx = g_org_read_key_ex;
+    }
+
+    gST->ConIn->ReadKeyStroke = g_org_read_key;
+
+    return EFI_SUCCESS;
+}
+
index e416c6f322cca2dbefa1de9a046458b4225b2e48..e1033d1803ab5acf26611b45aefdd00a2c922aed 100644 (file)
@@ -38,7 +38,7 @@ int g_ventoy_menu_refresh = 0;
 int g_ventoy_memdisk_mode = 0;
 int g_ventoy_iso_raw = 0;
 int g_ventoy_iso_uefi_drv = 0;
 int g_ventoy_memdisk_mode = 0;
 int g_ventoy_iso_raw = 0;
 int g_ventoy_iso_uefi_drv = 0;
-int g_ventoy_last_entry = 0;
+int g_ventoy_last_entry = -1;
 int g_ventoy_suppress_esc = 0;
 int g_ventoy_menu_esc = 0;
 int g_ventoy_fn_mutex = 0;
 int g_ventoy_suppress_esc = 0;
 int g_ventoy_menu_esc = 0;
 int g_ventoy_fn_mutex = 0;
index 93641ee393525c8777b750a271aeaf0470d5678c..32200f148ab8c91d44b30fc819f8bc013210c92f 100644 (file)
@@ -69,6 +69,7 @@ img_iterator_node *g_img_iterator_tail = NULL;
 grub_uint8_t g_ventoy_break_level = 0;
 grub_uint8_t g_ventoy_debug_level = 0;
 grub_uint8_t g_ventoy_chain_type = 0;
 grub_uint8_t g_ventoy_break_level = 0;
 grub_uint8_t g_ventoy_debug_level = 0;
 grub_uint8_t g_ventoy_chain_type = 0;
+
 grub_uint8_t *g_ventoy_cpio_buf = NULL;
 grub_uint32_t g_ventoy_cpio_size = 0;
 cpio_newc_header *g_ventoy_initrd_head = NULL;
 grub_uint8_t *g_ventoy_cpio_buf = NULL;
 grub_uint32_t g_ventoy_cpio_size = 0;
 cpio_newc_header *g_ventoy_initrd_head = NULL;
@@ -90,6 +91,15 @@ static int g_tree_script_pos = 0;
 static char *g_list_script_buf = NULL;
 static int g_list_script_pos = 0;
 
 static char *g_list_script_buf = NULL;
 static int g_list_script_pos = 0;
 
+static const char *g_menu_class[] = 
+{
+    "vtoyiso", "vtoywim", "vtoyefi", "vtoyimg"
+};
+    
+static const char *g_menu_prefix[] = 
+{
+    "iso", "wim", "efi", "img"
+};
 
 void ventoy_debug(const char *fmt, ...)
 {
 
 void ventoy_debug(const char *fmt, ...)
 {
@@ -806,6 +816,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
         {
             type = img_type_wim;
         }
         {
             type = img_type_wim;
         }
+        #ifdef GRUB_MACHINE_EFI
+        else if (0 == grub_strcasecmp(filename + len - 4, ".efi"))
+        {
+            type = img_type_efi;
+        }
+        #endif
         else
         {
             return 0;
         else
         {
             return 0;
@@ -831,12 +847,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
                 }
             }
             
                 }
             }
             
-            grub_snprintf(img->path, sizeof(img->path), "%s%s", node->dir, img->name);
+            img->pathlen = grub_snprintf(img->path, sizeof(img->path), "%s%s", node->dir, img->name);
 
             img->size = info->size;
             if (0 == img->size)
             {
 
             img->size = info->size;
             if (0 == img->size)
             {
-                img->size = ventoy_grub_get_file_size("%s/%s", g_iso_path, img->path);
+                img->size = ventoy_grub_get_file_size("%s/%s%s", g_iso_path, node->dir, filename);
             }
 
             if (img->size < VTOY_FILT_MIN_FILE_SIZE)
             }
 
             if (img->size < VTOY_FILT_MIN_FILE_SIZE)
@@ -876,6 +892,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
             g_ventoy_img_count++;
 
             img->alias = ventoy_plugin_get_menu_alias(img->path);
             g_ventoy_img_count++;
 
             img->alias = ventoy_plugin_get_menu_alias(img->path);
+            img->class = ventoy_plugin_get_menu_class(img->name);
+            if (!img->class)
+            {
+                img->class = g_menu_class[type];
+            }
+            img->menu_prefix = g_menu_prefix[type];
 
             debug("Add %s%s to list %d\n", node->dir, filename, g_ventoy_img_count);
         }
 
             debug("Add %s%s to list %d\n", node->dir, filename, g_ventoy_img_count);
         }
@@ -1025,7 +1047,7 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
         if (g_default_menu_mode == 0)
         {
             vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
         if (g_default_menu_mode == 0)
         {
             vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
-                          "menuentry \"%-10s [Return to ListView]\" VTOY_RET {\n  "
+                          "menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n  "
                           "  echo 'return ...' \n"
                           "}\n", "<--");
         }
                           "  echo 'return ...' \n"
                           "}\n", "<--");
         }
@@ -1034,11 +1056,11 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
     {
         node->dir[node->dirlen - 1] = 0;
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
     {
         node->dir[node->dirlen - 1] = 0;
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
-                      "submenu \"%-10s [%s]\" {\n", 
+                      "submenu \"%-10s [%s]\" --class=\"vtoydir\" {\n", 
                       "DIR", node->dir + offset);
 
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
                       "DIR", node->dir + offset);
 
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
-                      "menuentry \"%-10s [../]\" VTOY_RET {\n  "
+                      "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n  "
                       "  echo 'return ...' \n"
                       "}\n", "<--");
     }
                       "  echo 'return ...' \n"
                       "}\n", "<--");
     }
@@ -1051,13 +1073,13 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
     while ((img = ventoy_get_min_iso(node)) != NULL)
     {
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
     while ((img = ventoy_get_min_iso(node)) != NULL)
     {
         vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, 
-                      "menuentry \"%-10s %s%s\" --id=\"VID_%d\" {\n"
+                      "menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
                       "  %s_%s \n" 
                       "}\n", 
                       grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT), 
                       img->unsupport ? "[unsupported] " : "", 
                       "  %s_%s \n" 
                       "}\n", 
                       grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT), 
                       img->unsupport ? "[unsupported] " : "", 
-                      img->alias ? img->alias : img->name, img->id,
-                      (img->type == img_type_iso) ? "iso" : "wim",
+                      img->alias ? img->alias : img->name, img->class, img->id,
+                      img->menu_prefix,
                       img->unsupport ? "unsupport_menuentry" : "common_menuentry");
     }
 
                       img->unsupport ? "unsupport_menuentry" : "common_menuentry");
     }
 
@@ -1077,8 +1099,11 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
     grub_device_t dev = NULL;
     img_info *cur = NULL;
     img_info *tail = NULL;
     grub_device_t dev = NULL;
     img_info *cur = NULL;
     img_info *tail = NULL;
+    img_info *default_node = NULL;
     const char *strdata = NULL;
     char *device_name = NULL;
     const char *strdata = NULL;
     char *device_name = NULL;
+    const char *default_image = NULL;
+    int img_len = 0;
     char buf[32];
     img_iterator_node *node = NULL;
     img_iterator_node *tmp = NULL;
     char buf[32];
     img_iterator_node *node = NULL;
     img_iterator_node *tmp = NULL;
@@ -1188,22 +1213,45 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
     if (g_default_menu_mode == 1)
     {
         vtoy_ssprintf(g_list_script_buf, g_list_script_pos, 
     if (g_default_menu_mode == 1)
     {
         vtoy_ssprintf(g_list_script_buf, g_list_script_pos, 
-                      "menuentry \"%s [Return to TreeView]\" VTOY_RET {\n  "
+                      "menuentry \"%s [Return to TreeView]\" --class=\"vtoyret\" VTOY_RET {\n  "
                       "  echo 'return ...' \n"
                       "}\n", "<--");
     }
 
                       "  echo 'return ...' \n"
                       "}\n", "<--");
     }
 
+    if (g_default_menu_mode == 0)
+    {
+        default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");        
+        if (default_image)
+        {
+            img_len = grub_strlen(default_image);
+        }
+    }
+
     for (cur = g_ventoy_img_list; cur; cur = cur->next)
     {
         vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
     for (cur = g_ventoy_img_list; cur; cur = cur->next)
     {
         vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
-                  "menuentry \"%s%s\" --id=\"VID_%d\" {\n"
+                  "menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
                   "  %s_%s \n" 
                   "}\n", 
                   cur->unsupport ? "[unsupported] " : "", 
                   "  %s_%s \n" 
                   "}\n", 
                   cur->unsupport ? "[unsupported] " : "", 
-                  cur->alias ? cur->alias : cur->name, cur->id,
-                  (cur->type == img_type_iso) ? "iso" : "wim",
+                  cur->alias ? cur->alias : cur->name, cur->class, cur->id,
+                  cur->menu_prefix,
                   cur->unsupport ? "unsupport_menuentry" : "common_menuentry");
                   cur->unsupport ? "unsupport_menuentry" : "common_menuentry");
+
+        if (g_default_menu_mode == 0 && default_image && default_node == NULL)
+        {
+            if (img_len == cur->pathlen && grub_strcmp(default_image, cur->path) == 0)
+            {
+                default_node = cur;
+            }
+        }
+    }
+
+    if (default_node)
+    {
+        vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
     }
     }
+    
     g_list_script_buf[g_list_script_pos] = 0;
 
     grub_snprintf(buf, sizeof(buf), "%d", g_ventoy_img_count);
     g_list_script_buf[g_list_script_pos] = 0;
 
     grub_snprintf(buf, sizeof(buf), "%d", g_ventoy_img_count);
@@ -1421,6 +1469,7 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
 {
     char *pos;
     const char *fs = NULL;
 {
     char *pos;
     const char *fs = NULL;
+    const char *cdprompt = NULL;
     grub_uint32_t i;
     grub_uint8_t  chksum = 0;
     grub_disk_t   disk;
     grub_uint32_t i;
     grub_uint8_t  chksum = 0;
     grub_disk_t   disk;
@@ -1449,6 +1498,17 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
     
     param->vtoy_reserved[2] = g_ventoy_chain_type;
 
     
     param->vtoy_reserved[2] = g_ventoy_chain_type;
 
+    /* Windows CD/DVD prompt   0:suppress  1:reserved */
+    param->vtoy_reserved[4] = 0;
+    if (g_ventoy_chain_type == 1) /* Windows */
+    {
+        cdprompt = ventoy_get_env("VTOY_WINDOWS_CD_PROMPT");
+        if (cdprompt && cdprompt[0] == '1' && cdprompt[1] == 0)
+        {
+            param->vtoy_reserved[4] = 1;
+        }
+    }
+    
     fs = ventoy_get_env("ventoy_fs_probe");
     if (fs && grub_strcmp(fs, "udf") == 0)
     {
     fs = ventoy_get_env("ventoy_fs_probe");
     if (fs && grub_strcmp(fs, "udf") == 0)
     {
@@ -1905,7 +1965,7 @@ static grub_err_t ventoy_cmd_dump_img_list(grub_extcmd_context_t ctxt, int argc,
 
     while (cur)
     {
 
     while (cur)
     {
-        grub_printf("path:<%s>\n", cur->path);
+        grub_printf("path:<%s> id=%d\n", cur->path, cur->id);
         grub_printf("name:<%s>\n\n", cur->name);
         cur = cur->next;
     }
         grub_printf("name:<%s>\n\n", cur->name);
         cur = cur->next;
     }
index c621b1f858720cd2dbbe7251e835e82241e1cd25..4717f09450be30cf9f68037a8efd2525ff7eac8f 100644 (file)
@@ -127,13 +127,18 @@ typedef struct ventoy_udf_override
 
 #define img_type_iso 0
 #define img_type_wim 1
 
 #define img_type_iso 0
 #define img_type_wim 1
+#define img_type_efi 2
+#define img_type_img 3
 
 typedef struct img_info
 {
 
 typedef struct img_info
 {
+    int pathlen;
     char path[512];
     char name[256];
 
     const char *alias;
     char path[512];
     char name[256];
 
     const char *alias;
+    const char *class;
+    const char *menu_prefix;
     
     int id;
     int type;
     
     int id;
     int type;
@@ -623,6 +628,15 @@ typedef struct menu_alias
     struct menu_alias *next;
 }menu_alias;
 
     struct menu_alias *next;
 }menu_alias;
 
+typedef struct menu_class
+{
+    int  patlen;
+    char pattern[256];
+    char class[64];
+
+    struct menu_class *next;
+}menu_class;
+
 extern int g_ventoy_menu_esc;
 extern int g_ventoy_suppress_esc;
 extern int g_ventoy_last_entry;
 extern int g_ventoy_menu_esc;
 extern int g_ventoy_suppress_esc;
 extern int g_ventoy_last_entry;
@@ -641,6 +655,7 @@ void ventoy_plugin_dump_auto_install(void);
 int ventoy_fill_windows_rtdata(void *buf, char *isopath);
 int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
 const char * ventoy_plugin_get_menu_alias(const char *isopath);
 int ventoy_fill_windows_rtdata(void *buf, char *isopath);
 int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
 const char * ventoy_plugin_get_menu_alias(const char *isopath);
+const char * ventoy_plugin_get_menu_class(const char *isoname);
 int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
 int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
 void ventoy_plugin_dump_persistence(void);
 int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
 int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
 void ventoy_plugin_dump_persistence(void);
index 1948d0af4c4a859899bf443aafaa3d64fcc07798..6bb4e9c0b89181161790460b5c80f13cbe01324c 100644 (file)
@@ -33,6 +33,7 @@
 #include <grub/i18n.h>
 #include <grub/net.h>
 #include <grub/time.h>
 #include <grub/i18n.h>
 #include <grub/net.h>
 #include <grub/time.h>
+#include <grub/font.h>
 #include <grub/ventoy.h>
 #include "ventoy_def.h"
 
 #include <grub/ventoy.h>
 #include "ventoy_def.h"
 
@@ -42,6 +43,7 @@ static char g_iso_disk_name[128];
 static install_template *g_install_template_head = NULL;
 static persistence_config *g_persistence_head = NULL;
 static menu_alias *g_menu_alias_head = NULL;
 static install_template *g_install_template_head = NULL;
 static persistence_config *g_persistence_head = NULL;
 static menu_alias *g_menu_alias_head = NULL;
+static menu_class *g_menu_class_head = NULL;
 
 static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
 {
 
 static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
 {
@@ -114,6 +116,7 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
 {
     int exist = 0;
     const char *value;
 {
     int exist = 0;
     const char *value;
+    VTOY_JSON *node;
     
     value = vtoy_json_get_string_ex(json->pstChild, "file");
     if (value)
     
     value = vtoy_json_get_string_ex(json->pstChild, "file");
     if (value)
@@ -165,6 +168,29 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
         grub_printf("ventoy_color: %s\n", value);
     }
 
         grub_printf("ventoy_color: %s\n", value);
     }
 
+    node = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "fonts");
+    if (node)
+    {
+        for (node = node->pstChild; node; node = node->pstNext)
+        {
+            if (node->enDataType == JSON_TYPE_STRING)
+            {
+                if (ventoy_check_file_exist("%s%s", isodisk, node->unData.pcStrVal))
+                {
+                    grub_printf("%s [OK]\n", node->unData.pcStrVal);
+                }
+                else
+                {
+                    grub_printf("%s [NOT EXIST]\n", node->unData.pcStrVal);
+                }
+            }
+        }
+    }
+    else
+    {
+        grub_printf("fonts NOT found\n");
+    }
+
     return 0;
 }
 
     return 0;
 }
 
@@ -172,6 +198,7 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
 {
     const char *value;
     char filepath[256];
 {
     const char *value;
     char filepath[256];
+    VTOY_JSON *node;
     
     value = vtoy_json_get_string_ex(json->pstChild, "file");
     if (value)
     
     value = vtoy_json_get_string_ex(json->pstChild, "file");
     if (value)
@@ -227,6 +254,20 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
         grub_env_set("VTLE_CLR", value);
     }
 
         grub_env_set("VTLE_CLR", value);
     }
 
+    node = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "fonts");
+    if (node)
+    {
+        for (node = node->pstChild; node; node = node->pstNext)
+        {
+            if (node->enDataType == JSON_TYPE_STRING && 
+                ventoy_check_file_exist("%s%s", isodisk, node->unData.pcStrVal))
+            {
+                grub_snprintf(filepath, sizeof(filepath), "%s%s", isodisk, node->unData.pcStrVal);
+                grub_font_load(filepath);
+            }
+        }
+    }
+
     return 0;
 }
 
     return 0;
 }
 
@@ -612,7 +653,15 @@ static int ventoy_plugin_menualias_check(VTOY_JSON *json, const char *isodisk)
         alias = vtoy_json_get_string_ex(pNode->pstChild, "alias");
         if (iso && iso[0] == '/' && alias)
         {
         alias = vtoy_json_get_string_ex(pNode->pstChild, "alias");
         if (iso && iso[0] == '/' && alias)
         {
-            grub_printf("image: <%s>\n", iso);
+            if (ventoy_is_file_exist("%s%s", isodisk, iso))
+            {
+                grub_printf("image: <%s> [ OK ]\n", iso);
+            }
+            else
+            {
+                grub_printf("image: <%s> [ NOT EXIST ]\n", iso);
+            }
+
             grub_printf("alias: <%s>\n\n", alias);
         }
     }
             grub_printf("alias: <%s>\n\n", alias);
         }
     }
@@ -672,6 +721,90 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk)
     return 0;
 }
 
     return 0;
 }
 
+static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
+{
+    const char *key = NULL;
+    const char *class = NULL;
+    VTOY_JSON *pNode = NULL;
+    menu_class *tail = NULL;
+    menu_class *node = NULL;
+    menu_class *next = NULL;
+
+    (void)isodisk;
+
+    if (json->enDataType != JSON_TYPE_ARRAY)
+    {
+        debug("Not array %d\n", json->enDataType);
+        return 0;
+    }
+
+    if (g_menu_class_head)
+    {
+        for (node = g_menu_class_head; node; node = next)
+        {
+            next = node->next;
+            grub_free(node);
+        }
+
+        g_menu_class_head = NULL;
+    }
+
+    for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
+    {
+        key = vtoy_json_get_string_ex(pNode->pstChild, "key");
+        class = vtoy_json_get_string_ex(pNode->pstChild, "class");
+        if (key && class)
+        {
+            node = grub_zalloc(sizeof(menu_class));
+            if (node)
+            {
+                node->patlen = grub_snprintf(node->pattern, sizeof(node->pattern), "%s", key);
+                grub_snprintf(node->class, sizeof(node->class), "%s", class);
+
+                if (g_menu_class_head)
+                {
+                    tail->next = node;
+                }
+                else
+                {
+                    g_menu_class_head = node;
+                }
+                tail = node;
+            }
+        }
+    }
+
+    return 0;
+}
+
+static int ventoy_plugin_menuclass_check(VTOY_JSON *json, const char *isodisk)
+{
+    const char *key = NULL;
+    const char *class = NULL;
+    VTOY_JSON *pNode = NULL;
+
+    (void)isodisk;
+
+    if (json->enDataType != JSON_TYPE_ARRAY)
+    {
+        grub_printf("Not array %d\n", json->enDataType);
+        return 1;
+    }
+
+    for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
+    {
+        key = vtoy_json_get_string_ex(pNode->pstChild, "key");
+        class = vtoy_json_get_string_ex(pNode->pstChild, "class");
+        if (key && class)
+        {
+            grub_printf("key: <%s>\n", key);
+            grub_printf("class: <%s>\n\n", class);
+        }
+    }
+
+    return 0;
+}
+
 static plugin_entry g_plugin_entries[] = 
 {
     { "control", ventoy_plugin_control_entry, ventoy_plugin_control_check },
 static plugin_entry g_plugin_entries[] = 
 {
     { "control", ventoy_plugin_control_entry, ventoy_plugin_control_check },
@@ -679,6 +812,7 @@ static plugin_entry g_plugin_entries[] =
     { "auto_install", ventoy_plugin_auto_install_entry, ventoy_plugin_auto_install_check },
     { "persistence", ventoy_plugin_persistence_entry, ventoy_plugin_persistence_check },
     { "menu_alias", ventoy_plugin_menualias_entry, ventoy_plugin_menualias_check },
     { "auto_install", ventoy_plugin_auto_install_entry, ventoy_plugin_auto_install_check },
     { "persistence", ventoy_plugin_persistence_entry, ventoy_plugin_persistence_check },
     { "menu_alias", ventoy_plugin_menualias_entry, ventoy_plugin_menualias_check },
+    { "menu_class", ventoy_plugin_menuclass_entry, ventoy_plugin_menuclass_check },
 };
 
 static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk)
 };
 
 static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk)
@@ -932,6 +1066,23 @@ const char * ventoy_plugin_get_menu_alias(const char *isopath)
     return NULL;
 }
 
     return NULL;
 }
 
+const char * ventoy_plugin_get_menu_class(const char *isoname)
+{
+    menu_class *node = NULL;
+    int len = (int)grub_strlen(isoname);
+    
+    for (node = g_menu_class_head; node; node = node->next)
+    {
+        if (node->patlen <= len && grub_strstr(isoname, node->pattern))
+        {
+            return node->class;
+        }
+    }
+
+    return NULL;
+}
+
+
 grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int i = 0;
 grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int i = 0;
index 438b6985f4b6f8a2f77000d23b2326d3f6c4db54..76975dbfa113e7e53da963ec01d1441e65333989 100644 (file)
@@ -45,6 +45,9 @@ static int g_wim_total_patch_count = 0;
 static int g_wim_valid_patch_count = 0;
 static wim_patch *g_wim_patch_head = NULL;
 
 static int g_wim_valid_patch_count = 0;
 static wim_patch *g_wim_patch_head = NULL;
 
+static grub_uint64_t g_suppress_wincd_override_offset = 0;
+static grub_uint32_t g_suppress_wincd_override_data = 0;
+
 grub_uint8_t g_temp_buf[512];
 
 grub_ssize_t lzx_decompress ( const void *data, grub_size_t len, void *buf );
 grub_uint8_t g_temp_buf[512];
 
 grub_ssize_t lzx_decompress ( const void *data, grub_size_t len, void *buf );
@@ -923,13 +926,15 @@ grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, cha
 
 static grub_uint32_t ventoy_get_override_chunk_num(void)
 {
 
 static grub_uint32_t ventoy_get_override_chunk_num(void)
 {
+    grub_uint32_t chunk_num = 0;
+    
     if (g_iso_fs_type == 0)
     {
         /* ISO9660: */
         /* per wim */
         /* 1: file_size and file_offset */
         /* 2: new wim file header */
     if (g_iso_fs_type == 0)
     {
         /* ISO9660: */
         /* per wim */
         /* 1: file_size and file_offset */
         /* 2: new wim file header */
-        return g_wim_valid_patch_count * 2;
+        chunk_num = g_wim_valid_patch_count * 2;
     }
     else
     {
     }
     else
     {
@@ -941,8 +946,24 @@ static grub_uint32_t ventoy_get_override_chunk_num(void)
         /* 1: file_size in file_entry or extend_file_entry */
         /* 2: data_size and position in extend data short ad */
         /* 3: new wim file header */
         /* 1: file_size in file_entry or extend_file_entry */
         /* 2: data_size and position in extend data short ad */
         /* 3: new wim file header */
-        return g_wim_valid_patch_count * 3 + 1;        
+        chunk_num = g_wim_valid_patch_count * 3 + 1;
+    }
+
+    if (g_suppress_wincd_override_offset > 0)
+    {
+        chunk_num++;
     }
     }
+
+    return chunk_num;
+}
+
+static void ventoy_fill_suppress_wincd_override_data(void *override)
+{
+    ventoy_override_chunk *cur = (ventoy_override_chunk *)override;
+
+    cur->override_size = 4;
+    cur->img_offset = g_suppress_wincd_override_offset;
+    grub_memcpy(cur->override_data, &g_suppress_wincd_override_data, cur->override_size);
 }
 
 static void ventoy_windows_fill_override_data_iso9660(    grub_uint64_t isosize, void *override)
 }
 
 static void ventoy_windows_fill_override_data_iso9660(    grub_uint64_t isosize, void *override)
@@ -958,6 +979,12 @@ static void ventoy_windows_fill_override_data_iso9660(    grub_uint64_t isosize,
 
     cur = (ventoy_override_chunk *)override;
 
 
     cur = (ventoy_override_chunk *)override;
 
+    if (g_suppress_wincd_override_offset > 0)
+    {
+        ventoy_fill_suppress_wincd_override_data(cur);
+        cur++;
+    }
+
     debug("ventoy_windows_fill_override_data_iso9660 %lu\n", (ulong)isosize);
 
     for (node = g_wim_patch_head; node; node = node->next)
     debug("ventoy_windows_fill_override_data_iso9660 %lu\n", (ulong)isosize);
 
     for (node = g_wim_patch_head; node; node = node->next)
@@ -1012,6 +1039,12 @@ static void ventoy_windows_fill_override_data_udf(    grub_uint64_t isosize, voi
     sector = (isosize + 2047) / 2048;
 
     cur = (ventoy_override_chunk *)override;
     sector = (isosize + 2047) / 2048;
 
     cur = (ventoy_override_chunk *)override;
+    
+    if (g_suppress_wincd_override_offset > 0)
+    {
+        ventoy_fill_suppress_wincd_override_data(cur);
+        cur++;
+    }
 
     debug("ventoy_windows_fill_override_data_udf %lu\n", (ulong)isosize);
 
 
     debug("ventoy_windows_fill_override_data_udf %lu\n", (ulong)isosize);
 
@@ -1182,6 +1215,61 @@ static int ventoy_windows_drive_map(ventoy_chain_head *chain)
     return 0;
 }
 
     return 0;
 }
 
+static int ventoy_suppress_windows_cd_prompt(void)
+{
+    int rc = 1;
+    const char  *cdprompt = NULL;
+    grub_uint64_t readpos = 0;
+    grub_file_t file = NULL;
+    grub_uint8_t data[32];
+
+    cdprompt = ventoy_get_env("VTOY_WINDOWS_CD_PROMPT");
+    if (cdprompt && cdprompt[0] == '1' && cdprompt[1] == 0)
+    {
+        debug("VTOY_WINDOWS_CD_PROMPT:<%s>\n", cdprompt);
+        return 0;
+    }
+
+    g_ventoy_case_insensitive = 1;
+    file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s/boot/bootfix.bin", "(loop)");
+    g_ventoy_case_insensitive = 0;
+
+    if (!file)
+    {
+        debug("Failed to open %s\n", "bootfix.bin");
+        goto end;
+    }
+
+    grub_file_read(file, data, 32);
+
+    if (file->fs && file->fs->name && grub_strcmp(file->fs->name, "udf") == 0)
+    {
+        readpos = grub_udf_get_file_offset(file);
+    }
+    else
+    {
+        readpos = grub_iso9660_get_last_read_pos(file);
+    }
+
+    debug("bootfix.bin readpos:%lu (sector:%lu)  data: %02x %02x %02x %02x\n", 
+        (ulong)readpos, (ulong)readpos / 2048, data[24], data[25], data[26], data[27]);
+
+    if (*(grub_uint32_t *)(data + 24) == 0x13cd0080)
+    {
+        g_suppress_wincd_override_offset = readpos + 24;
+        g_suppress_wincd_override_data = 0x13cd00fd;
+
+        rc = 0;
+    }
+
+    debug("g_suppress_wincd_override_offset:%lu\n", (ulong)g_suppress_wincd_override_offset);
+
+end:
+    check_free(file, grub_file_close);
+
+    return rc;
+}
+
 grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int unknown_image = 0;
 grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int unknown_image = 0;
@@ -1250,11 +1338,18 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
         }
     }
 
         }
     }
 
+    g_suppress_wincd_override_offset = 0;
+    if (!ventoy_is_efi_os()) /* legacy mode */
+    {
+        ventoy_suppress_windows_cd_prompt();
+    }
+
     img_chunk_size = g_img_chunk_list.cur_chunk * sizeof(ventoy_img_chunk);
     
     if (ventoy_compatible || unknown_image)
     {
     img_chunk_size = g_img_chunk_list.cur_chunk * sizeof(ventoy_img_chunk);
     
     if (ventoy_compatible || unknown_image)
     {
-        size = sizeof(ventoy_chain_head) + img_chunk_size;
+        override_size = g_suppress_wincd_override_offset > 0 ? sizeof(ventoy_override_chunk) : 0;
+        size = sizeof(ventoy_chain_head) + img_chunk_size + override_size;
     }
     else
     {
     }
     else
     {
@@ -1319,6 +1414,13 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
 
     if (ventoy_compatible || unknown_image)
     {
 
     if (ventoy_compatible || unknown_image)
     {
+        if (g_suppress_wincd_override_offset > 0)
+        {
+            chain->override_chunk_offset = chain->img_chunk_offset + img_chunk_size;
+            chain->override_chunk_num = 1;
+            ventoy_fill_suppress_wincd_override_data((char *)chain + chain->override_chunk_offset);
+        }
+
         return 0;
     }
 
         return 0;
     }
 
index 6c320725dfdc31060aaec4300220efe83d84ba80..5b684b495a69d4a38e4a5f2575178f6661f3fd3e 100644 (file)
@@ -111,6 +111,7 @@ typedef struct ventoy_os_param
      * vtoy_reserved[1]: vtoy_debug_level
      * vtoy_reserved[2]: vtoy_chain_type     0:Linux    1:Windows
      * vtoy_reserved[3]: vtoy_iso_format     0:iso9660  1:udf
      * vtoy_reserved[1]: vtoy_debug_level
      * vtoy_reserved[2]: vtoy_chain_type     0:Linux    1:Windows
      * vtoy_reserved[3]: vtoy_iso_format     0:iso9660  1:udf
+     * vtoy_reserved[4]: vtoy_windows_cd_prompt
      *
      */
     grub_uint8_t   vtoy_reserved[32];    // Internal use by ventoy
      *
      */
     grub_uint8_t   vtoy_reserved[32];    // Internal use by ventoy
index 930330839c5327e841cb512d31772877aa67cdc1..1dc952af454a9abd991e97a0a69c0d8d15b32629 100644 (file)
@@ -12,14 +12,15 @@ make install
 PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
 
 net_modules_legacy="net tftp http"
 PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
 
 net_modules_legacy="net tftp http"
-all_modules_legacy="date drivemap blocklist ntldr search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal  linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_msdos fat exfat ntfs loopback gzio normal  udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
+all_modules_legacy="date drivemap blocklist ntldr search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal  linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal  udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
 
 net_modules_uefi="efinet net tftp http"
 all_modules_uefi="blocklist ventoy test search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain  priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
 
 
 net_modules_uefi="efinet net tftp http"
 all_modules_uefi="blocklist ventoy test search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain  priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
 
+all_extra_modules="elf macho offsetio regexp file"
 
 if [ "$1" = "uefi" ]; then
 
 if [ "$1" = "uefi" ]; then
-    all_modules="$net_modules_uefi $all_modules_uefi"
+    all_modules="$net_modules_uefi $all_modules_uefi $all_extra_modules"
     grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,msdos2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi"  --format 'x86_64-efi' --compression 'auto'  $all_modules_uefi 'fat' 'part_msdos'
 else
     all_modules="$net_modules_legacy $all_modules_legacy"
     grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,msdos2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi"  --format 'x86_64-efi' --compression 'auto'  $all_modules_uefi 'fat' 'part_msdos'
 else
     all_modules="$net_modules_legacy $all_modules_legacy"
@@ -38,6 +39,11 @@ else
     rm -f $VT_DIR/GRUB2/NBP/core.0
     cp -a $VT_DIR/GRUB2/PXE/grub2/i386-pc/core.0    $VT_DIR/GRUB2/NBP/core.0  || exit 1
     
     rm -f $VT_DIR/GRUB2/NBP/core.0
     cp -a $VT_DIR/GRUB2/PXE/grub2/i386-pc/core.0    $VT_DIR/GRUB2/NBP/core.0  || exit 1
     
+    for md in $all_extra_modules; do
+        rm -f $VT_DIR/INSTALL/grub/i386-pc/${md}.mod
+        cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/${md}.mod  $VT_DIR/INSTALL/grub/i386-pc/
+    done
+    
     rm -f $VT_DIR/INSTALL/grub/i386-pc/boot.img
     cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/boot.img  $VT_DIR/INSTALL/grub/i386-pc/boot.img   || exit 1
 fi
     rm -f $VT_DIR/INSTALL/grub/i386-pc/boot.img
     cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/boot.img  $VT_DIR/INSTALL/grub/i386-pc/boot.img   || exit 1
 fi
similarity index 77%
rename from IMG/cpio/ventoy/hook/guix/ventoy-waitdev.sh
rename to IMG/cpio/ventoy/hook/adelie/disk-hook.sh
index 22cdd92b141f2dcc56ae15d781bb6c2d561a7f84..8ee05793258c9a3260b4c1f34efd8041fa465ae3 100644 (file)
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
 
 . /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
 
 vtlog "####### $0 $* ########"
 
 VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
 
-while ! [ -e /dev/null ]; do
-    echo 'xxxxxxxxxx'
-    echo 'xxxxxxxxxx' > /dev/console
-    sleep 1
-done
+wait_for_usb_disk_ready
 
 
-vtlog "... start inotifyd listen $vtHook ..."
-$BUSYBOX_PATH/nohup $VTOY_PATH/tool/inotifyd  $VTOY_PATH/hook/guix/ventoy-disk.sh  /dev:n  2>&-  & 
+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"
 
 PATH=$VTPATH_OLD
 
 
 PATH=$VTPATH_OLD
 
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh b/IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..00d9eb0
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$VTOY_PATH/hook/adelie/disk-hook.sh &
+
index d886a2455a45c8fa2888080b0e04802e75289dfa..9a7fc661445cbc013a583b0bc829ee78bbdf60cd 100644 (file)
@@ -32,13 +32,14 @@ fi
 
 # 
 # We do a trick for ATL series here.
 
 # 
 # We do a trick for ATL series here.
-# Use /dev/loop7 and wapper it as a cdrom with bind mount.
-# Then the installer will accept /dev/loop7 as the install medium.
+# Use /dev/vtCheatLoop and wapper it as a cdrom with bind mount.
+# Then the installer will accept /dev/vtCheatLoop as the install medium.
 #
 #
-ventoy_copy_device_mapper  /dev/loop7
-$BUSYBOX_PATH/mkdir -p /tmp/loop7/device/
-echo 5 > /tmp/loop7/device/type
-$BUSYBOX_PATH/mount --bind /tmp/loop7 /sys/block/loop7 >> $VTLOG 2>&1
+vtCheatLoop=loop6
+ventoy_copy_device_mapper  /dev/$vtCheatLoop
+$BUSYBOX_PATH/mkdir -p /tmp/$vtCheatLoop/device/
+echo 5 > /tmp/$vtCheatLoop/device/type
+$BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
 
 
 # OK finish
 
 
 # OK finish
diff --git a/IMG/cpio/ventoy/hook/arch/ovios-disk.sh b/IMG/cpio/ventoy/hook/arch/ovios-disk.sh
new file mode 100644 (file)
index 0000000..561dc27
--- /dev/null
@@ -0,0 +1,50 @@
+#!/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
+
+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/')
+blkdev_num_mknod=$($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 "blkdev_num=$blkdev_num blkdev_num_mknod=$blkdev_num_mknod vtDM=$vtDM"
+
+if [ -b /dev/$vtDM ]; then
+    vtlog "dev already exist ..."
+else
+    vtlog "mknode dev ..."
+    mknod -m 660 /dev/$vtDM  b  $blkdev_num_mknod
+fi
+
+PATH=$VTPATH_OLD
index e65fb5bf9f1dce2a574a09ba95637f0abfc14637..7c99f77e4b0e54a078964841d4c5acfc8415c55c 100644 (file)
@@ -26,6 +26,14 @@ if $GREP -q '^"$mount_handler"' /init; then
     if [ -f /hooks/archiso ]; then
         $SED  '/while ! poll_device "${dev}"/a\    if /ventoy/busybox/sh /ventoy/hook/arch/ventoy-timeout.sh ${dev}; then break; fi'   -i /hooks/archiso
     fi
     if [ -f /hooks/archiso ]; then
         $SED  '/while ! poll_device "${dev}"/a\    if /ventoy/busybox/sh /ventoy/hook/arch/ventoy-timeout.sh ${dev}; then break; fi'   -i /hooks/archiso
     fi
+elif $GREP -q '^KEEP_SEARCHING' /init; then
+    echo 'KEEP_SEARCHING found ...' >> $VTLOG
+    $SED "/^KEEP_SEARCHING/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ovios-disk.sh " -i /init
+    
+    $BUSYBOX_PATH/mkdir -p /dev    
+    $BUSYBOX_PATH/mkdir -p /sys
+    $BUSYBOX_PATH/mount -t sysfs sys /sys
+    
 else
     # some archlinux initramfs doesn't contain device-mapper udev rules file
     ARCH_UDEV_DIR=$(ventoy_get_udev_conf_dir)
 else
     # some archlinux initramfs doesn't contain device-mapper udev rules file
     ARCH_UDEV_DIR=$(ventoy_get_udev_conf_dir)
index 28943562aba272f560ef9c36d95de80354a0e6e0..8fa19a410e0e1b6a0bb8e5df82ad16d12b54f7fd 100644 (file)
@@ -32,4 +32,5 @@ if [ "$vtdiskname" = "unknown" ]; then
     exit 0
 fi
 
     exit 0
 fi
 
+vtlog "${vtdiskname#/dev/}2 found..."
 $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
 $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
index 007d2fa37a574693229a9377dfebe53423ffe540..6dd6882b39c12856d934db2c3b5e86c09516b8d1 100644 (file)
@@ -21,6 +21,8 @@
 
 ventoy_os_install_dmsetup() {
 
 
 ventoy_os_install_dmsetup() {
 
+    vtlog "ventoy_os_install_dmsetup $1 ..."
+
     vt_usb_disk=$1
 
     # dump iso file location
     vt_usb_disk=$1
 
     # dump iso file location
diff --git a/IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh b/IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh
new file mode 100644 (file)
index 0000000..c29ca07
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$BUSYBOX_PATH/mkdir /dev
+$BUSYBOX_PATH/mknod -m 0660 /dev/null c 1 3
+
+$BUSYBOX_PATH/sh $VTOY_PATH/hook/guix/ventoy-disk.sh &
+
index 6d679419190664352f545a40174781cb38248980..561dc27a0a5df4c200439487245a21f2d72c1831 100644 (file)
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
-if is_ventoy_hook_finished; then
+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
 
     exit 0
 fi
 
-vtlog "##### INOTIFYD: $2/$3 is created ..."
-
-VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
 
 
-if is_inotify_ventoy_part $3; then
-    vtlog "find ventoy partition ..."
-    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3
-    
-    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})
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+blkdev_num_mknod=$($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 "This is $vtDM ..."
+vtlog "blkdev_num=$blkdev_num blkdev_num_mknod=$blkdev_num_mknod vtDM=$vtDM"
 
 
-    set_ventoy_hook_finish
+if [ -b /dev/$vtDM ]; then
+    vtlog "dev already exist ..."
+else
+    vtlog "mknode dev ..."
+    mknod -m 660 /dev/$vtDM  b  $blkdev_num_mknod
 fi
 
 PATH=$VTPATH_OLD
 fi
 
 PATH=$VTPATH_OLD
index 4678c83eb03cf269a73ba99ff5554110d5294597..dc6474e5119409bac7dd9a01e4a35255e20812c5 100644 (file)
@@ -18,8 +18,3 @@
 #************************************************************************************
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
 #************************************************************************************
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
-
-$BUSYBOX_PATH/mkdir /dev
-$BUSYBOX_PATH/mknode -m 0666 /dev/null c 1 3
-
-$BUSYBOX_PATH/nohup $VTOY_PATH/hook/guix/ventoy-waitdev.sh &
index d84f0bc8b6ad53520b50486c6f1510a7b59a0345..a1954ce534164eec5eb7e8ea25019edc57363b0c 100644 (file)
@@ -19,6 +19,8 @@
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
+vtCheatLoop=loop6
+
 ventoy_os_install_dmsetup() {
     vtlog "ventoy_os_install_dmsetup $1"
     
 ventoy_os_install_dmsetup() {
     vtlog "ventoy_os_install_dmsetup $1"
     
@@ -50,9 +52,9 @@ ventoy_os_install_dmsetup() {
 
 
 if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
 
 
 if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
-    # /dev/loop7 come first
-    if [ "$1" = "loop7" ] && [ -b $VTOY_DM_PATH ]; then
-        ventoy_copy_device_mapper  /dev/loop7
+    # /dev/vtCheatLoop come first
+    if [ "$1" = "$vtCheatLoop" ] && [ -b $VTOY_DM_PATH ]; then
+        ventoy_copy_device_mapper  /dev/$vtCheatLoop
     fi
     exit 0
 fi
     fi
     exit 0
 fi
@@ -72,14 +74,14 @@ $BUSYBOX_PATH/mount $VTOY_DM_PATH /mnt/ventoy
 
 # 
 # We do a trick for rhel6 series here.
 
 # 
 # We do a trick for rhel6 series here.
-# Use /dev/loop7 and wapper it as a removable cdrom with bind mount.
-# Then the anaconda installer will accept /dev/loop7 as the install medium.
+# Use /dev/$vtCheatLoop and wapper it as a removable cdrom with bind mount.
+# Then the anaconda installer will accept /dev/$vtCheatLoop as the install medium.
 #
 #
-ventoy_copy_device_mapper  /dev/loop7
+ventoy_copy_device_mapper  /dev/$vtCheatLoop
 
 
-$BUSYBOX_PATH/cp -a /sys/devices/virtual/block/loop7 /tmp/ >> $VTLOG 2>&1
-echo 19 > /tmp/loop7/capability
-$BUSYBOX_PATH/mount --bind /tmp/loop7 /sys/block/loop7 >> $VTLOG 2>&1
+$BUSYBOX_PATH/cp -a /sys/devices/virtual/block/$vtCheatLoop /tmp/ >> $VTLOG 2>&1
+echo 19 > /tmp/$vtCheatLoop/capability
+$BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
 
 # OK finish
 set_ventoy_hook_finish
 
 # OK finish
 set_ventoy_hook_finish
index beb41e13d9c89ad702e7b30450728b45f09c8e71..d2f0f6ba9e4368f7a0746fa252e57bf65b9b172b 100644 (file)
@@ -23,4 +23,6 @@ $BUSYBOX_PATH/mkdir -p /etc/anaconda.repos.d  /mnt/ventoy
 ventoy_print_yum_repo "ventoy" "file:///mnt/ventoy" > /etc/anaconda.repos.d/ventoy.repo
 
 ventoy_add_udev_rule "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
 ventoy_print_yum_repo "ventoy" "file:///mnt/ventoy" > /etc/anaconda.repos.d/ventoy.repo
 
 ventoy_add_udev_rule "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
-ventoy_add_kernel_udev_rule "loop7" "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
+
+#loop7 was used by loader
+ventoy_add_kernel_udev_rule "loop6" "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
index 84f54923c914e1e4af7e45a64f50138155867f9d..640b08a9e2d48baf9b8f1e76610e5ae2a5334261 100644 (file)
@@ -192,6 +192,10 @@ ventoy_get_os_type() {
         echo 'android'; return
     fi 
     
         echo 'android'; return
     fi 
     
+    if $GREP -q 'adelielinux' /proc/version; then
+        echo 'adelie'; return
+    fi
+    
     echo "default"
 }
 
     echo "default"
 }
 
@@ -218,7 +222,6 @@ if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
     exec $BUSYBOX_PATH/sh
 fi
 
     exec $BUSYBOX_PATH/sh
 fi
 
-
 ####################################################################
 #                                                                  #
 # Step 4 : Hand over to real init                                  #
 ####################################################################
 #                                                                  #
 # Step 4 : Hand over to real init                                  #
@@ -235,7 +238,8 @@ if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
 fi
 
 cd /
 fi
 
 cd /
-unset VTOY_PATH VTLOG FIND GREP EGREP CAT AWK SED SLEEP HEAD
+
+unset VTLOG FIND GREP EGREP CAT AWK SED SLEEP HEAD
 
 for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
     if [ -d /ventoy_rdroot ]; then
 
 for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
     if [ -d /ventoy_rdroot ]; then
@@ -246,6 +250,9 @@ for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
         fi
     else
         if [ -e "$vtinit" ];then
         fi
     else
         if [ -e "$vtinit" ];then
+            if [ -f "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh" ]; then
+                $BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh"
+            fi
             exec "$vtinit"
         fi
     fi
             exec "$vtinit"
         fi
     fi
index 292c37ac2c40948575dcbcb366746e75737d5658..c6874c3342484867e4602e4d872cfeb14960041e 100644 (file)
Binary files a/INSTALL/EFI/BOOT/grubx64_real.efi and b/INSTALL/EFI/BOOT/grubx64_real.efi differ
index 2ed82b7936120d9e12aa31a23d16625125a10235..1539d7b0524af02374eaeb7b62135857f9e17278 100644 (file)
Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ
index 9e74ac7b074d297f6a5a805d9491475f552a0e3b..0def325c831602ae51dd8661e5b903a0099c942b 100644 (file)
@@ -1,34 +1,34 @@
-submenu 'Check plugin json configuration (ventoy.json)' {
+submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
     menuentry 'Check global control plugin configuration' {
         set pager=1
     menuentry 'Check global control plugin configuration' {
         set pager=1
-        vt_check_plugin_json $iso_path control $iso_path
+        vt_check_plugin_json $vt_plugin_path control $iso_path
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
-    menuentry 'Check theme plugin configuration' {
+    menuentry 'Check theme plugin configuration' --class=debug_theme {
         set pager=1
         set pager=1
-        vt_check_plugin_json $iso_path theme $iso_path
+        vt_check_plugin_json $vt_plugin_path theme $iso_path
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
-    menuentry 'Check auto install plugin configuration' {
+    menuentry 'Check auto install plugin configuration' --class=debug_autoinstall {
         set pager=1
         set pager=1
-        vt_check_plugin_json $iso_path auto_install $iso_path
+        vt_check_plugin_json $vt_plugin_path auto_install $iso_path
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
-    menuentry 'Check persistence plugin configuration' {
+    menuentry 'Check persistence plugin configuration' --class=debug_persistence {
         set pager=1
         set pager=1
-        vt_check_plugin_json $iso_path persistence $iso_path
+        vt_check_plugin_json $vt_plugin_path persistence $iso_path
         
         echo -e "\n############### dump persistence ###############"
         vt_dump_persistence
         
         echo -e "\n############### dump persistence ###############"
         vt_dump_persistence
@@ -38,20 +38,29 @@ submenu 'Check plugin json configuration (ventoy.json)' {
         unset pager
     }
     
         unset pager
     }
     
-    menuentry 'Check menu alias plugin configuration' {
+    menuentry 'Check menu alias plugin configuration' --class=debug_menualias {
         set pager=1
         set pager=1
-        vt_check_plugin_json $iso_path menu_alias $iso_path
+        vt_check_plugin_json $vt_plugin_path menu_alias $iso_path
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
         
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
     }
     
-    menuentry 'Return to previous menu [Esc]' VTOY_RET {
+    menuentry 'Check menu class plugin configuration' --class=debug_menuclass {
+        set pager=1
+        vt_check_plugin_json $vt_plugin_path menu_class $iso_path
+        
+        echo -e "\npress ENTER to exit ..."
+        read vtInputKey
+        unset pager
+    }
+    
+    menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
         echo 'Return ...'
     }
 }
 
         echo 'Return ...'
     }
 }
 
-menuentry 'Return to previous menu [Esc]' VTOY_RET {
+menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
     echo 'Return ...'
 }
     echo 'Return ...'
 }
index e7627f651155f55a37eee481058fdd3a8d3b5a96..144b78e109f86a09c2d021ac3c79aa15ff5500e5 100644 (file)
@@ -152,7 +152,9 @@ function distro_specify_initrd_file_phase2 {
         vt_linux_specify_initrd_file /live/initrd.img
     elif [ -f (loop)/initrd.img ]; then 
         vt_linux_specify_initrd_file /initrd.img
         vt_linux_specify_initrd_file /live/initrd.img
     elif [ -f (loop)/initrd.img ]; then 
         vt_linux_specify_initrd_file /initrd.img
-
+    elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then 
+        vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
+    
     fi
 }
 
     fi
 }
 
@@ -337,6 +339,8 @@ function uefi_iso_memdisk {
     terminal_output  console
     chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
     boot
     terminal_output  console
     chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
     boot
+    
+    terminal_output  gfxterm
 }
 
 
 }
 
 
@@ -502,12 +506,16 @@ function iso_common_menuentry {
     fi      
 }
 
     fi      
 }
 
-function iso_unsupport_menuentry {
+function common_unsupport_menuentry {
     echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
     echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
+    echo -e " 文件名中不能有中文或空格 \n"
     echo -e "\n Will return to main menu after 10 seconds ...\n"
     sleep 10
 }
 
     echo -e "\n Will return to main menu after 10 seconds ...\n"
     sleep 10
 }
 
+function iso_unsupport_menuentry {
+    common_unsupport_menuentry
+}
 
 function wim_common_menuentry {
     vt_chosen_img_path chosen_path
 
 function wim_common_menuentry {
     vt_chosen_img_path chosen_path
@@ -521,6 +529,7 @@ function wim_common_menuentry {
         else
             terminal_output  console       
             chainloader ${vtoy_path}/ventoy_x64.efi  env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
         else
             terminal_output  console       
             chainloader ${vtoy_path}/ventoy_x64.efi  env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+            terminal_output  gfxterm
         fi
         boot
     else
         fi
         boot
     else
@@ -530,9 +539,20 @@ function wim_common_menuentry {
 }
 
 function wim_unsupport_menuentry {
 }
 
 function wim_unsupport_menuentry {
-    echo -e "\n The name of the wim file could NOT contain space or non-ascii characters. \n"
-    echo -e "\n Will return to main menu after 10 seconds ...\n"
-    sleep 10
+    common_unsupport_menuentry
+}
+
+function efi_common_menuentry {
+    vt_chosen_img_path chosen_path
+    
+    terminal_output  console    
+    chainloader ${iso_path}${chosen_path}
+    boot
+    terminal_output  gfxterm
+}
+
+function efi_unsupport_menuentry {
+    common_unsupport_menuentry
 }
 
 #############################################################
 }
 
 #############################################################
@@ -543,16 +563,13 @@ function wim_unsupport_menuentry {
 #############################################################
 #############################################################
 
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.13"
+set VENTOY_VERSION="1.0.14"
 
 # Default menu display mode, you can change it as you want.
 #    0: List mode   
 #    1: TreeView mode
 set VTOY_DEFAULT_MENU_MODE=0
 
 
 # Default menu display mode, you can change it as you want.
 #    0: List mode   
 #    1: TreeView mode
 set VTOY_DEFAULT_MENU_MODE=0
 
-#disable timeout
-unset timeout
-
 set VTOY_MEM_DISK_STR="[Memdisk]"
 set VTOY_ISO_RAW_STR="Compatible Mode"
 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
 set VTOY_MEM_DISK_STR="[Memdisk]"
 set VTOY_ISO_RAW_STR="Compatible Mode"
 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
@@ -579,6 +596,13 @@ if [ "$vtoy_dev" = "tftp" ]; then
         fi
     done
     loadfont ascii
         fi
     done
     loadfont ascii
+
+    if [ -f $iso_path/ventoy/ventoy.json ]; then
+       set vt_plugin_path=$iso_path
+    else
+        set vt_plugin_path=$prefix
+        vt_load_plugin $vt_plugin_path
+    fi
 else
     if [ "$prefix" = "(ventoydisk)/grub" ]; then
         set vtoy_path=(ventoydisk)/ventoy
 else
     if [ "$prefix" = "(ventoydisk)/grub" ]; then
         set vtoy_path=(ventoydisk)/ventoy
@@ -589,6 +613,7 @@ else
     set iso_path=($vtoy_dev,1)
     set vtoy_efi_part=($vtoy_dev,2)
     loadfont unicode
     set iso_path=($vtoy_dev,1)
     set vtoy_efi_part=($vtoy_dev,2)
     loadfont unicode
+    set vt_plugin_path=$iso_path
 fi
 
 
 fi
 
 
@@ -597,6 +622,12 @@ if [ -f $iso_path/ventoy/ventoy.json ]; then
    vt_load_plugin $iso_path
 fi
 
    vt_load_plugin $iso_path
 fi
 
+if [ -n "$VTOY_MENU_TIMEOUT" ]; then
+    set timeout=$VTOY_MENU_TIMEOUT
+else
+    unset timeout
+fi
+
 if [ -f $iso_path/ventoy/ventoy_wimboot.img ]; then
     vt_load_wimboot $iso_path/ventoy/ventoy_wimboot.img
 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
 if [ -f $iso_path/ventoy/ventoy_wimboot.img ]; then
     vt_load_wimboot $iso_path/ventoy/ventoy_wimboot.img
 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
@@ -631,8 +662,6 @@ else
     terminal_output  gfxterm
 fi
 
     terminal_output  gfxterm
 fi
 
-#vtdebug on
-
 #colect all image files (iso files)
 set ventoy_img_count=0
 vt_list_img $iso_path ventoy_img_count
 #colect all image files (iso files)
 set ventoy_img_count=0
 vt_list_img $iso_path ventoy_img_count
index 4406727906ab6ce10aeaa348b5dda8029c0e936c..fa74b5c933290372ce94f84ab4e7a313adec313f 100644 (file)
Binary files a/INSTALL/grub/i386-pc/core.img and b/INSTALL/grub/i386-pc/core.img differ
diff --git a/INSTALL/grub/i386-pc/elf.mod b/INSTALL/grub/i386-pc/elf.mod
new file mode 100644 (file)
index 0000000..c856e11
Binary files /dev/null and b/INSTALL/grub/i386-pc/elf.mod differ
diff --git a/INSTALL/grub/i386-pc/file.mod b/INSTALL/grub/i386-pc/file.mod
new file mode 100644 (file)
index 0000000..29488fc
Binary files /dev/null and b/INSTALL/grub/i386-pc/file.mod differ
diff --git a/INSTALL/grub/i386-pc/macho.mod b/INSTALL/grub/i386-pc/macho.mod
new file mode 100644 (file)
index 0000000..c4a88ce
Binary files /dev/null and b/INSTALL/grub/i386-pc/macho.mod differ
diff --git a/INSTALL/grub/i386-pc/offsetio.mod b/INSTALL/grub/i386-pc/offsetio.mod
new file mode 100644 (file)
index 0000000..9db26d0
Binary files /dev/null and b/INSTALL/grub/i386-pc/offsetio.mod differ
diff --git a/INSTALL/grub/i386-pc/regexp.mod b/INSTALL/grub/i386-pc/regexp.mod
new file mode 100644 (file)
index 0000000..dba574a
Binary files /dev/null and b/INSTALL/grub/i386-pc/regexp.mod differ
index e9893e46dff9bfa45a8770ebf3e06773e157c5a7..0afb344603cd3c2dc89b873aec4d8b37b94d6fe7 100644 (file)
@@ -1,6 +1,6 @@
 
 if [ "$grub_platform" = "pc" ]; then
 
 if [ "$grub_platform" = "pc" ]; then
-    menuentry 'Search and boot Windows' {    
+    menuentry 'Search and boot Windows' --class=boot_windows {    
         if search -n -s -f /bootmgr; then
             ntldr /bootmgr
         elif search -n -s -f /ntldr; then
         if search -n -s -f /bootmgr; then
             ntldr /bootmgr
         elif search -n -s -f /ntldr; then
@@ -10,19 +10,27 @@ if [ "$grub_platform" = "pc" ]; then
         fi        
     }
     
         fi        
     }
     
-    menuentry 'Boot the 1st local disk' {
+    menuentry 'Search and boot Grub4dos' --class=boot_g4d {
+        if search -n -s -f /grldr; then
+            ntldr /grldr
+        else
+            echo "Grub4dos NOT found ..."
+        fi        
+    }
+    
+    menuentry 'Boot the 1st local disk' --class=boot_disk {
         set root=(hd0,1)
         chainloader +1
         boot
     }
     
         set root=(hd0,1)
         chainloader +1
         boot
     }
     
-    menuentry 'Boot the 2nd local disk' {
+    menuentry 'Boot the 2nd local disk' --class=boot_disk {
         set root=(hd1,1)
         chainloader +1
         boot
     }
     
         set root=(hd1,1)
         chainloader +1
         boot
     }
     
-    menuentry 'Boot the 3rd local disk' {
+    menuentry 'Boot the 3rd local disk' --class=boot_disk {
         set root=(hd2,1)
         chainloader +1
         boot
         set root=(hd2,1)
         chainloader +1
         boot
@@ -30,7 +38,7 @@ if [ "$grub_platform" = "pc" ]; then
     
 else
 
     
 else
 
-    menuentry 'Search and boot Windows' {    
+    menuentry 'Search and boot Windows' --class=boot_windows {    
         if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
             terminal_output  console
             chainloader /EFI/Microsoft/Boot/bootmgfw.efi
         if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
             terminal_output  console
             chainloader /EFI/Microsoft/Boot/bootmgfw.efi
@@ -40,7 +48,7 @@ else
         fi        
     }
     
         fi        
     }
     
-    menuentry 'Search and boot BOOTX64.EFI' {    
+    menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi {    
         if search -n -s -f /efi/boot/bootx64.efi; then
             terminal_output  console
             chainloader /efi/boot/bootx64.efi
         if search -n -s -f /efi/boot/bootx64.efi; then
             terminal_output  console
             chainloader /efi/boot/bootx64.efi
@@ -52,6 +60,6 @@ else
 
 fi
 
 
 fi
 
-menuentry 'Return to menu [Esc]' VTOY_RET {
+menuentry 'Return to menu [Esc]' --class=vtoyret VTOY_RET {
     echo 'Return ...'
 }
     echo 'Return ...'
 }
index a07f278d7a563b760177df5847b16c24b010449b..7f6249f0bddf0e52f280bcc3cf70e6739fcba115 100644 (file)
@@ -1,15 +1,15 @@
-menuentry Reboot {
+menuentry Reboot --class=power_reboot {
     echo -e '\n\nSystem is rebooting ... \n'
     sleep 1
     reboot
 }
 
     echo -e '\n\nSystem is rebooting ... \n'
     sleep 1
     reboot
 }
 
-menuentry Halt {
+menuentry Halt --class=power_halt {
     echo -e '\n\nSystem is halting ... \n'
     sleep 1
     halt
 }
 
     echo -e '\n\nSystem is halting ... \n'
     sleep 1
     halt
 }
 
-menuentry 'Return to menu [Esc]' VTOY_RET {
+menuentry 'Return to menu [Esc]' --class=vtoyret VTOY_RET {
     echo 'Return ...'
 }
     echo 'Return ...'
 }
index ecb2e62b1c1c88bdfdc502cc48ace3d7e5c8f988..dda7f27fda80a99fa17a874d793b2ab19abb935e 100644 (file)
@@ -34,12 +34,11 @@ terminal-box: "terminal_box_*.png"
   id = "__timeout__"
   text = "@TIMEOUT_NOTIFICATION_SHORT@"
 
   id = "__timeout__"
   text = "@TIMEOUT_NOTIFICATION_SHORT@"
 
-  left = 95%
-  width = 48
-  top = 95%
-  height = 48
+  left = 20%
+  width = 60%
+  top = 85%
 
 
-  text_color = "#f2f2f2"
+  text_color = "red"
   bar_style = "*"
   highlight_style = "*"
 }
   bar_style = "*"
   highlight_style = "*"
 }
index 0f6b368a4a72551b553e59537ff8cf1856e36810..2acecccc1ef950d31a2773bb3c390763a8b5149b 100644 (file)
Binary files a/INSTALL/grub/x86_64-efi/normal.mod and b/INSTALL/grub/x86_64-efi/normal.mod differ
index 817a149f3464272d89dd5954e143e9b560bbda3e..422a93a4b8b4f1cbe87fa5e2573038d64ab31a6a 100644 (file)
@@ -10,12 +10,13 @@ print_usage() {
     echo '   -I  force install ventoy to sdX (no matter installed or not)'
     echo ''
     echo '  OPTION: (optional)'
     echo '   -I  force install ventoy to sdX (no matter installed or not)'
     echo ''
     echo '  OPTION: (optional)'
-    echo '   -s  enable secure boot support (default is disabled)'
+    echo '   -r SIZE_MB  preserve some space at the bottom of the disk (only for install)'
+    echo '   -s          enable secure boot support (default is disabled)'
     echo ''
     
 }
 
     echo ''
     
 }
 
-
+RESERVE_SIZE_MB=0
 while [ -n "$1" ]; do
     if [ "$1" = "-i" ]; then
         MODE="install"
 while [ -n "$1" ]; do
     if [ "$1" = "-i" ]; then
         MODE="install"
@@ -26,6 +27,10 @@ while [ -n "$1" ]; do
         MODE="update"
     elif [ "$1" = "-s" ]; then
         SECUREBOOT="YES"
         MODE="update"
     elif [ "$1" = "-s" ]; then
         SECUREBOOT="YES"
+    elif [ "$1" = "-r" ]; then
+        RESERVE_SPACE="YES"
+        shift
+        RESERVE_SIZE_MB=$1
     else
         if ! [ -b "$1" ]; then
             vterr "$1 is NOT a valid device"
     else
         if ! [ -b "$1" ]; then
             vterr "$1 is NOT a valid device"
@@ -53,6 +58,15 @@ if [ -e /sys/class/block/${DISK#/dev/}/start ]; then
     exit 1
 fi
 
     exit 1
 fi
 
+if [ -n "$RESERVE_SPACE" ]; then
+    if echo $RESERVE_SIZE_MB | grep -q '^[0-9][0-9]*$'; then
+        vtdebug "User will reserve $RESERVE_SIZE_MB MB disk space"
+    else
+        vterr "$RESERVE_SIZE_MB is invalid for reserved space"
+        exit 1
+    fi
+fi
+
 if dd if="$DISK" of=/dev/null bs=1 count=1 >/dev/null 2>&1; then
     vtdebug "root permission check ok ..."
 else
 if dd if="$DISK" of=/dev/null bs=1 count=1 >/dev/null 2>&1; then
     vtdebug "root permission check ok ..."
 else
@@ -61,7 +75,7 @@ else
     exit 1
 fi
 
     exit 1
 fi
 
-vtdebug "MODE=$MODE FORCE=$FORCE"
+vtdebug "MODE=$MODE FORCE=$FORCE RESERVE_SPACE=$RESERVE_SPACE RESERVE_SIZE_MB=$RESERVE_SIZE_MB"
 
 if ! check_tool_work_ok; then
     vterr "Some tools can not run in current system. Please check log.txt for detail."
 
 if ! check_tool_work_ok; then
     vterr "Some tools can not run in current system. Please check log.txt for detail."
@@ -124,12 +138,28 @@ if [ "$MODE" = "install" ]; then
         exit 1
     fi
 
         exit 1
     fi
 
+    if [ -n "$RESERVE_SPACE" ]; then
+        sum_size_mb=$(expr $RESERVE_SIZE_MB + $VENTOY_PART_SIZE_MB)
+        reserve_sector_num=$(expr $sum_size_mb \* 2048)
+        
+        if [ $disk_sector_num -le $reserve_sector_num ]; then
+            vterr "Can't reserve $RESERVE_SIZE_MB MB space from $DISK"
+            exit 1
+        fi
+    fi
+
+
     #Print disk info
     echo "Disk : $DISK"
     parted -s $DISK p 2>&1 | grep Model
     echo "Size : $disk_size_gb GB"
     echo ''
 
     #Print disk info
     echo "Disk : $DISK"
     parted -s $DISK p 2>&1 | grep Model
     echo "Size : $disk_size_gb GB"
     echo ''
 
+    if [ -n "$RESERVE_SPACE" ]; then
+        echo "You will reserve $RESERVE_SIZE_MB MB disk space "
+    fi
+    echo ''
+
     vtwarn "Attention:"
     vtwarn "You will install Ventoy to $DISK."
     vtwarn "All the data on the disk $DISK will be lost!!!"
     vtwarn "Attention:"
     vtwarn "You will install Ventoy to $DISK."
     vtwarn "All the data on the disk $DISK will be lost!!!"
@@ -162,7 +192,7 @@ if [ "$MODE" = "install" ]; then
         exit 1
     fi
 
         exit 1
     fi
 
-    format_ventoy_disk $DISK $PARTTOOL
+    format_ventoy_disk $RESERVE_SIZE_MB $DISK $PARTTOOL
 
     # format part1
     if ventoy_is_linux64; then
 
     # format part1
     if ventoy_is_linux64; then
@@ -278,8 +308,7 @@ else
     
     ./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1  
 
     
     ./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1  
 
-    disk_sector_num=$(cat /sys/block/${DISK#/dev/}/size) 
-    part2_start=$(expr $disk_sector_num - $VENTOY_SECTOR_NUM)
+    part2_start=$(cat /sys/class/block/${PART2#/dev/}/start) 
     ./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
 
     sync
     ./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
 
     sync
index a9fc9a8898514f6fa77468a69647816fc3885bb3..6fa869ae9516375c1519ef28ec7b65313371c7b0 100644 (file)
@@ -2,6 +2,7 @@
 
 #Ventoy partition 32MB
 VENTOY_PART_SIZE=33554432
 
 #Ventoy partition 32MB
 VENTOY_PART_SIZE=33554432
+VENTOY_PART_SIZE_MB=32
 VENTOY_SECTOR_SIZE=512
 VENTOY_SECTOR_NUM=65536
 
 VENTOY_SECTOR_SIZE=512
 VENTOY_SECTOR_NUM=65536
 
@@ -185,18 +186,28 @@ get_disk_ventoy_version() {
 }
 
 format_ventoy_disk() {
 }
 
 format_ventoy_disk() {
-    DISK=$1
-    PARTTOOL=$2
+    reserve_mb=$1
+    DISK=$2
+    PARTTOOL=$3
     
     PART1=$(get_disk_part_name $DISK 1)
     PART2=$(get_disk_part_name $DISK 2)
     
     sector_num=$(cat /sys/block/${DISK#/dev/}/size)
     
     
     PART1=$(get_disk_part_name $DISK 1)
     PART2=$(get_disk_part_name $DISK 2)
     
     sector_num=$(cat /sys/block/${DISK#/dev/}/size)
     
-    part1_start_sector=2048
-    part1_end_sector=$(expr $sector_num - $VENTOY_SECTOR_NUM - 1)
-    export part2_start_sector=$(expr $part1_end_sector + 1)
-    part2_end_sector=$(expr $sector_num - 1)
+    part1_start_sector=2048 
+    
+    if [ $reserve_mb -gt 0 ]; then
+        reserve_sector_num=$(expr $reserve_mb \* 2048)
+        part1_end_sector=$(expr $sector_num - $reserve_sector_num - $VENTOY_SECTOR_NUM - 1)
+    else
+        part1_end_sector=$(expr $sector_num - $VENTOY_SECTOR_NUM - 1)
+    fi
+    
+    part2_start_sector=$(expr $part1_end_sector + 1)
+    part2_end_sector=$(expr $part2_start_sector + $VENTOY_SECTOR_NUM - 1)
+
+    export part2_start_sector
 
     vtdebug "part1_start_sector=$part1_start_sector  part1_end_sector=$part1_end_sector"
     vtdebug "part2_start_sector=$part2_start_sector  part2_end_sector=$part2_end_sector"
 
     vtdebug "part1_start_sector=$part1_start_sector  part1_end_sector=$part1_end_sector"
     vtdebug "part2_start_sector=$part2_start_sector  part2_end_sector=$part2_end_sector"
index 766971d43476a673cd14a1da9f1ccc28cec452d4..3815916baff0eee0e2ae58ae769ce25afdb31f73 100644 (file)
Binary files a/INSTALL/ventoy/ipxe.krn and b/INSTALL/ventoy/ipxe.krn differ
index 74886bb53d2f6ee851b324114e0a356441a56279..96816e8dc05bca1d08300d066458cf3c8f26488f 100644 (file)
Binary files a/INSTALL/ventoy/ventoy.cpio and b/INSTALL/ventoy/ventoy.cpio differ
index c59a5d74a4fa75ce6fa6f84bfc3a399e7b8ac24f..d97097324e47d1c54b4e0765db5b925f02397d33 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_x64.efi and b/INSTALL/ventoy/ventoy_x64.efi differ
index 4ac037999092f3de8a48566286db3faffca3d9ad..9f61c4732c3c3403ba3c14d98646f6a3352ec91c 100644 (file)
@@ -1057,6 +1057,28 @@ static __asmcall void int13 ( struct i386_all_regs *ix86 ) {
         return;
     }
 
         return;
     }
 
+    if (VENTOY_BOOT_FIXBIN_DRIVE == bios_drive && INT13_READ_SECTORS == command)
+    {
+        /* read sector 0 0x80 */
+        if (ix86->regs.dh == 0 && (ix86->regs.cl & 0x3f) == 1 && ix86->regs.al == 1)
+        {
+            userptr_t buffer;
+            
+            buffer = real_to_user(ix86->segs.es, ix86->regs.bx);
+            if (buffer)
+            {
+                memset((void *)buffer, 0, 512);
+            }
+
+            ix86->regs.dl = 0x80;
+            ix86->regs.ah = 0;
+
+               /* Set OF to indicate to wrapper not to chain this call */
+               ix86->flags |= OF;
+            return;
+        }
+    }
+
     // drive swap
     if (g_drive_map1 >= 0x80 && g_drive_map2 >= 0x80)
     {
     // drive swap
     if (g_drive_map1 >= 0x80 && g_drive_map2 >= 0x80)
     {
index e61d8394bd5dd295ddbf5277ffb514ba53582cb1..2c2639a3cc0251bb68b4fe4ab740f0a252519f72 100644 (file)
@@ -92,7 +92,7 @@ struct san_device {
     uint8_t boot_catalog_sector[2048];
 
        /** SAN paths */
     uint8_t boot_catalog_sector[2048];
 
        /** SAN paths */
-       struct san_path path[0];
+       struct san_path path[0];    
 };
 
 /** SAN device flags */
 };
 
 /** SAN device flags */
index 27b4dcaf3adcfe5f77717f41d34d46766df150de..1898d7ac078bfc4f996c2772e2f5b16c52283474 100644 (file)
@@ -170,6 +170,7 @@ typedef struct ventoy_sector_flag
 }ventoy_sector_flag;
 
 #define VENTOY_BIOS_FAKE_DRIVE  0xFE
 }ventoy_sector_flag;
 
 #define VENTOY_BIOS_FAKE_DRIVE  0xFE
+#define VENTOY_BOOT_FIXBIN_DRIVE  0xFD
 
 extern int g_debug;
 extern char *g_cmdline_copy;
 
 extern int g_debug;
 extern char *g_cmdline_copy;
index d7c10ab247b31a335b460f3185050b68c8310edd..a1a528ae70b4f6baf8d9c014f4f6018fb91b7ecd 100644 (file)
Binary files a/LANGUAGES/languages.ini and b/LANGUAGES/languages.ini differ
index 5fb41ff946caf3c1ecf0bb25d830c392dead472a..3623dc332c58ad46513e7813cb412ac6aff82c6b 100644 (file)
@@ -51,12 +51,19 @@ typedef enum STR_ID
        STR_MENU_OPTION,//19
        STR_MENU_SECURE_BOOT,//20
 
        STR_MENU_OPTION,//19
        STR_MENU_SECURE_BOOT,//20
 
+    STR_MENU_PART_CFG,//21
+    STR_BTN_OK,//22
+    STR_BTN_CANCEL,//23
+    STR_PRESERVE_SPACE,//24
+       STR_SPACE_VAL_INVALID,//25
+
        STR_ID_MAX
 }STR_ID;
 
 extern BOOL g_SecureBoot;
 
 #define VTOY_MENU_SECURE_BOOT    0xA000
        STR_ID_MAX
 }STR_ID;
 
 extern BOOL g_SecureBoot;
 
 #define VTOY_MENU_SECURE_BOOT    0xA000
+#define VTOY_MENU_PART_CFG        0xA001
 #define VTOY_MENU_LANGUAGE_BEGIN  0xB000
 
 
 #define VTOY_MENU_LANGUAGE_BEGIN  0xB000
 
 
diff --git a/Ventoy2Disk/Ventoy2Disk/PartDialog.c b/Ventoy2Disk/Ventoy2Disk/PartDialog.c
new file mode 100644 (file)
index 0000000..b5f737c
Binary files /dev/null and b/Ventoy2Disk/Ventoy2Disk/PartDialog.c differ
index 7e90421e8abd18e4316f83e672833c67fbc70056..07c168cd000fd4192d324883aae28ae9a93b01e9 100644 (file)
@@ -304,7 +304,7 @@ static DWORD GetVentoyVolumeName(int PhyDrive, UINT32 StartSectorId, CHAR *NameB
 
     PartOffset = 512ULL * StartSectorId;
 
 
     PartOffset = 512ULL * StartSectorId;
 
-    Log("GetVentoyVolumeName PhyDrive %d PartOffset:%llu", PhyDrive, (ULONGLONG)PartOffset);
+       Log("GetVentoyVolumeName PhyDrive %d SectorStart:%u PartOffset:%llu", PhyDrive, StartSectorId, (ULONGLONG)PartOffset);
 
     hVolume = FindFirstVolumeA(VolumeName, sizeof(VolumeName));
     if (hVolume == INVALID_HANDLE_VALUE)
 
     hVolume = FindFirstVolumeA(VolumeName, sizeof(VolumeName));
     if (hVolume == INVALID_HANDLE_VALUE)
@@ -798,7 +798,7 @@ static int VentoyFatDiskRead(uint32 Sector, uint8 *Buffer, uint32 SectorCount)
 }
 
 
 }
 
 
-int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, CHAR *VerBuf, size_t BufLen)
+int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, MBR_HEAD *pMBR, CHAR *VerBuf, size_t BufLen)
 {
     int rc = 0;
     HANDLE hDrive;
 {
     int rc = 0;
     HANDLE hDrive;
@@ -810,7 +810,7 @@ int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, CHAR *VerBuf, size_
     }
     
     g_FatPhyDrive = hDrive;
     }
     
     g_FatPhyDrive = hDrive;
-    g_Part2StartSec = (pDriveInfo->SizeInBytes - VENTOY_EFI_PART_SIZE) / 512;
+       g_Part2StartSec = pMBR->PartTbl[1].StartSectorId;
 
     Log("Parse FAT fs...");
 
 
     Log("Parse FAT fs...");
 
@@ -1033,8 +1033,9 @@ static int FormatPart2Fat(HANDLE hDrive, UINT64 StartSectorId)
     BOOL bRet;
     unsigned char *data = NULL;
     LARGE_INTEGER liCurrentPosition;
     BOOL bRet;
     unsigned char *data = NULL;
     LARGE_INTEGER liCurrentPosition;
+       LARGE_INTEGER liNewPosition;
 
 
-    Log("FormatPart2Fat ...");
+       Log("FormatPart2Fat %llu...", StartSectorId);
 
     rc = ReadWholeFileToBuf(VENTOY_FILE_DISK_IMG, 0, (void **)&data, &len);
     if (rc)
 
     rc = ReadWholeFileToBuf(VENTOY_FILE_DISK_IMG, 0, (void **)&data, &len);
     if (rc)
@@ -1044,7 +1045,9 @@ static int FormatPart2Fat(HANDLE hDrive, UINT64 StartSectorId)
     }
 
     liCurrentPosition.QuadPart = StartSectorId * 512;
     }
 
     liCurrentPosition.QuadPart = StartSectorId * 512;
-    SetFilePointerEx(hDrive, liCurrentPosition, &liCurrentPosition, FILE_BEGIN);
+       SetFilePointerEx(hDrive, liCurrentPosition, &liNewPosition, FILE_BEGIN);
+
+       Log("Set file pointer: %llu  New pointer:%llu", liCurrentPosition.QuadPart, liNewPosition.QuadPart);
 
     memset(g_part_img_buf, 0, sizeof(g_part_img_buf));
 
 
     memset(g_part_img_buf, 0, sizeof(g_part_img_buf));
 
@@ -1063,7 +1066,7 @@ static int FormatPart2Fat(HANDLE hDrive, UINT64 StartSectorId)
             for (i = 0; i < VENTOY_EFI_PART_SIZE / SIZE_1MB; i++)
             {
                 dwSize = 0;
             for (i = 0; i < VENTOY_EFI_PART_SIZE / SIZE_1MB; i++)
             {
                 dwSize = 0;
-                bRet = WriteFile(hDrive, g_part_img_buf[0] + i * SIZE_1MB, SIZE_1MB, &dwSize, NULL);
+                               bRet = WriteFile(hDrive, g_part_img_buf[0] + i * SIZE_1MB, SIZE_1MB, &dwSize, NULL);
                 Log("Write part data bRet:%u dwSize:%u code:%u", bRet, dwSize, LASTERR);
 
                 if (!bRet)
                 Log("Write part data bRet:%u dwSize:%u code:%u", bRet, dwSize, LASTERR);
 
                 if (!bRet)
@@ -1425,11 +1428,10 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
     CHAR DriveName[] = "?:\\";
     CHAR DriveLetters[MAX_PATH] = { 0 };
     UINT32 StartSector;
     CHAR DriveName[] = "?:\\";
     CHAR DriveLetters[MAX_PATH] = { 0 };
     UINT32 StartSector;
+       UINT64 ReservedMB = 0;
     MBR_HEAD BootImg;
     MBR_HEAD MBR;
 
     MBR_HEAD BootImg;
     MBR_HEAD MBR;
 
-    StartSector = (UINT32)(pPhyDrive->SizeInBytes / 512 - VENTOY_EFI_PART_SIZE / 512);
-
     Log("UpdateVentoy2PhyDrive PhyDrive%d <<%s %s %dGB>>",
         pPhyDrive->PhyDrive, pPhyDrive->VendorId, pPhyDrive->ProductId, 
         GetHumanReadableGBSize(pPhyDrive->SizeInBytes));
     Log("UpdateVentoy2PhyDrive PhyDrive%d <<%s %s %dGB>>",
         pPhyDrive->PhyDrive, pPhyDrive->VendorId, pPhyDrive->ProductId, 
         GetHumanReadableGBSize(pPhyDrive->SizeInBytes));
@@ -1446,8 +1448,15 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
     }
 
     // Read MBR
     }
 
     // Read MBR
+       SetFilePointer(hDrive, 0, NULL, FILE_BEGIN);
     ReadFile(hDrive, &MBR, sizeof(MBR), &dwSize, NULL);
 
     ReadFile(hDrive, &MBR, sizeof(MBR), &dwSize, NULL);
 
+       StartSector = MBR.PartTbl[1].StartSectorId;
+       Log("StartSector in PartTbl:%u", StartSector);
+
+       ReservedMB = (pPhyDrive->SizeInBytes / 512 - (StartSector + VENTOY_EFI_PART_SIZE / 512)) / 2048;
+       Log("Reserved Disk Space:%u MB", ReservedMB);
+
     GetLettersBelongPhyDrive(pPhyDrive->PhyDrive, DriveLetters, sizeof(DriveLetters));
 
     if (DriveLetters[0] == 0)
     GetLettersBelongPhyDrive(pPhyDrive->PhyDrive, DriveLetters, sizeof(DriveLetters));
 
     if (DriveLetters[0] == 0)
index a1023fad70224da881dda00508fe56ee7f685598..21b0245d8e01d1cf07dd57c645af344d36c86cf0 100644 (file)
@@ -427,10 +427,12 @@ static int VentoyFillLocation(UINT64 DiskSizeInBytes, UINT32 StartSectorId, UINT
 int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
 {
     GUID Guid;
 int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
 {
     GUID Guid;
+       int ReservedValue;
     UINT32 DiskSignature;
     UINT32 DiskSectorCount;
     UINT32 PartSectorCount;
     UINT32 PartStartSector;
     UINT32 DiskSignature;
     UINT32 DiskSectorCount;
     UINT32 PartSectorCount;
     UINT32 PartStartSector;
+       UINT32 ReservedSector;
 
     VentoyGetLocalBootImg(pMBR);
 
 
     VentoyGetLocalBootImg(pMBR);
 
@@ -444,9 +446,21 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
 
     DiskSectorCount = (UINT32)(DiskSizeBytes / 512);
 
 
     DiskSectorCount = (UINT32)(DiskSizeBytes / 512);
 
+       ReservedValue = GetReservedSpaceInMB();
+       if (ReservedValue <= 0)
+       {
+               ReservedSector = 0;
+       }
+       else
+       {
+               ReservedSector = (UINT32)(ReservedValue * 2048);
+       }
+
+       Log("ReservedSector: %u", ReservedSector);
+
     //Part1
     PartStartSector = VENTOY_PART1_START_SECTOR;
     //Part1
     PartStartSector = VENTOY_PART1_START_SECTOR;
-    PartSectorCount = DiskSectorCount - VENTOY_EFI_PART_SIZE / 512 - PartStartSector;
+       PartSectorCount = DiskSectorCount - ReservedSector - VENTOY_EFI_PART_SIZE / 512 - PartStartSector;
     VentoyFillLocation(DiskSizeBytes, PartStartSector, PartSectorCount, pMBR->PartTbl);
 
     pMBR->PartTbl[0].Active = 0x80; // bootable
     VentoyFillLocation(DiskSizeBytes, PartStartSector, PartSectorCount, pMBR->PartTbl);
 
     pMBR->PartTbl[0].Active = 0x80; // bootable
index e4da211083371a530e503edbbe77979e327db4e8..f0ea679bd69ca2a3687731b0af636e18c9e5797b 100644 (file)
@@ -70,7 +70,7 @@ int ParseCmdLineOption(LPSTR lpCmdLine)
     return 0;
 }
 
     return 0;
 }
 
-static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
+static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD *pMBR)
 {
     int i;
     BOOL bRet;
 {
     int i;
     BOOL bRet;
@@ -121,30 +121,24 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
         Log("PartTbl.EndCylinder = %u", MBR.PartTbl[i].EndCylinder);
     }
 
         Log("PartTbl.EndCylinder = %u", MBR.PartTbl[i].EndCylinder);
     }
 
-    if (MBR.PartTbl[2].SectorCount > 0 || MBR.PartTbl[3].SectorCount > 0)
-    {
-        Log("Part3 Part4 are not empty");
-        return FALSE;
-    }
-
-    PartStartSector = 2048;
-    PartSectorCount = (UINT32)((SizeBytes - VENTOY_EFI_PART_SIZE - SIZE_1MB) / 512);
 
 
-    if (MBR.PartTbl[0].StartSectorId != PartStartSector ||
-        MBR.PartTbl[0].SectorCount != PartSectorCount)
+    if (MBR.PartTbl[0].StartSectorId != 2048)
     {
     {
-        Log("Part1 not match %u %u", PartStartSector, PartSectorCount);
+        Log("Part1 not match %u", MBR.PartTbl[0].StartSectorId);
         return FALSE;
     }
 
         return FALSE;
     }
 
-    PartStartSector = (UINT32)((SizeBytes - VENTOY_EFI_PART_SIZE) / 512);
+    PartStartSector = MBR.PartTbl[0].StartSectorId + MBR.PartTbl[0].SectorCount;
     PartSectorCount = VENTOY_EFI_PART_SIZE / 512;
 
     if (MBR.PartTbl[1].FsFlag != 0xEF ||
         MBR.PartTbl[1].StartSectorId != PartStartSector ||
         MBR.PartTbl[1].SectorCount != PartSectorCount)
     {
     PartSectorCount = VENTOY_EFI_PART_SIZE / 512;
 
     if (MBR.PartTbl[1].FsFlag != 0xEF ||
         MBR.PartTbl[1].StartSectorId != PartStartSector ||
         MBR.PartTbl[1].SectorCount != PartSectorCount)
     {
-        Log("Part2 not match %u %u", PartStartSector, PartSectorCount);
+        Log("Part2 not match [0x%x 0x%x] [%u %u] [%u %u]",
+            MBR.PartTbl[1].FsFlag, 0xEF,
+            MBR.PartTbl[1].StartSectorId, PartStartSector,
+            MBR.PartTbl[1].SectorCount, PartSectorCount);
         return FALSE;
     }
 
         return FALSE;
     }
 
@@ -154,6 +148,7 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
         return FALSE;
     }
 
         return FALSE;
     }
 
+       memcpy(pMBR, &MBR, sizeof(MBR_HEAD));
     Log("PhysicalDrive%d is ventoy disk", PhyDrive);
     return TRUE;
 }
     Log("PhysicalDrive%d is ventoy disk", PhyDrive);
     return TRUE;
 }
@@ -167,6 +162,7 @@ static int FilterPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount)
     int Id = 0;
     int LetterCount = 0;
     PHY_DRIVE_INFO *CurDrive;
     int Id = 0;
     int LetterCount = 0;
     PHY_DRIVE_INFO *CurDrive;
+       MBR_HEAD MBR;
     int LogLetter[VENTOY_MAX_PHY_DRIVE];
     int PhyDriveId[VENTOY_MAX_PHY_DRIVE];
 
     int LogLetter[VENTOY_MAX_PHY_DRIVE];
     int PhyDriveId[VENTOY_MAX_PHY_DRIVE];
 
@@ -221,9 +217,9 @@ static int FilterPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount)
             }
         }
 
             }
         }
 
-        if (IsVentoyPhyDrive(CurDrive->PhyDrive, CurDrive->SizeInBytes))
+               if (IsVentoyPhyDrive(CurDrive->PhyDrive, CurDrive->SizeInBytes, &MBR))
         {
         {
-            GetVentoyVerInPhyDrive(CurDrive, CurDrive->VentoyVersion, sizeof(CurDrive->VentoyVersion));
+                       GetVentoyVerInPhyDrive(CurDrive, &MBR, CurDrive->VentoyVersion, sizeof(CurDrive->VentoyVersion));
         }
     }
 
         }
     }
 
index ad8bb526c00e794500feafbf118b6e882a7b363f..26352ddf3277631541528e74200a4d816cb8e92f 100644 (file)
@@ -144,7 +144,7 @@ int GetRegDwordValue(HKEY Key, LPCSTR SubKey, LPCSTR ValueName, DWORD *pValue);
 int GetPhysicalDriveCount(void);
 int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount);
 int GetPhyDriveByLogicalDrive(int DriveLetter);
 int GetPhysicalDriveCount(void);
 int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount);
 int GetPhyDriveByLogicalDrive(int DriveLetter);
-int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, CHAR *VerBuf, size_t BufLen);
+int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, MBR_HEAD *pMBR, CHAR *VerBuf, size_t BufLen);
 int Ventoy2DiskInit(void);
 int Ventoy2DiskDestroy(void);
 PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id);
 int Ventoy2DiskInit(void);
 int Ventoy2DiskDestroy(void);
 PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id);
@@ -159,5 +159,7 @@ int INIT unxz(unsigned char *in, int in_size,
     unsigned char *out, int *in_used,
     void(*error)(char *x));
 void disk_io_set_param(HANDLE Handle, UINT64 SectorCount);
     unsigned char *out, int *in_used,
     void(*error)(char *x));
 void disk_io_set_param(HANDLE Handle, UINT64 SectorCount);
+INT_PTR CALLBACK PartDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
+int GetReservedSpaceInMB(void);
 
 #endif
 
 #endif
index 8dbf2a1039c575ad3ac728ab5521818e8e1d35e9..2df0e8afecd1299565f25bf76d6d73d1a560661d 100644 (file)
Binary files a/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc and b/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc differ
index 4f8767bf7f5d8d2eff81424115a6a3d07825ada6..4b9ccf82e6a9e8a8bee7ce90730858dcc803f952 100644 (file)
     <ClCompile Include="ff14\source\ffsystem.c" />
     <ClCompile Include="ff14\source\ffunicode.c" />
     <ClCompile Include="Language.c" />
     <ClCompile Include="ff14\source\ffsystem.c" />
     <ClCompile Include="ff14\source\ffunicode.c" />
     <ClCompile Include="Language.c" />
+    <ClCompile Include="PartDialog.c" />
     <ClCompile Include="PhyDrive.c" />
     <ClCompile Include="Utility.c" />
     <ClCompile Include="Ventoy2Disk.c" />
     <ClCompile Include="PhyDrive.c" />
     <ClCompile Include="Utility.c" />
     <ClCompile Include="Ventoy2Disk.c" />
index 58da7afcfba5d4b6e83f2ad6b5441e6f839acb00..8370af2ccce504c8af12cf41ee6410626b508036 100644 (file)
@@ -69,6 +69,9 @@
     <ClCompile Include="ff14\source\ffunicode.c">
       <Filter>源文件</Filter>
     </ClCompile>
     <ClCompile Include="ff14\source\ffunicode.c">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="PartDialog.c">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Ventoy2Disk.h">
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Ventoy2Disk.h">
index 6c562373bfd15d84224c633431151d0ca6551d94..afceab56d468d262141043b0331c652b6ac250fe 100644 (file)
Binary files a/Ventoy2Disk/Ventoy2Disk/WinDialog.c and b/Ventoy2Disk/Ventoy2Disk/WinDialog.c differ
index 706d3c74139ec1c42e09552078eaf9917766c6ed..9626e52e4c4a62be8fe37f2500a730f89e143918 100644 (file)
Binary files a/Ventoy2Disk/Ventoy2Disk/resource.h and b/Ventoy2Disk/Ventoy2Disk/resource.h differ