out-of-process COM design

Mike Hearn mh at codeweavers.com
Sat Dec 18 11:05:21 CST 2004


On Sat, 18 Dec 2004 07:46:42 -0800, Bill Medland wrote:
> If I combine it with Rob's CoInitializeEx patch rather than Mike's then it executes but still fails, as follows:

Try this patch. It's a modified form of Robs:

Index: dlls/ole32/rpc.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/rpc.c,v
retrieving revision 1.31
diff -u -p -d -r1.31 rpc.c
--- dlls/ole32/rpc.c	14 Dec 2004 15:28:58 -0000	1.31
+++ dlls/ole32/rpc.c	18 Dec 2004 16:59:43 -0000
@@ -758,9 +758,10 @@ static DWORD WINAPI listener_thread(LPVO
 {
     char		pipefn[200];
     HANDLE		listenPipe;
+    APARTMENT          *apt = (APARTMENT *) param;
 
-    sprintf(pipefn,OLESTUBMGR"_%08lx",GetCurrentProcessId());
-    TRACE("Process listener thread starting on (%s)\n",pipefn);
+    sprintf(pipefn,OLESTUBMGR"_%08lx%08lx", apt->oxid >> 32, apt->oxid);
+    TRACE("Apartment listener thread starting on (%s)\n",pipefn);
 
     while (1) {
 	listenPipe = CreateNamedPipeA(
@@ -789,13 +790,10 @@ static DWORD WINAPI listener_thread(LPVO
 
 void start_listener_thread()
 {
-  static BOOL running = FALSE;
-  DWORD tid;
-
-  if (!running)
-  {
-      running = TRUE;
-      CreateThread(NULL, 0, listener_thread, NULL, 0, &tid);
-      Sleep(2000); /* actually we just try opening the pipe until it succeeds */
-  }
+    APARTMENT *apt = COM_CurrentApt();
+    
+    if (!apt->tid)
+    {
+        CreateThread(NULL, 0, listener_thread, apt, 0, &apt->tid);
+    }
 }





More information about the wine-devel mailing list