ReadFile: When reading from a console handle with processed input mode enabled, simulate EOF if the first character read is ^Z (Bug 4745)

svn path=/trunk/; revision=42345
This commit is contained in:
Jeffrey Morlan 2009-08-02 18:56:05 +00:00
parent 2d8cd02bb5
commit ee2e05e18d

View file

@ -148,11 +148,22 @@ ReadFile(IN HANDLE hFile,
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)