Robert Shearman : rpcrt4: CContext can be NULL in NDRCContextMarshall, in which case we should marshall all-zeros.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jun 3 05:24:28 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Jun  2 20:42:54 2006 +0100

rpcrt4: CContext can be NULL in NDRCContextMarshall, in which case we should marshall all-zeros.

---

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

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 5a1f057..c714017 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -4476,21 +4476,29 @@ void WINAPI NDRCContextMarshall(NDR_CCON
 
     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)




More information about the wine-cvs mailing list