Only generate the random GUID if a package list already exist in the database.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5902 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-09-16 07:56:40 +00:00
parent 1947c70c3e
commit b436ed893b
1 changed files with 19 additions and 8 deletions

View File

@ -307,13 +307,6 @@ UefiRegisterPackageList(
CopyGuid (&ThunkContext->TagGuid, Packages->GuidId);
}
//
// UEFI HII database does not allow two package list with the same GUID.
// In Framework HII implementation, Packages->GuidId is used as an identifier to associate
// a PackageList with only IFR to a Package list the with String package.
//
GenerateRandomGuid (&GuidId);
//
// UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
// that Setup Utility can load the Buffer Storage using this protocol.
@ -321,13 +314,31 @@ UefiRegisterPackageList(
if (IfrPackageCount != 0) {
InstallDefaultConfigAccessProtocol (Packages, ThunkContext);
}
PackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &GuidId);
PackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &ThunkContext->TagGuid);
Status = mHiiDatabase->NewPackageList (
mHiiDatabase,
PackageListHeader,
ThunkContext->UefiHiiDriverHandle,
&ThunkContext->UefiHiiHandle
);
if (Status == EFI_INVALID_PARAMETER) {
SafeFreePool (PackageListHeader);
//
// UEFI HII database does not allow two package list with the same GUID.
// In Framework HII implementation, Packages->GuidId is used as an identifier to associate
// a PackageList with only IFR to a Package list the with String package.
//
GenerateRandomGuid (&GuidId);
PackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &GuidId);
Status = mHiiDatabase->NewPackageList (
mHiiDatabase,
PackageListHeader,
ThunkContext->UefiHiiDriverHandle,
&ThunkContext->UefiHiiHandle
);
}
//
// BUGBUG: Remove when development is done