]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
enhanced security check.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Setup.c
index 847679fce5d3f01631ef23b2558d7022453b8881..83feb0f9fef5ef66ae70ec08d3696df55f562ded 100644 (file)
@@ -217,10 +217,11 @@ SendForm (
   OUT EFI_BROWSER_ACTION_REQUEST       *ActionRequest  OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UI_MENU_SELECTION     *Selection;\r
-  UINTN                 Index;\r
-  FORM_BROWSER_FORMSET  *FormSet;\r
+  EFI_STATUS                    Status;\r
+  UI_MENU_SELECTION             *Selection;\r
+  UINTN                         Index;\r
+  FORM_BROWSER_FORMSET          *FormSet;\r
+  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
 \r
   Status = EFI_SUCCESS;\r
   ZeroMem (&gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
@@ -282,7 +283,15 @@ SendForm (
   // Ensure we are in Text mode\r
   //\r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
-  DisableQuietBoot ();\r
+\r
+  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
+  // Set console control to text mode.\r
+  //\r
+  ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
 \r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Selection = AllocateZeroPool (sizeof (UI_MENU_SELECTION));\r
@@ -333,7 +342,7 @@ SendForm (
 \r
     } while (Selection->Action == UI_ACTION_REFRESH_FORMSET);\r
 \r
-    gBS->FreePool (Selection);\r
+    FreePool (Selection);\r
   }\r
 \r
   if (ActionRequest != NULL) {\r
@@ -482,14 +491,14 @@ BrowserCallback (
     if (*ResultsDataSize < BufferSize) {\r
       *ResultsDataSize = BufferSize;\r
 \r
-      gBS->FreePool (ConfigResp);\r
+      FreePool (ConfigResp);\r
       return EFI_BUFFER_TOO_SMALL;\r
     }\r
 \r
     *ResultsDataSize = BufferSize;\r
     CopyMem (ResultsData, StrPtr, BufferSize);\r
 \r
-    gBS->FreePool (ConfigResp);\r
+    FreePool (ConfigResp);\r
   } else {\r
     //\r
     // Prepare <ConfigResp>\r
@@ -701,7 +710,7 @@ GetToken (
   Status = HiiLibGetString (HiiHandle, Token, String, &BufferLength);\r
 \r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
-    gBS->FreePool (String);\r
+    FreePool (String);\r
     String = AllocateZeroPool (BufferLength);\r
     ASSERT (String != NULL);\r
 \r
@@ -762,7 +771,7 @@ NewStringCat (
   StrCpy (NewString, *Dest);\r
   StrCat (NewString, Src);\r
 \r
-  gBS->FreePool (*Dest);\r
+  FreePool (*Dest);\r
   *Dest = NewString;\r
 }\r
 \r
@@ -1188,7 +1197,7 @@ GetQuestionValue (
         Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);\r
       }\r
 \r
-      gBS->FreePool (Value);\r
+      FreePool (Value);\r
     }\r
   } else {\r
     //\r
@@ -1241,7 +1250,7 @@ GetQuestionValue (
       Value = Value + 6;\r
     }\r
     if (*Value != '=') {\r
-      gBS->FreePool (Result);\r
+      FreePool (Result);\r
       return EFI_NOT_FOUND;\r
     }\r
     //\r
@@ -1267,7 +1276,7 @@ GetQuestionValue (
     } else {\r
       Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);\r
       if (EFI_ERROR (Status)) {\r
-        gBS->FreePool (Result);\r
+        FreePool (Result);\r
         return Status;\r
       }\r
     }\r
@@ -1280,7 +1289,7 @@ GetQuestionValue (
     } else {\r
       SetValueByName (Storage, Question->VariableName, Value);\r
     }\r
-    gBS->FreePool (Result);\r
+    FreePool (Result);\r
   }\r
 \r
   return Status;\r
@@ -1450,7 +1459,7 @@ SetQuestionValue (
     }\r
 \r
     Status = SetValueByName (Storage, Question->VariableName, Value);\r
-    gBS->FreePool (Value);\r
+    FreePool (Value);\r
   }\r
 \r
   if (!Cached) {\r
@@ -1505,11 +1514,11 @@ SetQuestionValue (
                                         &Progress\r
                                         );\r
       if (EFI_ERROR (Status)) {\r
-        gBS->FreePool (ConfigResp);\r
+        FreePool (ConfigResp);\r
         return Status;\r
       }\r
     }\r
-    gBS->FreePool (ConfigResp);\r
+    FreePool (ConfigResp);\r
 \r
     //\r
     // Synchronize shadow Buffer\r
@@ -1577,7 +1586,7 @@ ValidateQuestion (
         do {\r
           CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, PopUp, gPressEnter, gEmptyString);\r
         } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
-        gBS->FreePool (PopUp);\r
+        FreePool (PopUp);\r
       }\r
 \r
       return EFI_NOT_READY;\r
@@ -1692,11 +1701,11 @@ SubmitForm (
                                         &Progress\r
                                         );\r
       if (EFI_ERROR (Status)) {\r
-        gBS->FreePool (ConfigResp);\r
+        FreePool (ConfigResp);\r
         return Status;\r
       }\r
     }\r
-    gBS->FreePool (ConfigResp);\r
+    FreePool (ConfigResp);\r
 \r
     //\r
     // Config success, update storage shadow Buffer\r
@@ -2034,7 +2043,7 @@ LoadStorage (
   }\r
 \r
   Status = ConfigRespToStorage (Storage, Result);\r
-  gBS->FreePool (Result);\r
+  FreePool (Result);\r
   return Status;\r
 }\r
 \r
@@ -2157,7 +2166,8 @@ GetIfrBinaryData (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-\r
+  ASSERT (HiiPackageList != NULL);\r
+  \r
   //\r
   // Get Form package from this HII package List\r
   //\r
@@ -2211,7 +2221,7 @@ GetIfrBinaryData (
     //\r
     // Form package not found in this Package List\r
     //\r
-    gBS->FreePool (HiiPackageList);\r
+    FreePool (HiiPackageList);\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -2230,7 +2240,7 @@ GetIfrBinaryData (
   *BinaryLength = PackageHeader.Length - Offset2;\r
   *BinaryData = AllocateCopyPool (*BinaryLength, OpCodeData);\r
 \r
-  gBS->FreePool (HiiPackageList);\r
+  FreePool (HiiPackageList);\r
 \r
   if (*BinaryData == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r