rpcrt4: Implement higher-level NDR server context handle functions.

Implement NdrServerContextMarshall and NdrServerContextNewMarshall on
top of NDRSContextMarshall2. Implement NdrContextHandleInitialize,
NdrServerContextUnmarshall and NdrServerContextNewUnmarshall on top of
NDSContextUnmarshall2.
This commit is contained in:
Rob Shearman 2007-12-25 19:07:49 +00:00 committed by Alexandre Julliard
parent cf6d95c1b8
commit 698ba6b4d4
1 changed files with 73 additions and 8 deletions

View File

@ -6001,13 +6001,44 @@ void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_SCONTEXT ContextHandle, NDR_SCONTEXT ContextHandle,
NDR_RUNDOWN RundownRoutine ) NDR_RUNDOWN RundownRoutine )
{ {
FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine); TRACE("(%p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine);
ALIGN_POINTER(pStubMsg->Buffer, 4);
if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength)
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p\n",
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
NDRSContextMarshall2(pStubMsg->RpcMsg->Handle, ContextHandle,
pStubMsg->Buffer, RundownRoutine, NULL, 0);
pStubMsg->Buffer += cbNDRContext;
} }
NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg) NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
{ {
FIXME("(%p): stub\n", pStubMsg); NDR_SCONTEXT ContextHandle;
return NULL;
TRACE("(%p)\n", pStubMsg);
ALIGN_POINTER(pStubMsg->Buffer, 4);
if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength)
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p\n",
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
ContextHandle = NDRSContextUnmarshall2(pStubMsg->RpcMsg->Handle,
pStubMsg->Buffer,
pStubMsg->RpcMsg->DataRepresentation,
NULL, 0);
pStubMsg->Buffer += cbNDRContext;
return ContextHandle;
} }
void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg, void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
@ -6020,8 +6051,9 @@ void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
FIXME("(%p, %p): stub\n", pStubMsg, pFormat); TRACE("(%p, %p)\n", pStubMsg, pFormat);
return NULL; return NDRSContextUnmarshall2(pStubMsg->RpcMsg->Handle, NULL,
pStubMsg->RpcMsg->DataRepresentation, NULL, 0);
} }
void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg, void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
@ -6029,12 +6061,45 @@ void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_RUNDOWN RundownRoutine, NDR_RUNDOWN RundownRoutine,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat); TRACE("(%p, %p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
ALIGN_POINTER(pStubMsg->Buffer, 4);
if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength)
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p\n",
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* FIXME: do something with pFormat */
NDRSContextMarshall2(pStubMsg->RpcMsg->Handle, ContextHandle,
pStubMsg->Buffer, RundownRoutine, NULL, 0);
pStubMsg->Buffer += cbNDRContext;
} }
NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
FIXME("(%p, %p): stub\n", pStubMsg, pFormat); NDR_SCONTEXT ContextHandle;
return NULL;
TRACE("(%p, %p)\n", pStubMsg, pFormat);
ALIGN_POINTER(pStubMsg->Buffer, 4);
if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength)
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p\n",
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* FIXME: do something with pFormat */
ContextHandle = NDRSContextUnmarshall2(pStubMsg->RpcMsg->Handle,
pStubMsg->Buffer,
pStubMsg->RpcMsg->DataRepresentation,
NULL, 0);
pStubMsg->Buffer += cbNDRContext;
return ContextHandle;
} }