Alexandre Julliard : winedos: Only read input from the stdin handle if it is a console.
Alexandre Julliard
julliard at winehq.org
Wed May 7 13:28:09 CDT 2008
Module: wine
Branch: master
Commit: 279acf6a8aa16f84ab58dd15e9077cbc38de642c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=279acf6a8aa16f84ab58dd15e9077cbc38de642c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed May 7 17:32:23 2008 +0200
winedos: Only read input from the stdin handle if it is a console.
---
dlls/winedos/dosvm.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/winedos/dosvm.c b/dlls/winedos/dosvm.c
index 27dc3b7..7defba1 100644
--- a/dlls/winedos/dosvm.c
+++ b/dlls/winedos/dosvm.c
@@ -464,19 +464,18 @@ void WINAPI DOSVM_Wait( CONTEXT86 *waitctx )
DWORD WINAPI DOSVM_Loop( HANDLE hThread )
{
HANDLE objs[2];
+ int count = 0;
MSG msg;
DWORD waitret;
- objs[0] = GetStdHandle(STD_INPUT_HANDLE);
- objs[1] = hThread;
+ objs[count++] = hThread;
+ if (GetConsoleMode( GetStdHandle(STD_INPUT_HANDLE), NULL ))
+ objs[count++] = GetStdHandle(STD_INPUT_HANDLE);
for(;;) {
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) {
- DOSVM_ProcessConsole();
- }
- else if (waitret == WAIT_OBJECT_0 + 1) {
DWORD rv;
if(!GetExitCodeThread(hThread, &rv)) {
ERR("Failed to get thread exit code!\n");
@@ -484,7 +483,7 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread )
}
return rv;
}
- else if (waitret == WAIT_OBJECT_0 + 2) {
+ else if (waitret == WAIT_OBJECT_0 + count) {
while (PeekMessageA(&msg,0,0,0,PM_REMOVE)) {
if (msg.hwnd) {
/* it's a window message */
@@ -513,6 +512,10 @@ DWORD WINAPI DOSVM_Loop( HANDLE hThread )
}
}
}
+ else if (waitret == WAIT_OBJECT_0 + 1)
+ {
+ DOSVM_ProcessConsole();
+ }
else
{
ERR_(int)("MsgWaitForMultipleObjects returned unexpected value.\n");
More information about the wine-cvs
mailing list