crypt32(5/17): Test CryptMsgOpenToEncode for data messages

Juan Lang juan.lang at gmail.com
Thu Jun 28 19:28:10 CDT 2007


--Juan
-------------- next part --------------
From f73f335c9b75845894027b33d115f27eb64c678f Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Thu, 28 Jun 2007 16:46:08 -0700
Subject: [PATCH] Test CryptMsgOpenToEncode for data messages
---
 dlls/crypt32/tests/msg.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 035a40c..8bebdb9 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -281,6 +281,30 @@ static void test_msg_close(void)
     ok(ret, "CryptMsgClose failed: %x\n", GetLastError());
 }
 
+static void test_data_msg_open(void)
+{
+    HCRYPTMSG msg;
+    CMSG_HASHED_ENCODE_INFO hashInfo = { 0 };
+
+    /* The data message type takes no additional info */
+    SetLastError(0xdeadbeef);
+    msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, &hashInfo,
+     NULL, NULL);
+    todo_wine {
+    ok(!msg && GetLastError() == E_INVALIDARG,
+     "Expected E_INVALIDARG, got %x\n", GetLastError());
+    msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL,
+     NULL);
+    ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
+    }
+    CryptMsgClose(msg);
+}
+
+static void test_data_msg(void)
+{
+    test_data_msg_open();
+}
+
 START_TEST(msg)
 {
     /* Basic parameter checking tests */
@@ -288,4 +312,7 @@ START_TEST(msg)
     test_msg_open_to_decode();
     test_msg_get_param();
     test_msg_close();
+
+    /* Message-type specific tests */
+    test_data_msg();
 }
-- 
1.4.1


More information about the wine-patches mailing list