Fix the boot issue with old UEFI version firmware when secure boot is disabled.

This commit is contained in:
longpanda
2026-06-25 19:23:48 +08:00
parent 31648a0d4b
commit 475de1dada
5 changed files with 241 additions and 84 deletions

View File

@@ -66,19 +66,21 @@ typedef struct _SHIM_IMAGE_LOADER {
EFI_IMAGE_UNLOAD UnloadImage;
} SHIM_IMAGE_LOADER;
typedef VOID (*unhook_system_services_pf)(VOID);
typedef VOID (*shim_void_func_pf)(VOID);
/*
* The two offset here are extract from the shim file which used in Ventoy.
* nm BOOTX64.EFI | grep shim_load_image
* nm BOOTX64.EFI | grep unhook_system_services
* nm BOOTX64.EFI | grep uninstall_shim_protocols
*
* It means that they must be updated every time Ventoy update the shim file.
*
*/
#define NM_SHIM_LOAD_IMAGE_OFFSET 0x2dc12
#define NM_UNHOOK_SYSTEM_SERVICES_OFFSET 0x2e278
#define NM_UNINSTALL_SHIM_PROTOCOLS_OFFSET 0x26264
@@ -95,15 +97,6 @@ do { \
}\
} while (0)
#define CheckBSFreePool(p) \
do { \
if (p) { \
gBS->FreePool(p); \
(p) = NULL; \
}\
} while (0)
#define VTOY_SHIM_POLICY_GUID {0x90a29d14, 0x3968, 0x48fe, { 0x85, 0x81, 0x6b, 0x7f, 0x7d, 0xc4, 0x70, 0x55 }};