ShellPkg: Ensure UEFI apps open the correct StdOut

When an app opens StdOut for writing, ensure it opens the correct StdOut
(whatever was set up for the app in the NewShellParametersProtocol).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dai...@dell.com>
---
 ShellPkg/Application/Shell/ShellProtocol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Application/Shell/ShellProtocol.c 
b/ShellPkg/Application/Shell/ShellProtocol.c
index 22d3987..20a3423 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -2,6 +2,7 @@
   Member functions of EFI_SHELL_PROTOCOL and functions for creation,
   manipulation, and initialization of EFI_SHELL_PROTOCOL.
 
+  Copyright 2016 Dell Inc.
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
   Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
@@ -1268,12 +1269,12 @@ EfiShellOpenFileByName(
   //
   if (StrCmp(FileName, L">o") == 0) {
     //
-    // make sure not writing to StdIn
+    // make sure not reading from StdOut
     //
     if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
       return (EFI_INVALID_PARAMETER);
     }
-    *FileHandle = &FileInterfaceStdOut;
+    *FileHandle = ShellInfoObject.NewShellParametersProtocol->StdOut;
     return (EFI_SUCCESS);
   }
 
@@ -1290,7 +1291,7 @@ EfiShellOpenFileByName(
   //
   if (StrCmp(FileName, L">e") == 0) {
     //
-    // make sure not writing to StdIn
+    // make sure not reading from StdErr
     //
     if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
       return (EFI_INVALID_PARAMETER);
-- 
2.7.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to