From 8ebe972f6e6ce7a2da078c376c212a2b40fbee03 Mon Sep 17 00:00:00 2001 From: longpanda Date: Fri, 2 Apr 2021 14:11:47 +0800 Subject: [PATCH] Fixup a bug when booting special Windows/WinPE ISO file. --- .../MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c index 109087ea..d7ea1b08 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c @@ -860,7 +860,14 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch) } security = (wim_security_header *)decompress_data; - rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U)); + if (security->len > 0) + { + rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U)); + } + else + { + rootdir = (wim_directory_entry *)(decompress_data + 8); + } /* search winpeshl.exe dirent entry */ search = search_replace_wim_dirent(decompress_data, rootdir);