From 7547649f22102726e555be072e8975a199b027bf Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 22 Apr 2009 02:06:58 +0000 Subject: [PATCH] Update DxeCore to support to install gEfiHiiPackageListProtocolGuid in LoadImage() if it detects the existence of HII resource on the PE image. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8142 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/DxeMain.h | 1 + MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + MdeModulePkg/Core/Dxe/Image/Image.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index d499ab4850..4f57b7257f 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -49,6 +49,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index 9baef70b7e..1cec93fadc 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -130,6 +130,7 @@ gEfiCpuArchProtocolGuid ## CONSUMES gEfiDevicePathProtocolGuid ## CONSUMES gEfiLoadedImageProtocolGuid ## PRODUCES + gEfiHiiPackageListProtocolGuid ## SOMETIMES_PRODUCES gEfiEbcProtocolGuid ## SOMETIMES_CONSUMES gEfiLoadedImageDevicePathProtocolGuid ## PRODUCES diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 5502c7ab18..8ec6793966 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -641,6 +641,14 @@ CoreUnloadAndCloseImage ( &Image->Info ); + if (Image->ImageContext.HiiResourceData != 0) { + Status = CoreUninstallProtocolInterface ( + Image->Handle, + &gEfiHiiPackageListProtocolGuid, + (VOID *) (UINTN) Image->ImageContext.HiiResourceData + ); + } + } if (Image->RuntimeData != NULL) { @@ -903,6 +911,21 @@ CoreLoadImageCommon ( goto Done; } + // + // Install HII Package List Protocol onto the image handle + // + if (Image->ImageContext.HiiResourceData != 0) { + Status = CoreInstallProtocolInterface ( + &Image->Handle, + &gEfiHiiPackageListProtocolGuid, + EFI_NATIVE_INTERFACE, + (VOID *) (UINTN) Image->ImageContext.HiiResourceData + ); + if (EFI_ERROR (Status)) { + goto Done; + } + } + // // Success. Return the image handle // -- 2.39.2