mBmLegacyBoot = LegacyBoot;\r
}\r
\r
+/**\r
+ Return TRUE when the boot option is auto-created instead of manually added.\r
+\r
+ @param BootOption Pointer to the boot option to check.\r
+\r
+ @retval TRUE The boot option is auto-created.\r
+ @retval FALSE The boot option is manually added.\r
+**/\r
+BOOLEAN\r
+BmIsAutoCreateBootOption (\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
+ )\r
+{\r
+ if ((BootOption->OptionalDataSize == sizeof (EFI_GUID)) &&\r
+ CompareGuid ((EFI_GUID *) BootOption->OptionalData, &mBmAutoCreateBootOptionGuid)\r
+ ) {\r
+ return TRUE;\r
+ } else {\r
+ return FALSE;\r
+ }\r
+}\r
+\r
/**\r
For a bootable Device path, return its boot type.\r
\r
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);\r
ASSERT_EFI_ERROR (Status);\r
\r
- ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;\r
- ImageInfo->LoadOptions = BootOption->OptionalData;\r
+ if (!BmIsAutoCreateBootOption (BootOption)) {\r
+ ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;\r
+ ImageInfo->LoadOptions = BootOption->OptionalData;\r
+ }\r
\r
//\r
// Clean to NULL because the image is loaded directly from the firmwares boot manager.\r
for (Index = 0; Index < NvBootOptionCount; Index++) {\r
if (((DevicePathType (NvBootOptions[Index].FilePath) != BBS_DEVICE_PATH) || \r
(DevicePathSubType (NvBootOptions[Index].FilePath) != BBS_BBS_DP)\r
- ) &&\r
- (NvBootOptions[Index].OptionalDataSize == sizeof (EFI_GUID)) &&\r
- CompareGuid ((EFI_GUID *) NvBootOptions[Index].OptionalData, &mBmAutoCreateBootOptionGuid)\r
+ ) && BmIsAutoCreateBootOption (&NvBootOptions[Index])\r
) {\r
//\r
// Only check those added by BDS\r