Commit db051850 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

mmdevapi: Use InitOnce to initialize audio drivers.

parent 93959d21
......@@ -109,7 +109,7 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
return TRUE;
}
static BOOL init_driver(void)
static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context)
{
static const WCHAR drv_value[] = {'A','u','d','i','o',0};
......@@ -120,9 +120,6 @@ static BOOL init_driver(void)
HKEY key;
WCHAR reg_list[256], *p, *next, *driver_list = default_list;
if(drvs.module)
return TRUE;
if(RegOpenKeyW(HKEY_CURRENT_USER, drv_keyW, &key) == ERROR_SUCCESS){
DWORD size = sizeof(reg_list);
......@@ -276,10 +273,11 @@ static IClassFactoryImpl MMDEVAPI_CF[] = {
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
unsigned int i = 0;
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if(!init_driver()){
if(!InitOnceExecuteOnce(&init_once, init_driver, NULL, NULL)) {
ERR("Driver initialization failed\n");
return E_FAIL;
}
......
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