From b436ed893b1d01c5b72495c75dc0a400a97853b3 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 16 Sep 2008 07:56:40 +0000 Subject: 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 --- .../FrameworkHiiToUefiHiiThunk/Package.c | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'EdkCompatibilityPkg') diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c index d84eadeb93..5f2aa18b84 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c @@ -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 -- cgit v1.2.3