winmm: Allow HMIXEROBJ handles in place of device IDs in mixerGetDevCaps.

This commit is contained in:
Andrew Eikum 2015-01-27 09:02:50 -06:00 committed by Alexandre Julliard
parent 7b8dbc4776
commit bbc5244c0b
2 changed files with 28 additions and 5 deletions

View file

@ -395,6 +395,14 @@ static void mixer_test_deviceA(int device)
ok(rc==MMSYSERR_NOERROR,
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
if (rc==MMSYSERR_NOERROR) {
MIXERCAPSA capsA2;
rc=mixerGetDevCapsA((UINT_PTR)mix,&capsA2,sizeof(capsA2));
ok(rc==MMSYSERR_NOERROR,
"mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
mmsys_error(rc));
ok(!strcmp(capsA2.szPname, capsA.szPname), "Got wrong device caps\n");
for (d=0;d<capsA.cDestinations;d++) {
MIXERLINEA mixerlineA;
mixerlineA.cbStruct = 0;
@ -771,6 +779,14 @@ static void mixer_test_deviceW(int device)
ok(rc==MMSYSERR_NOERROR,
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
if (rc==MMSYSERR_NOERROR) {
MIXERCAPSW capsW2;
rc=mixerGetDevCapsW((UINT_PTR)mix,&capsW2,sizeof(capsW2));
ok(rc==MMSYSERR_NOERROR,
"mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
mmsys_error(rc));
ok(!lstrcmpW(capsW2.szPname, capsW.szPname), "Got wrong device caps\n");
for (d=0;d<capsW.cDestinations;d++) {
MIXERLINEW mixerlineW;
mixerlineW.cbStruct = 0;

View file

@ -122,6 +122,7 @@ struct _WINMM_MMDevice {
WAVEOUTCAPSW out_caps; /* must not be modified outside of WINMM_InitMMDevices*/
WAVEINCAPSW in_caps; /* must not be modified outside of WINMM_InitMMDevices*/
WCHAR *dev_id;
EDataFlow dataflow;
ISimpleAudioVolume *volume;
@ -510,6 +511,7 @@ static HRESULT WINMM_InitMMDevice(EDataFlow flow, IMMDevice *device,
{
HRESULT hr;
dev->dataflow = flow;
if(flow == eRender){
dev->out_caps.wMid = 0xFF;
dev->out_caps.wPid = 0xFF;
@ -3749,15 +3751,20 @@ UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize
return MMSYSERR_NOERROR;
if(uDeviceID >= g_outmmdevices_count + g_inmmdevices_count)
mmdevice = WINMM_GetMixerMMDevice((HMIXEROBJ)uDeviceID,
MIXER_OBJECTF_MIXER, NULL);
else if(uDeviceID < g_outmmdevices_count)
mmdevice = read_map(g_out_map, uDeviceID);
else
mmdevice = read_map(g_in_map, uDeviceID - g_outmmdevices_count);
if(!mmdevice)
return MMSYSERR_BADDEVICEID;
if(uDeviceID < g_outmmdevices_count){
mmdevice = read_map(g_out_map, uDeviceID);
if(mmdevice->dataflow == eRender)
memcpy(caps.szPname, mmdevice->out_caps.szPname, sizeof(caps.szPname));
}else{
mmdevice = read_map(g_in_map, uDeviceID - g_outmmdevices_count);
else
memcpy(caps.szPname, mmdevice->in_caps.szPname, sizeof(caps.szPname));
}
caps.wMid = 0xFF;
caps.wPid = 0xFF;