diff --git a/reactos/lib/rpcrt4/ndr_midl.c b/reactos/lib/rpcrt4/ndr_midl.c index 76f972b69f4..f2929b8937c 100644 --- a/reactos/lib/rpcrt4/ndr_midl.c +++ b/reactos/lib/rpcrt4/ndr_midl.c @@ -233,12 +233,12 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buflen, RPC_BINDING_HANDLE handle) { TRACE("(stubmsg == ^%p, buflen == %lu, handle == %p): wild guess.\n", stubmsg, buflen, handle); - + assert( stubmsg && stubmsg->RpcMsg ); /* I guess this is our chance to put the binding handle into the RPC_MESSAGE */ stubmsg->RpcMsg->Handle = handle; - + stubmsg->RpcMsg->BufferLength = buflen; if (I_RpcGetBuffer(stubmsg->RpcMsg) != S_OK) return NULL; @@ -248,6 +248,7 @@ unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buf stubmsg->BufferEnd = stubmsg->Buffer + stubmsg->BufferLength; return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer); } + /*********************************************************************** * NdrFreeBuffer [RPCRT4.@] */ @@ -262,28 +263,34 @@ void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg) /************************************************************************ * NdrSendReceive [RPCRT4.@] */ -unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char *buffer ) +unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *pStubMsg, unsigned char *buffer ) { - TRACE("(stubmsg == ^%p, buffer == ^%p)\n", stubmsg, buffer); + TRACE("(pStubMsg == ^%p, buffer == ^%p)\n", pStubMsg, buffer); /* FIXME: how to handle errors? (raise exception?) */ - if (!stubmsg) { + if (!pStubMsg) { ERR("NULL stub message. No action taken.\n"); return NULL; } - if (!stubmsg->RpcMsg) { + if (!pStubMsg->RpcMsg) { ERR("RPC Message not present in stub message. No action taken.\n"); return NULL; } /* FIXME: Seems wrong. Where should this really come from, and when? */ - stubmsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION; + pStubMsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION; - if (I_RpcSendReceive(stubmsg->RpcMsg) != RPC_S_OK) { + if (I_RpcSendReceive(pStubMsg->RpcMsg) != RPC_S_OK) { WARN("I_RpcSendReceive did not return success.\n"); /* FIXME: raise exception? */ + return NULL; } + pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength; + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; + /* FIXME: is this the right return value? */ return NULL; }