audk/ShellPkg/Library
jaben carsey d2a0d2e6ac ShellPkg: Fix ASCII and UNICODE file pipes.
Fix various errors when piping a UNICODE or ASCII file to a simple shell application that reads standard input and writes it to standard output.

1) When the memory file is created by CreateFileInferfaceMem() to capture the pipe output, no UNICODE BOM is written to the memory file. Later, when the memory file is read by the application using ShellFileHandleReadLine(), the function indicates that the file is ASCII because there is no BOM.

2) If the file is piped as ASCII, the ASCII memory image is not correctly created by FileInterfaceMemWrite() as each ASCII character is followed by '\0' in the image (when the ASCII data is written to the memory image, the file position should only be incremented by half the buffer size).

3) ShellFileHandleReadLine() does not read ASCII files correctly (writes to Buffer need to be cast as CHAR8*).

4) FileInterfaceMemRead() and FileInterfaceMemWrite() as somewhat hard to read and difficult to debug with certain tools due to the typecasting of This. Added a local variable (MemFile) of the correct type to these functions and used it instead of This.

Enhancement: ShellFileHandleReadLine() now returns EFI_END_OF_FILE when appropriate.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2016-02-08 15:59:04 -08:00
..
UefiDpLib ShellPkg UefiDpLib: Use Image->FilePath to get name for SMM drivers 2016-01-19 09:19:37 +00:00
UefiHandleParsingLib ShellPkg: Update 'dh' command to reflect correct driver handle information 2016-01-15 17:05:18 +00:00
UefiShellBcfgCommandLib ShellPkg: Refine the code to avoid use a constant number as offset. 2016-01-26 08:17:19 +00:00
UefiShellCEntryLib ShellPkg: Refine the fomat in INF/DEC files to follow spec. 2015-01-22 01:44:11 +00:00
UefiShellCommandLib ShellPkg: elevate DumpHex() from Debug1-internal to generic-internal 2016-01-21 18:40:40 +00:00
UefiShellDebug1CommandsLib ShellPkg: elevate DumpHex() from Debug1-internal to generic-internal 2016-01-21 18:40:40 +00:00
UefiShellDriver1CommandsLib ShellPkg: Convert all .uni files to utf-8 2015-12-09 23:07:58 +00:00
UefiShellInstall1CommandsLib Revert "ShellPkg : Add UEFI_APPLICATION module type to UefiShellInstall1CommandsLib.inf" 2016-01-06 16:23:20 +00:00
UefiShellLevel1CommandsLib ShellPkg: Convert all .uni files to utf-8 2015-12-09 23:07:58 +00:00
UefiShellLevel2CommandsLib ShellPkg: Clean-up 'map' command error message handling 2016-01-07 22:01:28 +00:00
UefiShellLevel3CommandsLib ShellPkg: Make 'alias' can display a single alias name. 2016-01-06 07:43:58 +00:00
UefiShellLib ShellPkg: Fix ASCII and UNICODE file pipes. 2016-02-08 15:59:04 -08:00
UefiShellNetwork1CommandsLib ShellPkg: Fix ifconfig hang issue with incomplete parameters 2015-12-10 10:59:29 +00:00
UefiShellTftpCommandLib ShellPkg: Convert all .uni files to utf-8 2015-12-09 23:07:58 +00:00