mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:30:58 +00:00
rpcrt4: Re-use existing memory for embedded pointers in NdrConformantVaryingArrayUnmarshall.
This commit is contained in:
parent
a05923e1d3
commit
273766ee6f
|
@ -2864,6 +2864,8 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
|
|||
ULONG bufsize, memsize;
|
||||
unsigned char alignment = pFormat[1] + 1;
|
||||
DWORD esize = *(const WORD*)(pFormat+2);
|
||||
unsigned char *saved_buffer;
|
||||
ULONG offset;
|
||||
|
||||
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
||||
|
||||
|
@ -2881,13 +2883,16 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
|
|||
|
||||
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
||||
memsize = safe_multiply(esize, pStubMsg->MaxCount);
|
||||
offset = pStubMsg->Offset;
|
||||
|
||||
if (!*ppMemory || fMustAlloc)
|
||||
*ppMemory = NdrAllocate(pStubMsg, memsize);
|
||||
pStubMsg->BufferMark = pStubMsg->Buffer;
|
||||
safe_copy_from_buffer(pStubMsg, *ppMemory + pStubMsg->Offset, bufsize);
|
||||
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
|
||||
safe_buffer_increment(pStubMsg, bufsize);
|
||||
|
||||
EmbeddedPointerUnmarshall(pStubMsg, *ppMemory, *ppMemory, pFormat, TRUE /* FIXME */);
|
||||
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc);
|
||||
|
||||
memcpy(*ppMemory + offset, saved_buffer, bufsize);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1143,7 +1143,6 @@ array_tests(void)
|
|||
|
||||
api[0].pi = pi;
|
||||
get_numbers(1, 1, api);
|
||||
todo_wine
|
||||
ok(api[0].pi == pi, "RPC conformant varying array [out] pointer changed from %p to %p\n", pi, api[0].pi);
|
||||
ok(*api[0].pi == 0, "pi unmarshalled incorrectly %d\n", *pi);
|
||||
HeapFree(GetProcessHeap(), 0, pi);
|
||||
|
|
Loading…
Reference in a new issue