From cba322d71d317bc52e9de5a057723bf5d6dc1e86 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 15 Dec 2014 10:21:52 -0600 Subject: [PATCH] winmm: Allow larger MMTIME sizes. --- dlls/winmm/tests/wave.c | 7 ++++++- dlls/winmm/waveform.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index d3704615082..4dcc5770606 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -487,7 +487,12 @@ static void check_position(int device, HWAVEOUT wout, DWORD bytes, DWORD returned; mmtime.wType = TIME_BYTES; - rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime)); + rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime) - 1); + ok(rc==MMSYSERR_ERROR, + "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc)); + + mmtime.wType = TIME_BYTES; + rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime) + 1); ok(rc==MMSYSERR_NOERROR, "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc)); if (mmtime.wType != TIME_BYTES && winetest_debug > 1) diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 32083b8fe36..f381c16180e 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -2981,9 +2981,12 @@ UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, LPMMTIME lpTime, { TRACE("(%p, %p, %u)\n", hWaveOut, lpTime, uSize); - if(!uSize || !lpTime || uSize != sizeof(MMTIME)) + if(!uSize || !lpTime) return MMSYSERR_INVALPARAM; + if(uSize < sizeof(MMTIME)) + return MMSYSERR_ERROR; + return WINMM_GetPosition((HWAVE)hWaveOut, lpTime); } @@ -3602,9 +3605,12 @@ UINT WINAPI waveInGetPosition(HWAVEIN hWaveIn, LPMMTIME lpTime, { TRACE("(%p, %p, %u)\n", hWaveIn, lpTime, uSize); - if(!uSize || !lpTime || uSize != sizeof(MMTIME)) + if(!uSize || !lpTime) return MMSYSERR_INVALPARAM; + if(uSize < sizeof(MMTIME)) + return MMSYSERR_ERROR; + return WINMM_GetPosition((HWAVE)hWaveIn, lpTime); }