]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellParametersProtocol.c
ShellPkg: Fixes the shell so output redirection works for the 'mode' command
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellParametersProtocol.c
index 9ce7e92605fbf7f469271212269bd16f86629fae..3564e066600fc77ba5c2e641101da61d1678f623 100644 (file)
@@ -2,7 +2,8 @@
   Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation,\r
   manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -13,8 +14,7 @@
 \r
 **/\r
 \r
-#include "ShellParametersProtocol.h"\r
-#include "ConsoleWrappers.h"\r
+#include "Shell.h"\r
 \r
 /**\r
   return the next parameter from a command line string;\r
@@ -291,10 +291,10 @@ CreatePopulateInstallShellParametersProtocol (
   //\r
   // Build the full command line\r
   //\r
-  Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, &FullCommandLine);\r
+  Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine);\r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
     FullCommandLine = AllocateZeroPool(Size + LoadedImage->LoadOptionsSize);\r
-    Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, &FullCommandLine);\r
+    Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine);\r
   }\r
   if (Status == EFI_NOT_FOUND) {\r
     //\r
@@ -314,9 +314,7 @@ CreatePopulateInstallShellParametersProtocol (
     FullCommandLine = AllocateZeroPool(Size);\r
   }\r
   if (FullCommandLine != NULL) {\r
-    if (LoadedImage->LoadOptionsSize != 0){\r
-      StrCpy(FullCommandLine, LoadedImage->LoadOptions);\r
-    }\r
+    CopyMem (FullCommandLine, LoadedImage->LoadOptions, LoadedImage->LoadOptionsSize);\r
     //\r
     // Populate Argc and Argv\r
     //\r
@@ -1011,7 +1009,7 @@ UpdateStdInStdOutStdErr(
         }\r
         if (!EFI_ERROR(Status)) {\r
           ShellParameters->StdErr = TempHandle;\r
-          gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle);\r
+          gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr);\r
         }\r
       }\r
 \r
@@ -1054,7 +1052,7 @@ UpdateStdInStdOutStdErr(
           }\r
           if (!EFI_ERROR(Status)) {\r
             ShellParameters->StdOut = TempHandle;\r
-            gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle);\r
+            gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut);\r
           }\r
         }\r
       }\r
@@ -1072,7 +1070,7 @@ UpdateStdInStdOutStdErr(
         TempHandle = CreateFileInterfaceEnv(StdOutVarName);\r
         ASSERT(TempHandle != NULL);\r
         ShellParameters->StdOut = TempHandle;\r
-        gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle);\r
+        gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut);\r
       }\r
 \r
       //\r
@@ -1088,7 +1086,7 @@ UpdateStdInStdOutStdErr(
         TempHandle = CreateFileInterfaceEnv(StdErrVarName);\r
         ASSERT(TempHandle != NULL);\r
         ShellParameters->StdErr = TempHandle;\r
-        gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle);\r
+        gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr);\r
       }\r
 \r
       //\r