ReadFile and WriteFile in overlapped mode

Martin Wilck Martin.Wilck at
Fri Apr 5 02:21:04 CST 2002

On Fri, 5 Apr 2002, Tony Bryant wrote:

> I fixed this a while ago, but never finished submitting the patch. The
> problem is that wine uses async callbacks to signal the event in the
> overlapped structure, which is a problem, because async callbacks can only
> happen when WaitOnSingleObjectEx specifically allows them.

This is not correct. The async IO requests are system APCs which are
called if the wait status is SELECT_INTERRUPTIBLE, which is always the
case with WaitForMultipleObjectsEx() and related functions (see
server/thread.c and scheduler/synchro.c).

Only the "Completion function" for ReadFileEx() and friends needs
an alertable wait, which is perfectly in accord with the MS specs.

> The solution is to
> have the wine directly trigger the event without going through the async
> callback system.

I think the current code does things right.

If you look at the MSDN specs for GetOverlappedResult(), it says clearly
that you can only rely on event notification if the function that
created the request (e.g. ReadFile() returned FALSE with error code
ERROR_IO_PENDING. The current implemengtation does set the event when
the async IO is finished, and no sooner.


Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at
D-33106 Paderborn 

More information about the wine-devel mailing list