crypt32: Pass function pointers to CryptMsgBase_Init rather than rely on callers to initialize them.
This commit is contained in:
parent
6d5eee0851
commit
dc63bf2de3
@ -47,11 +47,15 @@ typedef struct _CryptMsgBase
|
|||||||
} CryptMsgBase;
|
} CryptMsgBase;
|
||||||
|
|
||||||
static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags,
|
static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags,
|
||||||
PCMSG_STREAM_INFO pStreamInfo)
|
PCMSG_STREAM_INFO pStreamInfo, CryptMsgCloseFunc close,
|
||||||
|
CryptMsgGetParamFunc get_param, CryptMsgUpdateFunc update)
|
||||||
{
|
{
|
||||||
msg->ref = 1;
|
msg->ref = 1;
|
||||||
msg->open_flags = dwFlags;
|
msg->open_flags = dwFlags;
|
||||||
msg->stream_info = pStreamInfo;
|
msg->stream_info = pStreamInfo;
|
||||||
|
msg->close = close;
|
||||||
|
msg->get_param = get_param;
|
||||||
|
msg->update = update;
|
||||||
msg->finalized = FALSE;
|
msg->finalized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +170,8 @@ static HCRYPTMSG CDataEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo,
|
|||||||
msg = CryptMemAlloc(sizeof(CDataEncodeMsg));
|
msg = CryptMemAlloc(sizeof(CDataEncodeMsg));
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo);
|
CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo,
|
||||||
msg->base.close = CDataEncodeMsg_Close;
|
CDataEncodeMsg_Close, CDataEncodeMsg_GetParam, CDataEncodeMsg_Update);
|
||||||
msg->base.update = CDataEncodeMsg_Update;
|
|
||||||
msg->base.get_param = CDataEncodeMsg_GetParam;
|
|
||||||
msg->bare_content_len = sizeof(empty_data_content);
|
msg->bare_content_len = sizeof(empty_data_content);
|
||||||
msg->bare_content = (LPBYTE)empty_data_content;
|
msg->bare_content = (LPBYTE)empty_data_content;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user