aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons/Lesson_59/UefiLessonsPkg
diff options
context:
space:
mode:
Diffstat (limited to 'Lessons/Lesson_59/UefiLessonsPkg')
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c69
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf29
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Form.vfr37
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.c47
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf28
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Strings.uni25
-rw-r--r--Lessons/Lesson_59/UefiLessonsPkg/UefiLessonsPkg.dsc82
7 files changed, 317 insertions, 0 deletions
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c
new file mode 100644
index 0000000..87e7efe
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+
+#include <Library/MemoryAllocationLib.h>
+#include <Library/HiiLib.h>
+#include <Protocol/FormBrowser2.h>
+
+INTN
+EFIAPI
+ShellAppMain (
+ IN UINTN Argc,
+ IN CHAR16 **Argv
+ )
+{
+ if (Argc != 2) {
+ Print(L"Usage:\n");
+ Print(L" DisplayHIIByGuid <GUID>\n");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ GUID Guid;
+ EFI_STATUS Status = StrToGuid(Argv[1], &Guid);
+ if (Status != RETURN_SUCCESS) {
+ Print(L"Error! Can't convert input argument to GUID\n");
+ return EFI_INVALID_PARAMETER;
+ }
+
+
+ EFI_HII_HANDLE* HiiHandles = HiiGetHiiHandles(&Guid);
+
+ EFI_HII_HANDLE* HiiHandle = HiiHandles;
+ UINTN HandleCount=0;
+ while (*HiiHandle != NULL) {
+ HiiHandle++;
+ HandleCount++;
+ }
+
+ EFI_FORM_BROWSER2_PROTOCOL* FormBrowser2;
+ Status = gBS->LocateProtocol(&gEfiFormBrowser2ProtocolGuid, NULL, (VOID**)&FormBrowser2);
+ if (EFI_ERROR(Status)) {
+ Print(L"Error! Can't locate gEfiFormBrowser2Protocol\n");
+ FreePool(HiiHandles);
+ return Status;
+ }
+
+ Status = FormBrowser2->SendForm (
+ FormBrowser2,
+ HiiHandles,
+ HandleCount,
+ NULL,
+ 0,
+ NULL,
+ NULL
+ );
+
+ if (EFI_ERROR(Status)) {
+ Print(L"Error! SendForm returned %r\n", Status);
+ }
+
+ FreePool(HiiHandles);
+
+ return EFI_SUCCESS;
+}
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf
new file mode 100644
index 0000000..bb22a5e
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf
@@ -0,0 +1,29 @@
+##
+# Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+#
+# SPDX-License-Identifier: MIT
+##
+
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = DisplayHIIByGuid
+ FILE_GUID = 1597e1d0-7f62-4631-a166-703f03bd7223
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = ShellCEntryLib
+
+[Sources]
+ DisplayHIIByGuid.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ UefiLib
+ ShellCEntryLib
+ HiiLib
+
+[Protocols]
+ gEfiFormBrowser2ProtocolGuid
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Form.vfr b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Form.vfr
new file mode 100644
index 0000000..68a8ef0
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Form.vfr
@@ -0,0 +1,37 @@
+#define HIISTATICFORM_FORMSET_GUID {0x32783cc5, 0xe551, 0x4b61, {0xb7, 0xbd, 0x41, 0xba, 0x71, 0x7f, 0xba, 0x81}}
+
+formset
+ guid = HIISTATICFORM_FORMSET_GUID,
+ title = STRING_TOKEN(HIISTATICFORM_FORMSET_TITLE),
+ help = STRING_TOKEN(HIISTATICFORM_FORMSET_HELP),
+ form
+ formid = 1,
+ title = STRING_TOKEN(HIISTATICFORM_FORMID1_TITLE);
+
+ subtitle text = STRING_TOKEN(SUBTITLE1);
+ subtitle text = STRING_TOKEN(SUBTITLE2);
+
+ subtitle
+ text = STRING_TOKEN(SUBTITLE3),
+
+ subtitle text = STRING_TOKEN(SUBTITLE4);
+ subtitle text = STRING_TOKEN(SUBTITLE5);
+ endsubtitle;
+
+ subtitle text = STRING_TOKEN(STR_NULL);
+ subtitle text = STRING_TOKEN(SUBTITLE6);
+
+ text
+ help = STRING_TOKEN(TEXT1_HELP),
+ text = STRING_TOKEN(TEXT1_TEXT);
+
+ text
+ help = STRING_TOKEN(TEXT2_HELP),
+ text = STRING_TOKEN(TEXT2_TEXT);
+
+ text
+ help = STRING_TOKEN(TEXT3_HELP),
+ text = STRING_TOKEN(TEXT3_TEXT),
+ text = STRING_TOKEN(TEXT3_TEXT_TWO);
+ endform;
+endformset;
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.c b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.c
new file mode 100644
index 0000000..b9922f4
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HiiLib.h>
+
+
+extern UINT8 FormBin[];
+
+EFI_HII_HANDLE Handle;
+
+
+EFI_STATUS
+EFIAPI
+HIIStaticFormDriverUnload (
+ EFI_HANDLE ImageHandle
+ )
+{
+ if (Handle != NULL)
+ HiiRemovePackages(Handle);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HIIStaticFormDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ Handle = HiiAddPackages(
+ &gEfiCallerIdGuid,
+ NULL,
+ HIIStaticFormDriverStrings,
+ FormBin,
+ NULL
+ );
+ if (Handle == NULL)
+ return EFI_OUT_OF_RESOURCES;
+
+ return EFI_SUCCESS;
+}
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf
new file mode 100644
index 0000000..4a63c03
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf
@@ -0,0 +1,28 @@
+##
+# Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+#
+# SPDX-License-Identifier: MIT
+##
+
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = HIIStaticFormDriver
+ FILE_GUID = 22514099-ad3b-45ec-b14b-112eb6446db2
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = HIIStaticFormDriverEntryPoint
+ UNLOAD_IMAGE = HIIStaticFormDriverUnload
+
+[Sources]
+ HIIStaticFormDriver.c
+ Strings.uni
+ Form.vfr
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ UefiLib
+ HiiLib
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Strings.uni b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Strings.uni
new file mode 100644
index 0000000..3bada64
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/HIIStaticFormDriver/Strings.uni
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+//
+// SPDX-License-Identifier: MIT
+//
+
+#langdef en-US "English"
+
+#string HIISTATICFORM_FORMSET_TITLE #language en-US "Static Formset"
+#string HIISTATICFORM_FORMSET_HELP #language en-US "This is a static formset"
+#string HIISTATICFORM_FORMID1_TITLE #language en-US "Static Form"
+#string SUBTITLE1 #language en-US "Subtitle1"
+#string SUBTITLE2 #language en-US "Subtitle2"
+#string SUBTITLE3 #language en-US "Subtitle3"
+#string SUBTITLE4 #language en-US "Subtitle4"
+#string SUBTITLE5 #language en-US "Subtitle5"
+#string SUBTITLE6 #language en-US "Subtitle6"
+#string STR_NULL #language en-US ""
+#string TEXT1_TEXT #language en-US "Text1 title"
+#string TEXT1_HELP #language en-US "Text1 help"
+#string TEXT2_TEXT #language en-US "Text2 title"
+#string TEXT2_HELP #language en-US "Text2 help"
+#string TEXT3_TEXT #language en-US "Text3 title"
+#string TEXT3_TEXT_TWO #language en-US "Text3 value"
+#string TEXT3_HELP #language en-US "Text3 help"
diff --git a/Lessons/Lesson_59/UefiLessonsPkg/UefiLessonsPkg.dsc b/Lessons/Lesson_59/UefiLessonsPkg/UefiLessonsPkg.dsc
new file mode 100644
index 0000000..67ab576
--- /dev/null
+++ b/Lessons/Lesson_59/UefiLessonsPkg/UefiLessonsPkg.dsc
@@ -0,0 +1,82 @@
+##
+# Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
+#
+# SPDX-License-Identifier: MIT
+##
+
+[Defines]
+ DSC_SPECIFICATION = 0x0001001C
+ PLATFORM_GUID = 3db7270f-ffac-4139-90a4-0ae68f3f8167
+ PLATFORM_VERSION = 0.01
+ PLATFORM_NAME = UefiLessonsPkg
+ SKUID_IDENTIFIER = DEFAULT
+ SUPPORTED_ARCHITECTURES = X64
+ BUILD_TARGETS = RELEASE
+
+
+[LibraryClasses]
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ #PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+ ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf
+ #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
+ SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf
+
+[Components]
+ UefiLessonsPkg/SimplestApp/SimplestApp.inf
+ UefiLessonsPkg/HelloWorld/HelloWorld.inf
+ UefiLessonsPkg/ImageHandle/ImageHandle.inf
+ UefiLessonsPkg/ImageInfo/ImageInfo.inf
+ UefiLessonsPkg/MemoryInfo/MemoryInfo.inf
+ UefiLessonsPkg/SimpleShellApp/SimpleShellApp.inf
+ UefiLessonsPkg/ListVariables/ListVariables.inf
+ UefiLessonsPkg/ShowBootVariables/ShowBootVariables.inf
+ UefiLessonsPkg/InteractiveApp/InteractiveApp.inf
+ UefiLessonsPkg/PCDLesson/PCDLesson.inf
+ UefiLessonsPkg/SmbiosInfo/SmbiosInfo.inf
+ UefiLessonsPkg/ShowTables/ShowTables.inf
+ UefiLessonsPkg/AcpiInfo/AcpiInfo.inf
+ UefiLessonsPkg/SaveBGRT/SaveBGRT.inf
+ UefiLessonsPkg/ListPCI/ListPCI.inf
+ UefiLessonsPkg/SimpleDriver/SimpleDriver.inf
+ UefiLessonsPkg/PCIRomInfo/PCIRomInfo.inf
+ UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf
+ UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
+ UefiLessonsPkg/SimpleLibraryUser/SimpleLibraryUser.inf
+ UefiLessonsPkg/SimpleClassProtocol/SimpleClassProtocol.inf
+ UefiLessonsPkg/SimpleClassUser/SimpleClassUser.inf
+ UefiLessonsPkg/HotKeyDriver/HotKeyDriver.inf
+ UefiLessonsPkg/ShowHII/ShowHII.inf
+ UefiLessonsPkg/HIIStringsC/HIIStringsC.inf
+ UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf
+ UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf
+ UefiLessonsPkg/HIIStringsMan/HIIStringsMan.inf
+ UefiLessonsPkg/HIIAddRussianFont/HIIAddRussianFont.inf
+ UefiLessonsPkg/HIIAddLocalization/HIIAddLocalization.inf
+ UefiLessonsPkg/AddNewLanguage/AddNewLanguage.inf
+ UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf
+ UefiLessonsPkg/HIIStaticForm/HIIStaticForm.inf
+ UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf
+ UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf
+
+[PcdsFixedAtBuild]
+ gUefiLessonsPkgTokenSpaceGuid.PcdMyVar32_2|44
+