[PATCH 2/5] rpcrt4: Set CorrDespIncrement to the size of the (non-range) /robust payload.

Huw Davies huw at codeweavers.com
Mon Jul 13 06:49:08 CDT 2015


fHasNewCorrDesc is only set on older versions of Windows that don't
set CorrDespIncrement, but it can't hurt to continue to set it.
---
 dlls/rpcrt4/ndr_marshall.c       |  6 +++++-
 dlls/rpcrt4/tests/ndr_marshall.c | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 0ba5b00..35c15a1 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -7206,7 +7206,11 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
  */
 void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
 {
-    FIXME("(%p, %p, %d, 0x%x): stub\n", pStubMsg, pMemory, CacheSize, Flags);
+    FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
+
+    if (pStubMsg->CorrDespIncrement == 0)
+        pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
+
     pStubMsg->fHasNewCorrDesc = TRUE;
 }
 
diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c
index a9c16b2..76d72a0 100644
--- a/dlls/rpcrt4/tests/ndr_marshall.c
+++ b/dlls/rpcrt4/tests/ndr_marshall.c
@@ -2468,6 +2468,24 @@ if (status == RPC_S_OK)
     ok(status == RPC_S_OK, "got %d\n", status);
 }
 
+static void test_NdrCorrelationInitialize(void)
+{
+    MIDL_STUB_MESSAGE stub_msg;
+    BYTE buf[256];
+
+    memset( &stub_msg, 0, sizeof(stub_msg) );
+    memset( buf, 0, sizeof(buf) );
+
+    NdrCorrelationInitialize( &stub_msg, buf, sizeof(buf), 0 );
+    ok( stub_msg.CorrDespIncrement == 2 ||
+        broken(stub_msg.CorrDespIncrement == 0), /* <= Win 2003 */
+        "got %d\n", stub_msg.CorrDespIncrement );
+
+    stub_msg.CorrDespIncrement = 1;
+    NdrCorrelationInitialize( &stub_msg, buf, sizeof(buf), 0 );
+    ok( stub_msg.CorrDespIncrement == 1, "got %d\n", stub_msg.CorrDespIncrement );
+}
+
 START_TEST( ndr_marshall )
 {
     determine_pointer_marshalling_style();
@@ -2489,4 +2507,5 @@ START_TEST( ndr_marshall )
     test_NdrMapCommAndFaultStatus();
     test_NdrGetUserMarshalInfo();
     test_MesEncodeFixedBufferHandleCreate();
+    test_NdrCorrelationInitialize();
 }
-- 
1.8.0




More information about the wine-patches mailing list