+
+
+ 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)
+ {
+ AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
+ for (j = 0; j < g_img_replace_list->old_file_cnt; j++)
+ {
+ AsciiStrCpyS(OldName, sizeof(OldName), g_img_replace_list[i].old_file_name[j]);
+ if ((0 == AsciiStrCmp(OldName, TmpName)) ||
+ (AsciiStrnCmp(OldName, "\\loader\\entries", 15) == 0 &&
+ AsciiStrCmp(OldName + 16, TmpName) == 0
+ )
+ )
+ {
+ g_original_fclose(*New);
+ *New = &g_img_file_replace.WrapperHandle;
+ ventoy_wrapper_file_procotol(*New, TRUE);
+
+ virt = g_virt_chunk + g_img_replace_list->new_file_virtual_id;
+
+ 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;
+
+ if (gDebugPrint)
+ {
+ debug("## ventoy_wrapper_file_open2 <%s> BlockStart:%lu Sectors:%lu Bytes:%lu", Name,
+ g_img_file_replace.BlockIoSectorStart, Sectors, Sectors * 2048);
+ sleep(3);
+ }
+
+ return Status;
+ }
+ }
+
+ if (StrCmp(Name, L"\\loader\\entries") == 0)
+ {
+ (*New)->Open = ventoy_wrapper_file_open;
+ }
+ }
+