From d28167b2a3a55b2afc5a5dfdcb329b585f223225 Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Sun, 24 Oct 2021 13:21:30 +0300 Subject: Add lesson 48 Signed-off-by: Konstantin Aladyshev --- UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c | 32 ++++++++++++++++++++++++++ UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf | 24 +++++++++++++++++++ UefiLessonsPkg/HIIStringsUNI/Strings.uni | 8 +++++++ UefiLessonsPkg/UefiLessonsPkg.dec | 1 + UefiLessonsPkg/UefiLessonsPkg.dsc | 1 + 5 files changed, 66 insertions(+) create mode 100644 UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c create mode 100644 UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf create mode 100644 UefiLessonsPkg/HIIStringsUNI/Strings.uni (limited to 'UefiLessonsPkg') diff --git a/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c b/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c new file mode 100644 index 0000000..160108b --- /dev/null +++ b/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.c @@ -0,0 +1,32 @@ +#include +#include + +#include + +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/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf b/UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf new file mode 100644 index 0000000..42b01a7 --- /dev/null +++ b/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/UefiLessonsPkg/HIIStringsUNI/Strings.uni b/UefiLessonsPkg/HIIStringsUNI/Strings.uni new file mode 100644 index 0000000..2bce7e3 --- /dev/null +++ b/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!" diff --git a/UefiLessonsPkg/UefiLessonsPkg.dec b/UefiLessonsPkg/UefiLessonsPkg.dec index 8a6ff4b..6d44885 100644 --- a/UefiLessonsPkg/UefiLessonsPkg.dec +++ b/UefiLessonsPkg/UefiLessonsPkg.dec @@ -12,6 +12,7 @@ gHelloWorldFileGuid = {0x2e55fa38, 0xf148, 0x42d3, {0xaf, 0x90, 0x1b, 0xe2, 0x47, 0x32, 0x3e, 0x30}} gUefiLessonsPkgTokenSpaceGuid = {0x150cab53, 0xad47, 0x4385, {0xb5, 0xdd, 0xbc, 0xfc, 0x76, 0xba, 0xca, 0xf0}} gHIIStringsCGuid = { 0x8e0b8ed3, 0x14f7, 0x499d, { 0xa2, 0x24, 0xae, 0xe8, 0x9d, 0xc9, 0x7f, 0xa3 }} + gHIIStringsUNIGuid = { 0x6ee19058, 0x0fe2, 0x44ed, { 0x89, 0x1c, 0xa5, 0xd7, 0xe1, 0x08, 0xee, 0x1a }} [Protocols] gSimpleClassProtocolGuid = { 0xb5510eea, 0x6f11, 0x4e4b, { 0xad, 0x0f, 0x35, 0xce, 0x17, 0xbd, 0x7a, 0x67 }} diff --git a/UefiLessonsPkg/UefiLessonsPkg.dsc b/UefiLessonsPkg/UefiLessonsPkg.dsc index 075cc8e..6a331f2 100644 --- a/UefiLessonsPkg/UefiLessonsPkg.dsc +++ b/UefiLessonsPkg/UefiLessonsPkg.dsc @@ -60,6 +60,7 @@ UefiLessonsPkg/HotKeyDriver/HotKeyDriver.inf UefiLessonsPkg/ShowHII/ShowHII.inf UefiLessonsPkg/HIIStringsC/HIIStringsC.inf + UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf [PcdsFixedAtBuild] gUefiLessonsPkgTokenSpaceGuid.PcdMyVar32_2|44 -- cgit v1.2.3-18-g5258