Rob Shearman : rpcrt4: Pass the USER_MARSHAL_CB structure into user marshal routines.
Alexandre Julliard
julliard at winehq.org
Mon Dec 10 08:54:19 CST 2007
Module: wine
Branch: master
Commit: 766d8a17af4b8195b378c7fed2260372220fd549
URL: http://source.winehq.org/git/wine.git/?a=commit;h=766d8a17af4b8195b378c7fed2260372220fd549
Author: Rob Shearman <rob at codeweavers.com>
Date: Sun Dec 9 18:22:57 2007 +0000
rpcrt4: Pass the USER_MARSHAL_CB structure into user marshal routines.
---
dlls/rpcrt4/ndr_marshall.c | 42 +++++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 4e1d80b..66833df 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -3201,10 +3201,18 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
}
-static ULONG UserMarshalFlags(const MIDL_STUB_MESSAGE *pStubMsg)
+static void UserMarshalCB(PMIDL_STUB_MESSAGE pStubMsg,
+ USER_MARSHAL_CB_TYPE cbtype, PFORMAT_STRING pFormat,
+ USER_MARSHAL_CB *umcb)
{
- return MAKELONG(pStubMsg->dwDestContext,
- pStubMsg->RpcMsg->DataRepresentation);
+ umcb->Flags = MAKELONG(pStubMsg->dwDestContext,
+ pStubMsg->RpcMsg->DataRepresentation);
+ umcb->pStubMsg = pStubMsg;
+ umcb->pReserve = NULL;
+ umcb->Signature = USER_MARSHAL_CB_SIGNATURE;
+ umcb->CBType = cbtype;
+ umcb->pFormat = pFormat;
+ umcb->pTypeFormat = NULL /* FIXME */;
}
#define USER_MARSHAL_PTR_PREFIX \
@@ -3221,10 +3229,13 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned flags = pFormat[1];
unsigned index = *(const WORD*)&pFormat[2];
unsigned char *saved_buffer = NULL;
- ULONG uflag = UserMarshalFlags(pStubMsg);
+ USER_MARSHAL_CB umcb;
+
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
TRACE("index=%d\n", index);
+ UserMarshalCB(pStubMsg, USER_MARSHAL_CB_MARSHALL, pFormat, &umcb);
+
if (flags & USER_MARSHAL_POINTER)
{
ALIGN_POINTER(pStubMsg->Buffer, 4);
@@ -3243,7 +3254,7 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->Buffer =
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnMarshall(
- &uflag, pStubMsg->Buffer, pMemory);
+ &umcb.Flags, pStubMsg->Buffer, pMemory);
if (saved_buffer)
{
@@ -3269,10 +3280,13 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned index = *(const WORD*)&pFormat[2];
DWORD memsize = *(const WORD*)&pFormat[4];
unsigned char *saved_buffer = NULL;
- ULONG uflag = UserMarshalFlags(pStubMsg);
+ USER_MARSHAL_CB umcb;
+
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
TRACE("index=%d\n", index);
+ UserMarshalCB(pStubMsg, USER_MARSHAL_CB_UNMARSHALL, pFormat, &umcb);
+
if (flags & USER_MARSHAL_POINTER)
{
ALIGN_POINTER(pStubMsg->Buffer, 4);
@@ -3294,7 +3308,7 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->Buffer =
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnUnmarshall(
- &uflag, pStubMsg->Buffer, *ppMemory);
+ &umcb.Flags, pStubMsg->Buffer, *ppMemory);
if (saved_buffer)
{
@@ -3316,11 +3330,14 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned flags = pFormat[1];
unsigned index = *(const WORD*)&pFormat[2];
DWORD bufsize = *(const WORD*)&pFormat[6];
- ULONG uflag = UserMarshalFlags(pStubMsg);
+ USER_MARSHAL_CB umcb;
unsigned long saved_buffer_length = 0;
+
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
TRACE("index=%d\n", index);
+ UserMarshalCB(pStubMsg, USER_MARSHAL_CB_BUFFER_SIZE, pFormat, &umcb);
+
if (flags & USER_MARSHAL_POINTER)
{
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
@@ -3346,7 +3363,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
else
pStubMsg->BufferLength =
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnBufferSize(
- &uflag, pStubMsg->BufferLength, pMemory);
+ &umcb.Flags, pStubMsg->BufferLength, pMemory);
if (saved_buffer_length)
{
@@ -3401,12 +3418,15 @@ void WINAPI NdrUserMarshalFree(PMIDL_STUB_MESSAGE pStubMsg,
{
/* unsigned flags = pFormat[1]; */
unsigned index = *(const WORD*)&pFormat[2];
- ULONG uflag = UserMarshalFlags(pStubMsg);
+ USER_MARSHAL_CB umcb;
+
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
TRACE("index=%d\n", index);
+ UserMarshalCB(pStubMsg, USER_MARSHAL_CB_FREE, pFormat, &umcb);
+
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnFree(
- &uflag, pMemory);
+ &umcb.Flags, pMemory);
}
/***********************************************************************
More information about the wine-cvs
mailing list