audk/ShellPkg/Include/Library
jaben carsey 9ed21946c7 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-09 13:22:14 -08:00
..
BcfgCommandLib.h ShellPkg: Add a new library for "bcfg" command 2014-09-10 20:30:38 +00:00
HandleParsingLib.h ShellPkg/HandleParsingLib: Caller should free memory from 2 functions 2015-04-23 20:27:53 +00:00
ShellCEntryLib.h add comments to function declarations and definitions and updated to match coding style document. 2011-04-05 20:55:45 +00:00
ShellCommandLib.h ShellPkg: elevate DumpHex() from Debug1-internal to generic-internal 2016-01-21 18:40:40 +00:00
ShellLib.h ShellPkg: Fix ASCII and UNICODE file pipes. 2016-02-09 13:22:14 -08:00