rpcrt4: Change call_memory_sizer to preserve the buffer contents and

initialise the memory size field to zero before calling the memory
sizer function.
This commit is contained in:
Robert Shearman 2006-08-09 18:17:00 +01:00 committed by Alexandre Julliard
parent d29108c396
commit 88bbbed176
1 changed files with 12 additions and 1 deletions

View File

@ -94,7 +94,18 @@ static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemor
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]);