summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Include/Library/HiiLib.h9
-rw-r--r--MdeModulePkg/Library/UefiHiiLib/HiiLib.c33
2 files changed, 24 insertions, 18 deletions
diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h
index 91b7e4e7b3..9a040326c0 100644
--- a/MdeModulePkg/Include/Library/HiiLib.h
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -198,18 +198,19 @@ HiiGetPackageString (
;
/**
- Retrieves the array of all the HII Handles or the HII handle of a specific
- package list in the HII Database.
+ Retrieves the array of all the HII Handles or the HII handles of a specific
+ package list GUID in the HII Database.
This array is terminated with a NULL HII Handle.
This function allocates the returned array using AllocatePool().
The caller is responsible for freeing the array with FreePool().
@param[in] PackageListGuid An optional parameter that is used to request
- an HII Handle associated with a specific
+ HII Handles associated with a specific
Package List GUID. If this parameter is NULL,
then all the HII Handles in the HII Database
are returned. If this parameter is not NULL,
- then at most 1 HII Handle is returned.
+ then zero or more HII Handles associated with
+ PackageListGuid are returned.
@retval NULL No HII handles were found in the HII database
@retval NULL The array of HII Handles could not be retrieved
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
index f87ab8233c..2a42cd799e 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
@@ -272,18 +272,19 @@ HiiRemovePackages (
/**
- Retrieves the array of all the HII Handles or the HII handle of a specific
- package list in the HII Database.
+ Retrieves the array of all the HII Handles or the HII handles of a specific
+ package list GUID in the HII Database.
This array is terminated with a NULL HII Handle.
This function allocates the returned array using AllocatePool().
The caller is responsible for freeing the array with FreePool().
@param[in] PackageListGuid An optional parameter that is used to request
- an HII Handle that is associatd with a specific
- Package List GUID. If this parameter is NULL
+ HII Handles associated with a specific
+ Package List GUID. If this parameter is NULL,
then all the HII Handles in the HII Database
- are returned. If this parameter is not NULL
- then at most 1 HII Handle is returned.
+ are returned. If this parameter is not NULL,
+ then zero or more HII Handles associated with
+ PackageListGuid are returned.
@retval NULL No HII handles were found in the HII database
@retval NULL The array of HII Handles could not be retrieved
@@ -301,7 +302,8 @@ HiiGetHiiHandles (
EFI_HII_HANDLE TempHiiHandleBuffer;
EFI_HII_HANDLE *HiiHandleBuffer;
EFI_GUID Guid;
- UINTN Index;
+ UINTN Index1;
+ UINTN Index2;
//
// Retrieve the size required for the buffer of all HII handles.
@@ -364,17 +366,20 @@ HiiGetHiiHandles (
//
return HiiHandleBuffer;
} else {
- for (Index = 0; HiiHandleBuffer[Index] != NULL; Index++) {
- Status = InternalHiiExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
+ for (Index1 = 0, Index2 = 0; HiiHandleBuffer[Index1] != NULL; Index1++) {
+ Status = InternalHiiExtractGuidFromHiiHandle (HiiHandleBuffer[Index1], &Guid);
ASSERT_EFI_ERROR (Status);
if (CompareGuid (&Guid, PackageListGuid)) {
- HiiHandleBuffer[0] = HiiHandleBuffer[Index];
- HiiHandleBuffer[1] = NULL;
- return HiiHandleBuffer;
+ HiiHandleBuffer[Index2++] = HiiHandleBuffer[Index1];
}
}
- FreePool (HiiHandleBuffer);
- return NULL;
+ if (Index2 > 0) {
+ HiiHandleBuffer[Index2] = NULL;
+ return HiiHandleBuffer;
+ } else {
+ FreePool (HiiHandleBuffer);
+ return NULL;
+ }
}
}