Skip to content

Commit 9aff366

Browse files
committed
EfiGuardDxe: delay driver unload when a non-Windows OS is booted
Fixes #91
1 parent bb77cca commit 9aff366

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

EfiGuardDxe/EfiGuardDxe.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,6 @@ HookedLoadImage(
220220
LoadedImage->ImageBase,
221221
LoadedImage->ImageSize);
222222
}
223-
else
224-
{
225-
// A non-Windows OS is being booted. Unload ourselves
226-
EfiGuardUnload(gImageHandle);
227-
}
228223
}
229224
}
230225

@@ -402,7 +397,7 @@ ExitBootServicesEvent(
402397
// If the DSE bypass method is *not* DSE_DISABLE_SETVARIABLE_HOOK, perform some cleanup now. In principle this should allow
403398
// linking with /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER, because our driver image may be freed after this callback returns.
404399
// Using DSE_DISABLE_SETVARIABLE_HOOK requires linking with /SUBSYSTEM:EFI_RUNTIME_DRIVER, because the image must not be freed.
405-
if (gDriverConfig.DseBypassMethod != DSE_DISABLE_SETVARIABLE_HOOK)
400+
if (gDriverConfig.DseBypassMethod != DSE_DISABLE_SETVARIABLE_HOOK || gBootmgfwHandle == NULL)
406401
{
407402
// Uninstall our installed driver protocols
408403
gBS->UninstallMultipleProtocolInterfaces(gImageHandle,

0 commit comments

Comments
 (0)