diff options
Diffstat (limited to 'UefiMonitorTest/UefiMonitorTest.c')
-rw-r--r-- | UefiMonitorTest/UefiMonitorTest.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c index 8c4eb9c..bfe75ba 100644 --- a/UefiMonitorTest/UefiMonitorTest.c +++ b/UefiMonitorTest/UefiMonitorTest.c @@ -5,6 +5,9 @@ #include <Library/UefiLib.h> #include <Library/UefiBootServicesTableLib.h> +#include <Library/HiiLib.h> +#include <Library/UefiHiiServicesLib.h> + #include "UefiMonitorTest.h" #include "MainMenu.h" @@ -12,6 +15,41 @@ STATIC CONST UMT_STATE_ACTIONS mStateActions[UMT_STATE_END] = { { MainMenuInit, MainMenuDoit, MainMenuTip, MainMenuKeyRight, MainMenuKeyLeft } }; +EFI_HII_HANDLE gUmtHiiHandle = NULL; + +STATIC +EFI_STATUS +RegisterHiiPackage ( + IN EFI_HANDLE ImageHandle, + OUT EFI_HII_HANDLE *HiiHandle + ) +{ + EFI_STATUS Status; + EFI_HII_PACKAGE_LIST_HEADER *PackageList; + + // Retrieve HII package list from ImageHandle + Status = gBS->OpenProtocol ( + ImageHandle, + &gEfiHiiPackageListProtocolGuid, + (VOID **)&PackageList, + ImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to open EFI_HII_PACKAGE_LIST_PROTOCOL\n")); + return Status; + } + + Status = gHiiDatabase->NewPackageList(gHiiDatabase, PackageList, NULL, HiiHandle); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "Failed to add HII Package list to HII database: %r\n", Status)); + return Status; + } + + return Status; +} + STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL * GetGraphicsOutputProtocol ( @@ -90,6 +128,12 @@ UefiMain ( Status = EFI_SUCCESS; + Status = RegisterHiiPackage (ImageHandle, &gUmtHiiHandle); + if (EFI_ERROR(Status)) { + Print (L"Error: Failed to register HII Package list\n"); + return Status; + } + Gop = GetGraphicsOutputProtocol (); if (Gop == NULL) { Print (L"Error: Getting a Graphical Output Protocol is failed\n"); |