Commit fc124eca authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Implement marshalling, unmarshalling and buffer sizing for the context handle type.

parent d36f02ea
...@@ -118,6 +118,10 @@ static void WINAPI NdrBaseTypeBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PF ...@@ -118,6 +118,10 @@ static void WINAPI NdrBaseTypeBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PF
static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING); static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
static ULONG WINAPI NdrBaseTypeMemorySize(PMIDL_STUB_MESSAGE, PFORMAT_STRING); static ULONG WINAPI NdrBaseTypeMemorySize(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
static unsigned char *WINAPI NdrContextHandleMarshall(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
static void WINAPI NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
static unsigned char *WINAPI NdrContextHandleUnmarshall(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char);
const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = { const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
0, 0,
NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
...@@ -152,7 +156,7 @@ const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = { ...@@ -152,7 +156,7 @@ const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
/* 0x2f */ /* 0x2f */
NdrInterfacePointerMarshall, NdrInterfacePointerMarshall,
/* 0x30 */ /* 0x30 */
0, NdrContextHandleMarshall,
/* 0xb1 */ /* 0xb1 */
0, 0, 0, 0, 0, 0,
NdrUserMarshalMarshall, NdrUserMarshalMarshall,
...@@ -194,7 +198,7 @@ const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = { ...@@ -194,7 +198,7 @@ const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
/* 0x2f */ /* 0x2f */
NdrInterfacePointerUnmarshall, NdrInterfacePointerUnmarshall,
/* 0x30 */ /* 0x30 */
0, NdrContextHandleUnmarshall,
/* 0xb1 */ /* 0xb1 */
0, 0, 0, 0, 0, 0,
NdrUserMarshalUnmarshall, NdrUserMarshalUnmarshall,
...@@ -236,7 +240,7 @@ const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = { ...@@ -236,7 +240,7 @@ const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
/* 0x2f */ /* 0x2f */
NdrInterfacePointerBufferSize, NdrInterfacePointerBufferSize,
/* 0x30 */ /* 0x30 */
0, NdrContextHandleBufferSize,
/* 0xb1 */ /* 0xb1 */
0, 0, 0, 0, 0, 0,
NdrUserMarshalBufferSize, NdrUserMarshalBufferSize,
...@@ -5517,6 +5521,70 @@ static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -5517,6 +5521,70 @@ static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE pStubMsg,
} }
/*********************************************************************** /***********************************************************************
* NdrContextHandleBufferSize [internal]
*/
static void WINAPI NdrContextHandleBufferSize(
PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
if (*pFormat != RPC_FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
}
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
pStubMsg->BufferLength += cbNDRContext;
}
/***********************************************************************
* NdrContextHandleMarshall [internal]
*/
static unsigned char *WINAPI NdrContextHandleMarshall(
PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
if (*pFormat != RPC_FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
}
if (pFormat[1] & 0x80)
NdrClientContextMarshall(pStubMsg, *(NDR_CCONTEXT **)pMemory, FALSE);
else
NdrClientContextMarshall(pStubMsg, (NDR_CCONTEXT *)pMemory, FALSE);
return NULL;
}
/***********************************************************************
* NdrContextHandleUnmarshall [internal]
*/
static unsigned char *WINAPI NdrContextHandleUnmarshall(
PMIDL_STUB_MESSAGE pStubMsg,
unsigned char **ppMemory,
PFORMAT_STRING pFormat,
unsigned char fMustAlloc)
{
if (*pFormat != RPC_FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
}
**(NDR_CCONTEXT **)ppMemory = NULL;
NdrClientContextUnmarshall(pStubMsg, *(NDR_CCONTEXT **)ppMemory, pStubMsg->RpcMsg->Handle);
return NULL;
}
/***********************************************************************
* NdrClientContextMarshall [RPCRT4.@] * NdrClientContextMarshall [RPCRT4.@]
*/ */
void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
......
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