mmdevapi: Load devices on driver initialization.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-06-03 18:15:30 +02:00 committed by Alexandre Julliard
parent 4caea555af
commit 0f147492de
3 changed files with 12 additions and 11 deletions

View file

@ -373,7 +373,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 +466,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 +860,6 @@ static const IMMDeviceCollectionVtbl MMDevColVtbl =
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);
}
@ -1278,7 +1270,7 @@ static const IMMDeviceEnumeratorVtbl MMDevEnumVtbl =
static MMDevEnumImpl enumerator =
{
{&MMDevEnumVtbl},
0,
1,
};
static HRESULT MMDevPropStore_Create(MMDevice *parent, DWORD access, IPropertyStore **ppv)

View file

@ -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;
}

View file

@ -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;