diff options
author | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-14 10:47:19 +0000 |
---|---|---|
committer | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-14 10:47:19 +0000 |
commit | cb7d01c0c9fd199742d0fed6aa69dab0c79c3338 (patch) | |
tree | 920a78778c9de452a58ee0d0df2893e7c4822bdb /EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk | |
parent | 169a34619b6d583d9f2934a6a3e9caf6e5c6e355 (diff) | |
download | edk2-platforms-cb7d01c0c9fd199742d0fed6aa69dab0c79c3338.tar.xz |
HII Library Class interface refine.
The "HiiLib" prefix for all HII Library API function names changed to "Hii".
Remove:
HiiLibPreparePackageList(), replaced by HiiAddPackages()
HiiLibNewString(), replaced by HiiSetString()
HiiLibGetStringFromHandle(), replaced by HiiGetString()
HiiLibGetStringFromToken(), replaced by HiiGetPackageString()
HiiLibExtractGuidFromHiiHandle()
HiiLibDevicePathToHiiHandle()
HiiLibGetSupportedSecondaryLanguages()
HiiLibGetSupportedLanguageNumber()
HiiLibExportPackageLists()
HiiLibListPackageLists()
Interface change:
HiiAddPackages()
HiiSetString()
HiiGetString()
HiiGetHiiHandles()
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8083 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk')
7 files changed, 436 insertions, 92 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c index 117d6ea636..ac6f2ac244 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c @@ -674,7 +674,6 @@ CreateIfrDataArray ( FORMSET_STORAGE *BufferStorage;
EFI_STATUS Status;
UINTN Size;
- UINTN StringSize;
EFI_STRING String;
*NvMapAllocated = FALSE;
@@ -691,17 +690,10 @@ CreateIfrDataArray ( break;
case EFI_IFR_TYPE_STRING:
- StringSize = 0;
- Status = HiiLibGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, String, &StringSize);
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
-
- String = AllocateZeroPool (StringSize);
+ String = HiiGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, NULL);
ASSERT (String != NULL);
- Status = HiiLibGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, String, &StringSize);
- ASSERT_EFI_ERROR (Status);
-
- Size = StringSize;
+ Size = StrSize (String);
break;
default:
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c index 7882227faf..5a3df71aab 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c @@ -156,7 +156,7 @@ InitializeHiiDatabase ( );
ASSERT_EFI_ERROR (Status);
- Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
+ Status = ListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
if (Status == EFI_SUCCESS) {
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);
@@ -403,7 +403,7 @@ HiiGetPrimaryLanguages ( return EFI_INVALID_PARAMETER;
}
- LangCodes3066 = HiiLibGetSupportedLanguages (UefiHiiHandle);
+ LangCodes3066 = HiiGetSupportedLanguages (UefiHiiHandle);
if (LangCodes3066 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -437,6 +437,61 @@ Done: return Status;
}
+/**
+ This function returns the list of supported 2nd languages, in the format specified
+ in UEFI specification Appendix M.
+
+ If HiiHandle is not a valid Handle in the HII database, then ASSERT.
+ If not enough resource to complete the operation, then ASSERT.
+
+ @param HiiHandle The HII package list handle.
+ @param FirstLanguage Pointer to language name buffer.
+
+ @return The supported languages.
+
+**/
+CHAR8 *
+EFIAPI
+HiiGetSupportedSecondaryLanguages (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN CONST CHAR8 *FirstLanguage
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ CHAR8 *LanguageString;
+
+ ASSERT (HiiHandle != NULL);
+
+ //
+ // Collect current supported 2nd Languages for given HII handle
+ // First try allocate 4K buffer to store the current supported 2nd languages.
+ //
+ BufferSize = 0x1000;
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+
+ Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
+ ASSERT (Status != EFI_NOT_FOUND);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ FreePool (LanguageString);
+ LanguageString = AllocateZeroPool (BufferSize);
+ if (LanguageString == NULL) {
+ return NULL;
+ }
+
+ Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
+ }
+
+ if (EFI_ERROR (Status)) {
+ LanguageString = NULL;
+ }
+
+ return LanguageString;
+}
/**
Allows a program to determine which secondary languages are supported on a given handle for a given primary language
@@ -499,7 +554,7 @@ HiiGetSecondaryLanguages ( PrimaryLang3066 = ConvertIso639LanguageToRfc3066Language (PrimaryLang639);
ASSERT_EFI_ERROR (PrimaryLang3066 != NULL);
- SecLangCodes3066 = HiiLibGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang3066);
+ SecLangCodes3066 = HiiGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang3066);
if (SecLangCodes3066 == NULL) {
Status = EFI_INVALID_PARAMETER;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c index 3187a94160..5b326721ba 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c @@ -401,7 +401,7 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack ( if (ThunkContext != IfrThunkContext) {
if (CompareGuid (&IfrThunkContext->TagGuid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount == 0)) {
- Status = HiiLibExportPackageLists (ThunkContext->UefiHiiHandle, &StringPackageListHeader, &Size);
+ Status = ExportPackageLists (ThunkContext->UefiHiiHandle, &StringPackageListHeader, &Size);
ASSERT_EFI_ERROR (Status);
IfrThunkContext->StringPackageCount = GetPackageCountByType (StringPackageListHeader, EFI_HII_PACKAGE_STRINGS);
@@ -861,7 +861,7 @@ RemovePackNotify ( //
if (ThunkContext != NULL) {
if (!ThunkContext->ByFrameworkHiiNewPack) {
- Status = HiiLibExportPackageLists (Handle, &HiiPackageList, &BufferSize);
+ Status = ExportPackageLists (Handle, &HiiPackageList, &BufferSize);
ASSERT_EFI_ERROR (Status);
if (GetPackageCountByType (HiiPackageList, EFI_HII_PACKAGE_STRINGS) == 1) {
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c index 7c4b27f077..807e8396d0 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c @@ -40,13 +40,9 @@ GetStringById ( IN EFI_STRING_ID Id
)
{
- CHAR16 *String;
-
- String = NULL;
- HiiLibGetStringFromHandle (gStringPackHandle, Id, &String);
-
- return String;
+ return HiiGetString (gStringPackHandle, Id, NULL);
}
+
/**
Show progress bar with title above it. It only works in Graphics mode.
@@ -544,12 +540,14 @@ InitSetBrowserStrings ( VOID
)
{
- EFI_STATUS Status;
-
//
// Initialize strings to HII database
//
- Status = HiiLibAddPackages (1, &gEfiHiiThunkProducerGuid, NULL, &gStringPackHandle, STRING_ARRAY_NAME);
- ASSERT_EFI_ERROR (Status);
-
+ gStringPackHandle = HiiAddPackages (
+ &gEfiHiiThunkProducerGuid,
+ NULL,
+ STRING_ARRAY_NAME,
+ NULL
+ );
+ ASSERT (gStringPackHandle != NULL);
}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c index d9cc39eb8d..05a885cc8f 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c @@ -65,7 +65,7 @@ ConvertIso639ToRfc3066 ( If all glyphs in the string are available, the index is the index of the terminator
of the string.
@param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS,
- it contains the amount of memory that is required to store the string¡¯s glyph equivalent.
+ it contains the amount of memory that is required to store the string? glyph equivalent.
@retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
**/
@@ -148,73 +148,17 @@ UpdateString ( )
{
EFI_STRING_ID NewStringId;
- EFI_STATUS Status;
-
- NewStringId = 0;
-
- if (*StringId == 0) {
- //
- // Create a new string token.
- //
- if (Rfc3066AsciiLanguage == NULL) {
- //
- // For all languages in the package list.
- //
- Status = HiiLibNewString (ThunkContext->UefiHiiHandle, &NewStringId, NewString);
- } else {
- //
- // For specified language.
- //
- Status = mHiiStringProtocol->NewString (
- mHiiStringProtocol,
- ThunkContext->UefiHiiHandle,
- &NewStringId,
- Rfc3066AsciiLanguage,
- NULL,
- NewString,
- NULL
- );
- }
- } else {
- //
- // Update the existing string token.
- //
- if (Rfc3066AsciiLanguage == NULL) {
- //
- // For all languages in the package list.
- //
- Status = HiiLibSetString (ThunkContext->UefiHiiHandle, *StringId, NewString);
- } else {
- //
- // For specified language.
- //
- Status = mHiiStringProtocol->SetString (
- mHiiStringProtocol,
- ThunkContext->UefiHiiHandle,
- *StringId,
- Rfc3066AsciiLanguage,
- NewString,
- NULL
- );
- }
- }
-
- if (!EFI_ERROR (Status)) {
- if (*StringId == 0) {
- //
- // When creating new string, return the newly created String Token.
- //
- *StringId = NewStringId;
- }
- } else {
+ NewStringId = HiiSetString (ThunkContext->UefiHiiHandle, *StringId, NewString, Rfc3066AsciiLanguage);
+ *StringId = NewStringId;
+ if (NewStringId == 0) {
//
// Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
//
- *StringId = 0;
+ return EFI_INVALID_PARAMETER;
+ } else {
+ return EFI_SUCCESS;
}
-
- return Status;
}
/**
@@ -388,9 +332,12 @@ HiiThunkGetString ( OUT EFI_STRING StringBuffer
)
{
- CHAR8 *Iso639AsciiLanguage;
HII_THUNK_PRIVATE_DATA *Private;
+ CHAR8 *Iso639AsciiLanguage;
CHAR8 *Rfc3066AsciiLanguage;
+ CHAR8 *SupportedLanguages;
+ CHAR8 *PlatformLanguage;
+ CHAR8 *BestLanguage;
EFI_HII_HANDLE UefiHiiHandle;
EFI_STATUS Status;
@@ -427,7 +374,51 @@ HiiThunkGetString ( }
if (Rfc3066AsciiLanguage == NULL) {
- Status = HiiLibGetString (UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);
+ //
+ // Get the languages that the package specified by HiiHandle supports
+ //
+ SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
+ if (SupportedLanguages == NULL) {
+ goto Error2;
+ }
+
+ //
+ // Get the current platform language setting
+ //
+ PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
+ if (PlatformLanguage == NULL) {
+ goto Error1;
+ }
+
+ //
+ // Get the best matching language from SupportedLanguages
+ //
+ BestLanguage = GetBestLanguage (
+ SupportedLanguages,
+ FALSE, // RFC 4646 mode
+ PlatformLanguage, // Next highest priority
+ SupportedLanguages, // Lowest priority
+ NULL
+ );
+ if (BestLanguage == NULL) {
+ FreePool (PlatformLanguage);
+Error1:
+ FreePool (SupportedLanguages);
+Error2:
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ Status = mHiiStringProtocol->GetString (
+ mHiiStringProtocol,
+ BestLanguage,
+ UefiHiiHandle,
+ Token,
+ StringBuffer,
+ BufferLengthTemp,
+ NULL
+ );
+ FreePool (BestLanguage);
} else {
Status = mHiiStringProtocol->GetString (
mHiiStringProtocol,
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c index 0ad0668f72..e74830de56 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c @@ -21,6 +21,220 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. CONST EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
+/**
+
+ This function returns a list of the package handles of the
+ specified type that are currently active in the HII database. The
+ pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
+ handles to be listed.
+
+ If HandleBufferLength is NULL, then ASSERT.
+ If HandleBuffer is NULL, the ASSERT.
+ If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
+ NULL, then ASSERT.
+ If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
+ NULL, then ASSERT.
+
+
+ @param PackageType Specifies the package type of the packages
+ to list or EFI_HII_PACKAGE_TYPE_ALL for
+ all packages to be listed.
+
+ @param PackageGuid If PackageType is
+ EFI_HII_PACKAGE_TYPE_GUID, then this is
+ the pointer to the GUID which must match
+ the Guid field of
+ EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
+ must be NULL.
+
+ @param HandleBufferLength On output, the length of the handle buffer
+ that is required for the handles found.
+
+ @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
+ The caller is responcible to free this pointer allocated.
+
+ @retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
+ @retval EFI_NOT_FOUND No matching handle could not be found in database.
+**/
+EFI_STATUS
+EFIAPI
+ListPackageLists (
+ IN UINT8 PackageType,
+ IN CONST EFI_GUID *PackageGuid,
+ IN OUT UINTN *HandleBufferLength,
+ OUT EFI_HII_HANDLE **HandleBuffer
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (HandleBufferLength != NULL);
+ ASSERT (HandleBuffer != NULL);
+
+ *HandleBufferLength = 0;
+ *HandleBuffer = NULL;
+
+ if (PackageType == EFI_HII_PACKAGE_TYPE_GUID) {
+ ASSERT (PackageGuid != NULL);
+ } else {
+ ASSERT (PackageGuid == NULL);
+ }
+
+ Status = mHiiDatabase->ListPackageLists (
+ mHiiDatabase,
+ PackageType,
+ PackageGuid,
+ HandleBufferLength,
+ *HandleBuffer
+ );
+ if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
+ //
+ // No packages is registered to UEFI HII Database, just return.
+ //
+ //
+ return Status;
+ }
+
+ *HandleBuffer = AllocateZeroPool (*HandleBufferLength);
+
+ if (*HandleBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ return mHiiDatabase->ListPackageLists (
+ mHiiDatabase,
+ PackageType,
+ PackageGuid,
+ HandleBufferLength,
+ *HandleBuffer
+ );
+
+}
+
+/**
+ Exports the contents of one or all package lists in the HII database into a buffer.
+
+ If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
+ then ASSERT.
+ If PackageListHeader is NULL, then ASSERT.
+ If PackageListSize is NULL, then ASSERT.
+
+ @param Handle The HII Handle.
+ @param PackageListHeader A pointer to a buffer that will contain the results of
+ the export function.
+ @param PackageListSize On output, the length of the buffer that is required for the exported data.
+
+ @retval EFI_SUCCESS Package exported.
+
+ @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
+
+**/
+EFI_STATUS
+EFIAPI
+ExportPackageLists (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
+ OUT UINTN *PackageListSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr;
+
+ ASSERT (PackageListSize != NULL);
+ ASSERT (PackageListHeader != NULL);
+
+ Size = 0;
+ PackageListHdr = NULL;
+ Status = mHiiDatabase->ExportPackageLists (
+ mHiiDatabase,
+ Handle,
+ &Size,
+ PackageListHdr
+ );
+ ASSERT_EFI_ERROR (Status != EFI_BUFFER_TOO_SMALL);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ PackageListHdr = AllocateZeroPool (Size);
+
+ if (PackageListHeader == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ } else {
+ Status = mHiiDatabase->ExportPackageLists (
+ mHiiDatabase,
+ Handle,
+ &Size,
+ PackageListHdr
+ );
+ }
+ }
+
+ if (!EFI_ERROR (Status)) {
+ *PackageListHeader = PackageListHdr;
+ *PackageListSize = Size;
+ } else {
+ FreePool (PackageListHdr);
+ }
+
+ return Status;
+}
+
+/**
+ Extract Hii package list GUID for given HII handle.
+
+ If HiiHandle could not be found in the HII database, then ASSERT.
+ If Guid is NULL, then ASSERT.
+
+ @param Handle Hii handle
+ @param Guid Package list GUID
+
+ @retval EFI_SUCCESS Successfully extract GUID from Hii database.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractGuidFromHiiHandle (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_GUID *Guid
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
+
+ ASSERT (Guid != NULL);
+ ASSERT (Handle != NULL);
+
+ //
+ // Get HII PackageList
+ //
+ BufferSize = 0;
+ HiiPackageList = NULL;
+
+ Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
+ ASSERT (Status != EFI_NOT_FOUND);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HiiPackageList = AllocatePool (BufferSize);
+ ASSERT (HiiPackageList != NULL);
+
+ Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
+ }
+ if (EFI_ERROR (Status)) {
+ FreePool (HiiPackageList);
+ return Status;
+ }
+
+ //
+ // Extract GUID
+ //
+ CopyGuid (Guid, &HiiPackageList->PackageListGuid);
+
+ FreePool (HiiPackageList);
+
+ return EFI_SUCCESS;
+}
/**
Find the corressponding UEFI HII Handle from a Framework HII Handle given.
@@ -202,7 +416,7 @@ CreateThunkContextForUefiHiiHandle ( ThunkContext->UefiHiiHandle = UefiHiiHandle;
- Status = HiiLibExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
+ Status = ExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
ASSERT_EFI_ERROR (Status);
CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h index 99642fd5b9..087eafaaa8 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h @@ -17,6 +17,100 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define _HII_THUNK_UTILITY_H
/**
+
+ This function returns a list of the package handles of the
+ specified type that are currently active in the HII database. The
+ pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
+ handles to be listed.
+
+ If HandleBufferLength is NULL, then ASSERT.
+ If HandleBuffer is NULL, the ASSERT.
+ If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
+ NULL, then ASSERT.
+ If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
+ NULL, then ASSERT.
+
+
+ @param PackageType Specifies the package type of the packages
+ to list or EFI_HII_PACKAGE_TYPE_ALL for
+ all packages to be listed.
+
+ @param PackageGuid If PackageType is
+ EFI_HII_PACKAGE_TYPE_GUID, then this is
+ the pointer to the GUID which must match
+ the Guid field of
+ EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
+ must be NULL.
+
+ @param HandleBufferLength On output, the length of the handle buffer
+ that is required for the handles found.
+
+ @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
+ The caller is responcible to free this pointer allocated.
+
+ @retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
+ @retval EFI_NOT_FOUND No matching handle could not be found in database.
+**/
+EFI_STATUS
+EFIAPI
+ListPackageLists (
+ IN UINT8 PackageType,
+ IN CONST EFI_GUID *PackageGuid,
+ IN OUT UINTN *HandleBufferLength,
+ OUT EFI_HII_HANDLE **HandleBuffer
+ )
+;
+
+/**
+ Exports the contents of one or all package lists in the HII database into a buffer.
+
+ If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
+ then ASSERT.
+ If PackageListHeader is NULL, then ASSERT.
+ If PackageListSize is NULL, then ASSERT.
+
+ @param Handle The HII Handle.
+ @param PackageListHeader A pointer to a buffer that will contain the results of
+ the export function.
+ @param PackageListSize On output, the length of the buffer that is required for the exported data.
+
+ @retval EFI_SUCCESS Package exported.
+
+ @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
+
+**/
+EFI_STATUS
+EFIAPI
+ExportPackageLists (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
+ OUT UINTN *PackageListSize
+ )
+;
+
+/**
+ Extract Hii package list GUID for given HII handle.
+
+ If HiiHandle could not be found in the HII database, then ASSERT.
+ If Guid is NULL, then ASSERT.
+
+ @param Handle Hii handle
+ @param Guid Package list GUID
+
+ @retval EFI_SUCCESS Successfully extract GUID from Hii database.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractGuidFromHiiHandle (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_GUID *Guid
+ )
+;
+
+/**
Find the UefiHiiHandle based on a Framework HII Handle returned by
the HII Thunk to Framework HII code.
|