Make CryptEnumProvidersA pcbProvName parameter contain the correct

size of the provider name on return.
This commit is contained in:
James Hawkins 2004-08-09 22:53:58 +00:00 committed by Alexandre Julliard
parent bea0555890
commit 8cc77c1805
1 changed files with 10 additions and 0 deletions

View File

@ -977,8 +977,18 @@ BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
if (!pszProvName)
{
DWORD numkeys;
char *provName;
RegQueryInfoKeyA(hKey, NULL, NULL, NULL, &numkeys, pcbProvName, NULL, NULL, NULL, NULL, NULL, NULL);
if (!(provName = CRYPT_Alloc(*pcbProvName)))
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
RegEnumKeyExA(hKey, dwIndex, provName, pcbProvName, NULL, NULL, NULL, NULL);
(*pcbProvName)++;
CRYPT_Free(provName);
if (dwIndex >= numkeys)
CRYPT_ReturnLastError(ERROR_NO_MORE_ITEMS);
} else {