This patch fixes 2 problems -- 1) Overlapped I/O using ReadFile/WriteFile may never trigger Overlapped.hEvent The current wine is broken in this respect, because the notification event is set(i.e. triggered) in an wine supplied overlapped completion routine (i.e. like what ReadFileEx takes as its final parameter). This is broken because the completion routine is only ever called from when an alertable MsgWait function is running. However, there should be no need to run a alertable MsgWait function if we (as a windows programmer) aren't actally using ReadFileEx or WriteFileEx. This patch adds a "completion_event" member to the async_private structure. scheduler/synchro.c will fire this event when the async request is finished. This is of course in addition to the "completion_func" member (still) used for WriteFileEx/ReadFileEx calls. -- 2) Comms timeouts (set with SetCommsTimeouts) > 0x7FFFFFFF cause no wait to occurs (signed/unsigned SNAFU). -- ? patch.diff Index: files/file.c =================================================================== RCS file: /home/wine/wine/files/file.c,v retrieving revision 1.131 diff -r1.131 file.c 1359c1359,1360 < LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) --- > LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, > HANDLE hCompletionEvent) 1391a1393 > ovp->completion_event = hCompletionEvent; 1424,1429c1426 < return FILE_ReadFileEx(hFile,buffer,bytesToRead,overlapped,lpCompletionRoutine); < } < < static VOID CALLBACK FILE_OverlappedComplete(DWORD status, DWORD count, LPOVERLAPPED ov) < { < NtSetEvent(ov->hEvent,NULL); --- > return FILE_ReadFileEx(hFile,buffer,bytesToRead,overlapped,lpCompletionRoutine,(HANDLE)0L); 1442c1439,1441 < if(ReadFileEx(hFile, buffer, bytesToRead, &ov, FILE_OverlappedComplete)) --- > ov.Internal = STATUS_PENDING; > ov.InternalHigh = 0; > if(FILE_ReadFileEx(hFile, buffer, bytesToRead, &ov,NULL,ov.hEvent )) 1509c1508 < if(!FILE_ReadFileEx(hFile, buffer, bytesToRead, overlapped, FILE_OverlappedComplete)) --- > if(!FILE_ReadFileEx(hFile, buffer, bytesToRead, overlapped, NULL, overlapped->hEvent )) 1606c1605,1606 < LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) --- > LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, > HANDLE hCompletionEvent) 1639a1640 > ovp->completion_event = hCompletionEvent; 1670c1671 < return FILE_WriteFileEx(hFile, buffer, bytesToWrite, overlapped, lpCompletionRoutine); --- > return FILE_WriteFileEx(hFile, buffer, bytesToWrite, overlapped, lpCompletionRoutine, (HANDLE)0L); 1733c1734 < if(!FILE_WriteFileEx(hFile, buffer, bytesToWrite, overlapped, FILE_OverlappedComplete)) --- > if(!FILE_WriteFileEx(hFile, buffer, bytesToWrite, overlapped, NULL, overlapped->hEvent)) Index: include/file.h =================================================================== RCS file: /home/wine/wine/include/file.h,v retrieving revision 1.37 diff -r1.37 file.h 46a47 > HANDLE completion_event; Index: scheduler/synchro.c =================================================================== RCS file: /home/wine/wine/scheduler/synchro.c,v retrieving revision 1.40 diff -r1.40 synchro.c 20c20 < --- > #include <stdio.h> 57a58,63 > } > /* set ReadFile/WriteFile's overlapped completion event */ > if (ovp->completion_event) > { > NtSetEvent( ovp->completion_event, NULL ); > ovp->completion_event=NULL; Index: server/serial.c =================================================================== RCS file: /home/wine/wine/server/serial.c,v retrieving revision 1.17 diff -r1.17 serial.c 265a266,267 > if (timeout<0) > timeout=0x7FFFFFFF; 273a276,277 > if (timeout<0) > timeout=0x7FFFFFFF;