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
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
@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
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
*Response = Resp;\r
} else if (Buffer != NULL) {\r
*Response = Buffer;\r
+ } else {\r
+ *Response = NULL;\r
}\r
} else {\r
if (Resp != NULL) {\r
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
\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
\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