Rob Shearman : ole32: Call ServerNotify for channel hooks.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 20 08:54:58 CST 2006


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Dec 19 19:35:51 2006 +0000

ole32: Call ServerNotify for channel hooks.

Store the SChannelHookCallInfo structure in the message state.

---

 dlls/ole32/rpc.c |   64 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 7fe984d..64269c0 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -127,6 +127,7 @@ struct message_state
 {
     RPC_BINDING_HANDLE binding_handle;
     ULONG prefix_data_len;
+    SChannelHookCallInfo channel_hook_info;
 };
 
 typedef struct
@@ -243,6 +244,36 @@ static unsigned char * ChannelHooks_Clie
     return buffer;
 }
 
+static void ChannelHooks_ServerNotify(SChannelHookCallInfo *info,
+    DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent,
+    ULONG extension_count)
+{
+    struct channel_hook_entry *entry;
+    ULONG i;
+
+    EnterCriticalSection(&csChannelHook);
+
+    LIST_FOR_EACH_ENTRY(entry, &channel_hooks, struct channel_hook_entry, entry)
+    {
+        WIRE_ORPC_EXTENT *wire_orpc_extent;
+        for (i = 0, wire_orpc_extent = first_wire_orpc_extent;
+             i < extension_count;
+             i++, wire_orpc_extent = (WIRE_ORPC_EXTENT *)&wire_orpc_extent->data[wire_orpc_extent->conformance])
+        {
+            if (IsEqualGUID(&entry->id, &wire_orpc_extent->id))
+                break;
+        }
+        if (i == extension_count) wire_orpc_extent = NULL;
+
+        IChannelHook_ServerNotify(entry->hook, &entry->id, &info->iid,
+            wire_orpc_extent ? wire_orpc_extent->size : 0,
+            wire_orpc_extent ? wire_orpc_extent->data : NULL,
+            lDataRep);
+    }
+
+    LeaveCriticalSection(&csChannelHook);
+}
+
 HRESULT RPC_RegisterChannelHook(REFGUID rguid, IChannelHook *hook)
 {
     struct channel_hook_entry *entry;
@@ -360,7 +391,6 @@ static HRESULT WINAPI ClientRpcChannelBu
     struct channel_hook_buffer_data *channel_hook_data;
     unsigned int channel_hook_count;
     ULONG extension_count;
-    SChannelHookCallInfo channel_hook_info;
 
     TRACE("(%p)->(%p,%s)\n", This, olemsg, debugstr_guid(riid));
 
@@ -384,14 +414,14 @@ static HRESULT WINAPI ClientRpcChannelBu
     msg->Handle = This->bind;
     msg->RpcInterfaceInformation = cif;
 
-    channel_hook_info.iid = *riid;
-    channel_hook_info.cbSize = sizeof(channel_hook_info);
-    channel_hook_info.uCausality = GUID_NULL; /* FIXME */
-    channel_hook_info.dwServerPid = 0; /* FIXME */
-    channel_hook_info.iMethod = msg->ProcNum;
-    channel_hook_info.pObject = NULL; /* only present on server-side */
+    message_state->channel_hook_info.iid = *riid;
+    message_state->channel_hook_info.cbSize = sizeof(message_state->channel_hook_info);
+    message_state->channel_hook_info.uCausality = GUID_NULL; /* FIXME */
+    message_state->channel_hook_info.dwServerPid = 0; /* FIXME */
+    message_state->channel_hook_info.iMethod = msg->ProcNum;
+    message_state->channel_hook_info.pObject = NULL; /* only present on server-side */
 
-    extensions_size = ChannelHooks_ClientGetSize(&channel_hook_info,
+    extensions_size = ChannelHooks_ClientGetSize(&message_state->channel_hook_info,
         &channel_hook_data, &channel_hook_count, &extension_count);
 
     msg->BufferLength += FIELD_OFFSET(ORPCTHIS, extensions) + 4;
@@ -415,9 +445,9 @@ static HRESULT WINAPI ClientRpcChannelBu
 
         orpcthis->version.MajorVersion = COM_MAJOR_VERSION;
         orpcthis->version.MinorVersion = COM_MINOR_VERSION;
-        orpcthis->flags = channel_hook_info.dwServerPid ? ORPCF_LOCAL : ORPCF_NULL;
+        orpcthis->flags = message_state->channel_hook_info.dwServerPid ? ORPCF_LOCAL : ORPCF_NULL;
         orpcthis->reserved1 = 0;
-        orpcthis->cid = channel_hook_info.uCausality;
+        orpcthis->cid = message_state->channel_hook_info.uCausality;
 
         /* NDR representation of orpcthis->extensions */
         *(DWORD *)msg->Buffer = extensions_size ? 1 : 0;
@@ -436,7 +466,7 @@ static HRESULT WINAPI ClientRpcChannelBu
             *(DWORD *)msg->Buffer = (extension_count + 1) & ~1;
             msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
 
-            msg->Buffer = ChannelHooks_ClientFillBuffer(&channel_hook_info,
+            msg->Buffer = ChannelHooks_ClientFillBuffer(&message_state->channel_hook_info,
                 msg->Buffer, channel_hook_data, channel_hook_count);
 
             /* we must add a dummy extension if there is an odd extension
@@ -921,6 +951,18 @@ void RPC_ExecuteCall(struct dispatch_par
 
     message_state->prefix_data_len = original_buffer - (char *)msg->Buffer;
     message_state->binding_handle = msg->Handle;
+
+    message_state->channel_hook_info.iid = IID_NULL; /* FIXME */
+    message_state->channel_hook_info.cbSize = sizeof(message_state->channel_hook_info);
+    message_state->channel_hook_info.uCausality = orpcthis.cid;
+    message_state->channel_hook_info.dwServerPid = GetCurrentProcessId();
+    message_state->channel_hook_info.iMethod = msg->ProcNum;
+    message_state->channel_hook_info.pObject = NULL; /* FIXME */
+
+    if (orpcthis.extensions && first_wire_orpc_extent &&
+        orpcthis.extensions->size)
+        ChannelHooks_ServerNotify(&message_state->channel_hook_info, msg->DataRepresentation, first_wire_orpc_extent, orpcthis.extensions->size);
+
     msg->Handle = message_state;
     msg->BufferLength -= message_state->prefix_data_len;
 




More information about the wine-cvs mailing list