[PATCH 3/3] mmsystem: Always use CALLBACK_FUNCTION to update MIDI/WAVEHDR.dwFlags.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Wed Feb 27 07:46:02 CST 2013


Some apps may open winmm without any callback as they intend to
poll the whdr flags to know when a packet is ready.
The problem is, 16bit whdr are only updated by the thunk callbacks
(andupon return from (Un)Prepare and Write/AddBuffer).

Hmm, don't we have a race condition? the 16bit whdr may be updated
concurrently by an unsuccessful call to waveOutWrite as well as a DONE callback.
This does not happen to 32bit code, since waveOutWrite would be rejected by
STILLPLAYING without touching the flags! But in 16bit code ... boom!

The code could be simplified further in the WAVE_OPEN_QUERY case, as
I recently showed that there's no notification in that case (nor writing to the handle),
so thunk creation is superfluous. Any volunteer?

 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-mmsystem-Always-use-CALLBACK_FUNCTION-to-update-MID.patch
Type: application/octet-stream
Size: 4295 bytes
Desc: 0003-mmsystem-Always-use-CALLBACK_FUNCTION-to-update-MID.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130227/7b2a51a6/attachment.obj>

More information about the wine-patches mailing list