mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 08:51:29 +00:00
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:
parent
2d8cd02bb5
commit
ee2e05e18d
|
@ -148,11 +148,22 @@ ReadFile(IN HANDLE hFile,
|
||||||
|
|
||||||
if (IsConsoleHandle(hFile))
|
if (IsConsoleHandle(hFile))
|
||||||
{
|
{
|
||||||
return ReadConsoleA(hFile,
|
if (ReadConsoleA(hFile,
|
||||||
lpBuffer,
|
lpBuffer,
|
||||||
nNumberOfBytesToRead,
|
nNumberOfBytesToRead,
|
||||||
lpNumberOfBytesRead,
|
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)
|
if (lpOverlapped != NULL)
|
||||||
|
|
Loading…
Reference in a new issue