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-c344685c0cbd23d00ce032163cd42530c3068996.zip edk2-c344685c0cbd23d00ce032163cd42530c3068996.tar.gz edk2-c344685c0cbd23d00ce032163cd42530c3068996.tar.bz2 |
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 9ef3a3e..14a9313 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 a1797c9..1f59fa4 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 0303fa9..b2c8b87 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 (
|