Rob Shearman : ole32: Call the message filter for incoming calls.

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


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

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

ole32: Call the message filter for incoming calls.

---

 dlls/ole32/rpc.c           |   41 +++++++++++++++++++++++++++++++++++++++--
 dlls/ole32/tests/marshal.c |    2 +-
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 64269c0..5d66891 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -931,13 +931,15 @@ static HRESULT unmarshal_ORPCTHIS(RPC_ME
 
 void RPC_ExecuteCall(struct dispatch_params *params)
 {
-    struct message_state *message_state;
+    struct message_state *message_state = NULL;
     RPC_MESSAGE *msg = (RPC_MESSAGE *)params->msg;
     char *original_buffer = msg->Buffer;
     ORPCTHIS orpcthis;
     ORPC_EXTENT_ARRAY orpc_ext_array;
     WIRE_ORPC_EXTENT *first_wire_orpc_extent;
 
+    /* handle ORPCTHIS and server extensions */
+
     params->hr = unmarshal_ORPCTHIS(msg, &orpcthis, &orpc_ext_array, &first_wire_orpc_extent);
     if (params->hr != S_OK)
         goto exit;
@@ -966,6 +968,41 @@ void RPC_ExecuteCall(struct dispatch_par
     msg->Handle = message_state;
     msg->BufferLength -= message_state->prefix_data_len;
 
+    /* call message filter */
+
+    if (COM_CurrentApt()->filter)
+    {
+        DWORD handlecall;
+        INTERFACEINFO interface_info;
+
+        interface_info.pUnk = NULL; /* FIXME */
+        interface_info.iid = IID_NULL; /* FIXME */
+        interface_info.wMethod = msg->ProcNum;
+        handlecall = IMessageFilter_HandleInComingCall(COM_CurrentApt()->filter,
+                                                       CALLTYPE_TOPLEVEL /* FIXME */,
+                                                       (HTASK)GetCurrentProcessId(),
+                                                       0 /* FIXME */,
+                                                       &interface_info);
+        TRACE("IMessageFilter_HandleInComingCall returned %d\n", handlecall);
+        switch (handlecall)
+        {
+        case SERVERCALL_REJECTED:
+            params->hr = RPC_E_CALL_REJECTED;
+            goto exit;
+        case SERVERCALL_RETRYLATER:
+#if 0 /* FIXME: handle retries on the client side before enabling this code */
+            params->hr = RPC_E_RETRY;
+            goto exit;
+#else
+            FIXME("retry call later not implemented\n");
+            break;
+#endif
+        case SERVERCALL_ISHANDLED:
+        default:
+            break;
+        }
+    }
+
     /* invoke the method */
 
     params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
@@ -974,9 +1011,9 @@ void RPC_ExecuteCall(struct dispatch_par
     msg->Handle = message_state->binding_handle;
     msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
     msg->BufferLength += message_state->prefix_data_len;
-    HeapFree(GetProcessHeap(), 0, message_state);
 
 exit:
+    HeapFree(GetProcessHeap(), 0, message_state);
     IRpcStubBuffer_Release(params->stub);
     IRpcChannelBuffer_Release(params->chan);
     if (params->handle) SetEvent(params->handle);
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index c1e81f3..aa71790 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -1290,7 +1290,7 @@ static void test_message_filter(void)
     ok_more_than_one_lock();
 
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (LPVOID*)&proxy);
-    todo_wine { ok(hr == RPC_E_CALL_REJECTED, "Call should have returned RPC_E_CALL_REJECTED, but return 0x%08x instead\n", hr); }
+    ok(hr == RPC_E_CALL_REJECTED, "Call should have returned RPC_E_CALL_REJECTED, but return 0x%08x instead\n", hr);
     if (proxy) IUnknown_Release(proxy);
     proxy = NULL;
 




More information about the wine-cvs mailing list