Module: wine Branch: master Commit: 73654470abd9dc3094e3270df592c214be4c7c15 URL: https://gitlab.winehq.org/wine/wine/-/commit/73654470abd9dc3094e3270df592c21...
Author: Alex Henrie alexhenrie24@gmail.com Date: Thu Oct 19 21:47:52 2023 -0600
Revert "dsound: Get rid of the global device GUID arrays.".
This reverts commit e1f0318ec4fe83fdc86407303d55f4ee5ba3d2e7.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55608
---
dlls/dsound/dsound_main.c | 31 ++++++++++++++++++++----------- dlls/dsound/dsound_private.h | 6 +++++- dlls/dsound/propset.c | 12 ++++++++---- 3 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index 810ae616308..84a118f43aa 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c @@ -73,6 +73,9 @@ 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 */ @@ -385,13 +388,13 @@ HRESULT get_mmdevice(EDataFlow flow, const GUID *tgt, IMMDevice **device) return DSERR_INVALIDPARAM; }
-static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user) +static BOOL send_device(IMMDevice *device, GUID *guid, + LPDSENUMCALLBACKW cb, void *user) { IPropertyStore *ps; PROPVARIANT pv; BOOL keep_going; HRESULT hr; - GUID guid;
PropVariantInit(&pv);
@@ -401,7 +404,7 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user) return TRUE; }
- hr = get_mmdevice_guid(device, ps, &guid); + hr = get_mmdevice_guid(device, ps, guid); if(FAILED(hr)){ IPropertyStore_Release(ps); return TRUE; @@ -415,10 +418,10 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user) 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); @@ -428,12 +431,13 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
/* S_FALSE means the callback returned FALSE at some point * S_OK means the callback always returned TRUE */ -HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user) +HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids, + LPDSENUMCALLBACKW cb, void *user) { IMMDeviceEnumerator *devenum; IMMDeviceCollection *coll; IMMDevice *defdev = NULL; - UINT count, i; + UINT count, i, n; BOOL keep_going; HRESULT hr, init_hr;
@@ -472,8 +476,10 @@ HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user) eMultimedia, &defdev); if(FAILED(hr)){ defdev = NULL; + n = 0; }else{ - keep_going = send_device(defdev, cb, user); + keep_going = send_device(defdev, &guids[0], cb, user); + n = 1; } }
@@ -487,7 +493,8 @@ HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user) }
if(device != defdev){ - keep_going = send_device(device, cb, user); + keep_going = send_device(device, &guids[n], cb, user); + ++n; }
IMMDevice_Release(device); @@ -530,7 +537,8 @@ HRESULT WINAPI DirectSoundEnumerateW(
setup_dsound_options();
- hr = enumerate_mmdevices(eRender, lpDSEnumCallback, lpContext); + hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids, + lpDSEnumCallback, lpContext); return SUCCEEDED(hr) ? DS_OK : hr; }
@@ -593,7 +601,8 @@ DirectSoundCaptureEnumerateW(
setup_dsound_options();
- hr = enumerate_mmdevices(eCapture, lpDSEnumCallback, lpContext); + hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids, + lpDSEnumCallback, lpContext); return SUCCEEDED(hr) ? DS_OK : hr; }
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 6c3eb672f31..46c150fc9fc 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -255,6 +255,9 @@ 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); @@ -263,4 +266,5 @@ 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, LPDSENUMCALLBACKW cb, void *user); +HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids, + LPDSENUMCALLBACKW cb, void *user); diff --git a/dlls/dsound/propset.c b/dlls/dsound/propset.c index 5d9ad45b01b..be284a6dda5 100644 --- a/dlls/dsound/propset.c +++ b/dlls/dsound/propset.c @@ -134,9 +134,11 @@ static HRESULT DSPROPERTY_WaveDeviceMappingW( search.found_guid = &ppd->DeviceId;
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) - hr = enumerate_mmdevices(eRender, search_callback, &search); + hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids, + search_callback, &search); else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) - hr = enumerate_mmdevices(eCapture, search_callback, &search); + hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids, + search_callback, &search); else return DSERR_INVALIDPARAM;
@@ -314,10 +316,12 @@ static HRESULT DSPROPERTY_EnumerateW( return E_PROP_ID_UNSUPPORTED; }
- hr = enumerate_mmdevices(eRender, enum_callback, ppd); + hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids, + enum_callback, ppd);
if(hr == S_OK) - hr = enumerate_mmdevices(eCapture, enum_callback, ppd); + hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids, + enum_callback, ppd);
return SUCCEEDED(hr) ? DS_OK : hr; }