From a956086e1892f7ac44e1f42975dfd1f9cbc9b253 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Tue, 16 Feb 2010 09:08:46 +0100 Subject: [PATCH] winmm: dwBytesRecorded controls how much is played, not dwBufferLength. --- dlls/winmm/winmm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index d201d128904..46a3c068007 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -1530,9 +1530,9 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI */ lpMidiHdr = (LPMIDIHDR)msg->lParam; lpData = (LPBYTE)lpMidiHdr->lpData; - TRACE("Adding %s lpMidiHdr=%p [lpData=0x%p dwBufferLength=%u/%u dwFlags=0x%08x size=%lu]\n", + TRACE("Adding %s lpMidiHdr=%p [lpData=0x%p dwBytesRecorded=%u/%u dwFlags=0x%08x size=%lu]\n", (lpMidiHdr->dwFlags & MHDR_ISSTRM) ? "stream" : "regular", lpMidiHdr, - lpMidiHdr, lpMidiHdr->dwBufferLength, lpMidiHdr->dwBytesRecorded, + lpMidiHdr, lpMidiHdr->dwBytesRecorded, lpMidiHdr->dwBufferLength, lpMidiHdr->dwFlags, msg->wParam); #if 0 /* dumps content of lpMidiHdr->lpData @@ -1686,7 +1686,7 @@ static DWORD CALLBACK MMSYSTEM_MidiStream_Player(LPVOID pmt) lpMidiHdr->dwOffset += sizeof(MIDIEVENT) - sizeof(me->dwParms); if (me->dwEvent & MEVT_F_LONG) lpMidiHdr->dwOffset += (MEVT_EVENTPARM(me->dwEvent) + 3) & ~3; - if (lpMidiHdr->dwOffset >= lpMidiHdr->dwBufferLength) { + if (lpMidiHdr->dwOffset >= lpMidiHdr->dwBytesRecorded) { /* done with this header */ lpMidiHdr->dwFlags |= MHDR_DONE; lpMidiHdr->dwFlags &= ~MHDR_INQUEUE; @@ -1817,8 +1817,11 @@ MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr, TRACE("(%p, %p, %u)!\n", hMidiStrm, lpMidiHdr, cbMidiHdr); - if (cbMidiHdr < sizeof(MIDIHDR) || !lpMidiHdr || !lpMidiHdr->lpData) + if (cbMidiHdr < sizeof(MIDIHDR) || !lpMidiHdr || !lpMidiHdr->lpData + || lpMidiHdr->dwBufferLength < lpMidiHdr->dwBytesRecorded) return MMSYSERR_INVALPARAM; + /* FIXME: Native additionaly checks if the MIDIEVENTs in lpData + * exactly fit dwBytesRecorded. */ if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED; -- 2.11.4.GIT