From a9bd81be63c2ceaae949123a13652febeb376019 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Mon, 8 May 2006 20:51:23 -0400 Subject: [PATCH] winmm: Check waveOutGetVolume parameter. --- dlls/winmm/tests/wave.c | 3 +++ dlls/winmm/winmm.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index a41b9b079a6..a51fa3791be 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -640,6 +640,9 @@ static void wave_out_test_deviceOut(int device, double duration, frag.dwFlags=0; frag.dwLoops=0; + rc=waveOutGetVolume(wout,0); + ok(rc==MMSYSERR_INVALPARAM,"waveOutGetVolume(%s,0) expected " + "MMSYSERR_INVALPARAM, got %s\n", dev_name(device),wave_out_error(rc)); rc=waveOutGetVolume(wout,&volume); ok(has_volume ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED, "waveOutGetVolume(%s): rc=%s\n",dev_name(device),wave_out_error(rc)); diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 6b9ccb6d096..9a4a5486659 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -2425,7 +2425,12 @@ UINT WINAPI waveOutGetVolume(HWAVEOUT hWaveOut, LPDWORD lpdw) TRACE("(%p, %08lx);\n", hWaveOut, (DWORD)lpdw); - if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, TRUE)) == NULL) + if (lpdw == NULL) { + WARN("invalid parameter\n"); + return MMSYSERR_INVALPARAM; + } + + if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, TRUE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, WODM_GETVOLUME, (DWORD_PTR)lpdw, 0L, TRUE);