Patch for ReadFile with NULL hEvent
Scott W Gifford
gifford at umich.edu
Sat May 15 23:54:44 CDT 2004
According to MSDN, the hEvent member of an OVERLAPPED structure can be
NULL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/overlapped_str.asp
OVERLAPPED
...
Members
...
hEvent
Handle to an event set to the signaled state when the operation
has been completed. The calling process must set this member
either to zero or a valid event handle before calling any
overlapped functions.
A program I'm trying to run takes advantage of this, and as a result
triggered a lot of these errors from Wine:
err:file:GetOverlappedResult lpOverlapped->hEvent was null
I wrote a patch that solves this, although it may not be the best
solution.
If when ReadFile is called overlapped->hEvent is NULL, the patch
generates a new event with CreateEventA and sets the structure member
to that event. To create a unique name, it uses the hex address of
the overlapped structure along with a fairly long string, which is
pretty likely to be unique.
This works for the application I'm running. If this seems like a good
enough solution, I can easily modify the other functions which
initiate an overlapped read to do the same.
----ScottG.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-readfile-nullhevent.patch
Type: text/x-patch
Size: 1256 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20040516/6cd8aeda/wine-readfile-nullhevent.bin
More information about the wine-devel
mailing list