From 972ce2f6352a5acc82180ade30a1680730fbba3f Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Fri, 2 Jun 2006 20:42:54 +0100 Subject: [PATCH] rpcrt4: CContext can be NULL in NDRCContextMarshall, in which case we should marshall all-zeros. --- dlls/rpcrt4/ndr_marshall.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 5a1f057445f..c71401714c3 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -4476,21 +4476,29 @@ void WINAPI NDRCContextMarshall(NDR_CCONTEXT CContext, void *pBuff) TRACE("%p %p\n", CContext, pBuff); - EnterCriticalSection(&ndr_context_cs); - che = get_context_entry(CContext); - memcpy(pBuff, &che->wire_data, sizeof (ndr_context_handle)); - LeaveCriticalSection(&ndr_context_cs); + if (CContext) + { + EnterCriticalSection(&ndr_context_cs); + che = get_context_entry(CContext); + memcpy(pBuff, &che->wire_data, sizeof (ndr_context_handle)); + LeaveCriticalSection(&ndr_context_cs); + } + else + { + ndr_context_handle *wire_data = (ndr_context_handle *)pBuff; + wire_data->attributes = 0; + wire_data->uuid = GUID_NULL; + } } static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext, RPC_BINDING_HANDLE hBinding, ndr_context_handle *chi) { - static const GUID zeroguid = {0,0,0,{0,0,0,0,0,0,0,0}}; struct context_handle_entry *che = NULL; /* a null UUID means we should free the context handle */ - if (IsEqualGUID(&chi->uuid, &zeroguid)) + if (IsEqualGUID(&chi->uuid, &GUID_NULL)) { che = get_context_entry(*CContext); if (!che)