diff options
author | Jaben Carsey <jaben.carsey@intel.com> | 2014-01-13 18:52:48 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-01-13 18:52:48 +0000 |
commit | 49bb76ff717a8a02e23ef0585b142e5117fbaee1 (patch) | |
tree | 033ce10d1241295a84bf9120d1577f2a1b48bc8d | |
parent | 8da53ddd3b8a7e670fb1bdabe134f0ce7fc451a3 (diff) | |
download | edk2-platforms-49bb76ff717a8a02e23ef0585b142e5117fbaee1.tar.xz |
ShellPkg: Remove UNICODE file tag (FEFF) from files used for input redirection
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15109 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | ShellPkg/Application/Shell/ShellParametersProtocol.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c index 9b385bee15..ab435a1263 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -3,7 +3,7 @@ manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -568,6 +568,28 @@ FixVarName ( }
/**
+ Remove the unicode file tag from the begining of the file buffer since that will not be
+ used by StdIn.
+**/
+EFI_STATUS
+EFIAPI
+RemoveFileTag(
+ IN SHELL_FILE_HANDLE *Handle
+ )
+{
+ UINTN CharSize;
+ CHAR16 CharBuffer;
+
+ CharSize = sizeof(CHAR16);
+ CharBuffer = 0;
+ gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
+ if (CharBuffer != gUnicodeFileTag) {
+ gEfiShellProtocol->SetFilePosition(*Handle, 0);
+ }
+ return (EFI_SUCCESS);
+}
+
+/**
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
structure by parsing NewCommandLine. The current values are returned to the
user.
@@ -1148,7 +1170,15 @@ UpdateStdInStdOutStdErr( &TempHandle,
EFI_FILE_MODE_READ,
0);
- if (!InUnicode && !EFI_ERROR(Status)) {
+ if (InUnicode) {
+ //
+ // Chop off the 0xFEFF if it's there...
+ //
+ RemoveFileTag(&TempHandle);
+ } else if (!EFI_ERROR(Status)) {
+ //
+ // Create the ASCII->Unicode conversion layer
+ //
TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
}
if (!EFI_ERROR(Status)) {
|