winmm: The 64KB buffer limit on MIDIHDR buffers applies to streams only.

This commit is contained in:
Jörg Höhle 2010-01-31 21:19:39 +01:00 committed by Alexandre Julliard
parent 771a29da86
commit a758c6a981
5 changed files with 12 additions and 17 deletions

View File

@ -611,8 +611,7 @@ static DWORD midPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
TRACE("(%04X, %p, %08X);\n", wDevID, lpMidiHdr, dwSize);
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul)
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0)
return MMSYSERR_INVALPARAM;
lpMidiHdr->lpNext = 0;
@ -633,7 +632,7 @@ static DWORD midUnprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
if (MidiInDev[wDevID].state == -1) return MIDIERR_NODEVICE;
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || lpMidiHdr->dwBufferLength >= 0x10000ul)
lpMidiHdr->lpData == 0)
return MMSYSERR_INVALPARAM;
if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED;
@ -1057,8 +1056,7 @@ static DWORD modPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
* So at least check for the inqueue flag
*/
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul) {
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0) {
WARN("%p %p %08x %d\n", lpMidiHdr, lpMidiHdr ? lpMidiHdr->lpData : NULL,
lpMidiHdr ? lpMidiHdr->dwFlags : 0, dwSize);
return MMSYSERR_INVALPARAM;

View File

@ -470,8 +470,7 @@ static DWORD MIDIOut_Prepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
* So at least check for the inqueue flag
*/
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul) {
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0) {
WARN("%p %p %08x %lu/%d\n", lpMidiHdr, lpMidiHdr->lpData,
lpMidiHdr->dwFlags, sizeof(MIDIHDR), dwSize);
return MMSYSERR_INVALPARAM;
@ -721,8 +720,7 @@ static DWORD MIDIIn_Prepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
* So at least check for the inqueue flag
*/
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul) {
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0) {
WARN("Invalid parameter %p %p %08x %d\n", lpMidiHdr, lpMidiHdr->lpData,
lpMidiHdr->dwFlags, dwSize);
return MMSYSERR_INVALPARAM;

View File

@ -875,8 +875,7 @@ static DWORD midPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
TRACE("(%04X, %p, %08X);\n", wDevID, lpMidiHdr, dwSize);
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul)
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0)
return MMSYSERR_INVALPARAM;
lpMidiHdr->lpNext = 0;
@ -897,7 +896,7 @@ static DWORD midUnprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
if (MidiInDev[wDevID].state == -1) return MIDIERR_NODEVICE;
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || lpMidiHdr->dwBufferLength >= 0x10000ul)
lpMidiHdr->lpData == 0)
return MMSYSERR_INVALPARAM;
if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED;
@ -1621,8 +1620,7 @@ static DWORD modPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
* So at least check for the inqueue flag
*/
if (dwSize < sizeof(MIDIHDR) || lpMidiHdr == 0 ||
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0 ||
lpMidiHdr->dwBufferLength >= 0x10000ul) {
lpMidiHdr->lpData == 0 || (lpMidiHdr->dwFlags & MHDR_INQUEUE) != 0) {
WARN("%p %p %08x %d\n", lpMidiHdr, lpMidiHdr ? lpMidiHdr->lpData : NULL,
lpMidiHdr ? lpMidiHdr->dwFlags : 0, dwSize);
return MMSYSERR_INVALPARAM;

View File

@ -121,7 +121,7 @@ static void test_midiIn_device(UINT udev, HWND hwnd)
ok(mhdr.lpData!=NULL, "No %d bytes of memory!\n", mhdr.dwBufferLength);
if (mhdr.lpData) {
rc = midiInPrepareHeader(hm, &mhdr, sizeof(mhdr));
todo_wine ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
rc = midiInUnprepareHeader(hm, &mhdr, sizeof(mhdr));
ok(!rc, "midiInUnprepare rc=%s\n", mmsys_error(rc));
trace("MIDIHDR flags=%x when unsent\n", mhdr.dwFlags);
@ -260,7 +260,7 @@ static void test_midiOut_device(UINT udev, HWND hwnd)
test_notification(hwnd, "midiOutLong unprepared", 0, WHATEVER);
rc = midiOutPrepareHeader(hm, &mhdr, sizeof(mhdr));
todo_wine ok(!rc, "midiOutPrepare rc=%s\n", mmsys_error(rc));
ok(!rc, "midiOutPrepare rc=%s\n", mmsys_error(rc));
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
trace("MIDIHDR flags=%x when unsent\n", mhdr.dwFlags);
@ -416,7 +416,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
mhdr.dwFlags = 0;
/* PrepareHeader detects the too large buffer is for a stream. */
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
ok(rc==MMSYSERR_INVALPARAM, "midiOutPrepare stream too large rc=%s\n", mmsys_error(rc));
todo_wine ok(rc==MMSYSERR_INVALPARAM, "midiOutPrepare stream too large rc=%s\n", mmsys_error(rc));
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));

View File

@ -969,6 +969,7 @@ UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut,
if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL)
return MMSYSERR_INVALHANDLE;
/* FIXME: detect MIDIStream handles and enforce 64KB buffer limit on those */
return MMDRV_Message(wmld, MODM_PREPARE, (DWORD_PTR)lpMidiOutHdr, uSize);
}