From 78b2fd8399dc05ec8ff5dbf90aabe687c35b423d Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Fri, 25 Oct 2013 05:41:53 +0800 Subject: [PATCH] winmm: Fixed mixerGetControlDetails with null paDetails. --- dlls/winmm/tests/mixer.c | 9 ++++++++- dlls/winmm/waveform.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/winmm/tests/mixer.c b/dlls/winmm/tests/mixer.c index da27b160ada..2f483db3fa4 100644 --- a/dlls/winmm/tests/mixer.c +++ b/dlls/winmm/tests/mixer.c @@ -197,10 +197,17 @@ static void mixer_test_controlA(HMIXER mix, LPMIXERCONTROLA control) details.dwControlID = control->dwControlID; details.cChannels = 1; U(details).cMultipleItems = 0; - details.paDetails = &value; details.cbDetails = sizeof(value); + /* test NULL paDetails */ + details.paDetails = NULL; + rc=mixerGetControlDetails((HMIXEROBJ)mix,&details,MIXER_GETCONTROLDETAILSF_VALUE); + ok(rc==MMSYSERR_INVALPARAM, + "mixerGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n", + mmsys_error(rc)); + /* read the current control value */ + details.paDetails = &value; rc=mixerGetControlDetails((HMIXEROBJ)mix,&details,MIXER_GETCONTROLDETAILSF_VALUE); ok(rc==MMSYSERR_NOERROR,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): " "MMSYSERR_NOERROR expected, got %s\n", diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 23adfc0d042..8da547c6ab7 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -3849,7 +3849,7 @@ UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdW if(FAILED(hr)) return MMSYSERR_NODRIVER; - if(!lpmcdW) + if(!lpmcdW || !lpmcdW->paDetails) return MMSYSERR_INVALPARAM; TRACE("dwControlID: %u\n", lpmcdW->dwControlID);