summaryrefslogtreecommitdiff
path: root/ShellPkg/Application
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2014-09-18 01:58:03 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2014-09-18 01:58:03 +0000
commita308e0588b3ad87b94611391e9e7a04a8eb05ebf (patch)
treed90edaf7e5d543b64dc78400a32fa2733a039251 /ShellPkg/Application
parent4b6b543e77f3237c63e691f35d0bb259ddc287b4 (diff)
downloadedk2-platforms-a308e0588b3ad87b94611391e9e7a04a8eb05ebf.tar.xz
Roll back check in r15180 which caused the shell always returns EFI_ABORTED no matter what exit-code is specified for "exit" command.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Carsey Jaben <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16127 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r--ShellPkg/Application/Shell/Shell.c210
-rw-r--r--ShellPkg/Application/Shell/Shell.h34
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c51
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.h6
4 files changed, 59 insertions, 242 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 29c65b7f27..41fa78004d 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -244,9 +244,6 @@ UefiMain (
UINTN Size;
EFI_HANDLE ConInHandle;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- SHELL_STATUS ExitStatus;
if (PcdGet8(PcdShellSupportLevel) > 3) {
return (EFI_UNSUPPORTED);
@@ -300,12 +297,6 @@ UefiMain (
// install our console logger. This will keep a log of the output for back-browsing
//
Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo);
- if(EFI_ERROR (Status)) {
- ExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
- } else {
- ExitStatus = SHELL_SUCCESS;
- }
-
if (!EFI_ERROR(Status)) {
//
// Enable the cursor to be visible
@@ -419,7 +410,7 @@ UefiMain (
// Display the mapping
//
if (PcdGet8(PcdShellSupportLevel) >= 2 && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) {
- Status = RunCommand(L"map", NULL);
+ Status = RunCommand(L"map");
ASSERT_EFI_ERROR(Status);
}
@@ -485,11 +476,7 @@ UefiMain (
//
// process the startup script or launch the called app.
//
- Status = DoStartupScript(
- ShellInfoObject.ImageDevPath,
- ShellInfoObject.FileDevPath,
- &ExitStatus
- );
+ Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
}
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
@@ -523,7 +510,6 @@ UefiMain (
//
Status = DoShellPrompt();
} while (!ShellCommandGetExit());
- ExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();
}
if (OldConIn != NULL && ConInHandle != NULL) {
CloseSimpleTextInOnFile (gST->ConIn);
@@ -595,33 +581,10 @@ FreeResources:
DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;);
}
- if (!EFI_ERROR (Status)) {
- // If the command exited with an error, we pass this error out in the ExitData
- // so that it can be retrieved by the EfiShellExecute function (which may
- // start the shell with gBS->StartImage)
- if (ExitStatus != SHELL_SUCCESS) {
- // Allocate a buffer for exit data to pass to gBS->Exit().
- // This buffer will contain the empty string immediately followed by
- // the shell's exit status. (The empty string is required by the UEFI spec)
- ExitDataSize = (sizeof (CHAR16) + sizeof (SHELL_STATUS));
- ExitData = AllocatePool (ExitDataSize);
- if (ExitData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- ExitData[0] = '\0';
- // Use CopyMem to avoid alignment faults
- CopyMem ((ExitData + 1), &ExitStatus, sizeof (ExitStatus));
-
- gBS->Exit (ImageHandle, EFI_ABORTED, ExitDataSize, ExitData);
-
- ASSERT (FALSE);
- return EFI_SUCCESS;
- } else {
- return EFI_SUCCESS;
- }
- } else {
- return Status;
+ if (ShellCommandGetExit()) {
+ return ((EFI_STATUS)ShellCommandGetExitCode());
}
+ return (Status);
}
/**
@@ -986,16 +949,13 @@ ProcessCommandLine(
@param ImagePath the path to the image for shell. first place to look for the startup script
@param FilePath the path to the file for shell. second place to look for the startup script.
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
-
@retval EFI_SUCCESS the variable is initialized.
**/
EFI_STATUS
EFIAPI
DoStartupScript(
- IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT SHELL_STATUS *ExitStatus
+ IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
EFI_STATUS Status;
@@ -1030,7 +990,7 @@ DoStartupScript(
StrnCat(FileStringPath, L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);
StrnCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);
}
- Status = RunCommand(FileStringPath, ExitStatus);
+ Status = RunCommand(FileStringPath);
FreePool(FileStringPath);
return (Status);
@@ -1107,13 +1067,7 @@ DoStartupScript(
// If we got a file, run it
//
if (!EFI_ERROR(Status) && FileHandle != NULL) {
- Status = RunScriptFile (
- mStartupScript,
- FileHandle,
- L"",
- ShellInfoObject.NewShellParametersProtocol,
- ExitStatus
- );
+ Status = RunScriptFile (mStartupScript, FileHandle, L"", ShellInfoObject.NewShellParametersProtocol);
ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);
} else {
FileStringPath = ShellFindFilePath(mStartupScript);
@@ -1124,13 +1078,7 @@ DoStartupScript(
Status = EFI_SUCCESS;
ASSERT(FileHandle == NULL);
} else {
- Status = RunScriptFile(
- FileStringPath,
- NULL,
- L"",
- ShellInfoObject.NewShellParametersProtocol,
- ExitStatus
- );
+ Status = RunScriptFile(FileStringPath, NULL, L"", ShellInfoObject.NewShellParametersProtocol);
FreePool(FileStringPath);
}
}
@@ -1195,7 +1143,7 @@ DoShellPrompt (
//
if (!EFI_ERROR (Status)) {
CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;
- Status = RunCommand(CmdLine, NULL);
+ Status = RunCommand(CmdLine);
}
//
@@ -1526,9 +1474,6 @@ ShellConvertVariables (
@param[in] StdIn The pointer to the Standard input.
@param[in] StdOut The pointer to the Standard output.
- @param[out] ExitStatus The exit code of the last command in the pipeline.
- Ignored if NULL.
-
@retval EFI_SUCCESS The split command is executed successfully.
@retval other Some error occurs when executing the split command.
**/
@@ -1537,8 +1482,7 @@ EFIAPI
RunSplitCommand(
IN CONST CHAR16 *CmdLine,
IN SHELL_FILE_HANDLE *StdIn,
- IN SHELL_FILE_HANDLE *StdOut,
- OUT SHELL_STATUS *ExitStatus
+ IN SHELL_FILE_HANDLE *StdOut
)
{
EFI_STATUS Status;
@@ -1592,7 +1536,7 @@ RunSplitCommand(
ASSERT(Split->SplitStdOut != NULL);
InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);
- Status = RunCommand(OurCommandLine, NULL);
+ Status = RunCommand(OurCommandLine);
//
// move the output from the first to the in to the second.
@@ -1607,7 +1551,7 @@ RunSplitCommand(
ShellInfoObject.NewEfiShellProtocol->SetFilePosition(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn), 0);
if (!EFI_ERROR(Status)) {
- Status = RunCommand(NextCommandLine, ExitStatus);
+ Status = RunCommand(NextCommandLine);
}
//
@@ -1901,9 +1845,7 @@ VerifySplit(
/**
Process a split based operation.
- @param[in] CmdLine Pointer to the command line to process
- @param[out] ExitStatus The exit status of the command. Ignored if NULL.
- Invalid if this function returns an error.
+ @param[in] CmdLine pointer to the command line to process
@retval EFI_SUCCESS The operation was successful
@return an error occured.
@@ -1911,8 +1853,7 @@ VerifySplit(
EFI_STATUS
EFIAPI
ProcessNewSplitCommandLine(
- IN CONST CHAR16 *CmdLine,
- OUT SHELL_STATUS *ExitStatus
+ IN CONST CHAR16 *CmdLine
)
{
SPLIT_LIST *Split;
@@ -1933,14 +1874,9 @@ ProcessNewSplitCommandLine(
}
if (Split == NULL) {
- Status = RunSplitCommand(CmdLine, NULL, NULL, ExitStatus);
+ Status = RunSplitCommand(CmdLine, NULL, NULL);
} else {
- Status = RunSplitCommand(
- CmdLine,
- Split->SplitStdIn,
- Split->SplitStdOut,
- ExitStatus
- );
+ Status = RunSplitCommand(CmdLine, Split->SplitStdIn, Split->SplitStdOut);
}
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine);
@@ -2120,8 +2056,6 @@ ProcessCommandLineToFinal(
@param[in] FirstParameter the first parameter on the command line
@param[in] ParamProtocol the shell parameters protocol pointer
- @param[out] ExitStatus The exit code of the command. Ignored if NULL.
-
@retval EFI_SUCCESS The command was completed.
@retval EFI_ABORTED The command's operation was aborted.
**/
@@ -2130,8 +2064,7 @@ EFIAPI
RunInternalCommand(
IN CONST CHAR16 *CmdLine,
IN CHAR16 *FirstParameter,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
- OUT SHELL_STATUS *ExitStatus OPTIONAL
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
)
{
EFI_STATUS Status;
@@ -2171,9 +2104,6 @@ RunInternalCommand(
if (LastError) {
SetLastError(CommandReturnedStatus);
}
- if (ExitStatus != NULL) {
- *ExitStatus = CommandReturnedStatus;
- }
//
// Pass thru the exitcode from the app.
@@ -2229,9 +2159,6 @@ RunInternalCommand(
@param[in] FirstParameter the first parameter on the command line
@param[in] ParamProtocol the shell parameters protocol pointer
- @param[out] ExitStatus The exit code of the command or file.
- Ignored if NULL.
-
@retval EFI_SUCCESS The command was completed.
@retval EFI_ABORTED The command's operation was aborted.
**/
@@ -2241,8 +2168,7 @@ RunCommandOrFile(
IN SHELL_OPERATION_TYPES Type,
IN CONST CHAR16 *CmdLine,
IN CHAR16 *FirstParameter,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
- OUT SHELL_STATUS *ExitStatus
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
)
{
EFI_STATUS Status;
@@ -2258,12 +2184,7 @@ RunCommandOrFile(
switch (Type) {
case Internal_Command:
- Status = RunInternalCommand(
- CmdLine,
- FirstParameter,
- ParamProtocol,
- &CalleeExitStatus
- );
+ Status = RunInternalCommand(CmdLine, FirstParameter, ParamProtocol);
break;
case Script_File_Name:
case Efi_Application:
@@ -2298,13 +2219,7 @@ RunCommandOrFile(
}
switch (Type) {
case Script_File_Name:
- Status = RunScriptFile (
- CommandWithPath,
- NULL,
- CmdLine,
- ParamProtocol,
- &CalleeExitStatus
- );
+ Status = RunScriptFile (CommandWithPath, NULL, CmdLine, ParamProtocol);
break;
case Efi_Application:
//
@@ -2324,9 +2239,7 @@ RunCommandOrFile(
DevPath,
CmdLine,
NULL,
- &StartStatus,
- NULL,
- NULL
+ &StartStatus
);
SHELL_FREE_NON_NULL(DevPath);
@@ -2359,10 +2272,6 @@ RunCommandOrFile(
SHELL_FREE_NON_NULL(CommandWithPath);
- if (ExitStatus != NULL) {
- *ExitStatus = CalleeExitStatus;
- }
-
return (Status);
}
@@ -2374,20 +2283,16 @@ RunCommandOrFile(
@param[in] FirstParameter the first parameter on the command line.
@param[in] ParamProtocol the shell parameters protocol pointer
- @param[out] ExitStatus The exit code of the command or file.
- Ignored if NULL.
-
@retval EFI_SUCCESS The command was completed.
@retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
EFIAPI
SetupAndRunCommandOrFile(
- IN SHELL_OPERATION_TYPES Type,
- IN CHAR16 *CmdLine,
- IN CHAR16 *FirstParameter,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
- OUT SHELL_STATUS *ExitStatus
+ IN SHELL_OPERATION_TYPES Type,
+ IN CHAR16 *CmdLine,
+ IN CHAR16 *FirstParameter,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
)
{
EFI_STATUS Status;
@@ -2407,13 +2312,7 @@ SetupAndRunCommandOrFile(
//
if (!EFI_ERROR(Status)) {
TrimSpaces(&CmdLine);
- Status = RunCommandOrFile(
- Type,
- CmdLine,
- FirstParameter,
- ParamProtocol,
- ExitStatus
- );
+ Status = RunCommandOrFile(Type, CmdLine, FirstParameter, ParamProtocol);
}
//
@@ -2438,7 +2337,6 @@ SetupAndRunCommandOrFile(
command or dispatch an external application.
@param[in] CmdLine The command line to parse.
- @param[out] ExitStatus The exit code of the command. Ignored if NULL.
@retval EFI_SUCCESS The command was completed.
@retval EFI_ABORTED The command's operation was aborted.
@@ -2446,8 +2344,7 @@ SetupAndRunCommandOrFile(
EFI_STATUS
EFIAPI
RunCommand(
- IN CONST CHAR16 *CmdLine,
- OUT SHELL_STATUS *ExitStatus
+ IN CONST CHAR16 *CmdLine
)
{
EFI_STATUS Status;
@@ -2507,7 +2404,7 @@ RunCommand(
// We dont do normal processing with a split command line (output from one command input to another)
//
if (ContainsSplit(CleanOriginal)) {
- Status = ProcessNewSplitCommandLine(CleanOriginal, ExitStatus);
+ Status = ProcessNewSplitCommandLine(CleanOriginal);
SHELL_FREE_NON_NULL(CleanOriginal);
return (Status);
}
@@ -2533,13 +2430,7 @@ RunCommand(
case Internal_Command:
case Script_File_Name:
case Efi_Application:
- Status = SetupAndRunCommandOrFile(
- Type,
- CleanOriginal,
- FirstParameter,
- ShellInfoObject.NewShellParametersProtocol,
- ExitStatus
- );
+ Status = SetupAndRunCommandOrFile(Type, CleanOriginal, FirstParameter, ShellInfoObject.NewShellParametersProtocol);
break;
default:
//
@@ -2594,16 +2485,13 @@ IsValidCommandName(
@param[in] Handle The handle to the already opened file.
@param[in] Name The name of the script file.
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
-
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFileHandle (
- IN SHELL_FILE_HANDLE Handle,
- IN CONST CHAR16 *Name,
- OUT SHELL_STATUS *ExitStatus
+ IN SHELL_FILE_HANDLE Handle,
+ IN CONST CHAR16 *Name
)
{
EFI_STATUS Status;
@@ -2619,11 +2507,8 @@ RunScriptFileHandle (
CONST CHAR16 *CurDir;
UINTN LineCount;
CHAR16 LeString[50];
- SHELL_STATUS CalleeExitStatus;
ASSERT(!ShellCommandGetScriptExit());
-
- CalleeExitStatus = SHELL_SUCCESS;
PreScriptEchoState = ShellCommandGetEchoState();
@@ -2809,7 +2694,7 @@ RunScriptFileHandle (
//
PreCommandEchoState = ShellCommandGetEchoState();
ShellCommandSetEchoState(FALSE);
- Status = RunCommand(CommandLine3+1, NULL);
+ Status = RunCommand(CommandLine3+1);
//
// If command was "@echo -off" or "@echo -on" then don't restore echo state
@@ -2831,7 +2716,7 @@ RunScriptFileHandle (
}
ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);
}
- Status = RunCommand(CommandLine3, NULL);
+ Status = RunCommand(CommandLine3);
}
}
@@ -2839,8 +2724,7 @@ RunScriptFileHandle (
//
// ShellCommandGetExitCode() always returns a UINT64
//
- CalleeExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();
- UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", CalleeExitStatus);
+ UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ShellCommandGetExitCode());
DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE););
InternalEfiShellSetEnv(L"lasterror", LeString, TRUE);
@@ -2852,11 +2736,9 @@ RunScriptFileHandle (
break;
}
if (EFI_ERROR(Status)) {
- CalleeExitStatus = (SHELL_STATUS) Status;
break;
}
if (ShellCommandGetExit()) {
- CalleeExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();
break;
}
}
@@ -2888,11 +2770,6 @@ RunScriptFileHandle (
if (ShellCommandGetCurrentScriptFile()==NULL) {
ShellCommandSetEchoState(PreScriptEchoState);
}
-
- if (ExitStatus != NULL) {
- *ExitStatus = CalleeExitStatus;
- }
-
return (EFI_SUCCESS);
}
@@ -2904,18 +2781,15 @@ RunScriptFileHandle (
@param[in] CmdLine the command line to run.
@param[in] ParamProtocol the shell parameters protocol pointer
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
-
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFile (
- IN CONST CHAR16 *ScriptPath,
- IN SHELL_FILE_HANDLE Handle OPTIONAL,
- IN CONST CHAR16 *CmdLine,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
- OUT SHELL_STATUS *ExitStatus
+ IN CONST CHAR16 *ScriptPath,
+ IN SHELL_FILE_HANDLE Handle OPTIONAL,
+ IN CONST CHAR16 *CmdLine,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
)
{
EFI_STATUS Status;
@@ -2942,7 +2816,7 @@ RunScriptFile (
//
// run it
//
- Status = RunScriptFileHandle(FileHandle, ScriptPath, ExitStatus);
+ Status = RunScriptFileHandle(FileHandle, ScriptPath);
//
// now close the file
@@ -2950,7 +2824,7 @@ RunScriptFile (
ShellCloseFile(&FileHandle);
}
} else {
- Status = RunScriptFileHandle(Handle, ScriptPath, ExitStatus);
+ Status = RunScriptFileHandle(Handle, ScriptPath);
}
}
diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h
index 57518dfd29..c20ee3a803 100644
--- a/ShellPkg/Application/Shell/Shell.h
+++ b/ShellPkg/Application/Shell/Shell.h
@@ -231,17 +231,14 @@ ProcessCommandLine(
@param[in] ImagePath The path to the image for shell. The first place to look for the startup script.
@param[in] FilePath The path to the file for shell. The second place to look for the startup script.
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
- Invalid when this function returns an error.
@retval EFI_SUCCESS The variable is initialized.
**/
EFI_STATUS
EFIAPI
DoStartupScript(
- IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT SHELL_STATUS *ExitStatus
+ IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
);
/**
@@ -286,8 +283,7 @@ AddLineToCommandHistory(
This will determine if the command line represents an internal shell command or dispatch an external application.
- @param[in] CmdLine the command line to parse
- @param[out] ExitStatus The exit status of the command. Ignored if NULL.
+ @param[in] CmdLine the command line to parse
@retval EFI_SUCCESS the command was completed
@retval EFI_ABORTED the command's operation was aborted
@@ -295,8 +291,7 @@ AddLineToCommandHistory(
EFI_STATUS
EFIAPI
RunCommand(
- IN CONST CHAR16 *CmdLine,
- OUT SHELL_STATUS *ExitStatus
+ IN CONST CHAR16 *CmdLine
);
/**
@@ -320,17 +315,13 @@ IsValidCommandName(
@param[in] Handle The handle to the already opened file.
@param[in] Name The name of the script file.
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
- Invalid when this function returns an error.
-
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFileHandle (
- IN SHELL_FILE_HANDLE Handle,
- IN CONST CHAR16 *Name,
- OUT SHELL_STATUS *ExitStatus
+ IN SHELL_FILE_HANDLE Handle,
+ IN CONST CHAR16 *Name
);
/**
@@ -341,20 +332,17 @@ RunScriptFileHandle (
@param[in] CmdLine the command line to run.
@param[in] ParamProtocol the shell parameters protocol pointer
- @param[out] ExitStatus The exit code of the script. Ignored if NULL.
- Invalid when this function returns an error.
-
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFile (
- IN CONST CHAR16 *ScriptPath,
- IN SHELL_FILE_HANDLE Handle OPTIONAL,
- IN CONST CHAR16 *CmdLine,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
- OUT SHELL_STATUS *ExitStatus
+ IN CONST CHAR16 *ScriptPath,
+ IN SHELL_FILE_HANDLE Handle OPTIONAL,
+ IN CONST CHAR16 *CmdLine,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
);
+
#endif //_SHELL_INTERNAL_HEADER_
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index 11f5d481f9..b0303962ff 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -1401,8 +1401,6 @@ EfiShellEnablePageBreak (
is NULL, then the current shell environment is used.
@param[out] StartImageStatus Returned status from gBS->StartImage.
- @param[out] ExitDataSize ExitDataSize as returned from gBS->StartImage
- @param[out] ExitData ExitData as returned from gBS->StartImage
@retval EFI_SUCCESS The command executed successfully. The status code
returned by the command is pointed to by StatusCode.
@@ -1417,9 +1415,7 @@ InternalShellExecuteDevicePath(
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST CHAR16 *CommandLine OPTIONAL,
IN CONST CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StartImageStatus OPTIONAL,
- OUT UINTN *ExitDataSize OPTIONAL,
- OUT CHAR16 **ExitData OPTIONAL
+ OUT EFI_STATUS *StartImageStatus OPTIONAL
)
{
EFI_STATUS Status;
@@ -1429,21 +1425,11 @@ InternalShellExecuteDevicePath(
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
LIST_ENTRY OrigEnvs;
EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol;
- UINTN InternalExitDataSize;
- UINTN *ExitDataSizePtr;
CHAR16 *ImagePath;
UINTN Index;
CHAR16 *Walker;
CHAR16 *NewCmdLine;
- // ExitDataSize is not OPTIONAL for gBS->BootServices, provide somewhere for
- // it to be dumped if the caller doesn't want it.
- if (ExitData == NULL) {
- ExitDataSizePtr = &InternalExitDataSize;
- } else {
- ExitDataSizePtr = ExitDataSize;
- }
-
if (ParentImageHandle == NULL) {
return (EFI_INVALID_PARAMETER);
}
@@ -1547,13 +1533,13 @@ InternalShellExecuteDevicePath(
///@todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)
//
- // now start the image, passing up exit data if the caller requested it
+ // now start the image and if the caller wanted the return code pass it to them...
//
if (!EFI_ERROR(Status)) {
StartStatus = gBS->StartImage(
NewHandle,
- ExitDataSizePtr,
- ExitData
+ 0,
+ NULL
);
if (StartImageStatus != NULL) {
*StartImageStatus = StartStatus;
@@ -1642,8 +1628,6 @@ EfiShellExecute(
CHAR16 *Temp;
EFI_DEVICE_PATH_PROTOCOL *DevPath;
UINTN Size;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
if ((PcdGet8(PcdShellSupportLevel) < 1)) {
return (EFI_UNSUPPORTED);
@@ -1671,32 +1655,7 @@ EfiShellExecute(
DevPath,
Temp,
(CONST CHAR16**)Environment,
- StatusCode,
- &ExitDataSize,
- &ExitData);
-
- if (Status == EFI_ABORTED) {
- // If the command exited with an error, the shell should put the exit
- // status in ExitData, preceded by a null-terminated string.
- ASSERT (ExitDataSize == StrSize (ExitData) + sizeof (SHELL_STATUS));
-
- if (StatusCode != NULL) {
- // Skip the null-terminated string
- ExitData += StrLen (ExitData) + 1;
-
- // Use CopyMem to avoid alignment faults
- CopyMem (StatusCode, ExitData, sizeof (SHELL_STATUS));
-
- // Convert from SHELL_STATUS to EFI_STATUS
- // EFI_STATUSes have top bit set when they are errors.
- // (See UEFI Spec Appendix D)
- if (*StatusCode != SHELL_SUCCESS) {
- *StatusCode = (EFI_STATUS) *StatusCode | MAX_BIT;
- }
- }
- FreePool (ExitData);
- Status = EFI_SUCCESS;
- }
+ StatusCode);
//
// de-allocate and return
diff --git a/ShellPkg/Application/Shell/ShellProtocol.h b/ShellPkg/Application/Shell/ShellProtocol.h
index 16e3718e61..023ec12789 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.h
+++ b/ShellPkg/Application/Shell/ShellProtocol.h
@@ -445,8 +445,6 @@ EfiShellEnablePageBreak (
environment variable name and y is the value. If this
is NULL, then the current shell environment is used.
@param[out] StartImageStatus Returned status from gBS->StartImage.
- @param[out] ExitDataSize ExitDataSize as returned from gBS->StartImage
- @param[out] ExitData ExitData as returned from gBS->StartImage
@retval EFI_SUCCESS The command executed successfully. The status code
returned by the command is pointed to by StatusCode.
@@ -461,9 +459,7 @@ InternalShellExecuteDevicePath(
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST CHAR16 *CommandLine OPTIONAL,
IN CONST CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StartImageStatus OPTIONAL,
- OUT UINTN *ExitDataSize OPTIONAL,
- OUT CHAR16 **ExitData OPTIONAL
+ OUT EFI_STATUS *StartImageStatus OPTIONAL
);
/**