crypt32: Stub CryptMsgOpenToEncode for data messages.

This commit is contained in:
Juan Lang 2007-06-28 16:49:06 -07:00 committed by Alexandre Julliard
parent e829833986
commit fa0f5bd066
2 changed files with 27 additions and 3 deletions

View File

@ -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:

View File

@ -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);
}