[v2 PATCH 2/2] odbccp32: Handle ODBC_CONFIG_DRIVER request in SQLConfigDriver/W

Huw Davies huw at codeweavers.com
Tue Apr 11 02:47:31 CDT 2017


On Mon, Apr 10, 2017 at 04:30:48AM +0000, Alistair Leslie-Hughes wrote:

> diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
> index f28d464..2f415c7 100644
> --- a/dlls/odbccp32/odbccp32.c
> +++ b/dlls/odbccp32/odbccp32.c
> @@ -303,6 +303,41 @@ static HMODULE load_config_driver(const WCHAR *driver)
>      return hmod;
>  }
>  
> +static BOOL write_timeout_value(const WCHAR *driver, const WCHAR *args)
> +{
> +    static WCHAR cptimeout[] = {'C','P','T','i','m','e','o','u','t',0};
> +    long ret;
> +    HKEY hkey;
> +    WCHAR *position;
> +
> +    if ( !(position = strstrW(args, cptimeout)))
> +        return FALSE;
> +
> +    if ((ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, odbcini, &hkey)) == ERROR_SUCCESS)
> +    {
> +        HKEY hkeydriver;
> +
> +        if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
> +        {
> +            const WCHAR *value = &args[sizeof(cptimeout) / sizeof(WCHAR)];
> +
> +            TRACE("CPTimeout value %s\n", debugstr_w(value));
> +            if(RegSetValueExW(hkeydriver, cptimeout, 0, REG_SZ, (BYTE*)value,
> +                               strlenW(value) * sizeof(WCHAR)) != ERROR_SUCCESS)
> +                ERR("Failed to write registry installed key\n");
> +

What are the possible formats of the arg string here?  You initially
strstr to find "CPTimeout" (which is fine).  Later on, when you assign
value, you're assuming that "CPTimeout" is at the beginning of the
string (and this is a pretty ugly way of doing it).  You're then
writting anything that follows to the registry.  Could there be more
than one arg, if so how are they separated?

Huw.



More information about the wine-devel mailing list