[PATCH 3/5] winmm: MIDIHDR.dwOffset is set with MEVT_F_CALLBACK only.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Mon Feb 22 06:00:31 CST 2010


Hi,

Here's a case where win95/98/me/nt differ from 2k/xp/etc.
The w2k behaviour is safer, esp. in the presence of my next patch
which makes Wine accept the smaller MIDIHDR structure which does
not contain the dwOffset slot.  Now Wine behaves exactly like
w2k/xp/ etc. and will only write to MIDIHDR.dwOffset when presented
a MEVT_CALLBACK flag.
The tests in patch #5 demonstrate this behaviour.

At the same time, the change to the player loop prevents a buffer
overshoot and a (perhaps unlikely) program trace where a sequence
Suspend; Stop; midiStreamOut could send MOM_DONE twice and access
memory possibly released within a MOM_DONE DCB_FUNCTION callback.

The modified player loop, which is in fact 2 nested loops, may not
be the most beautiful piece of code if you dislike goto.  However,
since a rewrite using an outer for(;;) would still need one goto,
I left it this way, among other to prevent a change of indentation
of the existing code.

Regards,
	Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-winmm-MIDIHDR.dwOffset-is-set-with-MEVT_F_CALLBACK.patch
Type: application/octet-stream
Size: 4599 bytes
Desc: 0006-winmm-MIDIHDR.dwOffset-is-set-with-MEVT_F_CALLBACK.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100222/0e029716/attachment.obj>


More information about the wine-patches mailing list