Commit 28356337 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Implement proxy manager.

parent ffc55dad
......@@ -226,6 +226,7 @@ APARTMENT* COM_CreateApartment(DWORD model)
else
apt = NtCurrentTeb()->ReservedForOle;
list_init(&apt->proxies);
list_init(&apt->stubmgrs);
apt->oidc = 1;
......@@ -263,6 +264,14 @@ static void COM_DestroyApartment(APARTMENT *apt)
apt->prev = NULL; apt->next = NULL;
LeaveCriticalSection(&csApartment);
if (apt->model & COINIT_APARTMENTTHREADED) {
/* disconnect proxies to release the corresponding stubs.
* It is confirmed in "Essential COM" in the sub-chapter on
* "Lifecycle Management and Marshalling" that the native version also
* disconnects proxies in this function. */
/* FIXME: this should also be called for MTA destruction, but that
* requires restructuring how apartments work slightly. */
MARSHAL_Disconnect_Proxies(apt);
if (apt->win) DestroyWindow(apt->win);
DeleteCriticalSection(&apt->cs);
}
......@@ -545,14 +554,6 @@ void WINAPI CoUninitialize(void)
RunningObjectTableImpl_UnInitialize();
/* disconnect proxies to release the corresponding stubs.
* It is confirmed in "Essential COM" in the sub-chapter on
* "Lifecycle Management and Marshalling" that the native version also
* does some kind of proxy cleanup in this function.
* FIXME: does it just disconnect or completely destroy the proxies?
* FIXME: should this be in the apartment destructor? */
MARSHAL_Disconnect_Proxies();
/* Release the references to the registered class objects */
COM_RevokeAllClasses();
......
......@@ -68,29 +68,30 @@ typedef struct tagXOBJECT {
DWORD refs; /* external reference count */
} XOBJECT;
/* imported interface */
typedef struct tagIIF {
struct tagIIF *next;
/* imported interface proxy */
struct ifproxy
{
struct list entry;
LPVOID iface; /* interface pointer */
IID iid; /* interface ID */
IPID ipid; /* imported interface ID */
LPRPCPROXYBUFFER proxy; /* interface proxy */
DWORD refs; /* imported (public) references */
HRESULT hres; /* result of proxy creation attempt */
} IIF;
};
/* imported object */
typedef struct tagIOBJECT {
IRemUnknownVtbl *lpVtbl;
/* imported object / proxy manager */
struct proxy_manager
{
const IInternalUnknownVtbl *lpVtbl;
struct tagAPARTMENT *parent;
struct tagIOBJECT *next;
struct list entry;
LPRPCCHANNELBUFFER chan; /* channel to object */
OXID oxid; /* object exported ID */
OID oid; /* object ID */
IPID ipid; /* first imported interface ID */
IIF *ifaces; /* imported interfaces */
struct list interfaces; /* imported interfaces */
DWORD refs; /* proxy reference count */
} IOBJECT;
CRITICAL_SECTION cs; /* thread safety for this object and children */
};
/* apartment */
typedef struct tagAPARTMENT {
......@@ -105,7 +106,7 @@ typedef struct tagAPARTMENT {
CRITICAL_SECTION cs; /* thread safety */
LPMESSAGEFILTER filter; /* message filter */
XOBJECT *objs; /* exported objects */
IOBJECT *proxies; /* imported objects */
struct list proxies; /* imported objects */
LPUNKNOWN state; /* state object (see Co[Get,Set]State) */
LPVOID ErrorInfo; /* thread error info */
DWORD listenertid; /* id of apartment_listener_thread */
......@@ -139,7 +140,7 @@ MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) {
;
}
HRESULT MARSHAL_Disconnect_Proxies(void);
HRESULT MARSHAL_Disconnect_Proxies(APARTMENT *apt);
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
/* an interface stub */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment