From c909d52e5fa89bffa83f7109856d82dc07c56b82 Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Thu, 11 Nov 2021 16:08:26 +0300 Subject: Add lesson 58 Signed-off-by: Konstantin Aladyshev --- .../UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Lessons/Lesson_58/UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c (limited to 'Lessons/Lesson_58/UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c') diff --git a/Lessons/Lesson_58/UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c b/Lessons/Lesson_58/UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c new file mode 100644 index 0000000..45d992a --- /dev/null +++ b/Lessons/Lesson_58/UefiLessonsPkg/HIIStaticForm/HIIStaticForm.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021, Konstantin Aladyshev + * + * SPDX-License-Identifier: MIT + */ + +#include +#include + +#include +#include + +extern UINT8 FormBin[]; + + +EFI_STATUS +EFIAPI +UefiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_HII_HANDLE Handle = HiiAddPackages( + &gEfiCallerIdGuid, + NULL, + HIIStaticFormStrings, + FormBin, + NULL + ); + if (Handle == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + EFI_STATUS Status; + EFI_FORM_BROWSER2_PROTOCOL* FormBrowser2; + Status = gBS->LocateProtocol(&gEfiFormBrowser2ProtocolGuid, NULL, (VOID**)&FormBrowser2); + if (EFI_ERROR(Status)) { + return Status; + } + + Status = FormBrowser2->SendForm ( + FormBrowser2, + &Handle, + 1, + NULL, + 0, + NULL, + NULL + ); + + HiiRemovePackages(Handle); + + return EFI_SUCCESS; +} -- cgit v1.2.3-18-g5258