[ros-diffs] [ekohl] 14442: NdrSendReceive: Update the message buffer info after the call to I_RpcSendReceive.

ekohl at svn.reactos.com ekohl at svn.reactos.com
Sat Apr 2 17:11:39 CEST 2005


NdrSendReceive: Update the message buffer info after the call to
I_RpcSendReceive.
Modified: trunk/reactos/lib/rpcrt4/ndr_midl.c
  _____  

Modified: trunk/reactos/lib/rpcrt4/ndr_midl.c
--- trunk/reactos/lib/rpcrt4/ndr_midl.c	2005-04-02 14:26:56 UTC (rev
14441)
+++ trunk/reactos/lib/rpcrt4/ndr_midl.c	2005-04-02 15:11:36 UTC (rev
14442)
@@ -233,12 +233,12 @@

 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 @@
   stubmsg->BufferEnd = stubmsg->Buffer + stubmsg->BufferLength;
   return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer);
 }
+
 
/***********************************************************************
  *           NdrFreeBuffer [RPCRT4.@]
  */
@@ -262,28 +263,34 @@
 
/***********************************************************************
*
  *           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;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050402/24c7cb5e/attachment.html


More information about the Ros-diffs mailing list