crypt32(10/17): Add an update function,
use it to implement CryptMsgUpdate
Juan Lang
juan.lang at gmail.com
Thu Jun 28 19:30:56 CDT 2007
--Juan
-------------- next part --------------
From 6c5d7b3399656a75b5c5084c7cd261f990cc25ec Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Thu, 28 Jun 2007 16:51:47 -0700
Subject: [PATCH] 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 d48a670..44ca1cd 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -33,11 +33,15 @@ typedef void (*CryptMsgCloseFunc)(HCRYPT
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;
@@ -175,8 +179,13 @@ BOOL WINAPI CryptMsgClose(HCRYPTMSG hCry
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 9d7c3c6..df5e83f 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);
}
--
1.4.1
More information about the wine-patches
mailing list