aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2021-10-24 13:21:30 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2021-10-24 13:21:30 +0300
commitd28167b2a3a55b2afc5a5dfdcb329b585f223225 (patch)
tree3e7d7adbb4d8235738f0777da852dfe185a32158 /Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI
parent9fb84757c9a457d7193b7e863f2e90b22ff09cb4 (diff)
downloadUEFI-Lessons-d28167b2a3a55b2afc5a5dfdcb329b585f223225.tar.gz
UEFI-Lessons-d28167b2a3a55b2afc5a5dfdcb329b585f223225.tar.bz2
UEFI-Lessons-d28167b2a3a55b2afc5a5dfdcb329b585f223225.zip
Add lesson 48
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI')
-rw-r--r--Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c32
-rw-r--r--Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf24
-rw-r--r--Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/Strings.uni8
3 files changed, 64 insertions, 0 deletions
diff --git a/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c
new file mode 100644
index 0000000..160108b
--- /dev/null
+++ b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c
@@ -0,0 +1,32 @@
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+
+#include <Library/HiiLib.h>
+
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_HII_HANDLE Handle = HiiAddPackages(&gHIIStringsUNIGuid,
+ NULL,
+ HIIStringsUNIStrings,
+ NULL);
+
+ if (Handle == NULL)
+ {
+ Print(L"Error! Can't perform HiiAddPackages\n");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ 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"));
+
+ return EFI_SUCCESS;
+}
diff --git a/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf
new file mode 100644
index 0000000..42b01a7
--- /dev/null
+++ b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf
@@ -0,0 +1,24 @@
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = HIIStringsUNI
+ FILE_GUID = d6c2599a-096f-4644-af1c-aee12e320fb0
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+[Sources]
+ HIIStringsUNI.c
+ Strings.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UefiLessonsPkg/UefiLessonsPkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ UefiLib
+ HiiLib
+
+[Guids]
+ gHIIStringsUNIGuid
diff --git a/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/Strings.uni b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/Strings.uni
new file mode 100644
index 0000000..2bce7e3
--- /dev/null
+++ b/Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI/Strings.uni
@@ -0,0 +1,8 @@
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+
+#string STR_HELLO #language en-US "Hello!"
+ #language fr-FR "Bonjour!"
+
+#string STR_BYE #language en-US "Bye!"
+ #language fr-FR "Au revoir!"