From 788d8720e7972a1986589d6fbf2841da6f1e13fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Wed, 10 Feb 2010 08:55:00 +0100 Subject: [PATCH] midimap: Obey the size parameter in GetDevCaps. --- dlls/midimap/midimap.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c index 129427fa94c..24fc645188b 100644 --- a/dlls/midimap/midimap.c +++ b/dlls/midimap/midimap.c @@ -448,18 +448,16 @@ static DWORD modSetVolume(MIDIMAPDATA* mom, DWORD dwVolume) static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom, LPMIDIOUTCAPSW lpMidiCaps, DWORD_PTR size) { - static const WCHAR name[] = {'W','i','n','e',' ','m','i','d','i',' ','m','a','p','p','e','r',0}; - lpMidiCaps->wMid = 0x00FF; - lpMidiCaps->wPid = 0x0001; - lpMidiCaps->vDriverVersion = 0x0100; - lstrcpyW(lpMidiCaps->szPname, name); - lpMidiCaps->wTechnology = MOD_MAPPER; - lpMidiCaps->wVoices = 0; - lpMidiCaps->wNotes = 0; - lpMidiCaps->wChannelMask = 0xFFFF; - /* Native returns volume caps of underlying device | MIDICAPS_STREAM */ - lpMidiCaps->dwSupport = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME; + static const MIDIOUTCAPSW mappercaps = { + 0x00FF, 0x0001, 0x0100, /* Manufacturer and Product ID */ + {'W','i','n','e',' ','m','i','d','i',' ','m','a','p','p','e','r',0}, + MOD_MAPPER, 0, 0, 0xFFFF, + /* Native returns volume caps of underlying device + MIDICAPS_STREAM */ + MIDICAPS_VOLUME|MIDICAPS_LRVOLUME + }; + if (lpMidiCaps == NULL) return MMSYSERR_INVALPARAM; + memcpy(lpMidiCaps, &mappercaps, min(size, sizeof(*lpMidiCaps))); return MMSYSERR_NOERROR; }