Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mmdevapi/devenum.c | 14 ++------------ dlls/mmdevapi/main.c | 6 ++++++ dlls/mmdevapi/mmdevapi.h | 3 +++ 3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c index a5863af2705..d3272a1ff93 100644 --- a/dlls/mmdevapi/devenum.c +++ b/dlls/mmdevapi/devenum.c @@ -56,7 +56,6 @@ typedef struct MMDevPropStoreImpl typedef struct MMDevEnumImpl { IMMDeviceEnumerator IMMDeviceEnumerator_iface; - BOOL initialized; } MMDevEnumImpl;
static MMDevice **MMDevice_head; @@ -373,7 +372,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st return cur; }
-static HRESULT load_devices_from_reg(void) +HRESULT load_devices_from_reg(void) { DWORD i = 0; HKEY root, cur; @@ -466,7 +465,7 @@ static HRESULT set_format(MMDevice *dev) return S_OK; }
-static HRESULT load_driver_devices(EDataFlow flow) +HRESULT load_driver_devices(EDataFlow flow) { WCHAR **ids; GUID *guids; @@ -860,14 +859,6 @@ static const IMMDeviceCollectionVtbl MMDevColVtbl =
HRESULT MMDevEnum_Create(REFIID riid, void **ppv) { - if (!enumerator.initialized) - { - enumerator.initialized = TRUE; - load_devices_from_reg(); - load_driver_devices(eRender); - load_driver_devices(eCapture); - } - return IMMDeviceEnumerator_QueryInterface(&enumerator.IMMDeviceEnumerator_iface, riid, ppv); }
@@ -1272,7 +1263,6 @@ static const IMMDeviceEnumeratorVtbl MMDevEnumVtbl = static MMDevEnumImpl enumerator = { {&MMDevEnumVtbl}, - FALSE, };
static HRESULT MMDevPropStore_Create(MMDevice *parent, DWORD access, IPropertyStore **ppv) diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index 9cc0aad6105..358c1697a23 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -148,6 +148,12 @@ static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context) *next = ','; }
+ if (drvs.module != 0){ + load_devices_from_reg(); + load_driver_devices(eRender); + load_driver_devices(eCapture); + } + return drvs.module != 0; }
diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h index 3bcf568cddf..73c9b0e9592 100644 --- a/dlls/mmdevapi/mmdevapi.h +++ b/dlls/mmdevapi/mmdevapi.h @@ -73,4 +73,7 @@ extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN; extern HRESULT SpatialAudioClient_Create(IMMDevice *device, ISpatialAudioClient **out) DECLSPEC_HIDDEN;
+extern HRESULT load_devices_from_reg(void) DECLSPEC_HIDDEN; +extern HRESULT load_driver_devices(EDataFlow flow) DECLSPEC_HIDDEN; + extern const WCHAR drv_keyW[] DECLSPEC_HIDDEN;