]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
Merged in the following trackers from EDK:
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / Database.c
index 3ee8b4ca349348a5ccd5f3bea1f316182b10a652..b5a5c43b43c568286eb6152efd6769fba78e2083 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2008, 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
@@ -2771,8 +2771,7 @@ HiiNewPackageList (
 \r
   @retval EFI_SUCCESS            The data associated with the Handle was removed\r
                                  from  the HII database.\r
-  @retval EFI_NOT_FOUND          The specified PackageList could not be found in\r
-                                 database.\r
+  @retval EFI_NOT_FOUND          The specified andle is not in database.\r
   @retval EFI_INVALID_PARAMETER  The Handle was not valid.\r
 \r
 **/\r
@@ -2790,10 +2789,14 @@ HiiRemovePackageList (
   HII_DATABASE_PACKAGE_LIST_INSTANCE  *PackageList;\r
   HII_HANDLE                          *HiiHandle;\r
 \r
-  if (This == NULL || !IsHiiHandleValid (Handle)) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (!IsHiiHandleValid (Handle)) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);\r
 \r
   //\r
@@ -2879,9 +2882,8 @@ HiiRemovePackageList (
   @retval EFI_SUCCESS            The HII database was successfully updated.\r
   @retval EFI_OUT_OF_RESOURCES   Unable to allocate enough memory for the updated\r
                                  database.\r
-  @retval EFI_INVALID_PARAMETER  Handle or PackageList was NULL.\r
-  @retval EFI_NOT_FOUND          The Handle was not valid or could not be found in\r
-                                 database.\r
+  @retval EFI_INVALID_PARAMETER  PackageList was NULL.\r
+  @retval EFI_NOT_FOUND          The specified Handle is not in database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -2900,7 +2902,7 @@ HiiUpdatePackageList (
   HII_DATABASE_PACKAGE_LIST_INSTANCE  *OldPackageList;\r
   EFI_HII_PACKAGE_HEADER              PackageHeader;\r
 \r
-  if (This == NULL || PackageList == NULL || Handle == NULL) {\r
+  if (This == NULL || PackageList == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -2993,12 +2995,17 @@ HiiUpdatePackageList (
   @param  Handle                 An array of EFI_HII_HANDLE instances returned.\r
 \r
   @retval EFI_SUCCESS            The matching handles are outputed successfully.\r
+                                               HandleBufferLength is updated with the actual length.\r
   @retval EFI_BUFFER_TO_SMALL    The HandleBufferLength parameter indicates that\r
                                  Handle is too small to support the number of\r
                                  handles. HandleBufferLength is updated with a\r
                                  value that will  enable the data to fit.\r
   @retval EFI_NOT_FOUND          No matching handle could not be found in database.\r
   @retval EFI_INVALID_PARAMETER  Handle or HandleBufferLength was NULL.\r
+  \r
+  @retval EFI_INVALID_PARAMETER  PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but\r
+                                                     PackageGuid is not NULL, PackageType is a EFI_HII_\r
+                                                     PACKAGE_TYPE_GUID but PackageGuid is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -3350,10 +3357,14 @@ HiiUnregisterPackageNotify (
   LIST_ENTRY                          *Link;\r
   EFI_STATUS                          Status;\r
 \r
-  if (This == NULL || NotificationHandle == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (NotificationHandle == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   Status = gBS->OpenProtocol (\r
                   NotificationHandle,\r
                   &mHiiDatabaseNotifyGuid,\r
@@ -3363,7 +3374,7 @@ HiiUnregisterPackageNotify (
                   EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return EFI_INVALID_PARAMETER;\r
+    return EFI_NOT_FOUND;\r
   }\r
 \r
   Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);\r
@@ -3474,7 +3485,7 @@ HiiFindKeyboardLayouts (
       for (Index = 0; Index < LayoutCount; Index++) {\r
         ResultSize += sizeof (EFI_GUID);\r
         if (ResultSize <= *KeyGuidBufferLength) {\r
-          CopyMem (KeyGuidBuffer + Index, Layout + sizeof (UINT16), sizeof (EFI_GUID));\r
+          CopyMem (KeyGuidBuffer + (ResultSize / sizeof (EFI_GUID) - 1), Layout + sizeof (UINT16), sizeof (EFI_GUID));\r
           CopyMem (&LayoutLength, Layout, sizeof (UINT16));\r
           Layout = Layout + LayoutLength;\r
         }\r