crypt32: Implement getting content of a data message.

This commit is contained in:
Juan Lang 2007-07-17 07:33:01 -07:00 committed by Alexandre Julliard
parent 95bb1be2b7
commit 4e28944934
2 changed files with 12 additions and 1 deletions

View File

@ -743,6 +743,13 @@ static BOOL CDecodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
ret = CRYPT_CopyParam(pvData, pcbData, (const BYTE *)&msg->type,
sizeof(msg->type));
break;
case CMSG_CONTENT_PARAM:
if (msg->data)
ret = CRYPT_CopyParam(pvData, pcbData, msg->data->pbData,
msg->data->cbData);
else
SetLastError(CRYPT_E_INVALID_MSG_TYPE);
break;
default:
FIXME("unimplemented for parameter %d\n", dwParamType);
SetLastError(CRYPT_E_INVALID_MSG_TYPE);

View File

@ -1208,10 +1208,14 @@ static void test_decode_msg_get_param(void)
{
HCRYPTMSG msg;
BOOL ret;
DWORD size = 0;
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
SetLastError(0xdeadbeef);
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, NULL, &size);
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError());
ret = CryptMsgUpdate(msg, dataContent, sizeof(dataContent), TRUE);
todo_wine
check_param("data content", msg, CMSG_CONTENT_PARAM, msgData,
sizeof(msgData));
CryptMsgClose(msg);