Commit 279acf6a authored by Alexandre Julliard's avatar Alexandre Julliard

winedos: Only read input from the stdin handle if it is a console.

parent 267d38e1
...@@ -464,19 +464,18 @@ void WINAPI DOSVM_Wait( CONTEXT86 *waitctx ) ...@@ -464,19 +464,18 @@ void WINAPI DOSVM_Wait( CONTEXT86 *waitctx )
DWORD WINAPI DOSVM_Loop( HANDLE hThread ) DWORD WINAPI DOSVM_Loop( HANDLE hThread )
{ {
HANDLE objs[2]; HANDLE objs[2];
int count = 0;
MSG msg; MSG msg;
DWORD waitret; DWORD waitret;
objs[0] = GetStdHandle(STD_INPUT_HANDLE); objs[count++] = hThread;
objs[1] = hThread; if (GetConsoleMode( GetStdHandle(STD_INPUT_HANDLE), NULL ))
objs[count++] = GetStdHandle(STD_INPUT_HANDLE);
for(;;) { for(;;) {
TRACE_(int)("waiting for action\n"); TRACE_(int)("waiting for action\n");
waitret = MsgWaitForMultipleObjects(2, objs, FALSE, INFINITE, QS_ALLINPUT); waitret = MsgWaitForMultipleObjects(count, objs, FALSE, INFINITE, QS_ALLINPUT);
if (waitret == WAIT_OBJECT_0) { if (waitret == WAIT_OBJECT_0) {
DOSVM_ProcessConsole();
}
else if (waitret == WAIT_OBJECT_0 + 1) {
DWORD rv; DWORD rv;
if(!GetExitCodeThread(hThread, &rv)) { if(!GetExitCodeThread(hThread, &rv)) {
ERR("Failed to get thread exit code!\n"); ERR("Failed to get thread exit code!\n");
...@@ -484,7 +483,7 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread ) ...@@ -484,7 +483,7 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread )
} }
return rv; return rv;
} }
else if (waitret == WAIT_OBJECT_0 + 2) { else if (waitret == WAIT_OBJECT_0 + count) {
while (PeekMessageA(&msg,0,0,0,PM_REMOVE)) { while (PeekMessageA(&msg,0,0,0,PM_REMOVE)) {
if (msg.hwnd) { if (msg.hwnd) {
/* it's a window message */ /* it's a window message */
...@@ -513,6 +512,10 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread ) ...@@ -513,6 +512,10 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread )
} }
} }
} }
else if (waitret == WAIT_OBJECT_0 + 1)
{
DOSVM_ProcessConsole();
}
else else
{ {
ERR_(int)("MsgWaitForMultipleObjects returned unexpected value.\n"); ERR_(int)("MsgWaitForMultipleObjects returned unexpected value.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment