Hi,
RFC ... since its likely not the clean way Robert wants.
This defers the appartment window creation until it is actually need.
Ciao, Marcus
Changelog:
Defer OLE apartment window creation until it is actually
needed.
Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.168
diff -u -r1.168 compobj.c
--- dlls/ole32/compobj.c 12 Nov 2005 19:11:21 -0000 1.168
+++ dlls/ole32/compobj.c 20 Dec 2005 22:06:39 -0000
@@ -236,9 +236,6 @@
{
/* FIXME: should be randomly generated by in an RPC call to rpcss */
apt->oxid = ((OXID)GetCurrentProcessId() << 32) | GetCurrentThreadId();
- apt->win = CreateWindowW(wszAptWinClass, NULL, 0,
- 0, 0, 0, 0,
- 0, 0, OLE32_hInstance, NULL);
}
else
{
@@ -257,6 +254,15 @@
return apt;
}
+void make_apartment_window(APARTMENT *apt) {
+ if (apt->win) return;
+ if (!(apt->model & COINIT_APARTMENTTHREADED))
+ return;
+ apt->win = CreateWindowW(wszAptWinClass, NULL, 0,
+ 0, 0, 0, 0,
+ 0, 0, OLE32_hInstance, NULL);
+}
+
/* gets and existing apartment if one exists or otherwise creates an apartment
* structure which stores OLE apartment-local information and stores a pointer
* to it in the thread-local storage */
Index: dlls/ole32/compobj_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj_private.h,v
retrieving revision 1.60
diff -u -r1.60 compobj_private.h
--- dlls/ole32/compobj_private.h 28 Nov 2005 11:04:18 -0000 1.60
+++ dlls/ole32/compobj_private.h 20 Dec 2005 22:06:39 -0000
@@ -253,6 +253,8 @@
return COM_CurrentInfo()->apt;
}
+void make_apartment_window(APARTMENT *apt);
+
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
/* helpers for debugging */
Index: dlls/ole32/rpc.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/rpc.c,v
retrieving revision 1.72
diff -u -r1.72 rpc.c
--- dlls/ole32/rpc.c 19 Dec 2005 20:24:25 -0000 1.72
+++ dlls/ole32/rpc.c 20 Dec 2005 22:06:39 -0000
@@ -257,6 +257,7 @@
TRACE("Calling apartment thread 0x%08lx...\n", apt->tid);
+ if (!apt->win) make_apartment_window(apt);
PostMessageW(apt->win, DM_EXECUTERPC, 0, (LPARAM)params);
}
else
@@ -498,6 +499,7 @@
TRACE("Calling apartment thread 0x%08lx...\n", apt->tid);
+ if (!apt->win) make_apartment_window(apt);
PostMessageW(apt->win, DM_EXECUTERPC, 0, (LPARAM)params);
WaitForSingleObject(params->handle, INFINITE);
CloseHandle(params->handle);