Commit 0f147492 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mmdevapi: Load devices on driver initialization.

parent 4caea555
...@@ -373,7 +373,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st ...@@ -373,7 +373,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
return cur; return cur;
} }
static HRESULT load_devices_from_reg(void) HRESULT load_devices_from_reg(void)
{ {
DWORD i = 0; DWORD i = 0;
HKEY root, cur; HKEY root, cur;
...@@ -466,7 +466,7 @@ static HRESULT set_format(MMDevice *dev) ...@@ -466,7 +466,7 @@ static HRESULT set_format(MMDevice *dev)
return S_OK; return S_OK;
} }
static HRESULT load_driver_devices(EDataFlow flow) HRESULT load_driver_devices(EDataFlow flow)
{ {
WCHAR **ids; WCHAR **ids;
GUID *guids; GUID *guids;
...@@ -860,14 +860,6 @@ static const IMMDeviceCollectionVtbl MMDevColVtbl = ...@@ -860,14 +860,6 @@ static const IMMDeviceCollectionVtbl MMDevColVtbl =
HRESULT MMDevEnum_Create(REFIID riid, void **ppv) HRESULT MMDevEnum_Create(REFIID riid, void **ppv)
{ {
if (enumerator.ref == 0)
{
enumerator.ref = 1;
load_devices_from_reg();
load_driver_devices(eRender);
load_driver_devices(eCapture);
}
return IMMDeviceEnumerator_QueryInterface(&enumerator.IMMDeviceEnumerator_iface, riid, ppv); return IMMDeviceEnumerator_QueryInterface(&enumerator.IMMDeviceEnumerator_iface, riid, ppv);
} }
...@@ -1278,7 +1270,7 @@ static const IMMDeviceEnumeratorVtbl MMDevEnumVtbl = ...@@ -1278,7 +1270,7 @@ static const IMMDeviceEnumeratorVtbl MMDevEnumVtbl =
static MMDevEnumImpl enumerator = static MMDevEnumImpl enumerator =
{ {
{&MMDevEnumVtbl}, {&MMDevEnumVtbl},
0, 1,
}; };
static HRESULT MMDevPropStore_Create(MMDevice *parent, DWORD access, IPropertyStore **ppv) static HRESULT MMDevPropStore_Create(MMDevice *parent, DWORD access, IPropertyStore **ppv)
......
...@@ -148,6 +148,12 @@ static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context) ...@@ -148,6 +148,12 @@ static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context)
*next = ','; *next = ',';
} }
if (drvs.module != 0){
load_devices_from_reg();
load_driver_devices(eRender);
load_driver_devices(eCapture);
}
return drvs.module != 0; return drvs.module != 0;
} }
......
...@@ -73,4 +73,7 @@ extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC ...@@ -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 AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN;
extern HRESULT SpatialAudioClient_Create(IMMDevice *device, ISpatialAudioClient **out) 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; extern const WCHAR drv_keyW[] DECLSPEC_HIDDEN;
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