Re: cleanup a->w cross calls in advapi32/crypt.c
"James Hawkins" <truiken(a)gmail.com> wrote:
Fixed even more bugs spotted by Dmitry.
Changelog * cleanup cross-call functions
The quality of the patch still is not good enough. -- Dmitry.
What is left to change? On Sun, 1 Aug 2004 20:14:58 +0900, Dmitry Timoshkov <dmitry(a)baikal.ru> wrote:
"James Hawkins" <truiken(a)gmail.com> wrote:
Fixed even more bugs spotted by Dmitry.
Changelog * cleanup cross-call functions
The quality of the patch still is not good enough.
-- Dmitry.
-- James Hawkins
"James Hawkins" <truiken(a)gmail.com> wrote:
What is left to change?
- DWORD keytype, type, len; + DWORD keytype, type, len, size;
Why do you need new 'size' variable? 'len' works fine.
- CRYPT_Free(keyname); - r = RegQueryValueExA(key, "Name", NULL, &keytype, NULL, &len); - if( r != ERROR_SUCCESS || !len || keytype != REG_SZ) + CRYPT_Free(keyname); + r = RegQueryValueExW(key, nameW, NULL, &keytype, NULL, &size);
Please do not change formatting here and everywhere else, use tab equal to 8 spaces by default, not 4.
- r = RegQueryValueExA(key, "Image Path", NULL, &keytype, NULL, &len); + size = sizeof(DWORD); + r = RegQueryValueExW(key, imagePathW, NULL, &keytype, NULL, &size);
It was already explained. There are another similar cases. Take into account that CryptEnumProvidersA/W, CryptEnumProviderTypesA/W, CryptGetDefaultProviderA/W take number of bytes for in/out buffer in all cases: when making cross calls to them and in internal implementation.
- if (RegSetValueExA(hKey, "Name", 0, REG_SZ, pszProvName, strlen(pszProvName) +1)) + if (RegSetValueExW(hKey, nameW, 0, REG_SZ, (LPBYTE)pszProvName, strlenW(pszProvName) +1))
Already was explained. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
James Hawkins