diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-12-30 16:21:10 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-12-30 16:22:24 +0300 |
commit | 03fd5898331a52003250ca2e21bbd5f1452a1dbd (patch) | |
tree | d3e2aa5a34404b0d9908e6b1bd4683e6f5568196 /Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid | |
parent | df6a98ab804500e843b08307c20d8f890f148021 (diff) | |
download | UEFI-Lessons-03fd5898331a52003250ca2e21bbd5f1452a1dbd.tar.gz UEFI-Lessons-03fd5898331a52003250ca2e21bbd5f1452a1dbd.tar.bz2 UEFI-Lessons-03fd5898331a52003250ca2e21bbd5f1452a1dbd.zip |
Add draft for lesson 59
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid')
-rw-r--r-- | Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c | 69 | ||||
-rw-r--r-- | Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf | 23 |
2 files changed, 92 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..f1bf789 --- /dev/null +++ b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.c @@ -0,0 +1,69 @@ +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> + +#include <Library/MemoryAllocationLib.h> +#include <Protocol/FormBrowser2.h> +#include <Library/HiiLib.h> + +INTN +EFIAPI +ShellAppMain ( + IN UINTN Argc, + IN CHAR16 **Argv + ) +{ + if (Argc <=1) { + Print(L"Usage:\n"); + Print(L" DisplayHIIByGuid <GUID> [<GUID> [<GUID> [...]]]\n"); + return EFI_INVALID_PARAMETER; + } + + GUID* Guids = (GUID*)AllocatePool(sizeof(GUID)*(Argc-1)); + + for (UINTN i=1; i<Argc; i++) { + RETURN_STATUS Status = StrToGuid(Argv[i], &Guids[i-1]); + if (Status != RETURN_SUCCESS) { + Print(L"Error! Can't convert one of the GUIDs to string\n"); + FreePool(Guids); + return EFI_INVALID_PARAMETER; + } + Print(L"%g\n", Guids[i-1]); + } + + + EFI_HII_HANDLE* Handle = HiiGetHiiHandles(&Guids[0]); + + UINTN HandleCount=0; + while (*Handle != NULL) { + Handle++; + HandleCount++; + Print(L"Total HandleCount=%d\n", HandleCount); + } + Print(L"Total HandleCount=%d\n", HandleCount); + +/* + return EFI_SUCCESS; + + 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 + ); + +*/ + FreePool(Handle); + FreePool(Guids); + + 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..d8e97ad --- /dev/null +++ b/Lessons/Lesson_59/UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf @@ -0,0 +1,23 @@ +[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 |