]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLib/UefiShellLib.c
ShellPkg: Fix spelling mistake for occurred
[mirror_edk2.git] / ShellPkg / Library / UefiShellLib / UefiShellLib.c
index 430b20e1272d968b70bde58ebb2c16fc878cd104..c4749941a648b4083834c2debd05df07e7380dbf 100644 (file)
@@ -1291,9 +1291,27 @@ ShellExecute (
   if (mEfiShellEnvironment2 != NULL) {\r
     //\r
     // Call EFI Shell version.\r
-    // Due to oddity in the EFI shell we want to dereference the ParentHandle here\r
     //\r
-    CmdStatus = (mEfiShellEnvironment2->Execute(*ParentHandle,\r
+    // Due to an unfixable bug in the EdkShell implementation, we must\r
+    // dereference "ParentHandle" here:\r
+    //\r
+    // 1. The EFI shell installs the EFI_SHELL_ENVIRONMENT2 protocol,\r
+    //    identified by gEfiShellEnvironment2Guid.\r
+    // 2. The Execute() member function takes "ParentImageHandle" as first\r
+    //    parameter, with type (EFI_HANDLE*).\r
+    // 3. In the EdkShell implementation, SEnvExecute() implements the\r
+    //    Execute() member function. It passes "ParentImageHandle" correctly to\r
+    //    SEnvDoExecute().\r
+    // 4. SEnvDoExecute() takes the (EFI_HANDLE*), and passes it directly --\r
+    //    without de-referencing -- to the HandleProtocol() boot service.\r
+    // 5. But HandleProtocol() takes an EFI_HANDLE.\r
+    //\r
+    // Therefore we must\r
+    // - de-reference "ParentHandle" here, to mask the bug in\r
+    //   SEnvDoExecute(), and\r
+    // - pass the resultant EFI_HANDLE as an (EFI_HANDLE*).\r
+    //\r
+    CmdStatus = (mEfiShellEnvironment2->Execute((EFI_HANDLE *)*ParentHandle,\r
                                           CommandLine,\r
                                           Output));\r
     //\r
@@ -2997,7 +3015,7 @@ ShellPrintHiiEx(
   IN INT32                Row OPTIONAL,\r
   IN CONST CHAR8          *Language OPTIONAL,\r
   IN CONST EFI_STRING_ID  HiiFormatStringId,\r
-  IN CONST EFI_HANDLE     HiiFormatHandle,\r
+  IN CONST EFI_HII_HANDLE HiiFormatHandle,\r
   ...\r
   )\r
 {\r
@@ -3163,7 +3181,7 @@ ShellIsFileInPath(
   @param[in] String   String representation of a number.\r
 \r
   @return             The unsigned integer result of the conversion.\r
-  @retval (UINTN)(-1) An error occured.\r
+  @retval (UINTN)(-1) An error occurred.\r
 **/\r
 UINTN\r
 EFIAPI\r
@@ -3366,6 +3384,9 @@ ShellPromptForResponse (
   if (Type != ShellPromptResponseTypeFreeform) {\r
     Resp = (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESPONSE));\r
     if (Resp == NULL) {\r
+      if (Response != NULL) {\r
+        *Response = NULL;\r
+      }\r
       return (EFI_OUT_OF_RESOURCES);\r
     }\r
   }\r
@@ -3568,6 +3589,8 @@ ShellPromptForResponse (
       *Response = Resp;\r
     } else if (Buffer != NULL) {\r
       *Response = Buffer;\r
+    } else {\r
+      *Response = NULL;\r
     }\r
   } else {\r
     if (Resp != NULL) {\r
@@ -3604,7 +3627,7 @@ EFIAPI
 ShellPromptForResponseHii (\r
   IN SHELL_PROMPT_REQUEST_TYPE         Type,\r
   IN CONST EFI_STRING_ID  HiiFormatStringId,\r
-  IN CONST EFI_HANDLE     HiiFormatHandle,\r
+  IN CONST EFI_HII_HANDLE HiiFormatHandle,\r
   IN OUT VOID             **Response\r
   )\r
 {\r
@@ -3787,7 +3810,7 @@ InternalShellHexCharToUintn (
 \r
   @retval EFI_SUCCESS             The conversion was successful.\r
   @retval EFI_INVALID_PARAMETER   A parameter was NULL or invalid.\r
-  @retval EFI_DEVICE_ERROR        An overflow occured.\r
+  @retval EFI_DEVICE_ERROR        An overflow occurred.\r
 **/\r
 EFI_STATUS\r
 InternalShellStrHexToUint64 (\r
@@ -3888,7 +3911,7 @@ InternalShellStrHexToUint64 (
 \r
   @retval EFI_SUCCESS             The conversion was successful.\r
   @retval EFI_INVALID_PARAMETER   A parameter was NULL or invalid.\r
-  @retval EFI_DEVICE_ERROR        An overflow occured.\r
+  @retval EFI_DEVICE_ERROR        An overflow occurred.\r
 **/\r
 EFI_STATUS\r
 InternalShellStrDecimalToUint64 (\r