midimap: Have GetDevCaps error out when no MIDI device is present.

This commit is contained in:
Jörg Höhle 2010-02-18 17:37:25 +01:00 committed by Alexandre Julliard
parent bdea146639
commit e1cf94d9da
2 changed files with 7 additions and 0 deletions

View File

@ -470,6 +470,7 @@ static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom, LPMIDIOUTCAPSW lpMidiC
MIDICAPS_VOLUME|MIDICAPS_LRVOLUME MIDICAPS_VOLUME|MIDICAPS_LRVOLUME
}; };
if (lpMidiCaps == NULL) return MMSYSERR_INVALPARAM; if (lpMidiCaps == NULL) return MMSYSERR_INVALPARAM;
if (!numMidiOutPorts) return MMSYSERR_BADDEVICEID;
memcpy(lpMidiCaps, &mappercaps, min(size, sizeof(*lpMidiCaps))); memcpy(lpMidiCaps, &mappercaps, min(size, sizeof(*lpMidiCaps)));
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;

View File

@ -437,7 +437,13 @@ static void test_midi_outfns(HWND hwnd)
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc)); ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
} }
if (!ndevs) { if (!ndevs) {
MIDIOUTCAPSA capsA;
skip("Found no MIDI out device\n"); skip("Found no MIDI out device\n");
rc = midiOutGetDevCapsA(MIDIMAPPER, &capsA, sizeof(capsA));
/* GetDevCaps and Open must return compatible results */
ok(rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*nt,w2k*/), "midiOutGetDevCaps MAPPER with no MIDI rc=%s\n", mmsys_error(rc));
rc = midiOutOpen(&hm, MIDIMAPPER, 0, 0, CALLBACK_NULL); rc = midiOutOpen(&hm, MIDIMAPPER, 0, 0, CALLBACK_NULL);
if (rc==MIDIERR_INVALIDSETUP) todo_wine /* Wine without snd-seq */ if (rc==MIDIERR_INVALIDSETUP) todo_wine /* Wine without snd-seq */
ok(rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*w2k*/), "midiOutOpen MAPPER with no MIDI rc=%s\n", mmsys_error(rc)); ok(rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*w2k*/), "midiOutOpen MAPPER with no MIDI rc=%s\n", mmsys_error(rc));