[PATCH 1/3] wineoss.drv: Attempt to verify that the system is actually running OSS

Alexandre Julliard julliard at winehq.org
Mon Jul 25 09:09:41 CDT 2011


Andrew Eikum <aeikum at codeweavers.com> writes:

> +/* Attempt to determine if we are running on OSS or ALSA's OSS compatability
> + * layer. There is no official way to do that, so just check for validity
> + * as best as possible, without rejecting valid OSS implementations. */
> +static BOOL verify_actually_oss(void)
> +{
> +    int mixer_fd;
> +    oss_sysinfo sysinfo;
> +    HKEY key;
> +
> +    static const WCHAR drv_key[] = {'S','o','f','t','w','a','r','e','\\',
> +        'W','i','n','e','\\','D','r','i','v','e','r','s',0};
> +    static const WCHAR drv_value[] = {'A','u','d','i','o',0};
> +    static const WCHAR ossW[] = {'O','S','S'};
> +
> +    /* if the user has specified a driver explicitly, then succeed
> +     * if they want OSS and fail if they don't */
> +    if(RegOpenKeyW(HKEY_CURRENT_USER, drv_key, &key) == ERROR_SUCCESS){
> +        WCHAR driver_name[256];
> +        DWORD size = sizeof(driver_name);
> +
> +        if(RegQueryValueExW(key, drv_value, 0, NULL, (BYTE*)driver_name,
> +                    &size) == ERROR_SUCCESS){
> +            RegCloseKey(key);
> +            if(!lstrcmpiW(ossW, driver_name))
> +                return TRUE;
> +            return FALSE;
> +        }
> +
> +        RegCloseKey(key);
> +    }

It's not the driver's business to check the configuration key. If
there's really a need to know if some other driver was configured, this
info should be passed from the driver loader. But it would be preferable
to avoid that.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list