]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
Improve coding style in MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / Database.c
index d3aba3d25c88a584711ba0f1e52fd36e84508bac..d148b02bf69868f389ae156487ccd71fc587ef9e 100644 (file)
@@ -1,8 +1,7 @@
 /** @file\r
 Implementation for EFI_HII_DATABASE_PROTOCOL.\r
 \r
-\r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2010, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -659,7 +658,7 @@ ExportFormPackages (
   for (Link = PackageList->FormPkgHdr.ForwardLink; Link != &PackageList->FormPkgHdr; Link = Link->ForwardLink) {\r
     FormPackage = CR (Link, HII_IFR_PACKAGE_INSTANCE, IfrEntry, HII_IFR_PACKAGE_SIGNATURE);\r
     PackageLength += FormPackage->FormPkgHdr.Length;\r
-    if (PackageLength + *ResultSize + UsedSize <= BufferSize) {\r
+    if ((Buffer != NULL) && (PackageLength + *ResultSize + UsedSize <= BufferSize)) {\r
       //\r
       // Invoke registered notification if exists\r
       //\r
@@ -2700,6 +2699,8 @@ ExportPackageList (
   @param  PackageList            A pointer to an EFI_HII_PACKAGE_LIST_HEADER\r
                                  structure.\r
   @param  DriverHandle           Associate the package list with this EFI handle.\r
+                                 If a NULL is specified, this data will not be associate\r
+                                 with any drivers and cannot have a callback induced.\r
   @param  Handle                 A pointer to the EFI_HII_HANDLE instance.\r
 \r
   @retval EFI_SUCCESS            The package list associated with the Handle was\r
@@ -2715,7 +2716,7 @@ EFIAPI
 HiiNewPackageList (\r
   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,\r
   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList,\r
-  IN CONST EFI_HANDLE                   DriverHandle,\r
+  IN CONST EFI_HANDLE                   DriverHandle, OPTIONAL\r
   OUT EFI_HII_HANDLE                    *Handle\r
   )\r
 {\r
@@ -2740,9 +2741,8 @@ HiiNewPackageList (
     DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);\r
     if (CompareGuid (\r
           &(DatabaseRecord->PackageList->PackageListHdr.PackageListGuid),\r
-          &PackageListGuid\r
-          )\r
-        ) {\r
+          &PackageListGuid) && \r
+        DatabaseRecord->DriverHandle == DriverHandle) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
   }\r