From: Louis Lenders xerox.xerox2000x@gmail.com
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com --- v2: -added test in capture.c v3: Fix test messages.
dlls/winmm/tests/capture.c | 10 ++++++++++ dlls/winmm/waveform.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/winmm/tests/capture.c b/dlls/winmm/tests/capture.c index 54c379317c..fd4005cdab 100644 --- a/dlls/winmm/tests/capture.c +++ b/dlls/winmm/tests/capture.c @@ -661,6 +661,16 @@ static void wave_in_tests(void) ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) || preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred);
+ rc = waveInMessage((HWAVEIN)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, + (DWORD_PTR)-1 , 0); + ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */ + "waveInMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc); + + rc = waveInMessage((HWAVEIN)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, + 0, (DWORD_PTR)&status); + ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */ + "waveInMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc); + rc=waveInGetDevCapsA(ndev+1,&capsA,sizeof(capsA)); ok(rc==MMSYSERR_BADDEVICEID, "waveInGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n", diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 26fed17cfd..045bf4ac20 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -3660,17 +3660,17 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, case DRV_QUERYMAPPABLE: return MMSYSERR_NOERROR; case DRVM_MAPPER_PREFERRED_GET: - if(dwParam1) { - if(g_inmmdevices_count > 0) - /* Device 0 is always the default device */ - *(DWORD *)dwParam1 = 0; - else - *(DWORD *)dwParam1 = -1; - } + if(!dwParam1 || !dwParam2) + return MMSYSERR_INVALPARAM;
- if(dwParam2) - /* Status flags */ - *(DWORD *)dwParam2 = 0; + if(g_inmmdevices_count > 0) + /* Device 0 is always the default device */ + *(DWORD *)dwParam1 = 0; + else + *(DWORD *)dwParam1 = -1; + + /* Status flags */ + *(DWORD *)dwParam2 = 0;
return MMSYSERR_NOERROR; }