Module: wine Branch: refs/heads/master Commit: f0aea2d5eebe07cdd6c63f04d7a9c08f869749b6 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f0aea2d5eebe07cdd6c63f04...
Author: Robert Shearman rob@codeweavers.com Date: Mon May 15 13:35:07 2006 +0100
rpcrt4: Rename ComplexStructSize to ComplexStructMemorySize to reflect the fact that it increments the buffer.
Replace the code in EmbeddedComplexSize that sizes non-encapsulated unions without using a memory sizer routine, since this function shouldn't touch the buffer.
Add a new function EmbeddedComplexMemorySize and use it in some memory sizer routines where EmbeddedComplexSize was previously used.
---
dlls/rpcrt4/ndr_marshall.c | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 678c38f..5681430 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1523,7 +1523,14 @@ unsigned long WINAPI EmbeddedComplexSize case RPC_FC_USER_MARSHAL: return *(const WORD*)&pFormat[4]; case RPC_FC_NON_ENCAPSULATED_UNION: - return NdrNonEncapsulatedUnionMemorySize(pStubMsg, pFormat); + pFormat += 2; + if (pStubMsg->fHasNewCorrDesc) + pFormat += 6; + else + pFormat += 4; + + pFormat += *(const SHORT*)pFormat; + return *(const SHORT*)pFormat; default: FIXME("unhandled embedded type %02x\n", *pFormat); } @@ -1531,6 +1538,21 @@ unsigned long WINAPI EmbeddedComplexSize }
+unsigned long WINAPI EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + PFORMAT_STRING pFormat) +{ + NDR_MEMORYSIZE m = NdrMemorySizer[*pFormat & NDR_TABLE_MASK]; + + if (!m) + { + FIXME("no memorysizer for data type=%02x\n", *pFormat); + return 0; + } + + return m(pStubMsg, pFormat); +} + + unsigned char * WINAPI ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, @@ -1776,7 +1798,7 @@ unsigned char * WINAPI ComplexFree(PMIDL return pMemory; }
-unsigned long WINAPI ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, +unsigned long WINAPI ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { PFORMAT_STRING desc; @@ -1814,7 +1836,7 @@ unsigned long WINAPI ComplexStructSize(P size += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; - size += EmbeddedComplexSize(pStubMsg, desc); + size += EmbeddedComplexMemorySize(pStubMsg, desc); pFormat += 2; continue; case RPC_FC_PAD: @@ -1940,7 +1962,6 @@ unsigned long WINAPI NdrComplexStructMem unsigned size = *(const WORD*)(pFormat+2); PFORMAT_STRING conf_array = NULL; PFORMAT_STRING pointer_desc = NULL; - unsigned long saved_memory_size;
TRACE("(%p,%p)\n", pStubMsg, pFormat);
@@ -1952,9 +1973,7 @@ unsigned long WINAPI NdrComplexStructMem if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2;
- saved_memory_size = pStubMsg->MemorySize; - ComplexStructSize(pStubMsg, pFormat); - pStubMsg->MemorySize = saved_memory_size; + ComplexStructMemorySize(pStubMsg, pFormat);
if (conf_array) NdrConformantArrayMemorySize(pStubMsg, conf_array); @@ -2333,7 +2352,7 @@ unsigned char * WINAPI NdrComplexArrayUn pFormat = ReadVariance(pStubMsg, pFormat);
Buffer = pStubMsg->Buffer; - esize = ComplexStructSize(pStubMsg, pFormat); + esize = ComplexStructMemorySize(pStubMsg, pFormat); pStubMsg->Buffer = Buffer;
if (fMustAlloc || !*ppMemory) @@ -2426,13 +2445,13 @@ unsigned long WINAPI NdrComplexArrayMemo SavedMemorySize = pStubMsg->MemorySize;
Buffer = pStubMsg->Buffer; - esize = ComplexStructSize(pStubMsg, pFormat); + esize = ComplexStructMemorySize(pStubMsg, pFormat); pStubMsg->Buffer = Buffer;
MemorySize = esize * pStubMsg->MaxCount;
for (count = 0; count < pStubMsg->ActualCount; count++) - ComplexStructSize(pStubMsg, pFormat); + ComplexStructMemorySize(pStubMsg, pFormat);
pStubMsg->MemorySize = SavedMemorySize;