From 76dc3b64ae10f94d71510f7c3b787a33a66b6c0f Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 13 Jul 2015 13:11:36 +0100 Subject: [PATCH] rpcrt4: Set CorrDespIncrement to the size of the (non-range) /robust payload. 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 | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 0ba5b009900..35c15a1de2c 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 a9c16b26bfa..d6befe51aa3 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -2468,6 +2468,27 @@ 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 ); + + memset( &stub_msg, 0, sizeof(stub_msg) ); + memset( buf, 0, sizeof(buf) ); + + 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 +2510,5 @@ START_TEST( ndr_marshall ) test_NdrMapCommAndFaultStatus(); test_NdrGetUserMarshalInfo(); test_MesEncodeFixedBufferHandleCreate(); + test_NdrCorrelationInitialize(); }