diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index ce7b15f7a66..38f249ef04d 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -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 ) diff --git a/dlls/dssenh/tests/dssenh.c b/dlls/dssenh/tests/dssenh.c index 704b3685c3f..6ad15225924 100644 --- a/dlls/dssenh/tests/dssenh.c +++ b/dlls/dssenh/tests/dssenh.c @@ -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);