Skip to content

Commit

Permalink
EfiGuardDxe: delay driver unload when a non-Windows OS is booted
Browse files Browse the repository at this point in the history
Fixes #91
  • Loading branch information
Mattiwatti committed Sep 26, 2023
1 parent bb77cca commit 9aff366
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions EfiGuardDxe/EfiGuardDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ HookedLoadImage(
LoadedImage->ImageBase,
LoadedImage->ImageSize);
}
else
{
// A non-Windows OS is being booted. Unload ourselves
EfiGuardUnload(gImageHandle);
}
}
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9aff366

Please sign in to comment.