]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / FrontPageCustomizedUiSupport.c
index da0cff7556c84f0e9e2a164637fb049f1229caa3..c9823e565de8c10bc9e122fc2c04c866e072ad5b 100644 (file)
@@ -3,13 +3,7 @@
   This library class defines a set of interfaces to customize Ui module\r
 \r
 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under\r
-the terms and conditions of the BSD License that accompanies this distribution.\r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 #include <Uefi.h>\r
@@ -43,6 +37,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define FRONT_PAGE_KEY_CONTINUE               0x1000\r
 #define FRONT_PAGE_KEY_RESET                  0x1001\r
 #define FRONT_PAGE_KEY_LANGUAGE               0x1002\r
+#define FRONT_PAGE_KEY_DRIVER                 0x2000\r
 \r
 typedef struct {\r
   EFI_STRING_ID   PromptId;\r
@@ -259,6 +254,7 @@ UiCreateLanguageMenu (
 {\r
   CHAR8                       *LangCode;\r
   CHAR8                       *Lang;\r
+  UINTN                       LangSize;\r
   CHAR8                       *CurrentLang;\r
   UINTN                       OptionCount;\r
   CHAR16                      *StringBuffer;\r
@@ -328,9 +324,10 @@ UiCreateLanguageMenu (
       }\r
 \r
       if (EFI_ERROR (Status)) {\r
-        StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));\r
+        LangSize = AsciiStrSize (Lang);\r
+        StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));\r
         ASSERT (StringBuffer != NULL);\r
-        AsciiStrToUnicodeStr (Lang, StringBuffer);\r
+        AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);\r
       }\r
 \r
       ASSERT (StringBuffer != NULL);\r
@@ -636,9 +633,13 @@ UiListThirdPartyDrivers (
 \r
     Count++;\r
     if (Count >= CurrentSize) {\r
-      DriverListPtr = AllocateCopyPool ((Count + UI_HII_DRIVER_LIST_SIZE) * sizeof (UI_HII_DRIVER_INSTANCE), gHiiDriverList);\r
+      DriverListPtr = ReallocatePool (\r
+                        CurrentSize * sizeof (UI_HII_DRIVER_INSTANCE),\r
+                        (Count + UI_HII_DRIVER_LIST_SIZE)\r
+                          * sizeof (UI_HII_DRIVER_INSTANCE),\r
+                        gHiiDriverList\r
+                        );\r
       ASSERT (DriverListPtr != NULL);\r
-      FreePool (gHiiDriverList);\r
       gHiiDriverList = DriverListPtr;\r
       CurrentSize += UI_HII_DRIVER_LIST_SIZE;\r
     }\r
@@ -654,7 +655,7 @@ UiListThirdPartyDrivers (
       gHiiDriverList[Index].PromptId,\r
       gHiiDriverList[Index].HelpId,\r
       0,\r
-      0,\r
+      (EFI_QUESTION_ID) (Index + FRONT_PAGE_KEY_DRIVER),\r
       0,\r
       &gHiiDriverList[Index].FormSetGuid,\r
       gHiiDriverList[Index].DevicePathId\r