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) ...@@ -226,6 +226,7 @@ APARTMENT* COM_CreateApartment(DWORD model)
else else
apt = NtCurrentTeb()->ReservedForOle; apt = NtCurrentTeb()->ReservedForOle;
list_init(&apt->proxies);
list_init(&apt->stubmgrs); list_init(&apt->stubmgrs);
apt->oidc = 1; apt->oidc = 1;
...@@ -263,6 +264,14 @@ static void COM_DestroyApartment(APARTMENT *apt) ...@@ -263,6 +264,14 @@ static void COM_DestroyApartment(APARTMENT *apt)
apt->prev = NULL; apt->next = NULL; apt->prev = NULL; apt->next = NULL;
LeaveCriticalSection(&csApartment); LeaveCriticalSection(&csApartment);
if (apt->model & COINIT_APARTMENTTHREADED) { 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); if (apt->win) DestroyWindow(apt->win);
DeleteCriticalSection(&apt->cs); DeleteCriticalSection(&apt->cs);
} }
...@@ -545,14 +554,6 @@ void WINAPI CoUninitialize(void) ...@@ -545,14 +554,6 @@ void WINAPI CoUninitialize(void)
RunningObjectTableImpl_UnInitialize(); 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 */ /* Release the references to the registered class objects */
COM_RevokeAllClasses(); COM_RevokeAllClasses();
......
...@@ -68,29 +68,30 @@ typedef struct tagXOBJECT { ...@@ -68,29 +68,30 @@ typedef struct tagXOBJECT {
DWORD refs; /* external reference count */ DWORD refs; /* external reference count */
} XOBJECT; } XOBJECT;
/* imported interface */ /* imported interface proxy */
typedef struct tagIIF { struct ifproxy
struct tagIIF *next; {
struct list entry;
LPVOID iface; /* interface pointer */ LPVOID iface; /* interface pointer */
IID iid; /* interface ID */ IID iid; /* interface ID */
IPID ipid; /* imported interface ID */ IPID ipid; /* imported interface ID */
LPRPCPROXYBUFFER proxy; /* interface proxy */ LPRPCPROXYBUFFER proxy; /* interface proxy */
DWORD refs; /* imported (public) references */ DWORD refs; /* imported (public) references */
HRESULT hres; /* result of proxy creation attempt */ };
} IIF;
/* imported object */ /* imported object / proxy manager */
typedef struct tagIOBJECT { struct proxy_manager
IRemUnknownVtbl *lpVtbl; {
const IInternalUnknownVtbl *lpVtbl;
struct tagAPARTMENT *parent; struct tagAPARTMENT *parent;
struct tagIOBJECT *next; struct list entry;
LPRPCCHANNELBUFFER chan; /* channel to object */ LPRPCCHANNELBUFFER chan; /* channel to object */
OXID oxid; /* object exported ID */ OXID oxid; /* object exported ID */
OID oid; /* object ID */ OID oid; /* object ID */
IPID ipid; /* first imported interface ID */ struct list interfaces; /* imported interfaces */
IIF *ifaces; /* imported interfaces */
DWORD refs; /* proxy reference count */ DWORD refs; /* proxy reference count */
} IOBJECT; CRITICAL_SECTION cs; /* thread safety for this object and children */
};
/* apartment */ /* apartment */
typedef struct tagAPARTMENT { typedef struct tagAPARTMENT {
...@@ -105,7 +106,7 @@ typedef struct tagAPARTMENT { ...@@ -105,7 +106,7 @@ typedef struct tagAPARTMENT {
CRITICAL_SECTION cs; /* thread safety */ CRITICAL_SECTION cs; /* thread safety */
LPMESSAGEFILTER filter; /* message filter */ LPMESSAGEFILTER filter; /* message filter */
XOBJECT *objs; /* exported objects */ XOBJECT *objs; /* exported objects */
IOBJECT *proxies; /* imported objects */ struct list proxies; /* imported objects */
LPUNKNOWN state; /* state object (see Co[Get,Set]State) */ LPUNKNOWN state; /* state object (see Co[Get,Set]State) */
LPVOID ErrorInfo; /* thread error info */ LPVOID ErrorInfo; /* thread error info */
DWORD listenertid; /* id of apartment_listener_thread */ DWORD listenertid; /* id of apartment_listener_thread */
...@@ -139,7 +140,7 @@ MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) { ...@@ -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); HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
/* an interface stub */ /* 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