Juan Lang : crypt32: Test CryptMsgGetParam for data messages opened to encode.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 29 08:14:38 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Jun 28 16:46:55 2007 -0700

crypt32: Test CryptMsgGetParam for data messages opened to encode.

---

 dlls/crypt32/tests/msg.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 2b0b3fe..1895f82 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -361,10 +361,48 @@ static void test_data_msg_update(void)
     CryptMsgClose(msg);
 }
 
+static void test_data_msg_get_param(void)
+{
+    HCRYPTMSG msg;
+    DWORD size;
+    BOOL ret;
+
+    msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL,
+     NULL);
+
+    /* Content and bare content are always gettable */
+    size = 0;
+    ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, NULL, &size);
+    todo_wine {
+    ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
+    size = 0;
+    ret = CryptMsgGetParam(msg, CMSG_BARE_CONTENT_PARAM, 0, NULL, &size);
+    ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
+    /* But for this type of message, the signer and hash aren't applicable,
+     * and the type isn't available.
+     */
+    size = 0;
+    SetLastError(0xdeadbeef);
+    ret = CryptMsgGetParam(msg, CMSG_ENCODED_SIGNER, 0, NULL, &size);
+    ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
+     "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError());
+    SetLastError(0xdeadbeef);
+    ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
+    ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
+     "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError());
+    ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
+    ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
+     "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError());
+    }
+
+    CryptMsgClose(msg);
+}
+
 static void test_data_msg(void)
 {
     test_data_msg_open();
     test_data_msg_update();
+    test_data_msg_get_param();
 }
 
 START_TEST(msg)




More information about the wine-cvs mailing list