Robert Shearman : rpcrt4: Implement NdrComplexArrayMemorySize.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 15 07:35:11 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: cedbddbfde27fa7fa1b31cd351dd4ac400c397a1
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=cedbddbfde27fa7fa1b31cd351dd4ac400c397a1

Author: Robert Shearman <rob at codeweavers.com>
Date:   Sat May 13 16:59:20 2006 +0100

rpcrt4: Implement NdrComplexArrayMemorySize.

---

 dlls/rpcrt4/ndr_marshall.c |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 7897695..72634b1 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -2374,8 +2374,13 @@ void WINAPI NdrComplexArrayBufferSize(PM
 unsigned long WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
                                                PFORMAT_STRING pFormat)
 {
-  DWORD size = 0;
-  FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
+  ULONG count, esize;
+  unsigned char alignment;
+  unsigned char *Buffer;
+  unsigned long SavedMemorySize;
+  unsigned long MemorySize;
+
+  TRACE("(%p,%p)\n", pStubMsg, pFormat);
 
   if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
   {
@@ -2384,15 +2389,30 @@ unsigned long WINAPI NdrComplexArrayMemo
       return 0;
   }
 
+  alignment = pFormat[1] + 1;
+
   pFormat += 4;
 
   pFormat = ReadConformance(pStubMsg, pFormat);
-  size = pStubMsg->MaxCount;
-  TRACE("conformance=%ld\n", size);
+  pFormat = ReadVariance(pStubMsg, pFormat);
 
-  pFormat += 4;
+  ALIGN_POINTER(pStubMsg->Buffer, alignment);
 
-  return 0;
+  SavedMemorySize = pStubMsg->MemorySize;
+
+  Buffer = pStubMsg->Buffer;
+  esize = ComplexStructSize(pStubMsg, pFormat);
+  pStubMsg->Buffer = Buffer;
+
+  MemorySize = esize * pStubMsg->MaxCount;
+
+  for (count = 0; count < pStubMsg->ActualCount; count++)
+    ComplexStructSize(pStubMsg, pFormat);
+
+  pStubMsg->MemorySize = SavedMemorySize;
+
+  pStubMsg->MemorySize += MemorySize;
+  return MemorySize;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list