Change the behavior of the HII Library function HiiGetHiiHandles() when the PackageListGuid parameter is not NULL. The original behavior is that if this parameter is not NULL at most 1 HII Handle is returned. Behavior after change is if this parameter is not NULL zero or more HII Handles associated with PackageListGuid are returned, because it is possible that there are multiple package lists with same package list GUID in the HII Database.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9393 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2009-11-05 08:53:47 +00:00
parent 44770e5910
commit 7992c0b02d
2 changed files with 24 additions and 18 deletions

View File

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

View File

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