Author: jmorlan
Date: Sun Aug 2 20:56:05 2009
New Revision: 42345
URL:
http://svn.reactos.org/svn/reactos?rev=42345&view=rev
Log:
ReadFile: When reading from a console handle with processed input mode enabled, simulate
EOF if the first character read is ^Z (Bug 4745)
Modified:
trunk/reactos/dll/win32/kernel32/file/rw.c
Modified: trunk/reactos/dll/win32/kernel32/file/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/rw…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/rw.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/rw.c [iso-8859-1] Sun Aug 2 20:56:05 2009
@@ -148,11 +148,22 @@
if (IsConsoleHandle(hFile))
{
- return ReadConsoleA(hFile,
+ if (ReadConsoleA(hFile,
lpBuffer,
nNumberOfBytesToRead,
lpNumberOfBytesRead,
- NULL);
+ NULL))
+ {
+ DWORD dwMode;
+ GetConsoleMode(hFile, &dwMode);
+ if ((dwMode & ENABLE_PROCESSED_INPUT) && *(char *)lpBuffer ==
0x1a)
+ {
+ /* EOF character entered; simulate end-of-file */
+ *lpNumberOfBytesRead = 0;
+ }
+ return TRUE;
+ }
+ return FALSE;
}
if (lpOverlapped != NULL)