[PATCH 1/5] mmdevapi: Add InitializeDriver() method to drivers

Paul Chitescu paulc at voip.null.ro
Mon May 2 05:47:24 CDT 2011


On Monday 02 May 2011 01:32:59 pm Alexandre Julliard wrote:
> Andrew Eikum <aeikum at codeweavers.com> writes:
> > @@ -72,11 +73,19 @@ static BOOL load_driver(const WCHAR *name)
> >      }
> >
> >  #define LDFC(n) do { drvs.p##n = (void*)GetProcAddress(drvs.module,
> > #n);\ -        if(!drvs.p##n) return FALSE; } while(0);
> > +        if(!drvs.p##n) { FreeLibrary(drvs.module); return FALSE; } }
> > while(0); +    LDFC(InitializeDriver);
> >      LDFC(GetEndpointIDs);
> >      LDFC(GetAudioEndpoint);
> >  #undef LDFC
> >
> > +    hr = drvs.pInitializeDriver();
> > +    if(FAILED(hr)){
> > +        TRACE("Driver initialization failed: %08x\n", hr);
> > +        FreeLibrary(drvs.module);
> > +        return hr;
> > +    }
>
> If you are going to call it on load, you could just as well do the init
> in the driver on DLL_PROCESS_ATTACH and avoid the extra method.

Wine is already plagued by deadlocks in the MM drivers initialization that 
interfere with the loader's lock. Explicit initialization after LoadLibrary 
returns should help getting rid of these.




More information about the wine-devel mailing list