\r
\r
/**\r
- Retrieves the array of all the HII Handles or the HII handle of a specific\r
- package list in the HII Database.\r
+ Retrieves the array of all the HII Handles or the HII handles of a specific\r
+ package list GUID in the HII Database.\r
This array is terminated with a NULL HII Handle.\r
This function allocates the returned array using AllocatePool().\r
The caller is responsible for freeing the array with FreePool().\r
\r
@param[in] PackageListGuid An optional parameter that is used to request \r
- an HII Handle that is associatd with a specific\r
- Package List GUID. If this parameter is NULL\r
+ HII Handles associated with a specific\r
+ Package List GUID. If this parameter is NULL,\r
then all the HII Handles in the HII Database\r
- are returned. If this parameter is not NULL\r
- then at most 1 HII Handle is returned.\r
+ are returned. If this parameter is not NULL,\r
+ then zero or more HII Handles associated with \r
+ PackageListGuid are returned.\r
\r
@retval NULL No HII handles were found in the HII database\r
@retval NULL The array of HII Handles could not be retrieved\r
EFI_HII_HANDLE TempHiiHandleBuffer;\r
EFI_HII_HANDLE *HiiHandleBuffer;\r
EFI_GUID Guid;\r
- UINTN Index;\r
+ UINTN Index1;\r
+ UINTN Index2;\r
\r
//\r
// Retrieve the size required for the buffer of all HII handles.\r
//\r
return HiiHandleBuffer;\r
} else {\r
- for (Index = 0; HiiHandleBuffer[Index] != NULL; Index++) {\r
- Status = InternalHiiExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);\r
+ for (Index1 = 0, Index2 = 0; HiiHandleBuffer[Index1] != NULL; Index1++) {\r
+ Status = InternalHiiExtractGuidFromHiiHandle (HiiHandleBuffer[Index1], &Guid);\r
ASSERT_EFI_ERROR (Status);\r
if (CompareGuid (&Guid, PackageListGuid)) {\r
- HiiHandleBuffer[0] = HiiHandleBuffer[Index];\r
- HiiHandleBuffer[1] = NULL;\r
- return HiiHandleBuffer;\r
+ HiiHandleBuffer[Index2++] = HiiHandleBuffer[Index1]; \r
}\r
}\r
- FreePool (HiiHandleBuffer);\r
- return NULL;\r
+ if (Index2 > 0) {\r
+ HiiHandleBuffer[Index2] = NULL;\r
+ return HiiHandleBuffer;\r
+ } else {\r
+ FreePool (HiiHandleBuffer);\r
+ return NULL;\r
+ }\r
}\r
}\r
\r