Robert Shearman : ole: Join the MTA if necessary when executing an
RPC call.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 9 13:52:50 CST 2006
Module: wine
Branch: refs/heads/master
Commit: b75db2d9dee8bace87ef69ce0d38cf8714d4af7c
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=b75db2d9dee8bace87ef69ce0d38cf8714d4af7c
Author: Robert Shearman <rob at codeweavers.com>
Date: Mon Jan 9 18:41:19 2006 +0100
ole: Join the MTA if necessary when executing an RPC call.
Join the MTA if necessary when executing an RPC call to ensure that it
is executing with a valid apartment and won't fail for certain COM
calls.
---
dlls/ole32/compobj.c | 6 ++++++
dlls/ole32/compobj_private.h | 1 +
dlls/ole32/rpc.c | 13 +++++++++++++
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index d28728e..6f33091 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -422,6 +422,12 @@ static LRESULT CALLBACK apartment_wndpro
}
}
+void apartment_joinmta(void)
+{
+ apartment_addref(MTA);
+ COM_CurrentInfo()->apt = MTA;
+}
+
/*****************************************************************************
* This section contains OpenDllList implemantation
*/
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 14a33b7..c7a1069 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -228,6 +228,7 @@ static inline HRESULT apartment_getoxid(
*oxid = apt->oxid;
return S_OK;
}
+void apartment_joinmta(void);
/* DCOM messages used by the apartment window (not compatible with native) */
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 09fb902..ba8ad10 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -503,7 +503,20 @@ static void __RPC_STUB dispatch_rpc(RPC_
CloseHandle(params->handle);
}
else
+ {
+ BOOL joined = FALSE;
+ if (!COM_CurrentInfo()->apt)
+ {
+ apartment_joinmta();
+ joined = TRUE;
+ }
RPC_ExecuteCall(params);
+ if (joined)
+ {
+ apartment_release(COM_CurrentInfo()->apt);
+ COM_CurrentInfo()->apt = NULL;
+ }
+ }
HeapFree(GetProcessHeap(), 0, params);
More information about the wine-cvs
mailing list