Commit c89853eb authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

winmm: More MIDI boundary tests & fixes.

parent a311dff7
......@@ -911,6 +911,13 @@ UINT WINAPI midiOutOpen(LPHMIDIOUT lphMidiOut, UINT uDeviceID,
if (lphMidiOut != NULL) *lphMidiOut = 0;
switch (dwFlags & CALLBACK_TYPEMASK) {
case CALLBACK_WINDOW:
if (dwCallback && !IsWindow((HWND)dwCallback))
return MMSYSERR_INVALPARAM;
break;
}
lpwm = MIDI_OutAlloc(&hMidiOut, &dwCallback, &dwInstance, &dwFlags, 0, NULL);
if (lpwm == NULL)
......@@ -1754,6 +1761,13 @@ MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
if (cMidi != 1 || lphMidiStrm == NULL || lpuDeviceID == NULL)
return MMSYSERR_INVALPARAM;
switch (fdwOpen & CALLBACK_TYPEMASK) {
case CALLBACK_WINDOW:
if (dwCallback && !IsWindow((HWND)dwCallback))
return MMSYSERR_INVALPARAM;
break;
}
lpMidiStrm = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_MIDIStream));
if (!lpMidiStrm)
return MMSYSERR_NOMEM;
......@@ -1816,7 +1830,8 @@ MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr,
TRACE("(%p, %p, %u)!\n", hMidiStrm, lpMidiHdr, cbMidiHdr);
if (cbMidiHdr < offsetof(MIDIHDR,dwOffset) || !lpMidiHdr || !lpMidiHdr->lpData
|| lpMidiHdr->dwBufferLength < lpMidiHdr->dwBytesRecorded)
|| lpMidiHdr->dwBufferLength < lpMidiHdr->dwBytesRecorded
|| lpMidiHdr->dwBytesRecorded % 4 /* player expects DWORD padding */)
return MMSYSERR_INVALPARAM;
/* FIXME: Native additionally checks if the MIDIEVENTs in lpData
* exactly fit dwBytesRecorded. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment