mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:50:37 +00:00
kernel32: Properly manage ctrl-Z (and ctrl-D) in ReadFile when dealing with a console handle.
This commit is contained in:
parent
9c577630d1
commit
ead4712606
|
@ -406,7 +406,23 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
|
|||
if (!bytesToRead) return TRUE;
|
||||
|
||||
if (is_console_handle(hFile))
|
||||
return ReadConsoleA(hFile, buffer, bytesToRead, bytesRead, NULL);
|
||||
{
|
||||
DWORD conread, mode;
|
||||
if (!ReadConsoleA(hFile, buffer, bytesToRead, &conread, NULL) ||
|
||||
!GetConsoleMode(hFile, &mode))
|
||||
return FALSE;
|
||||
/* ctrl-Z (26) means end of file on window (if at beginning of buffer)
|
||||
* but Unix uses ctrl-D (4), and ctrl-Z is a bad idea on Unix :-/
|
||||
* So map both ctrl-D ctrl-Z to EOF.
|
||||
*/
|
||||
if ((mode & ENABLE_PROCESSED_INPUT) && conread > 0 &&
|
||||
(((char*)buffer)[0] == 26 || ((char*)buffer)[0] == 4))
|
||||
{
|
||||
conread = 0;
|
||||
}
|
||||
if (bytesRead) *bytesRead = conread;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (overlapped != NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue