Alexander Morozov : crypt32/tests: Use pCryptAcquireContextA.

Alexandre Julliard julliard at winehq.org
Wed Nov 24 11:28:39 CST 2010


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

Author: Alexander Morozov <amorozov at etersoft.ru>
Date:   Tue Nov 23 13:50:22 2010 +0300

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,




More information about the wine-cvs mailing list