[PATCH 3/3] crypt32/tests: Use pCryptAcquireContextA.

Alexander Morozov amorozov at etersoft.ru
Tue Nov 23 13:51:13 CST 2010


-------------- next part --------------
From cd4c6a5e76c8268806ec9b325513bc5f065ad968 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Tue, 23 Nov 2010 13:50:22 +0300
Subject: [PATCH 3/3] crypt32/tests: Use pCryptAcquireContextA.

---
 dlls/crypt32/tests/message.c |   23 +++++++++++++++++++++--
 dlls/crypt32/tests/msg.c     |    2 +-
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/tests/message.c b/dlls/crypt32/tests/message.c
index b7114b7..392ec47 100644
--- a/dlls/crypt32/tests/message.c
+++ b/dlls/crypt32/tests/message.c
@@ -27,6 +27,23 @@
 
 #include "wine/test.h"
 
+static BOOL (WINAPI * pCryptAcquireContextA)
+                        (HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD);
+
+static void init_function_pointers(void)
+{
+    HMODULE hAdvapi32 = GetModuleHandleA("advapi32.dll");
+
+#define GET_PROC(dll, func) \
+    p ## func = (void *)GetProcAddress(dll, #func); \
+    if(!p ## func) \
+      trace("GetProcAddress(%s) failed\n", #func);
+
+    GET_PROC(hAdvapi32, CryptAcquireContextA)
+
+#undef GET_PROC
+}
+
 static const BYTE dataEmptyBareContent[] = { 0x04,0x00 };
 static const BYTE dataEmptyContent[] = {
 0x30,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x02,
@@ -1001,7 +1018,7 @@ static void test_sign_message(void)
     ok(signedBlobSize, "bad size\n");
 
     SetLastError(0xdeadbeef);
-    ret = CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+    ret = pCryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
      CRYPT_VERIFYCONTEXT);
     ok(ret, "CryptAcquireContextA failed: %08x\n", GetLastError());
     SetLastError(0xdeadbeef);
@@ -1188,7 +1205,7 @@ static void test_encrypt_message(void)
     DWORD encryptedBlobSize;
 
     SetLastError(0xdeadbeef);
-    ret = CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+    ret = pCryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
      CRYPT_VERIFYCONTEXT);
     ok(ret, "CryptAcquireContextA failed: %08x\n", GetLastError());
 
@@ -1343,6 +1360,8 @@ static void test_encrypt_message(void)
 
 START_TEST(message)
 {
+    init_function_pointers();
+
     test_msg_get_signer_count();
     test_verify_detached_message_hash();
     test_verify_message_hash();
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 90dd783..898b10c 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -3100,7 +3100,7 @@ static void test_decode_msg_get_param(void)
     check_param("enveloped empty content", msg, CMSG_CONTENT_PARAM, NULL, 0);
     CryptMsgClose(msg);
 
-    CryptAcquireContextA(&hCryptProv, NULL, MS_ENHANCED_PROV_A, PROV_RSA_FULL,
+    pCryptAcquireContextA(&hCryptProv, NULL, MS_ENHANCED_PROV_A, PROV_RSA_FULL,
      CRYPT_VERIFYCONTEXT);
     SetLastError(0xdeadbeef);
     ret = CryptImportKey(hCryptProv, publicPrivateKeyPair,
-- 
1.7.3.2



More information about the wine-patches mailing list