aboutsummaryrefslogtreecommitdiffstats
path: root/UefiLessonsPkg
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2021-11-10 17:30:32 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2021-11-10 17:30:32 +0300
commitd03724c8fc726c9add02ed19984d66077edd56ef (patch)
tree2875bbd19a9e91bc86daa4a48af687b6032c8795 /UefiLessonsPkg
parent5da37dd73d8b6c175eedbf4d92307a86ef6b269e (diff)
downloadUEFI-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 'UefiLessonsPkg')
-rw-r--r--UefiLessonsPkg/HIISimpleForm/Form.vfr11
-rw-r--r--UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c53
-rw-r--r--UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf30
-rw-r--r--UefiLessonsPkg/HIISimpleForm/Strings.uni11
-rw-r--r--UefiLessonsPkg/UefiLessonsPkg.dsc1
5 files changed, 106 insertions, 0 deletions
diff --git a/UefiLessonsPkg/HIISimpleForm/Form.vfr b/UefiLessonsPkg/HIISimpleForm/Form.vfr
new file mode 100644
index 0000000..0671b15
--- /dev/null
+++ b/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/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c b/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.c
new file mode 100644
index 0000000..3aa401e
--- /dev/null
+++ b/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/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf b/UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf
new file mode 100644
index 0000000..4def985
--- /dev/null
+++ b/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/UefiLessonsPkg/HIISimpleForm/Strings.uni b/UefiLessonsPkg/HIISimpleForm/Strings.uni
new file mode 100644
index 0000000..e54db41
--- /dev/null
+++ b/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"
diff --git a/UefiLessonsPkg/UefiLessonsPkg.dsc b/UefiLessonsPkg/UefiLessonsPkg.dsc
index 85ea19a..aec7768 100644
--- a/UefiLessonsPkg/UefiLessonsPkg.dsc
+++ b/UefiLessonsPkg/UefiLessonsPkg.dsc
@@ -72,6 +72,7 @@
UefiLessonsPkg/HIIAddRussianFont/HIIAddRussianFont.inf
UefiLessonsPkg/HIIAddLocalization/HIIAddLocalization.inf
UefiLessonsPkg/AddNewLanguage/AddNewLanguage.inf
+ UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf
[PcdsFixedAtBuild]
gUefiLessonsPkgTokenSpaceGuid.PcdMyVar32_2|44