Commit ae13a279 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

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

Based on a patch by Changping Yu <dead.ash@hotmail.com>. Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2f454fa3
......@@ -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);
if(!WINMM_ValidateAndLock(device))
return MMSYSERR_BADDEVICEID;
caps = &device->parent->out_caps;
caps = &read_map(g_out_map, uDeviceID)->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);
if(!WINMM_ValidateAndLock(device))
return MMSYSERR_BADDEVICEID;
caps = &device->parent->in_caps;
caps = &read_map(g_in_map, uDeviceID)->in_caps;
LeaveCriticalSection(&device->lock);
}else{
caps = &read_map(g_in_map, uDeviceID)->in_caps;
}
}
memcpy(lpCaps, caps, min(uSize, sizeof(*lpCaps)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment