Rob Shearman : rpcrt4: Set the memory pointer in NdrBaseTypeUnmarshall to the buffer if we' re unmarshalling on a server without memory being passed in.
Alexandre Julliard
julliard at winehq.org
Wed Dec 5 06:57:03 CST 2007
Module: wine
Branch: master
Commit: 13e47d762aec935687d9a0c1b08e10dc37889ed9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=13e47d762aec935687d9a0c1b08e10dc37889ed9
Author: Rob Shearman <rob at codeweavers.com>
Date: Wed Dec 5 11:56:32 2007 +0000
rpcrt4: Set the memory pointer in NdrBaseTypeUnmarshall to the buffer if we're unmarshalling on a server without memory being passed in.
---
dlls/rpcrt4/ndr_marshall.c | 16 ++++++++++++----
dlls/rpcrt4/tests/ndr_marshall.c | 4 ----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 3e5021a..3f991ce 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -5463,10 +5463,18 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
#define BASE_TYPE_UNMARSHALL(type) \
ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \
- if (fMustAlloc || !*ppMemory) \
- *ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
- TRACE("*ppMemory: %p\n", *ppMemory); \
- **(type **)ppMemory = *(type *)pStubMsg->Buffer; \
+ if (!fMustAlloc && !pStubMsg->IsClient && !*ppMemory) \
+ { \
+ *ppMemory = pStubMsg->Buffer; \
+ TRACE("*ppMemory: %p\n", *ppMemory); \
+ } \
+ else \
+ { \
+ if (fMustAlloc) \
+ *ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
+ TRACE("*ppMemory: %p\n", *ppMemory); \
+ **(type **)ppMemory = *(type *)pStubMsg->Buffer; \
+ } \
pStubMsg->Buffer += sizeof(type);
switch(*pFormat)
diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c
index 25448e9..d2ea543 100644
--- a/dlls/rpcrt4/tests/ndr_marshall.c
+++ b/dlls/rpcrt4/tests/ndr_marshall.c
@@ -250,17 +250,13 @@ todo_wine {
if (formattypes[2] == 0xd /* FC_ENUM16 */)
ok(mem != StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem points to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
else
-todo_wine {
ok(mem == StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem doesn't point to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
- }
ok(!cmp(mem, memsrc, size), "%s: incorrecly unmarshaled\n", msgpfx);
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
if (formattypes[2] != 0xd /* FC_ENUM16 */) {
-todo_wine {
ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
my_alloc_called = 0;
- }
}
}
HeapFree(GetProcessHeap(), 0, mem_orig);
More information about the wine-cvs
mailing list