Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/advapi32/crypt.c | 8 +------- dlls/advapi32/tests/crypt.c | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index a9314d31472..79eeec98c2d 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -582,13 +582,7 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
TRACE("(0x%lx, %p, %08x)\n", hProv, pdwReserved, dwFlags);
- if (!pProv) - { - SetLastError(NTE_BAD_UID); - return FALSE; - } - - if (pProv->dwMagic != MAGIC_CRYPTPROV) + if (!pProv || pProv->dwMagic != MAGIC_CRYPTPROV) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; diff --git a/dlls/advapi32/tests/crypt.c b/dlls/advapi32/tests/crypt.c index f34c99ee9bf..8d4f2ae5936 100644 --- a/dlls/advapi32/tests/crypt.c +++ b/dlls/advapi32/tests/crypt.c @@ -152,6 +152,9 @@ static void test_CryptReleaseContext(void) ret = CryptContextAddRef(prov, NULL, 0); ok(ret, "got %u\n", GetLastError());
+ ret = CryptContextAddRef(0, NULL, 0); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %u\n", GetLastError()); + ret = CryptReleaseContext(prov, 0); ok(ret, "got %u\n", GetLastError());