advapi32: CryptCreateHash actually sets ERROR_INVALID_PARAMETER if the CSP handle is 0.
This commit is contained in:
parent
454467dc93
commit
16dc83578a
|
@ -720,12 +720,7 @@ BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
|
|||
|
||||
TRACE("(0x%lx, 0x%x, 0x%lx, %08x, %p)\n", hProv, Algid, hKey, dwFlags, phHash);
|
||||
|
||||
if (!prov)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
if (!phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
|
||||
if (!prov || !phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
|
||||
(key && key->dwMagic != MAGIC_CRYPTKEY))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
|
|
@ -238,6 +238,9 @@ static void test_incorrect_api_usage(void)
|
|||
if (!result) return;
|
||||
pCryptDestroyHash(hHash);
|
||||
|
||||
result = pCryptCreateHash(0, CALG_SHA, 0, 0, &hHash);
|
||||
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
|
||||
|
||||
result = pCryptGenKey(0, CALG_RC4, 0, &hKey);
|
||||
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
|
||||
|
||||
|
|
Loading…
Reference in New Issue