Commit 16dc8357 authored by Johan Gill's avatar Johan Gill Committed by Alexandre Julliard

advapi32: CryptCreateHash actually sets ERROR_INVALID_PARAMETER if the CSP handle is 0.

parent 454467dc
...@@ -720,12 +720,7 @@ BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, ...@@ -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); TRACE("(0x%lx, 0x%x, 0x%lx, %08x, %p)\n", hProv, Algid, hKey, dwFlags, phHash);
if (!prov) if (!prov || !phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
(key && key->dwMagic != MAGIC_CRYPTKEY)) (key && key->dwMagic != MAGIC_CRYPTKEY))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
......
...@@ -238,6 +238,9 @@ static void test_incorrect_api_usage(void) ...@@ -238,6 +238,9 @@ static void test_incorrect_api_usage(void)
if (!result) return; if (!result) return;
pCryptDestroyHash(hHash); 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); result = pCryptGenKey(0, CALG_RC4, 0, &hKey);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment