summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell/ShellParametersProtocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Application/Shell/ShellParametersProtocol.c')
-rw-r--r--ShellPkg/Application/Shell/ShellParametersProtocol.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index b6598c0cf..ab435a126 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)) {
@@ -1163,8 +1193,15 @@ UpdateStdInStdOutStdErr(
CalculateEfiHdrCrc(&gST->Hdr);
if (gST->ConIn == NULL ||gST->ConOut == NULL) {
- return (EFI_OUT_OF_RESOURCES);
+ Status = EFI_OUT_OF_RESOURCES;
}
+
+ if (Status == EFI_NOT_FOUND) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_REDUNDA_REDIR), ShellInfoObject.HiiHandle);
+ } else if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle);
+ }
+
return (Status);
}