[v2 PATCH 2/3] odbccp32: Implement SQLRemoveTranslator/W

Huw Davies huw at codeweavers.com
Tue Apr 4 03:06:51 CDT 2017


On Wed, Mar 22, 2017 at 10:06:18PM +0000, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
> index 7b2f020..d95a110 100644
> --- a/dlls/odbccp32/odbccp32.c
> +++ b/dlls/odbccp32/odbccp32.c
> @@ -1229,20 +1229,75 @@ BOOL WINAPI SQLRemoveDSNFromIni(LPCSTR lpszDSN)
>      return FALSE;
>  }
>  
> -BOOL WINAPI SQLRemoveTranslatorW(LPCWSTR lpszTranslator, LPDWORD lpdwUsageCount)
> +BOOL WINAPI SQLRemoveTranslatorW(const WCHAR *translator, DWORD *usage_count)
>  {
> +    HKEY hkey;
> +    DWORD usagecount = 1;
> +
>      clear_errors();
> -    FIXME("%s %p\n", debugstr_w(lpszTranslator), lpdwUsageCount);
> -    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
> -    return FALSE;
> +    TRACE("%s %p\n", debugstr_w(translator), usage_count);
> +
> +    if (RegOpenKeyW(HKEY_LOCAL_MACHINE, odbcini, &hkey) == ERROR_SUCCESS)
> +    {
> +        HKEY hkeydriver;
> +
> +        if (RegOpenKeyW(hkey, translator, &hkeydriver) == ERROR_SUCCESS)
> +        {
> +            DWORD size, type;
> +            DWORD count;
> +
> +            size = sizeof(usagecount);
> +            RegGetValueA(hkeydriver, NULL, "UsageCount", RRF_RT_DWORD, &type, &usagecount, &size);
> +            TRACE("Usage count %d\n", count);

I think you mean usagecount here.  It makes me wonder whether you
actually need two variables to represent the same thing.

Huw.



More information about the wine-devel mailing list