>From edd15d7d71e7309937c27dd9e6eab56bf42cc589 Mon Sep 17 00:00:00 2001 From: Johannes Kroll Date: Wed, 9 Jan 2013 02:40:34 +0100 Subject: terminate sysex messages --- dlls/winmm/winmm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index aecb9cf..1f8ea10 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -531,11 +531,27 @@ UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, MIDIHDR* lpMidiOutHdr, UINT uSize) { LPWINE_MLD wmld; + int i; TRACE("(%p, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; + + for(i= 0; idwBufferLength; i++) + { + /* SysEx messages are terminated by a 0xF7 byte. If the buffer contains additional bytes, send only the bytes up to the termination byte. */ + if((unsigned char)lpMidiOutHdr->lpData[i] == 0xF7 && i < lpMidiOutHdr->dwBufferLength-1) + { + DWORD oldBufferLength = lpMidiOutHdr->dwBufferLength; + DWORD ret; + lpMidiOutHdr->dwBufferLength = i+1; + ret = MMDRV_Message(wmld, MODM_LONGDATA, (DWORD_PTR)lpMidiOutHdr, uSize); + /* restore the midi header to its original state. */ + lpMidiOutHdr->dwBufferLength = oldBufferLength; + return ret; + } + } return MMDRV_Message(wmld, MODM_LONGDATA, (DWORD_PTR)lpMidiOutHdr, uSize); } -- 1.7.9.5