Commit fa0f5bd0 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Stub CryptMsgOpenToEncode for data messages.

parent e8298339
......@@ -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:
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment