rpcrt4: Set the memory pointer in NdrBaseTypeUnmarshall to the buffer if we're unmarshalling on a server without memory being passed in.

This commit is contained in:
Rob Shearman 2007-12-05 11:56:32 +00:00 committed by Alexandre Julliard
parent 17132f7e1f
commit 13e47d762a
2 changed files with 12 additions and 8 deletions

View file

@ -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)

View file

@ -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);