winmm: Accept open handles in wave{In,Out}GetDevCaps.

Based on a patch by Changping Yu <dead.ash@hotmail.com>.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2020-05-08 08:45:57 -05:00 committed by Alexandre Julliard
parent 2f454fa375
commit ae13a279e1
1 changed files with 22 additions and 6 deletions

View File

@ -2669,10 +2669,18 @@ UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps,
caps = &mapper_caps;
}else{
if(uDeviceID >= g_outmmdevices_count)
return MMSYSERR_BADDEVICEID;
if(uDeviceID >= g_outmmdevices_count){
WINMM_Device *device = WINMM_GetDeviceFromHWAVE((HWAVE)uDeviceID);
caps = &read_map(g_out_map, uDeviceID)->out_caps;
if(!WINMM_ValidateAndLock(device))
return MMSYSERR_BADDEVICEID;
caps = &device->parent->out_caps;
LeaveCriticalSection(&device->lock);
}else{
caps = &read_map(g_out_map, uDeviceID)->out_caps;
}
}
memcpy(lpCaps, caps, min(uSize, sizeof(*lpCaps)));
@ -3336,10 +3344,18 @@ UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSi
caps = &mapper_caps;
}else{
if(uDeviceID >= g_inmmdevices_count)
return MMSYSERR_BADDEVICEID;
if(uDeviceID >= g_inmmdevices_count){
WINMM_Device *device = WINMM_GetDeviceFromHWAVE((HWAVE)uDeviceID);
caps = &read_map(g_in_map, uDeviceID)->in_caps;
if(!WINMM_ValidateAndLock(device))
return MMSYSERR_BADDEVICEID;
caps = &device->parent->in_caps;
LeaveCriticalSection(&device->lock);
}else{
caps = &read_map(g_in_map, uDeviceID)->in_caps;
}
}
memcpy(lpCaps, caps, min(uSize, sizeof(*lpCaps)));