[PATCH 1/3] crypt32/tests: Do not crash on some Win98.

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


Using null pointer results in crash on some Win98:
http://test.winehq.org/data/892502479c3acf64257e19ec4aac113024642f4d/98_fg-win98/crypt32:msg.html
-------------- next part --------------
From b89a277f23a0a00b904a32f1b79846e0e30273ab Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Tue, 23 Nov 2010 13:02:22 +0300
Subject: [PATCH 1/3] crypt32/tests: Do not crash on some Win98.

---
 dlls/crypt32/tests/msg.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 63149e7..d560c30 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -2081,15 +2081,18 @@ static void test_enveloped_msg_open(void)
     SetLastError(0xdeadbeef);
     context = CertCreateCertificateContext(X509_ASN_ENCODING,
      v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
-    ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
-     GetLastError());
-    envelopedInfo.rgpRecipientCert = (PCERT_INFO *)&context->pCertInfo;
-    SetLastError(0xdeadbeef);
-    msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
-     &envelopedInfo, NULL, NULL);
-    todo_wine
-    ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
-    CryptMsgClose(msg);
+    if (context)
+    {
+        envelopedInfo.rgpRecipientCert = (PCERT_INFO *)&context->pCertInfo;
+        SetLastError(0xdeadbeef);
+        msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
+         &envelopedInfo, NULL, NULL);
+        todo_wine
+        ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
+        CryptMsgClose(msg);
+    }
+    else
+        win_skip("failed to create certificate context, skipping a test\n");
 
     SetLastError(0xdeadbeef);
     ret = pCryptAcquireContextA(&envelopedInfo.hCryptProv, NULL, NULL,
-- 
1.7.3.2



More information about the wine-patches mailing list