diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-11-10 17:30:32 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-11-10 17:30:32 +0300 |
commit | d03724c8fc726c9add02ed19984d66077edd56ef (patch) | |
tree | 2875bbd19a9e91bc86daa4a48af687b6032c8795 /Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c | |
parent | 5da37dd73d8b6c175eedbf4d92307a86ef6b269e (diff) | |
download | UEFI-Lessons-d03724c8fc726c9add02ed19984d66077edd56ef.tar.gz UEFI-Lessons-d03724c8fc726c9add02ed19984d66077edd56ef.tar.bz2 UEFI-Lessons-d03724c8fc726c9add02ed19984d66077edd56ef.zip |
Add lesson 57
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c')
-rw-r--r-- | Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c new file mode 100644 index 0000000..3aa401e --- /dev/null +++ b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com> + * + * SPDX-License-Identifier: MIT + */ + +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> + +#include <Library/HiiLib.h> +#include <Protocol/FormBrowser2.h> + +extern UINT8 FormBin[]; + +EFI_STATUS +EFIAPI +UefiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_HII_HANDLE Handle = HiiAddPackages( + &gEfiCallerIdGuid, + NULL, + HIISimpleFormStrings, + 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; +} |