diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-04-14 06:29:03 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-04-14 06:29:03 +0000 |
commit | c344685c0cbd23d00ce032163cd42530c3068996 (patch) | |
tree | d48860de222f1462e94386e0e73d8290704ad7dc /MdePkg | |
parent | 33b3b83219656ec3f9a022714be62517e51ba90b (diff) | |
download | edk2-platforms-c344685c0cbd23d00ce032163cd42530c3068996.tar.xz |
add in a new API HiiLibGetSupportedSecondaryLanguages
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5063 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLanguage.c | 54 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLib.c | 4 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/InternalHiiLib.h | 4 |
3 files changed, 56 insertions, 6 deletions
diff --git a/MdePkg/Library/HiiLib/HiiLanguage.c b/MdePkg/Library/HiiLib/HiiLanguage.c index 9ef3a3e9ed..14a9313507 100644 --- a/MdePkg/Library/HiiLib/HiiLanguage.c +++ b/MdePkg/Library/HiiLib/HiiLanguage.c @@ -91,12 +91,20 @@ HiiLibGetSupportedLanguages ( // Collect current supported Languages for given HII handle
//
BufferSize = 0x1000;
- LanguageString = AllocatePool (BufferSize);
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (LanguageString);
- LanguageString = AllocatePool (BufferSize);
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
}
@@ -134,3 +142,45 @@ HiiLibGetSupportedLanguageNumber ( return LangNumber;
}
+
+CHAR8 *
+EFIAPI
+HiiLibGetSupportedSecondaryLanguages (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN CONST CHAR8 *FirstLanguage
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ CHAR8 *LanguageString;
+
+ ASSERT (HiiHandle != NULL);
+ ASSERT (IsHiiHandleRegistered (HiiHandle));
+ //
+ // Collect current supported 2nd Languages for given HII handle
+ //
+ BufferSize = 0x1000;
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+ Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gBS->FreePool (LanguageString);
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+
+ Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
+ }
+
+ if (EFI_ERROR (Status)) {
+ LanguageString = NULL;
+ }
+
+ return LanguageString;
+}
+
+
diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c index a1797c930f..1f59fa4fa5 100644 --- a/MdePkg/Library/HiiLib/HiiLib.c +++ b/MdePkg/Library/HiiLib/HiiLib.c @@ -14,8 +14,8 @@ #include "InternalHiiLib.h"
-EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
-EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
+CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
/**
The constructor function of Hii Library.
diff --git a/MdePkg/Library/HiiLib/InternalHiiLib.h b/MdePkg/Library/HiiLib/InternalHiiLib.h index 0303fa9968..b2c8b87707 100644 --- a/MdePkg/Library/HiiLib/InternalHiiLib.h +++ b/MdePkg/Library/HiiLib/InternalHiiLib.h @@ -36,8 +36,8 @@ #define HII_LIB_DEFAULT_STRING_SIZE 0x200
-extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
-extern EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
+extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
BOOLEAN
IsHiiHandleRegistered (
|