Michael Stefaniuc : advapi32: Remove wrong "is NULL and error out" code ( coccicheck).

Alexandre Julliard julliard at winehq.org
Mon Jun 6 15:19:08 CDT 2011


Module: wine
Branch: master
Commit: b856884c3b27219302598536a05d49fa749c19c8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b856884c3b27219302598536a05d49fa749c19c8

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Sun Jun  5 23:33:47 2011 +0200

advapi32: Remove wrong "is NULL and error out" code (coccicheck).

---

 dlls/advapi32/crypt.c       |    5 -----
 dlls/advapi32/tests/crypt.c |    3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
index a6f8bc1..26fda66 100644
--- a/dlls/advapi32/crypt.c
+++ b/dlls/advapi32/crypt.c
@@ -1420,11 +1420,6 @@ BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKE
 
 	TRACE("(0x%lx, %d, %08x, %p)\n", hProv, Algid, dwFlags, phKey);
 
-	if (!prov)
-	{
-		SetLastError(ERROR_INVALID_HANDLE);
-		return FALSE;
-	}
 	if (!phKey || !prov || prov->dwMagic != MAGIC_CRYPTPROV)
 	{
 		SetLastError(ERROR_INVALID_PARAMETER);
diff --git a/dlls/advapi32/tests/crypt.c b/dlls/advapi32/tests/crypt.c
index 865ffa4..1180275 100644
--- a/dlls/advapi32/tests/crypt.c
+++ b/dlls/advapi32/tests/crypt.c
@@ -238,6 +238,9 @@ static void test_incorrect_api_usage(void)
     if (!result) return;
     pCryptDestroyHash(hHash);
 
+    result = pCryptGenKey(0, CALG_RC4, 0, &hKey);
+    ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
+
     result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey);
     ok (result, "%d\n", GetLastError());
     if (!result) return;




More information about the wine-cvs mailing list