add in a new API HiiLibGetSupportedSecondaryLanguages

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5063 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-04-14 06:29:03 +00:00
parent 33b3b83219
commit c344685c0c
3 changed files with 56 additions and 6 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -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 (