diff options
Diffstat (limited to 'Lessons/Lesson_48/UefiLessonsPkg/HIIStringsUNI')
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!" |