From 5db6b1cc962d0ab8c3bb6e9f05ef534437c91af3 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 28 Jun 2007 16:51:47 -0700 Subject: [PATCH] crypt32: Add an update function, use it to implement CryptMsgUpdate. --- dlls/crypt32/msg.c | 13 +++++++++++-- dlls/crypt32/tests/msg.c | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 3c282309b9c..536851555a4 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -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, diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 9d7c3c695c3..df5e83fce4d 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -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); }