diff options
Diffstat (limited to 'ShellPkg/Application/Shell')
-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)) {
|