diff options
Diffstat (limited to 'UefiLessonsPkg')
-rw-r--r-- | UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c | 54 | ||||
-rw-r--r-- | UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf | 30 | ||||
-rw-r--r-- | UefiLessonsPkg/HIIStringsUNIRC/Strings.uni | 8 | ||||
-rw-r--r-- | UefiLessonsPkg/UefiLessonsPkg.dec | 1 | ||||
-rw-r--r-- | UefiLessonsPkg/UefiLessonsPkg.dsc | 1 |
5 files changed, 94 insertions, 0 deletions
diff --git a/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c b/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.c new file mode 100644 index 0000000..39efbc5 --- /dev/null +++ b/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; +} diff --git a/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf b/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf new file mode 100644 index 0000000..c31e19d --- /dev/null +++ b/UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf @@ -0,0 +1,30 @@ +[Defines] + INF_VERSION = 1.25 + BASE_NAME = HIIStringsUNIRC + FILE_GUID = f8dc4b7a-8c6d-4a16-b2a1-03682db32bfd + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + UEFI_HII_RESOURCE_SECTION = TRUE + +[Sources] + HIIStringsUNIRC.c + Strings.uni + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiLessonsPkg/UefiLessonsPkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + HiiLib + UefiHiiServicesLib + +[Protocols] + gEfiHiiPackageListProtocolGuid + +[Guids] + gHIIStringsUNIRCGuid + diff --git a/UefiLessonsPkg/HIIStringsUNIRC/Strings.uni b/UefiLessonsPkg/HIIStringsUNIRC/Strings.uni new file mode 100644 index 0000000..2bce7e3 --- /dev/null +++ b/UefiLessonsPkg/HIIStringsUNIRC/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 6d44885..2f9f3e2 100644 --- a/UefiLessonsPkg/UefiLessonsPkg.dec +++ b/UefiLessonsPkg/UefiLessonsPkg.dec @@ -13,6 +13,7 @@ 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 }}
+ gHIIStringsUNIRCGuid = { 0x785693b4, 0x623e, 0x40fa, { 0x9a, 0x45, 0x68, 0xda, 0x38, 0x30, 0x89, 0xdd }}
[Protocols]
gSimpleClassProtocolGuid = { 0xb5510eea, 0x6f11, 0x4e4b, { 0xad, 0x0f, 0x35, 0xce, 0x17, 0xbd, 0x7a, 0x67 }}
diff --git a/UefiLessonsPkg/UefiLessonsPkg.dsc b/UefiLessonsPkg/UefiLessonsPkg.dsc index 6a331f2..6cf0ffc 100644 --- a/UefiLessonsPkg/UefiLessonsPkg.dsc +++ b/UefiLessonsPkg/UefiLessonsPkg.dsc @@ -61,6 +61,7 @@ UefiLessonsPkg/ShowHII/ShowHII.inf UefiLessonsPkg/HIIStringsC/HIIStringsC.inf UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf + UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf [PcdsFixedAtBuild] gUefiLessonsPkgTokenSpaceGuid.PcdMyVar32_2|44 |