[PATCH 1/2] odbccp32: Implement SQLInstallDriverEx correctly

Vincent Povirk madewokherd at gmail.com
Fri Mar 10 13:11:38 CST 2017


> +            if(RegSetValueExW(hkeydriver, driver, 0, REG_SZ, (BYTE*)installed,
> +                                    (sizeof(installed)+1)*sizeof(WCHAR)) != ERROR_SUCCESS)

sizeof(installed) is already in bytes and includes the null terminator.

> +                    /* Driver and Setup entries use the system path unless a path is specified. */
> +                    if(lstrcmpiW(driverW, entry) == 0 || lstrcmpiW(setupW, entry) == 0)
> +                    {
> +                        lstrcpyW(value, path);
> +                        lstrcatW(value, slash);
> +                        lstrcatW(value, divider);
> +                    }
> +                    else
> +                        lstrcpyW(value, divider);

Some sort of overflow check might be good here.

> +    ret = SQLInstallDriverEx("WINE ODBC Driver\0Driver=sample.dll\0Setup=sample.dll\0\0", NULL, path, MAX_PATH, &size, ODBC_INSTALL_COMPLETE, NULL);
> +    sql_ret = SQLInstallerErrorW(1, &error_code, NULL, 0, NULL);
> +    if (sql_ret && error_code == ODBC_ERROR_WRITING_SYSINFO_FAILED)
> +    {
> +         win_skip("not enough privileges\n");
> +         return;
> +    }
> +    ok(sql_ret && error_code == SQL_SUCCESS, "SQLInstallDriverEx failed %d, %u\n", sql_ret, error_code);
> +    ok(!strcmp(path, syspath), "invalid path %s\n", path);

This doesn't use the value of ret.



More information about the wine-devel mailing list