diff options
author | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2023-09-26 06:29:01 +0200 |
---|---|---|
committer | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2023-09-26 06:29:01 +0200 |
commit | 9aff3669c6703454e14c748d0c1d24ff5ab90196 (patch) | |
tree | 104a040cba18782470166e9cf2b189c111388858 | |
parent | bb77cca1a797c79e63dd0e951650548ef2005f83 (diff) |
EfiGuardDxe: delay driver unload when a non-Windows OS is booted
Fixes #91
-rw-r--r-- | EfiGuardDxe/EfiGuardDxe.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/EfiGuardDxe/EfiGuardDxe.c b/EfiGuardDxe/EfiGuardDxe.c index 3b6fe9b..0af6bd9 100644 --- a/EfiGuardDxe/EfiGuardDxe.c +++ b/EfiGuardDxe/EfiGuardDxe.c @@ -220,11 +220,6 @@ HookedLoadImage( LoadedImage->ImageBase, LoadedImage->ImageSize); } - else - { - // A non-Windows OS is being booted. Unload ourselves - EfiGuardUnload(gImageHandle); - } } } @@ -402,7 +397,7 @@ ExitBootServicesEvent( // If the DSE bypass method is *not* DSE_DISABLE_SETVARIABLE_HOOK, perform some cleanup now. In principle this should allow // linking with /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER, because our driver image may be freed after this callback returns. // Using DSE_DISABLE_SETVARIABLE_HOOK requires linking with /SUBSYSTEM:EFI_RUNTIME_DRIVER, because the image must not be freed. - if (gDriverConfig.DseBypassMethod != DSE_DISABLE_SETVARIABLE_HOOK) + if (gDriverConfig.DseBypassMethod != DSE_DISABLE_SETVARIABLE_HOOK || gBootmgfwHandle == NULL) { // Uninstall our installed driver protocols gBS->UninstallMultipleProtocolInterfaces(gImageHandle, |