mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
8da53ddd3b
commit
49bb76ff71
|
@ -3,7 +3,7 @@
|
||||||
manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
|
manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
|
||||||
|
|
||||||
Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -567,6 +567,28 @@ FixVarName (
|
||||||
return (FixFileName(Copy));
|
return (FixFileName(Copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
|
||||||
structure by parsing NewCommandLine. The current values are returned to the
|
structure by parsing NewCommandLine. The current values are returned to the
|
||||||
|
@ -1148,7 +1170,15 @@ UpdateStdInStdOutStdErr(
|
||||||
&TempHandle,
|
&TempHandle,
|
||||||
EFI_FILE_MODE_READ,
|
EFI_FILE_MODE_READ,
|
||||||
0);
|
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);
|
TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
|
|
Loading…
Reference in New Issue