yet more rpc stuff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Log:
Ove Kaaven <ovek@transgaming.com>
For RPC servers, don't deallocate the RPC request packet before the RPC
reply packet is sent, in case marshalling the reply needs any of the
request data.

Index: dlls/rpcrt4/rpc_message.c
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpc_message.c,v
retrieving revision 1.5
diff -u -r1.5 rpc_message.c
--- dlls/rpcrt4/rpc_message.c	19 Feb 2003 03:44:35 -0000	1.5
+++ dlls/rpcrt4/rpc_message.c	20 May 2003 15:17:15 -0000
@@ -46,11 +46,19 @@
  */
 RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
 {
+  RpcBinding* bind = (RpcBinding*)pMsg->Handle;
   void* buf;
 
   TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength);
   /* FIXME: pfnAllocate? */
-  buf = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->BufferLength);
+  if (bind->server) {
+    /* it turns out that the original buffer data must still be available
+     * while the RPC server is marshalling a reply, so we should not deallocate
+     * it, we'll leave deallocating the original buffer to the RPC server */
+    buf = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
+  } else {
+    buf = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->BufferLength);
+  }
   TRACE("Buffer=%p\n", buf);
   if (buf) pMsg->Buffer = buf;
   /* FIXME: which errors to return? */
@@ -62,7 +70,7 @@
  */
 RPC_STATUS WINAPI I_RpcFreeBuffer(PRPC_MESSAGE pMsg)
 {
-  TRACE("(%p)\n", pMsg);
+  TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer);
   /* FIXME: pfnFree? */
   HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
   pMsg->Buffer = NULL;
Index: dlls/rpcrt4/rpc_server.c
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpc_server.c,v
retrieving revision 1.15
diff -u -r1.15 rpc_server.c
--- dlls/rpcrt4/rpc_server.c	19 Apr 2003 20:06:42 -0000	1.15
+++ dlls/rpcrt4/rpc_server.c	20 May 2003 15:17:15 -0000
@@ -171,7 +171,10 @@
   }
 
   /* clean up */
-  HeapFree(GetProcessHeap(), 0, msg.Buffer);
+  if (msg.Buffer == buf) msg.Buffer = NULL;
+  TRACE("freeing Buffer=%p\n", buf);
+  HeapFree(GetProcessHeap(), 0, buf);
+  I_RpcFreeBuffer(&msg);
   msg.Buffer = NULL;
 }
 





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux