in OemPkg/BootMenu/BootMenu.c [237:261]
BOOLEAN IsDefaultBootOption (EFI_BOOT_MANAGER_LOAD_OPTION *BootOption) {
UINT32 CurrentAttributes;
BOOLEAN IsDefault;
mDefaultLoadOptions = MsBootOptionsLibGetDefaultOptions (&mDefaultLoadOptionCount);
if (NULL == mDefaultLoadOptions) {
DEBUG((DEBUG_ERROR, "%a Error obtaining default boot options\n", __FUNCTION__));
return FALSE;
}
// The actual boot option may have LOAD_OPTION_ACTIVE set or off. Check for both.
CurrentAttributes = BootOption->Attributes;
BootOption->Attributes |= LOAD_OPTION_ACTIVE;
IsDefault = (-1 != EfiBootManagerFindLoadOption (BootOption, mDefaultLoadOptions, mDefaultLoadOptionCount));
if (!IsDefault) {
BootOption->Attributes &= ~LOAD_OPTION_ACTIVE;
IsDefault = (-1 != EfiBootManagerFindLoadOption (BootOption, mDefaultLoadOptions, mDefaultLoadOptionCount));
}
// Restore attributes
BootOption->Attributes = CurrentAttributes;
EfiBootManagerFreeLoadOptions (mDefaultLoadOptions, mDefaultLoadOptionCount);
return IsDefault;
}