Commit 5db6b1cc authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Add an update function, use it to implement CryptMsgUpdate.

parent d5e784bd
......@@ -32,11 +32,15 @@ typedef void (*CryptMsgCloseFunc)(HCRYPTMSG msg);
typedef BOOL (*CryptMsgGetParamFunc)(HCRYPTMSG hCryptMsg, DWORD dwParamType,
DWORD dwIndex, void *pvData, DWORD *pcbData);
typedef BOOL (*CryptMsgUpdateFunc)(HCRYPTMSG hCryptMsg, const BYTE *pbData,
DWORD cbData, BOOL fFinal);
typedef struct _CryptMsgBase
{
LONG ref;
DWORD open_flags;
CryptMsgCloseFunc close;
CryptMsgUpdateFunc update;
CryptMsgGetParamFunc get_param;
} CryptMsgBase;
......@@ -171,8 +175,13 @@ BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg)
BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData,
DWORD cbData, BOOL fFinal)
{
FIXME("(%p, %p, %d, %d): stub\n", hCryptMsg, pbData, cbData, fFinal);
return TRUE;
CryptMsgBase *msg = (CryptMsgBase *)hCryptMsg;
BOOL ret = FALSE;
TRACE("(%p, %p, %d, %d)\n", hCryptMsg, pbData, cbData, fFinal);
if (msg && msg->update)
ret = msg->update(hCryptMsg, pbData, cbData, fFinal);
return ret;
}
BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
......
......@@ -314,6 +314,7 @@ static void test_data_msg_update(void)
"Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError());
/* Updating it with final = TRUE succeeds */
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
todo_wine
ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError());
/* Any subsequent update will fail, as the last was final */
SetLastError(0xdeadbeef);
......@@ -354,6 +355,7 @@ static void test_data_msg_update(void)
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %x\n", GetLastError());
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
todo_wine
ok(ret, "CryptMsgUpdate 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