aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2021-10-26 16:56:43 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2021-10-26 16:56:43 +0300
commit4817afa8f3b58bb61cabec0a538d6bfe02372787 (patch)
treebe0e64bf3001e95fd887b27606dc2d285b3f363e /Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c
parentdcbd8fb9a24cbc4ad99c37c35f248cb4d29828e0 (diff)
downloadUEFI-Lessons-4817afa8f3b58bb61cabec0a538d6bfe02372787.tar.gz
UEFI-Lessons-4817afa8f3b58bb61cabec0a538d6bfe02372787.tar.bz2
UEFI-Lessons-4817afa8f3b58bb61cabec0a538d6bfe02372787.zip
Move app files in Lesson 50 to the correct folder
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c')
-rw-r--r--Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c b/Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c
new file mode 100644
index 0000000..39efbc5
--- /dev/null
+++ b/Lessons/Lesson_50/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c
@@ -0,0 +1,54 @@
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+
+#include <Library/HiiLib.h>
+#include <Library/UefiHiiServicesLib.h>
+
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ //
+ // Retrieve HII package list from ImageHandle.
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **)&PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ Print(L"Error! Can't open EFI_HII_PACKAGE_LIST_PROTOCOL\n");
+ return Status;
+ }
+
+ EFI_HII_HANDLE Handle;
+ Status = gHiiDatabase->NewPackageList(gHiiDatabase, PackageList, NULL, &Handle);
+ if (EFI_ERROR(Status))
+ {
+ Print(L"Can't register HII Package list %g, status = %r\n", gHIIStringsUNIRCGuid, Status);
+ return Status;
+ }
+
+ Print(L"en-US ID=1: %s\n", HiiGetString(Handle, 1, "en-US"));
+ Print(L"en-US ID=2: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_HELLO), "en-US"));
+ Print(L"en-US ID=3: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_BYE), "en-US"));
+ Print(L"fr-FR ID=1: %s\n", HiiGetString(Handle, 1, "fr-FR"));
+ Print(L"fr-FR ID=2: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_HELLO), "fr-FR"));
+ Print(L"fr-FR ID=3: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_BYE), "fr-FR"));
+
+ Print(L"Best language ID=1: %s\n", HiiGetString(Handle, 1, NULL));
+ Print(L"Best language ID=2: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_HELLO), NULL));
+ Print(L"Best language ID=3: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_BYE), NULL));
+
+ Print(L"fr ID=3: %s\n", HiiGetString(Handle, STRING_TOKEN(STR_BYE), "fr"));
+
+ return EFI_SUCCESS;
+}