From 26da0b64df29c2a7c266661a7fe0325e0444c96c Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 23 Oct 2015 07:26:58 +0000 Subject: [PATCH] MdeModulePkg: Update BootManagerMenuApp to not display itself Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18656 6f19259b-4bc3-4df7-8a09-765794883524 --- .../BootManagerMenuApp/BootManagerMenu.c | 17 +++++++++++++++-- .../BootManagerMenuApp/BootManagerMenuApp.inf | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c index d43c12f34a..a8d5c03674 100644 --- a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c +++ b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c @@ -262,13 +262,18 @@ InitializeBootMenuData ( OUT BOOT_MENU_POPUP_DATA *BootMenuData ) { + EFI_STATUS Status; UINTN Index; UINTN StrIndex; + EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; if (BootOption == NULL || BootMenuData == NULL) { return EFI_INVALID_PARAMETER; - } - + } + + Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageDevicePathProtocolGuid, (VOID **) &ImageDevicePath); + ASSERT_EFI_ERROR (Status); + BootMenuData->TitleToken[0] = STRING_TOKEN (STR_BOOT_POPUP_MENU_TITLE_STRING); BootMenuData->PtrTokens = AllocateZeroPool (BootOptionCount * sizeof (EFI_STRING_ID)); ASSERT (BootMenuData->PtrTokens != NULL); @@ -284,6 +289,14 @@ InitializeBootMenuData ( !IsBootManagerMenu (&BootOption[Index])) { continue; } + + // + // Don't display myself + // + if (CompareMem (BootOption[Index].FilePath, ImageDevicePath, GetDevicePathSize (ImageDevicePath)) == 0) { + continue; + } + ASSERT (BootOption[Index].Description != NULL); BootMenuData->PtrTokens[StrIndex++] = HiiSetString ( gStringPackHandle, diff --git a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf index b445505409..dd60ef4cd8 100644 --- a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf +++ b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf @@ -52,6 +52,7 @@ [Protocols] gEfiBootLogoProtocolGuid ## CONSUMES + gEfiLoadedImageDevicePathProtocolGuid ## CONSUMES [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## PRODUCES -- 2.39.2