[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    console input problem
From:       Ove Kaaven <ovehk () ping ! uio ! no>
Date:       2000-01-30 12:16:48
[Download RAW message or body]

Anyone care to tell me why this loop doesn't detect user input from the
Win32 console xterm (win32 complex_console), before I press ctrl-c in the
terminal I started wine from, to abort wine? (when I do press ctrl-c, some
traces are printed, stating that first it detected and dispatched
(DOSVM_ProcessConsole calls ReadConsoleInputA and dispatches it to int09
as necessary) the pending user input, then a return from WaitForInputIdle
and a GetMessageA call is printed in relay, then wine quits)

Everything else works fine, the DOS install app I'm running, with
full-screen output etc, is shown fine inside that Win32 console xterm, so
it's probably not a case of this loop not running at all or something like
that...

This is called as DOSVM_Wait(lpDosTask->read_pipe, lpDosTask->hReadPipe);

void DOSVM_Wait( int read_pipe, HANDLE hObject )
{
  LPDOSTASK lpDosTask = MZ_Current();
  MSG msg;
  DWORD waitret;
  HANDLE objs[2];
  int objc;
  BOOL got_msg = FALSE;

  objs[0]=GetStdHandle(STD_INPUT_HANDLE);
  objs[1]=hObject;
  objc=hObject?2:1;
  do {
    /* check for messages (waste time before the response check below) */
    while (PeekMessageA(&msg,0,0,0,PM_REMOVE|PM_NOYIELD)) {
      /* got a message */
      DOSVM_ProcessMessage(lpDosTask,&msg);
      /* we don't need a TranslateMessage here */
      DispatchMessageA(&msg);
      got_msg = TRUE;
    }
    if (!got_msg) {
      /* check for console input */
      INPUT_RECORD msg;
      DWORD num;
      if (PeekConsoleInputA(objs[0],&msg,1,&num) && num) {
        DOSVM_ProcessConsole(lpDosTask);
      }
    }
    if (read_pipe == -1) {
      if (got_msg) break;
    } else {
      fd_set readfds;
      struct timeval timeout={0,0};
      /* quick check for response from dosmod
       * (faster than doing the full blocking wait, if data already available) */
      FD_ZERO(&readfds); FD_SET(read_pipe,&readfds);
      if (select(read_pipe+1,&readfds,NULL,NULL,&timeout)>0)
        break;
    }
    /* nothing yet, block while waiting for something to do */
    waitret=MsgWaitForMultipleObjects(objc,objs,FALSE,INFINITE,QS_ALLINPUT);
    if (waitret==(DWORD)-1) {
      ERR_(module)("dosvm wait error=%ld\n",GetLastError());
    }
    if ((read_pipe != -1) && hObject) {
      if (waitret==(WAIT_OBJECT_0+1)) break;
    }
    if (waitret==WAIT_OBJECT_0) {
      DOSVM_ProcessConsole(lpDosTask);
    }
  } while (TRUE);
}

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic