speed improvement for 16bit comm support

Reinhard Karcher rkarcher at frey.de
Mon Jan 1 10:45:06 CST 2007

Hello wine developers,

the attached patch fixes some issues I had with the 16 bit configuration
program for our SOHO PBX.

- The fix removes a delaying issue, as the mentioned application
  calls GetCommError16 twice per character received (via ReadComm16
  with a buffer size of 1), which causes a delay of 20 ms per
  character, as long as no further characters arrive. Because the
  (Visual Basic) application is so slow that it does not keep up with
  the PBX sending date, the one-line responses are received much more
  quickly than the program reads the characters from the buffer; during
  emptying the buffer no further characters arrive.
  I don't really get the point of sleeping at that point at all, but
  suppose it is a hack against busy-waiting. This hack can be safely
  disabled if characters are in the input buffer.

Michael Karcher

diff -ur ../wine-0.9.28/dlls/user32/comm16.c ../wine-0.9.28n/dlls/user32/comm16.c
--- ../wine-0.9.28/dlls/user32/comm16.c 2006-11-25 12:00:23.000000000 +0100
+++ ../wine-0.9.28n/dlls/user32/comm16.c        2006-12-28 19:25:45.000000000 +0100
@@ -722,7 +722,8 @@
        if (lpStat) {
                lpStat->status = 0;

-               SleepEx(1,TRUE);
+               if (comm_inbuf(ptr) == 0)
+                       SleepEx(1,TRUE);

                lpStat->cbOutQue = comm_outbuf(ptr);
                lpStat->cbInQue = comm_inbuf(ptr);

More information about the wine-patches mailing list