cleanup a->w cross calls in advapi32/crypt.c

Dmitry Timoshkov dmitry at baikal.ru
Sun Aug 1 03:16:41 CDT 2004


"James Hawkins" <truiken at gmail.com> wrote:

> Fixed more bugs spotted by Dmitry.
> 
> Changelog
>    * cleanup cross-call functions

If you could use 'static const' as everywhere else and not 'const static'
that would be nice.

> + size = sizeof(DWORD);
> + r = RegQueryValueExW(key, nameW, NULL, &keytype, NULL, &size);

Why did you add size initialization here? If that wasn't done before there was
a reason for that.

> + provNameLen = *pcbProvName * sizeof(WCHAR);
> + if ( pszProvName && (str = CRYPT_Alloc(provNameLen * sizeof(WCHAR))) )
> + CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
> + ret = CryptEnumProvidersW(dwIndex, pdwReserved, dwFlags, pdwProvType, str, &provNameLen);

Remove double sizeof(WCHAR) multiplcation here and everywhere else.

> - DWORD size = sizeof(DWORD);
> + DWORD size = sizeof(pdwProvType);
> HKEY subkey;
> - if (RegEnumKeyA(hKey, dwIndex, pszProvName, *pcbProvName))
> + if (RegEnumKeyW(hKey, dwIndex, pszProvName, *pcbProvName))

RegEnumKeyW takes number of characters, not bytes. Why did you
change that since your previous patch?

Please read documentation first, otherwise you are wasting your
and our time.

-- 
Dmitry.




More information about the wine-devel mailing list