Robert Shearman : rpcrt4: Change call_memory_sizer to preserve the buffer contents and

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 9 16:18:50 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 88bbbed176807010312c96ee8e5d2ead06a2fc9d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=88bbbed176807010312c96ee8e5d2ead06a2fc9d

Author: Robert Shearman <rob at codeweavers.com>
Date:   Wed Aug  9 18:17:00 2006 +0100

rpcrt4: Change call_memory_sizer to preserve the buffer contents and
initialise the memory size field to zero before calling the memory
sizer function.

---

 dlls/rpcrt4/ndr_stubless.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index 9206c38..3b1c071 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -94,7 +94,18 @@ static inline void call_freer(PMIDL_STUB
 static inline unsigned long call_memory_sizer(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 {
     NDR_MEMORYSIZE m = NdrMemorySizer[pFormat[0] & NDR_TABLE_MASK];
-    if (m) return m(pStubMsg, pFormat);
+    if (m)
+    {
+        unsigned char *saved_buffer = pStubMsg->Buffer;
+        unsigned long ret;
+        int saved_ignore_embedded_pointers = pStubMsg->IgnoreEmbeddedPointers;
+        pStubMsg->MemorySize = 0;
+        pStubMsg->IgnoreEmbeddedPointers = 1;
+        ret = m(pStubMsg, pFormat);
+        pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded_pointers;
+        pStubMsg->Buffer = saved_buffer;
+        return ret;
+    }
     else
     {
         FIXME("format type 0x%x not implemented\n", pFormat[0]);




More information about the wine-cvs mailing list