[v2 PATCH 1/3] odbccp32: Implement SQLInstallTranslator

Huw Davies huw at codeweavers.com
Tue Apr 4 03:04:12 CDT 2017


On Wed, Mar 22, 2017 at 10:06:05PM +0000, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/odbccp32/tests/misc.c b/dlls/odbccp32/tests/misc.c
> index 4fdf584..e977e91 100644
> --- a/dlls/odbccp32/tests/misc.c
> +++ b/dlls/odbccp32/tests/misc.c
> @@ -473,6 +473,67 @@ void test_SQLInstallDriverEx(void)
>      ok(cnt == 0, "SQLRemoveDriver failed %d\n", cnt);
>  }
>  
> +void test_SQLInstallTranslatorEx(void)
> +{
> +    char path[MAX_PATH];
> +    char syspath[MAX_PATH];
> +    WORD size = 0;
> +    BOOL ret, sql_ret;
> +    DWORD cnt, error_code = 0;
> +    HKEY hkey;
> +    LONG res;
> +
> +    GetSystemDirectoryA(syspath, MAX_PATH);
> +
> +    ret = SQLInstallTranslatorEx("WINE ODBC Translator\0Translator=sample.dll\0Setup=sample.dll\0\0", NULL, path, MAX_PATH, &size, ODBC_INSTALL_COMPLETE, NULL);

The string will be terminated in three '\0's, I suspect you only need two.
Also, 160 chars is a little long for a line - There are other cases in this
series where line-length is excessive.

> +    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);

You should test size here.  Does it include the '\0' or not, msdn is vague.

Huw.



More information about the wine-devel mailing list