Commit e1f0318e authored by Arkadiusz Hiler's avatar Arkadiusz Hiler Committed by Alexandre Julliard

dsound: Get rid of the global device GUID arrays.

They are not used for anything anymore and just impose limit of 10 devices of a given type (capturer / renderer) without doing bound checking.
parent ca86155b
......@@ -73,9 +73,6 @@ static CRITICAL_SECTION_DEBUG DSOUND_renderers_lock_debug =
};
CRITICAL_SECTION DSOUND_renderers_lock = { &DSOUND_renderers_lock_debug, -1, 0, 0, 0, 0 };
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
const WCHAR wine_vxd_drv[] = L"winemm.vxd";
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
......@@ -388,13 +385,13 @@ HRESULT get_mmdevice(EDataFlow flow, const GUID *tgt, IMMDevice **device)
return DSERR_INVALIDPARAM;
}
static BOOL send_device(IMMDevice *device, GUID *guid,
LPDSENUMCALLBACKW cb, void *user)
static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
{
IPropertyStore *ps;
PROPVARIANT pv;
BOOL keep_going;
HRESULT hr;
GUID guid;
PropVariantInit(&pv);
......@@ -404,7 +401,7 @@ static BOOL send_device(IMMDevice *device, GUID *guid,
return TRUE;
}
hr = get_mmdevice_guid(device, ps, guid);
hr = get_mmdevice_guid(device, ps, &guid);
if(FAILED(hr)){
IPropertyStore_Release(ps);
return TRUE;
......@@ -418,10 +415,10 @@ static BOOL send_device(IMMDevice *device, GUID *guid,
return TRUE;
}
TRACE("Calling back with %s (%s)\n", wine_dbgstr_guid(guid),
TRACE("Calling back with %s (%s)\n", wine_dbgstr_guid(&guid),
wine_dbgstr_w(pv.pwszVal));
keep_going = cb(guid, pv.pwszVal, wine_vxd_drv, user);
keep_going = cb(&guid, pv.pwszVal, wine_vxd_drv, user);
PropVariantClear(&pv);
IPropertyStore_Release(ps);
......@@ -431,13 +428,12 @@ static BOOL send_device(IMMDevice *device, GUID *guid,
/* S_FALSE means the callback returned FALSE at some point
* S_OK means the callback always returned TRUE */
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
LPDSENUMCALLBACKW cb, void *user)
HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user)
{
IMMDeviceEnumerator *devenum;
IMMDeviceCollection *coll;
IMMDevice *defdev = NULL;
UINT count, i, n;
UINT count, i;
BOOL keep_going;
HRESULT hr, init_hr;
......@@ -476,10 +472,8 @@ HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
eMultimedia, &defdev);
if(FAILED(hr)){
defdev = NULL;
n = 0;
}else{
keep_going = send_device(defdev, &guids[0], cb, user);
n = 1;
keep_going = send_device(defdev, cb, user);
}
}
......@@ -493,8 +487,7 @@ HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
}
if(device != defdev){
keep_going = send_device(device, &guids[n], cb, user);
++n;
keep_going = send_device(device, cb, user);
}
IMMDevice_Release(device);
......@@ -537,8 +530,7 @@ HRESULT WINAPI DirectSoundEnumerateW(
setup_dsound_options();
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
lpDSEnumCallback, lpContext);
hr = enumerate_mmdevices(eRender, lpDSEnumCallback, lpContext);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......@@ -601,8 +593,7 @@ DirectSoundCaptureEnumerateW(
setup_dsound_options();
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
lpDSEnumCallback, lpContext);
hr = enumerate_mmdevices(eCapture, lpDSEnumCallback, lpContext);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......
......@@ -255,9 +255,6 @@ HRESULT IDirectSoundCaptureImpl_Create(IUnknown *outer_unk, REFIID riid, void **
extern CRITICAL_SECTION DSOUND_renderers_lock;
extern struct list DSOUND_renderers;
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
extern const WCHAR wine_vxd_drv[];
void setup_dsound_options(void);
......@@ -266,5 +263,4 @@ HRESULT get_mmdevice(EDataFlow flow, const GUID *tgt, IMMDevice **device);
BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
DWORD depth, WORD channels);
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
LPDSENUMCALLBACKW cb, void *user);
HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user);
......@@ -134,11 +134,9 @@ static HRESULT DSPROPERTY_WaveDeviceMappingW(
search.found_guid = &ppd->DeviceId;
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
search_callback, &search);
hr = enumerate_mmdevices(eRender, search_callback, &search);
else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE)
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
search_callback, &search);
hr = enumerate_mmdevices(eCapture, search_callback, &search);
else
return DSERR_INVALIDPARAM;
......@@ -316,12 +314,10 @@ static HRESULT DSPROPERTY_EnumerateW(
return E_PROP_ID_UNSUPPORTED;
}
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
enum_callback, ppd);
hr = enumerate_mmdevices(eRender, enum_callback, ppd);
if(hr == S_OK)
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
enum_callback, ppd);
hr = enumerate_mmdevices(eCapture, enum_callback, ppd);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......
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