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

Alexandre Julliard julliard at winehq.org
Mon May 2 05:32:59 CDT 2011


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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list