diff options
Diffstat (limited to 'Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm')
4 files changed, 105 insertions, 0 deletions
diff --git a/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Form.vfr b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Form.vfr new file mode 100644 index 0000000..0671b15 --- /dev/null +++ b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Form.vfr @@ -0,0 +1,11 @@ +#define HIISIMPLEFORM_FORMSET_GUID {0xef2acc91, 0x7b50, 0x4ab9, {0xab, 0x67, 0x2b, 0x4, 0xf8, 0xbc, 0x13, 0x5e}} + +formset + guid = HIISIMPLEFORM_FORMSET_GUID, + title = STRING_TOKEN(HIISIMPLEFORM_FORMSET_TITLE), + help = STRING_TOKEN(HIISIMPLEFORM_FORMSET_HELP), + form + formid = 1, + title = STRING_TOKEN(HIISIMPLEFORM_FORMID1_TITLE); + endform; +endformset; 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; +} diff --git a/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf new file mode 100644 index 0000000..4def985 --- /dev/null +++ b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf @@ -0,0 +1,30 @@ +## +# Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com> +# +# SPDX-License-Identifier: MIT +## + +[Defines] + INF_VERSION = 1.25 + BASE_NAME = HIISimpleForm + FILE_GUID = df2f1465-2bf1-492c-af6c-232ac40bdf82 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + +[Sources] + HIISimpleForm.c + Strings.uni + Form.vfr + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + HiiLib + +[Protocols] + gEfiFormBrowser2ProtocolGuid diff --git a/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Strings.uni b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Strings.uni new file mode 100644 index 0000000..e54db41 --- /dev/null +++ b/Lessons/Lesson_57/UefiLessonsPkg/HIISimpleForm/Strings.uni @@ -0,0 +1,11 @@ +// +// Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com> +// +// SPDX-License-Identifier: MIT +// + +#langdef en-US "English" + +#string HIISIMPLEFORM_FORMSET_TITLE #language en-US "Simple Formset" +#string HIISIMPLEFORM_FORMSET_HELP #language en-US "This is a very simple formset" +#string HIISIMPLEFORM_FORMID1_TITLE #language en-US "Simple Form" |