dssenh: Set last error in CPHashData.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-10-12 16:11:12 +02:00 committed by Alexandre Julliard
parent c822cb995e
commit 603cb31633
2 changed files with 8 additions and 4 deletions

View File

@ -641,8 +641,12 @@ BOOL WINAPI CPHashData( HCRYPTPROV hprov, HCRYPTHASH hhash, const BYTE *data, DW
if (hash->magic != MAGIC_HASH) return FALSE;
if (hash->finished || BCryptHashData( hash->handle, (UCHAR *)data, len, 0 )) return FALSE;
return TRUE;
if (hash->finished)
{
SetLastError( NTE_BAD_HASH_STATE );
return FALSE;
}
return !BCryptHashData( hash->handle, (UCHAR *)data, len, 0 );
}
BOOL WINAPI CPGetHashParam( HCRYPTPROV hprov, HCRYPTHASH hhash, DWORD param, BYTE *data, DWORD *len, DWORD flags )

View File

@ -1440,7 +1440,7 @@ static void test_duplicate_hash(void)
SetLastError(0xdeadbeef);
result = CryptHashData(hhash, (const BYTE *)"winetest", sizeof("winetest"), 0);
ok(!result, "success\n");
todo_wine ok(GetLastError() == NTE_BAD_HASH_STATE, "got %08x\n", GetLastError());
ok(GetLastError() == NTE_BAD_HASH_STATE, "got %08x\n", GetLastError());
result = CryptDuplicateHash(hhash, NULL, 0, &hhash2);
ok(result, "got %08x\n", GetLastError());
@ -1448,7 +1448,7 @@ static void test_duplicate_hash(void)
SetLastError(0xdeadbeef);
result = CryptHashData(hhash2, (const BYTE *)"winetest", sizeof("winetest"), 0);
ok(!result, "success\n");
todo_wine ok(GetLastError() == NTE_BAD_HASH_STATE, "got %08x\n", GetLastError());
ok(GetLastError() == NTE_BAD_HASH_STATE, "got %08x\n", GetLastError());
len = sizeof(buf);
result = CryptGetHashParam(hhash2, HP_HASHVAL, buf, &len, 0);