]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
1.0.78 release v1.0.78
authorlongpanda <admin@ventoy.net>
Fri, 1 Jul 2022 11:10:12 +0000 (19:10 +0800)
committerlongpanda <admin@ventoy.net>
Fri, 1 Jul 2022 11:10:12 +0000 (19:10 +0800)
24 files changed:
.github/ISSUE_TEMPLATE/issue_template.yml
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/VentoyProtocol.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
INSTALL/grub/grub.cfg
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/ventoy_aa64.efi
INSTALL/ventoy/ventoy_arm64.cpio
INSTALL/ventoy/ventoy_ia32.efi
INSTALL/ventoy/ventoy_mips64.cpio
INSTALL/ventoy/ventoy_unix.cpio
INSTALL/ventoy/ventoy_x64.efi
INSTALL/ventoy/ventoy_x86.cpio
INSTALL/ventoy/vtloopex.cpio
INSTALL/ventoy/vtoyutil_aa64.efi
INSTALL/ventoy/vtoyutil_ia32.efi
INSTALL/ventoy/vtoyutil_x64.efi
README.md

index d774426661f7b855ea198bfaa98b4f782c2e93a0..8cb01a3a77c90181ad120d8ed32beed6f103c16d 100644 (file)
@@ -21,7 +21,7 @@ body:
     attributes:
       label: Ventoy Version
       description: What version of ventoy are you running?
     attributes:
       label: Ventoy Version
       description: What version of ventoy are you running?
-      placeholder: 1.0.76
+      placeholder: 1.0.78
     validations:
       required: true
   - type: dropdown
     validations:
       required: true
   - type: dropdown
index 8341f314e619f010d2759ffc0ecb89167dbd090c..0682c74c522caf00f02dd920e1a4768eec4c5ef6 100644 (file)
@@ -60,7 +60,7 @@ ventoy_grub_param_file_replace *g_file_replace_list = NULL;
 ventoy_efi_file_replace g_efi_file_replace;
 
 ventoy_grub_param_file_replace *g_img_replace_list = NULL;
 ventoy_efi_file_replace g_efi_file_replace;
 
 ventoy_grub_param_file_replace *g_img_replace_list = NULL;
-ventoy_efi_file_replace g_img_file_replace;
+ventoy_efi_file_replace g_img_file_replace[VTOY_MAX_CONF_REPLACE];
 
 CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
 CONST CHAR16 gUdfEfiDriverPath[] = UDF_EFI_DRIVER_PATH;
 
 CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
 CONST CHAR16 gUdfEfiDriverPath[] = UDF_EFI_DRIVER_PATH;
@@ -829,6 +829,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
     ventoy_grub_param *pGrubParam = NULL;
     EFI_LOADED_IMAGE_PROTOCOL *pImageInfo = NULL;
     ventoy_chain_head *chain = NULL;
     ventoy_grub_param *pGrubParam = NULL;
     EFI_LOADED_IMAGE_PROTOCOL *pImageInfo = NULL;
     ventoy_chain_head *chain = NULL;
+    ventoy_grub_param_file_replace *replace = NULL;
 
     Status = gBS->HandleProtocol(ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&pImageInfo);
     if (EFI_ERROR(Status))
 
     Status = gBS->HandleProtocol(ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&pImageInfo);
     if (EFI_ERROR(Status))
@@ -926,18 +927,27 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
         old_cnt > 3 ? g_file_replace_list->old_file_name[3] : ""
         );
 
         old_cnt > 3 ? g_file_replace_list->old_file_name[3] : ""
         );
 
-    g_img_replace_list = &pGrubParam->img_replace;
-    ventoy_proc_img_replace_name(g_img_replace_list);
-    old_cnt = g_img_replace_list->old_file_cnt;
-    debug("img replace: magic:0x%x virtid:%u name count:%u <%a> <%a> <%a> <%a>",
-        g_img_replace_list->magic,
-        g_img_replace_list->new_file_virtual_id,
-        old_cnt,
-        old_cnt > 0 ? g_img_replace_list->old_file_name[0] : "",
-        old_cnt > 1 ? g_img_replace_list->old_file_name[1] : "",
-        old_cnt > 2 ? g_img_replace_list->old_file_name[2] : "",
-        old_cnt > 3 ? g_img_replace_list->old_file_name[3] : ""
-        );
+    
+    for (i = 0; i < VTOY_MAX_CONF_REPLACE; i++)
+    {
+        replace = pGrubParam->img_replace + i;
+        if (replace->magic == GRUB_IMG_REPLACE_MAGIC)
+        {
+            ventoy_proc_img_replace_name(replace);
+            old_cnt = replace->old_file_cnt;
+            debug("img replace[%d]: magic:0x%x virtid:%u name count:%u <%a> <%a> <%a> <%a>",
+                  i, replace->magic,
+                  replace->new_file_virtual_id,
+                  old_cnt,
+                  old_cnt > 0 ? replace->old_file_name[0] : "",
+                  old_cnt > 1 ? replace->old_file_name[1] : "",
+                  old_cnt > 2 ? replace->old_file_name[2] : "",
+                  old_cnt > 3 ? replace->old_file_name[3] : ""
+                  );
+            g_img_replace_list = pGrubParam->img_replace;
+        }
+    }
+
     
     pPos = StrStr(pCmdLine, L"mem:");
     chain = (ventoy_chain_head *)StrHexToUintn(pPos + 4);
     
     pPos = StrStr(pCmdLine, L"mem:");
     chain = (ventoy_chain_head *)StrHexToUintn(pPos + 4);
@@ -1178,8 +1188,7 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
                 gST->ConIn->Reset(gST->ConIn, FALSE);
             }
             
                 gST->ConIn->Reset(gST->ConIn, FALSE);
             }
             
-            if ((g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC) ||
-                (g_img_replace_list && g_img_replace_list->magic == GRUB_IMG_REPLACE_MAGIC))
+            if ((g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC) || g_img_replace_list)
             {
                 ventoy_wrapper_push_openvolume(pFile->OpenVolume);
                 pFile->OpenVolume = ventoy_wrapper_open_volume;
             {
                 ventoy_wrapper_push_openvolume(pFile->OpenVolume);
                 pFile->OpenVolume = ventoy_wrapper_open_volume;
index 0e2b3fa84ad41c74a762b947ddda28ed8d255290..8de03516cab2d5b59ca72aed21a8ae6562474608 100644 (file)
@@ -244,6 +244,7 @@ typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
 #pragma pack(1)
 
 
 #pragma pack(1)
 
+#define VTOY_MAX_CONF_REPLACE    2
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
 #define GRUB_IMG_REPLACE_MAGIC   0x1259BEEF
 
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
 #define GRUB_IMG_REPLACE_MAGIC   0x1259BEEF
 
@@ -270,7 +271,7 @@ typedef struct ventoy_grub_param
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
-    ventoy_grub_param_file_replace img_replace;
+    ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
 
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
 
@@ -400,7 +401,7 @@ extern ventoy_virt_chunk *g_virt_chunk;
 extern UINT32 g_virt_chunk_num;
 extern vtoy_block_data gBlockData;
 extern ventoy_efi_file_replace g_efi_file_replace;
 extern UINT32 g_virt_chunk_num;
 extern vtoy_block_data gBlockData;
 extern ventoy_efi_file_replace g_efi_file_replace;
-extern ventoy_efi_file_replace g_img_file_replace;
+extern ventoy_efi_file_replace g_img_file_replace[VTOY_MAX_CONF_REPLACE];
 extern ventoy_sector_flag *g_sector_flag;
 extern UINT32 g_sector_flag_num;
 extern BOOLEAN gMemdiskMode;
 extern ventoy_sector_flag *g_sector_flag;
 extern UINT32 g_sector_flag_num;
 extern BOOLEAN gMemdiskMode;
index 941575d1d428d40dd8ce9f65ae493d82f0448695..d904336727d7014c8d77ab6cdd8015be8a4e9729 100644 (file)
@@ -37,9 +37,6 @@
 #include <Protocol/DriverBinding.h>
 #include <Ventoy.h>
 
 #include <Protocol/DriverBinding.h>
 #include <Ventoy.h>
 
-#define ASSIGN_REPLACE(This, replace) \
-    replace = (This->FlushEx == ventoy_wrapper_file_flush_ex) ? &g_efi_file_replace : &g_img_file_replace
-
 UINT8 *g_iso_data_buf = NULL;
 UINTN g_iso_buf_size = 0;
 BOOLEAN gMemdiskMode = FALSE;
 UINT8 *g_iso_data_buf = NULL;
 UINTN g_iso_buf_size = 0;
 BOOLEAN gMemdiskMode = FALSE;
@@ -1251,13 +1248,96 @@ ventoy_wrapper_file_flush_ex(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
 
 /* Ex version */
 STATIC EFI_STATUS EFIAPI
 
 /* Ex version */
 STATIC EFI_STATUS EFIAPI
-ventoy_wrapper_file_flush_ex_img(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
+ventoy_wrapper_file_flush_ex_img0(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
+{
+    (VOID)This;
+    (VOID)Token;
+       return EFI_SUCCESS;
+}
+/* Ex version */
+STATIC EFI_STATUS EFIAPI
+ventoy_wrapper_file_flush_ex_img1(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
 {
     (VOID)This;
     (VOID)Token;
        return EFI_SUCCESS;
 }
 
 {
     (VOID)This;
     (VOID)Token;
        return EFI_SUCCESS;
 }
 
+#define DEF_WRAP_FUNC(n) \
+STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_flush_ex_img#n(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token) \
+{\
+    (VOID)This;\
+    (VOID)Token;\
+       return EFI_SUCCESS;\
+}
+
+#define ITEM_WRAP_FUNC(n) ventoy_wrapper_file_flush_ex_img#n
+
+#if (VTOY_MAX_CONF_REPLACE > 2)
+DEF_WRAP_FUNC(2);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 3)
+DEF_WRAP_FUNC(3);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 4)
+DEF_WRAP_FUNC(4);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 5)
+DEF_WRAP_FUNC(5);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 6)
+DEF_WRAP_FUNC(6);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 7)
+DEF_WRAP_FUNC(7);
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 8)
+#error "VTOY_MAX_CONF_REPLACE overflow"
+#endif
+
+static EFI_FILE_FLUSH_EX g_img_flush_func[VTOY_MAX_CONF_REPLACE] = 
+{
+    ventoy_wrapper_file_flush_ex_img0,
+    ventoy_wrapper_file_flush_ex_img1,
+#if (VTOY_MAX_CONF_REPLACE > 2)
+    ITEM_WRAP_FUNC(2),
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 3)
+    ITEM_WRAP_FUNC(3),
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 4)
+    ITEM_WRAP_FUNC(4),
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 5)
+    ITEM_WRAP_FUNC(5),
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 6)
+    ITEM_WRAP_FUNC(6),
+#endif
+#if (VTOY_MAX_CONF_REPLACE > 7)
+    ITEM_WRAP_FUNC(7),
+#endif
+};
+
+STATIC ventoy_efi_file_replace *ventoy_wrapper_get_replace(EFI_FILE_HANDLE This)
+{
+    UINTN i;
+
+    if (This->FlushEx == ventoy_wrapper_file_flush_ex)
+    {
+        return &g_efi_file_replace;
+    }
+
+    for (i = 0; i < VTOY_MAX_CONF_REPLACE; i++)
+    {
+        if (This->FlushEx == g_img_flush_func[i])
+        {
+            return g_img_file_replace + i;
+        }
+    }
+    
+    return NULL;
+}
 
 STATIC EFI_STATUS EFIAPI
 ventoy_wrapper_file_write(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
 
 STATIC EFI_STATUS EFIAPI
 ventoy_wrapper_file_write(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
@@ -1288,7 +1368,7 @@ ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
 {
     ventoy_efi_file_replace *replace = NULL;
 
 {
     ventoy_efi_file_replace *replace = NULL;
 
-    ASSIGN_REPLACE(This, replace);
+    replace = ventoy_wrapper_get_replace(This);
     
     if (Position <= replace->FileSizeBytes)
     {
     
     if (Position <= replace->FileSizeBytes)
     {
@@ -1307,7 +1387,7 @@ ventoy_wrapper_file_get_pos(EFI_FILE_HANDLE This, UINT64 *Position)
 {
     ventoy_efi_file_replace *replace = NULL;
 
 {
     ventoy_efi_file_replace *replace = NULL;
 
-    ASSIGN_REPLACE(This, replace);
+    replace = ventoy_wrapper_get_replace(This);
 
     *Position = replace->CurPos;
 
 
     *Position = replace->CurPos;
 
@@ -1321,7 +1401,7 @@ ventoy_wrapper_file_get_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN *Len, V
     EFI_FILE_INFO *Info = (EFI_FILE_INFO *) Data;
     ventoy_efi_file_replace *replace = NULL;
 
     EFI_FILE_INFO *Info = (EFI_FILE_INFO *) Data;
     ventoy_efi_file_replace *replace = NULL;
 
-    ASSIGN_REPLACE(This, replace);
+    replace = ventoy_wrapper_get_replace(This);
 
     debug("ventoy_wrapper_file_get_info ... %u", *Len);
 
 
     debug("ventoy_wrapper_file_get_info ... %u", *Len);
 
@@ -1356,7 +1436,7 @@ ventoy_wrapper_file_read(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
     UINTN ReadLen = *Len;
     ventoy_efi_file_replace *replace = NULL;
 
     UINTN ReadLen = *Len;
     ventoy_efi_file_replace *replace = NULL;
 
-    ASSIGN_REPLACE(This, replace);
+    replace = ventoy_wrapper_get_replace(This);
     
     debug("ventoy_wrapper_file_read ... %u", *Len);
 
     
     debug("ventoy_wrapper_file_read ... %u", *Len);
 
@@ -1382,7 +1462,7 @@ ventoy_wrapper_file_read_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN
        return ventoy_wrapper_file_read(This, &(Token->BufferSize), Token->Buffer);
 }
 
        return ventoy_wrapper_file_read(This, &(Token->BufferSize), Token->Buffer);
 }
 
-STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, BOOLEAN Img)
+STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, BOOLEAN Img, UINTN Index)
 {
     File->Revision    = EFI_FILE_PROTOCOL_REVISION2;
     File->Open        = ventoy_wrapper_fs_open;
 {
     File->Revision    = EFI_FILE_PROTOCOL_REVISION2;
     File->Open        = ventoy_wrapper_fs_open;
@@ -1398,7 +1478,15 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, B
     File->OpenEx      = ventoy_wrapper_file_open_ex;
     File->ReadEx      = ventoy_wrapper_file_read_ex;
     File->WriteEx     = ventoy_wrapper_file_write_ex;
     File->OpenEx      = ventoy_wrapper_file_open_ex;
     File->ReadEx      = ventoy_wrapper_file_read_ex;
     File->WriteEx     = ventoy_wrapper_file_write_ex;
-    File->FlushEx     = Img ? ventoy_wrapper_file_flush_ex_img : ventoy_wrapper_file_flush_ex;
+
+    if (Img)
+    {
+        File->FlushEx = g_img_flush_func[Index];
+    }
+    else
+    {
+        File->FlushEx = ventoy_wrapper_file_flush_ex;
+    }
 
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
@@ -1419,6 +1507,7 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
     CHAR8 TmpName[256];
     CHAR8 OldName[256];
     ventoy_virt_chunk *virt = NULL;
     CHAR8 TmpName[256];
     CHAR8 OldName[256];
     ventoy_virt_chunk *virt = NULL;
+    ventoy_grub_param_file_replace *replace = NULL;
 
     debug("## ventoy_wrapper_file_open <%s> ", Name);
 
 
     debug("## ventoy_wrapper_file_open <%s> ", Name);
 
@@ -1449,7 +1538,7 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
             {
                 g_original_fclose(*New);
                 *New = &g_efi_file_replace.WrapperHandle;
             {
                 g_original_fclose(*New);
                 *New = &g_efi_file_replace.WrapperHandle;
-                ventoy_wrapper_file_procotol(*New, FALSE);
+                ventoy_wrapper_file_procotol(*New, FALSE, 0);
 
                 virt = g_virt_chunk + g_file_replace_list->new_file_virtual_id;
 
 
                 virt = g_virt_chunk + g_file_replace_list->new_file_virtual_id;
 
@@ -1475,15 +1564,18 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
         }
     }
 
         }
     }
 
-
-
-    if (g_img_replace_list && g_img_replace_list->magic == GRUB_IMG_REPLACE_MAGIC &&
-        g_img_replace_list->new_file_virtual_id < g_virt_chunk_num)
+    for (i = 0; g_img_replace_list && i < VTOY_MAX_CONF_REPLACE; i++)
     {
     {
+        replace = g_img_replace_list + i;
+        if (replace->magic != GRUB_IMG_REPLACE_MAGIC || replace->new_file_virtual_id >= g_virt_chunk_num)
+        {
+            continue;
+        }
+
         AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
         AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
-        for (j = 0; j < g_img_replace_list->old_file_cnt; j++)
+        for (j = 0; j < replace->old_file_cnt; j++)
         {
         {
-            AsciiStrCpyS(OldName, sizeof(OldName), g_img_replace_list[i].old_file_name[j]);
+            AsciiStrCpyS(OldName, sizeof(OldName), replace->old_file_name[j]);
             if ((0 == AsciiStrCmp(OldName, TmpName)) ||
                  (AsciiStrnCmp(OldName, "\\loader\\entries\\", 16) == 0 && 
                   AsciiStrCmp(OldName + 16, TmpName) == 0
             if ((0 == AsciiStrCmp(OldName, TmpName)) ||
                  (AsciiStrnCmp(OldName, "\\loader\\entries\\", 16) == 0 && 
                   AsciiStrCmp(OldName + 16, TmpName) == 0
@@ -1491,31 +1583,31 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
                 )
             {
                 g_original_fclose(*New);
                 )
             {
                 g_original_fclose(*New);
-                *New = &g_img_file_replace.WrapperHandle;
-                ventoy_wrapper_file_procotol(*New, TRUE);
+                *New = &(g_img_file_replace[i].WrapperHandle);
+                ventoy_wrapper_file_procotol(*New, TRUE, i);
 
 
-                virt = g_virt_chunk + g_img_replace_list->new_file_virtual_id;
+                virt = g_virt_chunk + replace->new_file_virtual_id;
 
                 Sectors = (virt->mem_sector_end - virt->mem_sector_start) + (virt->remap_sector_end - virt->remap_sector_start);
                 
 
                 Sectors = (virt->mem_sector_end - virt->mem_sector_start) + (virt->remap_sector_end - virt->remap_sector_start);
                 
-                g_img_file_replace.BlockIoSectorStart = virt->mem_sector_start;
-                g_img_file_replace.FileSizeBytes = Sectors * 2048;
+                g_img_file_replace[i].BlockIoSectorStart = virt->mem_sector_start;
+                g_img_file_replace[i].FileSizeBytes = Sectors * 2048;
 
                 if (gDebugPrint)
                 {
                     debug("## ventoy_wrapper_file_open2 <%s> BlockStart:%lu Sectors:%lu Bytes:%lu", Name,
 
                 if (gDebugPrint)
                 {
                     debug("## ventoy_wrapper_file_open2 <%s> BlockStart:%lu Sectors:%lu Bytes:%lu", Name,
-                        g_img_file_replace.BlockIoSectorStart, Sectors, Sectors * 2048);
+                        g_img_file_replace[i].BlockIoSectorStart, Sectors, Sectors * 2048);
                     sleep(3);
                 }
                 
                 return Status;
             }
         }
                     sleep(3);
                 }
                 
                 return Status;
             }
         }
+    }
 
 
-        if (StrCmp(Name, L"\\loader\\entries") == 0)
-        {
-            (*New)->Open = ventoy_wrapper_file_open;
-        }
+    if (g_img_replace_list && StrCmp(Name, L"\\loader\\entries") == 0)
+    {
+        (*New)->Open = ventoy_wrapper_file_open;
     }
 
     return Status;
     }
 
     return Status;
index 702a3f5ffe06d89f71a0687c71888a882149b558..f0c9b2586cec1f1c4f3a069ebfff9d9544ada2b9 100644 (file)
@@ -28,6 +28,8 @@ typedef int (*grub_env_set_pf)(const char *name, const char *val);
 typedef const char * (*grub_env_get_pf)(const char *name);
 typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
 typedef const char * (*grub_env_get_pf)(const char *name);
 typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
+#define VTOY_MAX_CONF_REPLACE    2
+
 typedef struct ventoy_grub_param_file_replace
 {
     UINT32 magic;
 typedef struct ventoy_grub_param_file_replace
 {
     UINT32 magic;
@@ -41,7 +43,7 @@ typedef struct ventoy_grub_param
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
-    ventoy_grub_param_file_replace img_replace;
+    ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
 #pragma pack()
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
 #pragma pack()
index eecc932d7f2ab01956df034975b97caad7372a3a..fc1279fcf6a8f7199c63e73dcd2c7437c17e5fab 100644 (file)
@@ -107,12 +107,14 @@ grub_uint32_t g_wimiso_size = 0;
 
 int g_vhdboot_enable = 0;
 
 
 int g_vhdboot_enable = 0;
 
-grub_uint64_t g_conf_replace_offset = 0;
 grub_uint64_t g_svd_replace_offset = 0;
 grub_uint64_t g_svd_replace_offset = 0;
-conf_replace *g_conf_replace_node = NULL;
-grub_uint8_t *g_conf_replace_new_buf = NULL;
-int g_conf_replace_new_len = 0;
-int g_conf_replace_new_len_align = 0;
+
+int g_conf_replace_count = 0;
+grub_uint64_t g_conf_replace_offset[VTOY_MAX_CONF_REPLACE] = { 0 };
+conf_replace *g_conf_replace_node[VTOY_MAX_CONF_REPLACE] = { NULL };
+grub_uint8_t *g_conf_replace_new_buf[VTOY_MAX_CONF_REPLACE] = { NULL };
+int g_conf_replace_new_len[VTOY_MAX_CONF_REPLACE] = { 0 };
+int g_conf_replace_new_len_align[VTOY_MAX_CONF_REPLACE] = { 0 };
 
 int g_ventoy_disk_bios_id = 0;
 ventoy_gpt_info *g_ventoy_part_info = NULL;
 
 int g_ventoy_disk_bios_id = 0;
 ventoy_gpt_info *g_ventoy_part_info = NULL;
@@ -3250,8 +3252,9 @@ static grub_err_t ventoy_cmd_img_sector(grub_extcmd_context_t ctxt, int argc, ch
         return grub_error(GRUB_ERR_BAD_ARGUMENT, "Can't open file %s\n", args[0]); 
     }
 
         return grub_error(GRUB_ERR_BAD_ARGUMENT, "Can't open file %s\n", args[0]); 
     }
 
-    g_conf_replace_node = NULL;
-    g_conf_replace_offset = 0;
+    g_conf_replace_count = 0;
+    grub_memset(g_conf_replace_node, 0, sizeof(g_conf_replace_node ));
+    grub_memset(g_conf_replace_offset, 0, sizeof(g_conf_replace_offset ));
     
     if (g_img_chunk_list.chunk)
     {
     
     if (g_img_chunk_list.chunk)
     {
@@ -3294,11 +3297,15 @@ static grub_err_t ventoy_cmd_img_sector(grub_extcmd_context_t ctxt, int argc, ch
 
 static grub_err_t ventoy_select_conf_replace(grub_extcmd_context_t ctxt, int argc, char **args)
 {
 
 static grub_err_t ventoy_select_conf_replace(grub_extcmd_context_t ctxt, int argc, char **args)
 {
+    int i;
+    int n;
     grub_uint64_t offset = 0;
     grub_uint32_t align = 0;
     grub_file_t file = NULL;
     conf_replace *node = NULL;
     grub_uint64_t offset = 0;
     grub_uint32_t align = 0;
     grub_file_t file = NULL;
     conf_replace *node = NULL;
-        
+    conf_replace *nodes[VTOY_MAX_CONF_REPLACE] = { NULL };
+    ventoy_grub_param_file_replace *replace = NULL;
+    
     (void)ctxt;
     (void)argc;
     (void)args;
     (void)ctxt;
     (void)argc;
     (void)args;
@@ -3310,67 +3317,72 @@ static grub_err_t ventoy_select_conf_replace(grub_extcmd_context_t ctxt, int arg
         return 0;
     }
 
         return 0;
     }
 
-    node = ventoy_plugin_find_conf_replace(args[1]);
-    if (!node)
+    n = ventoy_plugin_find_conf_replace(args[1], nodes);
+    if (!n)
     {
         debug("Conf replace not found for %s\n", args[1]);
         goto end;
     }
 
     {
         debug("Conf replace not found for %s\n", args[1]);
         goto end;
     }
 
-    debug("Find conf replace for %s\n", args[1]);
+    debug("Find %d conf replace for %s\n", n, args[1]);
 
 
-    file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(loop)%s", node->orgconf);
-    if (file)
+    g_conf_replace_count = n;
+    for (i = 0; i < n; i++)
     {
     {
-        offset = grub_iso9660_get_last_file_dirent_pos(file);
-        grub_file_close(file);  
-    }
-    else if (node->img > 0)
-    {
-        offset = 0;
-    }
-    else
-    {
-        debug("<(loop)%s> NOT exist\n", node->orgconf);
-        goto end;
-    }
+        node = nodes[i];
 
 
-    file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[0], node->newconf);
-    if (!file)
-    {
-        debug("New config file <%s%s> NOT exist\n", args[0], node->newconf);
-        goto end;
-    }
+        file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(loop)%s", node->orgconf);
+        if (file)
+        {
+            offset = grub_iso9660_get_last_file_dirent_pos(file);
+            grub_file_close(file);  
+        }
+        else if (node->img > 0)
+        {
+            offset = 0;
+        }
+        else
+        {
+            debug("<(loop)%s> NOT exist\n", node->orgconf);
+            continue;
+        }
 
 
-    align = ((int)file->size + 2047) / 2048 * 2048;
+        file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[0], node->newconf);
+        if (!file)
+        {
+            debug("New config file <%s%s> NOT exist\n", args[0], node->newconf);
+            continue;
+        }
 
 
-    if (align > vtoy_max_replace_file_size)
-    {
-        debug("New config file <%s%s> too big\n", args[0], node->newconf);
-        goto end;
-    }
+        align = ((int)file->size + 2047) / 2048 * 2048;
 
 
-    grub_file_read(file, g_conf_replace_new_buf, file->size);
-    g_conf_replace_new_len = (int)file->size;
-    g_conf_replace_new_len_align = align;
+        if (align > vtoy_max_replace_file_size)
+        {
+            debug("New config file <%s%s> too big\n", args[0], node->newconf);
+            grub_file_close(file);
+            continue;
+        }
 
 
-    g_conf_replace_node = node;
-    g_conf_replace_offset = offset + 2;
+        grub_file_read(file, g_conf_replace_new_buf[i], file->size);
+        grub_file_close(file);
+        g_conf_replace_new_len[i] = (int)file->size;
+        g_conf_replace_new_len_align[i] = align;
 
 
-    if (node->img > 0)
-    {
-        g_grub_param->img_replace.magic = GRUB_IMG_REPLACE_MAGIC;
-        g_grub_param->img_replace.old_name_cnt = 1;
-        grub_snprintf(g_grub_param->img_replace.old_file_name[0], 256, "%s", node->orgconf);
-    }
+        g_conf_replace_node[i] = node;
+        g_conf_replace_offset[i] = offset + 2;
 
 
-    debug("conf_replace OK: newlen: %d\n", g_conf_replace_new_len);
+        if (node->img > 0)
+        {
+            replace = &(g_grub_param->img_replace[i]);
+            replace->magic = GRUB_IMG_REPLACE_MAGIC;
+            grub_snprintf(replace->old_file_name[replace->old_name_cnt], 256, "%s", node->orgconf);
+            replace->old_name_cnt++;
+        }
 
 
-end:
-    if (file)
-    {
-        grub_file_close(file);        
+        debug("conf_replace OK: newlen[%d]: %d img:%d\n", i, g_conf_replace_new_len[i], node->img);
     }
     }
+
+end:
     VENTOY_CMD_RETURN(GRUB_ERR_NONE);
 }
 
     VENTOY_CMD_RETURN(GRUB_ERR_NONE);
 }
 
@@ -5945,6 +5957,7 @@ static grub_err_t ventoy_cmd_dump_rsv_page(grub_extcmd_context_t ctxt, int argc,
 
 int ventoy_env_init(void)
 {
 
 int ventoy_env_init(void)
 {
+    int i;
     char buf[64];
 
     grub_env_set("vtdebug_flag", "");
     char buf[64];
 
     grub_env_set("vtdebug_flag", "");
@@ -5952,7 +5965,10 @@ int ventoy_env_init(void)
     g_part_list_buf = grub_malloc(VTOY_PART_BUF_LEN);
     g_tree_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
     g_list_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
     g_part_list_buf = grub_malloc(VTOY_PART_BUF_LEN);
     g_tree_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
     g_list_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
-    g_conf_replace_new_buf = grub_malloc(vtoy_max_replace_file_size); 
+    for (i = 0; i < VTOY_MAX_CONF_REPLACE; i++)
+    {
+        g_conf_replace_new_buf[i] = grub_malloc(vtoy_max_replace_file_size);         
+    }
 
     ventoy_filt_register(0, ventoy_wrapper_open);
 
 
     ventoy_filt_register(0, ventoy_wrapper_open);
 
index 3462c5e5c601f628211d7845c58aa68ee496f98a..2f4d140603e5dbead5bcd5d6d785eaa57be4d4ff 100644 (file)
@@ -960,7 +960,7 @@ typedef struct custom_boot
     struct custom_boot *next;
 }custom_boot;
 
     struct custom_boot *next;
 }custom_boot;
 
-#define vtoy_max_replace_file_size  (2 * 1024 * 1024)
+#define vtoy_max_replace_file_size  (1024 * 1024)
 typedef struct conf_replace
 {
     int pathlen;
 typedef struct conf_replace
 {
     int pathlen;
@@ -1046,12 +1046,13 @@ extern int g_vhdboot_enable;
 extern int g_plugin_image_list;
 
 extern ventoy_gpt_info *g_ventoy_part_info;
 extern int g_plugin_image_list;
 
 extern ventoy_gpt_info *g_ventoy_part_info;
-extern grub_uint64_t g_conf_replace_offset;
+extern int g_conf_replace_count;
+extern grub_uint64_t g_conf_replace_offset[VTOY_MAX_CONF_REPLACE];
 extern grub_uint64_t g_svd_replace_offset;
 extern grub_uint64_t g_svd_replace_offset;
-extern conf_replace *g_conf_replace_node;
-extern grub_uint8_t *g_conf_replace_new_buf;
-extern int g_conf_replace_new_len;
-extern int g_conf_replace_new_len_align;
+extern conf_replace *g_conf_replace_node[VTOY_MAX_CONF_REPLACE];
+extern grub_uint8_t *g_conf_replace_new_buf[VTOY_MAX_CONF_REPLACE];
+extern int g_conf_replace_new_len[VTOY_MAX_CONF_REPLACE];
+extern int g_conf_replace_new_len_align[VTOY_MAX_CONF_REPLACE];
 extern int g_ventoy_disk_bios_id;
 extern grub_uint64_t g_ventoy_disk_size;
 extern grub_uint64_t g_ventoy_disk_part_size[2];
 extern int g_ventoy_disk_bios_id;
 extern grub_uint64_t g_ventoy_disk_size;
 extern grub_uint64_t g_ventoy_disk_part_size[2];
@@ -1095,7 +1096,7 @@ const menu_tip * ventoy_plugin_get_menu_tip(int type, const char *isopath);
 const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path);
 int ventoy_plugin_check_memdisk(const char *isopath);
 int ventoy_plugin_get_image_list_index(int type, const char *name);
 const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path);
 int ventoy_plugin_check_memdisk(const char *isopath);
 int ventoy_plugin_get_image_list_index(int type, const char *name);
-conf_replace * ventoy_plugin_find_conf_replace(const char *iso);
+int ventoy_plugin_find_conf_replace(const char *iso, conf_replace *nodes[VTOY_MAX_CONF_REPLACE]);
 dud * ventoy_plugin_find_dud(const char *iso);
 int ventoy_plugin_load_dud(dud *node, const char *isopart);
 int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
 dud * ventoy_plugin_find_dud(const char *iso);
 int ventoy_plugin_load_dud(dud *node, const char *isopart);
 int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
index f0ac3251bdbe92cec0dac3010232f6b370965c35..94befa7aaf93d9d817c06ba9c41ae3c497ab03d9 100644 (file)
@@ -654,11 +654,18 @@ int ventoy_cpio_newc_fill_head(void *buf, int filesize, const void *filedata, co
 
 static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
 {
 
 static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
 {
+    int i;
     grub_uint32_t count = g_valid_initrd_count;
     
     grub_uint32_t count = g_valid_initrd_count;
     
-    if (g_conf_replace_offset > 0)
+    if (g_conf_replace_count > 0)
     {
     {
-        count++;
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {
+                count++;
+            }
+        }
     }
     
     if (g_append_ext_sector > 0)
     }
     
     if (g_append_ext_sector > 0)
@@ -671,13 +678,20 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
 
 static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
 {
 
 static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
 {
+    int i;
     grub_uint32_t size;
     
     size = (sizeof(ventoy_virt_chunk) + g_ventoy_cpio_size) * g_valid_initrd_count;
     grub_uint32_t size;
     
     size = (sizeof(ventoy_virt_chunk) + g_ventoy_cpio_size) * g_valid_initrd_count;
-    
-    if (g_conf_replace_offset > 0)
+
+    if (g_conf_replace_count > 0)
     {
     {
-        size += sizeof(ventoy_virt_chunk) + g_conf_replace_new_len_align;
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {
+                size += sizeof(ventoy_virt_chunk) + g_conf_replace_new_len_align[i];
+            }
+        }
     }
     
     if (g_append_ext_sector > 0)
     }
     
     if (g_append_ext_sector > 0)
@@ -690,6 +704,7 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
 
 static void ventoy_linux_fill_virt_data(    grub_uint64_t isosize, ventoy_chain_head *chain)
 {
 
 static void ventoy_linux_fill_virt_data(    grub_uint64_t isosize, ventoy_chain_head *chain)
 {
+    int i = 0;
     int id = 0;
     int virtid = 0;
     initrd_info *node;
     int id = 0;
     int virtid = 0;
     initrd_info *node;
@@ -699,6 +714,7 @@ static void ventoy_linux_fill_virt_data(    grub_uint64_t isosize, ventoy_chain_
     grub_uint32_t initrd_secs;
     char *override;
     ventoy_virt_chunk *cur;
     grub_uint32_t initrd_secs;
     char *override;
     ventoy_virt_chunk *cur;
+    ventoy_grub_param_file_replace *replace = NULL;
     char name[32];
 
     override = (char *)chain + chain->virt_chunk_offset;
     char name[32];
 
     override = (char *)chain + chain->virt_chunk_offset;
@@ -764,30 +780,37 @@ static void ventoy_linux_fill_virt_data(    grub_uint64_t isosize, ventoy_chain_
         virtid++;
     }
 
         virtid++;
     }
 
-    if (g_conf_replace_offset > 0)
+    if (g_conf_replace_count > 0)
     {
     {
-        cpio_secs = g_conf_replace_new_len_align / 2048;
-    
-        cur->mem_sector_start   = sector;
-        cur->mem_sector_end     = cur->mem_sector_start + cpio_secs;
-        cur->mem_sector_offset  = offset;
-        cur->remap_sector_start = 0;
-        cur->remap_sector_end   = 0;
-        cur->org_sector_start   = 0;
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {
+                cpio_secs = g_conf_replace_new_len_align[i] / 2048;
+            
+                cur->mem_sector_start   = sector;
+                cur->mem_sector_end     = cur->mem_sector_start + cpio_secs;
+                cur->mem_sector_offset  = offset;
+                cur->remap_sector_start = 0;
+                cur->remap_sector_end   = 0;
+                cur->org_sector_start   = 0;
 
 
-        grub_memcpy(override + offset, g_conf_replace_new_buf, g_conf_replace_new_len);
+                grub_memcpy(override + offset, g_conf_replace_new_buf[i], g_conf_replace_new_len[i]);
 
 
-        chain->virt_img_size_in_bytes += g_conf_replace_new_len_align;
+                chain->virt_img_size_in_bytes += g_conf_replace_new_len_align[i];
 
 
-        if (g_grub_param->img_replace.magic == GRUB_IMG_REPLACE_MAGIC)
-        {
-            g_grub_param->img_replace.new_file_virtual_id = virtid;
-        }
+                replace = g_grub_param->img_replace + i;
+                if (replace->magic == GRUB_IMG_REPLACE_MAGIC)
+                {
+                    replace->new_file_virtual_id = virtid;
+                }
 
 
-        offset += g_conf_replace_new_len_align;
-        sector += cpio_secs;
-        cur++;
-        virtid++;
+                offset += g_conf_replace_new_len_align[i];
+                sector += cpio_secs;
+                cur++;
+                virtid++;
+            }
+        }
     }
 
     return;
     }
 
     return;
@@ -795,11 +818,18 @@ static void ventoy_linux_fill_virt_data(    grub_uint64_t isosize, ventoy_chain_
 
 static grub_uint32_t ventoy_linux_get_override_chunk_count(void)
 {
 
 static grub_uint32_t ventoy_linux_get_override_chunk_count(void)
 {
+    int i;
     grub_uint32_t count = g_valid_initrd_count;
     grub_uint32_t count = g_valid_initrd_count;
-    
-    if (g_conf_replace_offset > 0)
+
+    if (g_conf_replace_count > 0)
     {
     {
-        count++;
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {
+                count++;
+            }
+        }
     }
 
     if (g_svd_replace_offset > 0)
     }
 
     if (g_svd_replace_offset > 0)
@@ -812,11 +842,18 @@ static grub_uint32_t ventoy_linux_get_override_chunk_count(void)
 
 static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
 {
 
 static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
 {
+    int i;
     int count = g_valid_initrd_count;
     int count = g_valid_initrd_count;
-    
-    if (g_conf_replace_offset > 0)
+
+    if (g_conf_replace_count > 0)
     {
     {
-        count++;
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {
+                count++;
+            }
+        }
     }
 
     if (g_svd_replace_offset > 0)
     }
 
     if (g_svd_replace_offset > 0)
@@ -829,6 +866,7 @@ static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
 
 static void ventoy_linux_fill_override_data(    grub_uint64_t isosize, void *override)
 {
 
 static void ventoy_linux_fill_override_data(    grub_uint64_t isosize, void *override)
 {
+    int i;
     initrd_info *node;
     grub_uint32_t mod;
     grub_uint32_t newlen;
     initrd_info *node;
     grub_uint32_t mod;
     grub_uint32_t newlen;
@@ -883,23 +921,29 @@ static void ventoy_linux_fill_override_data(    grub_uint64_t isosize, void *ove
         cur++;
     }
 
         cur++;
     }
 
-    if (g_conf_replace_offset > 0)
-    {        
-        cur->img_offset = g_conf_replace_offset;
-        cur->override_size = sizeof(ventoy_iso9660_override);
+    if (g_conf_replace_count > 0)
+    {
+        for (i = 0; i < g_conf_replace_count; i++)
+        {
+            if (g_conf_replace_offset[i] > 0)
+            {        
+                cur->img_offset = g_conf_replace_offset[i];
+                cur->override_size = sizeof(ventoy_iso9660_override);
 
 
-        newlen = (grub_uint32_t)(g_conf_replace_new_len);
+                newlen = (grub_uint32_t)(g_conf_replace_new_len[i]);
 
 
-        dirent = (ventoy_iso9660_override *)cur->override_data;
-        dirent->first_sector    = (grub_uint32_t)sector;
-        dirent->size            = newlen;
-        dirent->first_sector_be = grub_swap_bytes32(dirent->first_sector);
-        dirent->size_be         = grub_swap_bytes32(dirent->size);
+                dirent = (ventoy_iso9660_override *)cur->override_data;
+                dirent->first_sector    = (grub_uint32_t)sector;
+                dirent->size            = newlen;
+                dirent->first_sector_be = grub_swap_bytes32(dirent->first_sector);
+                dirent->size_be         = grub_swap_bytes32(dirent->size);
 
 
-        sector += (dirent->size + 2047) / 2048;
-        cur++;
+                sector += (dirent->size + 2047) / 2048;
+                cur++;
+            }
+        }
     }
     }
-    
+
     if (g_svd_replace_offset > 0)
     {        
         cur->img_offset = g_svd_replace_offset;
     if (g_svd_replace_offset > 0)
     {        
         cur->img_offset = g_svd_replace_offset;
index 1d6e760876d2a4546ddceede58031a099149a59b..b0dd1d52779736b59788d354cc2222af32ba5e79 100644 (file)
@@ -3054,14 +3054,15 @@ int ventoy_plugin_get_image_list_index(int type, const char *name)
     return 0;
 }
 
     return 0;
 }
 
-conf_replace * ventoy_plugin_find_conf_replace(const char *iso)
+int ventoy_plugin_find_conf_replace(const char *iso, conf_replace *nodes[VTOY_MAX_CONF_REPLACE])
 {
 {
+    int n = 0;
     int len;
     conf_replace *node;
 
     if (!g_conf_replace_head)
     {
     int len;
     conf_replace *node;
 
     if (!g_conf_replace_head)
     {
-        return NULL;
+        return 0;
     }
 
     len = (int)grub_strlen(iso);
     }
 
     len = (int)grub_strlen(iso);
@@ -3070,11 +3071,15 @@ conf_replace * ventoy_plugin_find_conf_replace(const char *iso)
     {
         if (node->pathlen == len && ventoy_strncmp(node->isopath, iso, len) == 0)
         {
     {
         if (node->pathlen == len && ventoy_strncmp(node->isopath, iso, len) == 0)
         {
-            return node;
+            nodes[n++] = node;
+            if (n >= VTOY_MAX_CONF_REPLACE)
+            {
+                return n;
+            }
         }
     }
     
         }
     }
     
-    return NULL;
+    return n;
 }
 
 dud * ventoy_plugin_find_dud(const char *iso)
 }
 
 dud * ventoy_plugin_find_dud(const char *iso)
index 9b5bb4a80e28547f0f1873a1425b36ce2d634a4d..c140b9257923ba3dd42db5fafc5e9b5cbac69b78 100644 (file)
@@ -262,6 +262,7 @@ typedef struct ventoy_img_chunk_list
 
 #pragma pack(1)
 
 
 #pragma pack(1)
 
+#define VTOY_MAX_CONF_REPLACE    2
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
 #define GRUB_IMG_REPLACE_MAGIC   0x1259BEEF
 
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
 #define GRUB_IMG_REPLACE_MAGIC   0x1259BEEF
 
@@ -282,7 +283,7 @@ typedef struct ventoy_grub_param
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_get_pf grub_env_get;
     grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
-    ventoy_grub_param_file_replace img_replace;
+    ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
     grub_env_printf_pf grub_env_printf;
 }ventoy_grub_param;
 
     grub_env_printf_pf grub_env_printf;
 }ventoy_grub_param;
 
index b232262cd5bf5fcc4be98f92b8c5676375a05541..5d7d5b5f3165171e3aa9fb829c10be98bd47a83d 100644 (file)
@@ -2145,7 +2145,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.77"
+set VENTOY_VERSION="1.0.78"
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
index 09e4c25d782fb3fbc14cd5487d5452c6292bfc34..5a514ccc40974151a3c16e3c4e9798333f3fb627 100644 (file)
Binary files a/INSTALL/ventoy/ventoy.cpio and b/INSTALL/ventoy/ventoy.cpio differ
index c4d60ddffbe34560d7b461f1750e5af36a1a7493..d359a0a77f7e1c42d9a9443e8f0904efa580929d 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_aa64.efi and b/INSTALL/ventoy/ventoy_aa64.efi differ
index c4b9027b7635c7b25c04de6d3362e8d058c38047..76f065c2874994fd228a983e2cdb9e17f9e58b0f 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_arm64.cpio and b/INSTALL/ventoy/ventoy_arm64.cpio differ
index c53b859848dd86ae502cea339c1b49ae92c2d429..b28a9d4a0d0ed990ecdc96f2ceb4a3cffd6bcd47 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_ia32.efi and b/INSTALL/ventoy/ventoy_ia32.efi differ
index d4d2241a6d3a68dfaf8bc3730bf89dabf8fc2f2a..ed2edeb99bbda71900c6f586fd10c1068c0191ce 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_mips64.cpio and b/INSTALL/ventoy/ventoy_mips64.cpio differ
index 4f1f052ea4b857d7bdcaef3beef9023b58b2704e..7131cab963c501a0e4291db0e683a3166bf59780 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_unix.cpio and b/INSTALL/ventoy/ventoy_unix.cpio differ
index ab970ebbdafcab949a1e29520ec7e607a80be97a..9126e4a60d194f3caedb31fd46627b82f2c7b16a 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_x64.efi and b/INSTALL/ventoy/ventoy_x64.efi differ
index 5622f0d006db02d7bc2ff35d377ae90ec259dad6..205854385dab408dbb43dbc5cde7ecd9320a0673 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_x86.cpio and b/INSTALL/ventoy/ventoy_x86.cpio differ
index 59f1fa6171d434563bb442b75c592bf06caddd1d..bc99e27da23ff6bf2d6d82336f810fd24f653b82 100644 (file)
Binary files a/INSTALL/ventoy/vtloopex.cpio and b/INSTALL/ventoy/vtloopex.cpio differ
index e2e305e62d3fb2110f62f8f024a2c3e185bbbce0..57387a088aadb7bd32533e4f659e0dc07d13b0c4 100644 (file)
Binary files a/INSTALL/ventoy/vtoyutil_aa64.efi and b/INSTALL/ventoy/vtoyutil_aa64.efi differ
index 6b2d05ca51bbf42589372d608414141839e5f570..9c76ce170fa55f4364bb704f9ff923a29f7f3f18 100644 (file)
Binary files a/INSTALL/ventoy/vtoyutil_ia32.efi and b/INSTALL/ventoy/vtoyutil_ia32.efi differ
index a75bcef04d4cf460714a05e8fd0761683e78968d..eb430dde22795a25963652d08b3208362cb32d99 100644 (file)
Binary files a/INSTALL/ventoy/vtoyutil_x64.efi and b/INSTALL/ventoy/vtoyutil_x64.efi differ
index 41309d12474fb3a152fa44c8f6321aa09b87e771..3b0f258eada94a9fd386719b22d31b939f88d3da 100644 (file)
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ You can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.<br
 x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
 Both MBR and GPT partition style are supported in the same way.<br/>
 Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
 x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
 Both MBR and GPT partition style are supported in the same way.<br/>
 Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
-  900+ ISO files are tested (<a href="https://www.ventoy.net/en/isolist.html">List</a>). 90%+ distros in <a href="https://distrowatch.com/">distrowatch.com</a> supported (<a href="https://www.ventoy.net/en/distrowatch.html">Details</a>). <br/>
+  920+ ISO files are tested (<a href="https://www.ventoy.net/en/isolist.html">List</a>). 90%+ distros in <a href="https://distrowatch.com/">distrowatch.com</a> supported (<a href="https://www.ventoy.net/en/distrowatch.html">Details</a>). <br/>
 <br/>Official Website: <a href=https://www.ventoy.net>https://www.ventoy.net</a>
 </h4>
 
 <br/>Official Website: <a href=https://www.ventoy.net>https://www.ventoy.net</a>
 </h4>
 
@@ -70,7 +70,7 @@ A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plug
 * FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
 * ISO files larger than 4GB supported
 * Native boot menu style for Legacy & UEFI
 * FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
 * ISO files larger than 4GB supported
 * Native boot menu style for Legacy & UEFI
-* Most types of OS supported, 900+ iso files tested
+* Most types of OS supported, 920+ iso files tested
 * Linux vDisk boot supported
 * Not only boot but also complete installation process
 * Menu dynamically switchable between List/TreeView mode
 * Linux vDisk boot supported
 * Not only boot but also complete installation process
 * Menu dynamically switchable between List/TreeView mode