Revision: 16127
          http://sourceforge.net/p/edk2/code/16127
Author:   niruiyu
Date:     2014-09-18 01:58:03 +0000 (Thu, 18 Sep 2014)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Carsey Jaben <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/15180

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/Shell.c
    trunk/edk2/ShellPkg/Application/Shell/Shell.h
    trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c
    trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.h

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c       2014-09-18 01:21:01 UTC 
(rev 16126)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c       2014-09-18 01:58:03 UTC 
(rev 16127)
@@ -244,9 +244,6 @@
   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 @@
   // 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 @@
     // 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 @@
         //
         // 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 @@
           //
           Status = DoShellPrompt();
         } while (!ShellCommandGetExit());
-        ExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();
       }
       if (OldConIn != NULL && ConInHandle != NULL) {
         CloseSimpleTextInOnFile (gST->ConIn);
@@ -595,33 +581,10 @@
     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 @@
   @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 @@
       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 @@
   // 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 @@
       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 @@
   //
   if (!EFI_ERROR (Status)) {
     CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;
-    Status = RunCommand(CmdLine, NULL);
+    Status = RunCommand(CmdLine);
     }
 
   //
@@ -1526,9 +1474,6 @@
   @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 @@
 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 @@
   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 @@
   
ShellInfoObject.NewEfiShellProtocol->SetFilePosition(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn),
 0);
 
   if (!EFI_ERROR(Status)) {
-    Status = RunCommand(NextCommandLine, ExitStatus);
+    Status = RunCommand(NextCommandLine);
   }
 
   //
@@ -1901,9 +1845,7 @@
 /**
   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 @@
 EFI_STATUS
 EFIAPI
 ProcessNewSplitCommandLine(
-  IN CONST CHAR16       *CmdLine,
-  OUT      SHELL_STATUS *ExitStatus
+  IN CONST CHAR16 *CmdLine
   )
 {
   SPLIT_LIST                *Split;
@@ -1933,14 +1874,9 @@
   }
 
   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 @@
   @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 @@
 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 @@
       if (LastError) {
         SetLastError(CommandReturnedStatus);
       }
-      if (ExitStatus != NULL) {
-        *ExitStatus = CommandReturnedStatus;
-      }
 
       //
       // Pass thru the exitcode from the app.
@@ -2229,9 +2159,6 @@
   @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 @@
   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 @@
 
   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 @@
       }
       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 @@
             DevPath,
             CmdLine,
             NULL,
-            &StartStatus,
-            NULL,
-            NULL
+            &StartStatus
            );
 
           SHELL_FREE_NON_NULL(DevPath);
@@ -2359,10 +2272,6 @@
 
   SHELL_FREE_NON_NULL(CommandWithPath);
 
-  if (ExitStatus != NULL) {
-    *ExitStatus = CalleeExitStatus;
-  }
-
   return (Status);
 }
 
@@ -2374,20 +2283,16 @@
   @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 @@
   //
   if (!EFI_ERROR(Status)) {
     TrimSpaces(&CmdLine);
-    Status = RunCommandOrFile(
-              Type,
-              CmdLine,
-              FirstParameter,
-              ParamProtocol,
-              ExitStatus
-              );
+    Status = RunCommandOrFile(Type, CmdLine, FirstParameter, ParamProtocol);
   }
 
   //
@@ -2438,7 +2337,6 @@
   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 @@
 EFI_STATUS
 EFIAPI
 RunCommand(
-  IN CONST CHAR16         *CmdLine,
-  OUT      SHELL_STATUS   *ExitStatus
+  IN CONST CHAR16   *CmdLine
   )
 {
   EFI_STATUS                Status;
@@ -2507,7 +2404,7 @@
   // 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 @@
     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 @@
   @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 @@
   CONST CHAR16        *CurDir;
   UINTN               LineCount;
   CHAR16              LeString[50];
-  SHELL_STATUS        CalleeExitStatus;
 
   ASSERT(!ShellCommandGetScriptExit());
-  
-  CalleeExitStatus = SHELL_SUCCESS;
 
   PreScriptEchoState = ShellCommandGetEchoState();
 
@@ -2809,7 +2694,7 @@
             //
             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 @@
               }
               ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);
             }
-            Status = RunCommand(CommandLine3, NULL);
+            Status = RunCommand(CommandLine3);
           }
         }
 
@@ -2839,8 +2724,7 @@
           //
           // 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 @@
           break;
         }
         if (EFI_ERROR(Status)) {
-          CalleeExitStatus = (SHELL_STATUS) Status;
           break;
         }
         if (ShellCommandGetExit()) {
-          CalleeExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();
           break;
         }
       }
@@ -2888,11 +2770,6 @@
   if (ShellCommandGetCurrentScriptFile()==NULL) {
     ShellCommandSetEchoState(PreScriptEchoState);
   }
-
-  if (ExitStatus != NULL) {
-    *ExitStatus = CalleeExitStatus;
-  }
-
   return (EFI_SUCCESS);
 }
 
@@ -2904,18 +2781,15 @@
   @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 @@
         //
         // run it
         //
-        Status = RunScriptFileHandle(FileHandle, ScriptPath, ExitStatus);
+        Status = RunScriptFileHandle(FileHandle, ScriptPath);
 
         //
         // now close the file
@@ -2950,7 +2824,7 @@
         ShellCloseFile(&FileHandle);
       }
     } else {
-      Status = RunScriptFileHandle(Handle, ScriptPath, ExitStatus);
+      Status = RunScriptFileHandle(Handle, ScriptPath);
     }
   }
 

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.h
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.h       2014-09-18 01:21:01 UTC 
(rev 16126)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.h       2014-09-18 01:58:03 UTC 
(rev 16127)
@@ -231,17 +231,14 @@
 
   @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 @@
 
   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 @@
 EFI_STATUS
 EFIAPI
 RunCommand(
-  IN  CONST CHAR16         *CmdLine,
-  OUT       SHELL_STATUS   *ExitStatus
+  IN CONST CHAR16   *CmdLine
   );
 
 /**
@@ -320,17 +315,13 @@
   @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 @@
   @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_
 

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2014-09-18 
01:21:01 UTC (rev 16126)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2014-09-18 
01:58:03 UTC (rev 16127)
@@ -1401,8 +1401,6 @@
                                 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 @@
   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 @@
   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 @@
     ///@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 @@
   CHAR16                    *Temp;
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;
   UINTN                     Size;
-  UINTN                     ExitDataSize;
-  CHAR16                    *ExitData;
 
   if ((PcdGet8(PcdShellSupportLevel) < 1)) {
     return (EFI_UNSUPPORTED);
@@ -1671,33 +1655,8 @@
     DevPath,
     Temp,
     (CONST CHAR16**)Environment,
-    StatusCode,
-    &ExitDataSize,
-    &ExitData);
+    StatusCode);
 
-    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;
-    }
-
   //
   // de-allocate and return
   //

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.h
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.h       2014-09-18 
01:21:01 UTC (rev 16126)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.h       2014-09-18 
01:58:03 UTC (rev 16127)
@@ -445,8 +445,6 @@
                                 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 @@
   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
   );
 
 /**


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to