From fa0f5bd066b6514a14e877fad9dd7836ef5f4ae0 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 28 Jun 2007 16:49:06 -0700 Subject: [PATCH] crypt32: Stub CryptMsgOpenToEncode for data messages. --- dlls/crypt32/msg.c | 27 +++++++++++++++++++++++++++ dlls/crypt32/tests/msg.c | 3 --- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index f8068385dc3..ebd7b657a4f 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -42,6 +42,30 @@ static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags) msg->open_flags = dwFlags; } +typedef struct _CDataEncodeMsg +{ + CryptMsgBase base; +} CDataEncodeMsg; + +static HCRYPTMSG CDataEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo, + LPSTR pszInnerContentObjID, PCMSG_STREAM_INFO pStreamInfo) +{ + CDataEncodeMsg *msg; + + if (pvMsgEncodeInfo) + { + SetLastError(E_INVALIDARG); + return NULL; + } + FIXME("semi-stub\n"); + msg = CryptMemAlloc(sizeof(CDataEncodeMsg)); + if (msg) + { + CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags); + } + return (HCRYPTMSG)msg; +} + static inline const char *MSG_TYPE_STR(DWORD type) { switch (type) @@ -76,6 +100,9 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, switch (dwMsgType) { case CMSG_DATA: + msg = CDataEncodeMsg_Open(dwFlags, pvMsgEncodeInfo, + pszInnerContentObjID, pStreamInfo); + break; case CMSG_SIGNED: case CMSG_ENVELOPED: case CMSG_HASHED: diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 1895f820ab7..9d7c3c695c3 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -275,7 +275,6 @@ static void test_msg_close(void) ret = CryptMsgClose((HCRYPTMSG)1); msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, NULL); - todo_wine ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError()); ret = CryptMsgClose(msg); ok(ret, "CryptMsgClose failed: %x\n", GetLastError()); @@ -290,13 +289,11 @@ static void test_data_msg_open(void) 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); }