Commit 5ce396f9 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Remove obsolete structs, rearrange things to group the structs

together and to group similar functions. - Document thread-safety of members of structs.
parent ca608933
......@@ -39,54 +39,68 @@
#include "winternl.h"
struct apartment;
typedef struct apartment APARTMENT;
/* Thread-safety Annotation Legend:
*
* RO - The value is read only. It never changes after creation, so no
* locking is required.
* LOCK - The value is written to only using Interlocked* functions.
* CS - The value is read or written to with a critical section held.
* The identifier following "CS" is the specific critical section that
* must be used.
*/
/* an interface stub */
struct ifstub
{
struct list entry; /* entry in stub_manager->ifstubs list (CS stub_manager->lock) */
IRpcStubBuffer *stubbuffer; /* RO */
IID iid; /* RO */
IPID ipid; /* RO */
IUnknown *iface; /* RO */
BOOL table; /* CS stub_manager->lock */
};
/* exported interface */
typedef struct tagXIF {
struct tagXIF *next;
LPVOID iface; /* interface pointer */
IID iid; /* interface ID */
IPID ipid; /* exported interface ID */
LPRPCSTUBBUFFER stub; /* interface stub */
DWORD refs; /* external reference count */
HRESULT hres; /* result of stub creation attempt */
} XIF;
/* exported object */
typedef struct tagXOBJECT {
IRpcStubBufferVtbl *lpVtbl;
struct apartment *parent;
struct tagXOBJECT *next;
LPUNKNOWN obj; /* object identity (IUnknown) */
OID oid; /* object ID */
DWORD ifc; /* interface ID counter */
XIF *ifaces; /* exported interfaces */
DWORD refs; /* external reference count */
} XOBJECT;
/* stub managers hold refs on the object and each interface stub */
struct stub_manager
{
struct list entry; /* entry in apartment stubmgr list (CS apt->cs) */
struct list ifstubs; /* list of active ifstubs for the object (CS lock) */
CRITICAL_SECTION lock;
APARTMENT *apt; /* owning apt (RO) */
ULONG extrefs; /* number of 'external' references (LOCK) */
ULONG refs; /* internal reference count (CS apt->cs) */
OID oid; /* apartment-scoped unique identifier (RO) */
IUnknown *object; /* the object we are managing the stub for (RO) */
ULONG next_ipid; /* currently unused (LOCK) */
};
/* 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 */
LPVOID iface; /* interface pointer (RO) */
IID iid; /* interface ID (RO) */
IPID ipid; /* imported interface ID (RO) */
LPRPCPROXYBUFFER proxy; /* interface proxy (RO) */
DWORD refs; /* imported (public) references (CS ?) */
};
/* imported object / proxy manager */
struct proxy_manager
{
const IInternalUnknownVtbl *lpVtbl;
struct apartment *parent;
struct list entry;
LPRPCCHANNELBUFFER chan; /* channel to object */
OXID oxid; /* object exported ID */
OID oid; /* object ID */
struct list interfaces; /* imported interfaces */
DWORD refs; /* proxy reference count */
CRITICAL_SECTION cs; /* thread safety for this object and children */
struct apartment *parent; /* owning apartment (RO) */
struct list entry; /* entry in apartment (CS parent->cs) */
LPRPCCHANNELBUFFER chan; /* channel to object (CS cs) */
OXID oxid; /* object exported ID (RO) */
OID oid; /* object ID (RO) */
struct list interfaces; /* imported interfaces (CS cs) */
DWORD refs; /* proxy reference count (LOCK) */
CRITICAL_SECTION cs; /* thread safety for this object and children */
};
/* this needs to become a COM object that implements IRemUnknown */
......@@ -94,28 +108,38 @@ struct apartment
{
struct list entry;
DWORD refs; /* refcount of the apartment */
DWORD model; /* threading model */
DWORD tid; /* thread id */
HANDLE thread; /* thread handle */
OXID oxid; /* object exporter ID */
OID oidc; /* object ID counter, starts at 1, zero is invalid OID */
HWND win; /* message window */
DWORD refs; /* refcount of the apartment (LOCK) */
DWORD model; /* threading model (RO) */
DWORD tid; /* thread id (RO) */
HANDLE thread; /* thread handle (RO) */
OXID oxid; /* object exporter ID (RO) */
OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs) */
HWND win; /* message window (RO) */
CRITICAL_SECTION cs; /* thread safety */
LPMESSAGEFILTER filter; /* message filter */
XOBJECT *objs; /* exported objects */
struct list proxies; /* imported objects */
DWORD listenertid; /* id of apartment_listener_thread */
struct list stubmgrs; /* stub managers for exported objects */
LPMESSAGEFILTER filter; /* message filter (CS cs) */
struct list proxies; /* imported objects (CS cs) */
struct list stubmgrs; /* stub managers for exported objects (CS cs) */
DWORD listenertid; /* id of apartment_listener_thread. FIXME: remove me */
};
typedef struct apartment APARTMENT;
/* this is what is stored in TEB->ReservedForOle */
struct oletls
{
struct apartment *apt;
IErrorInfo *errorinfo; /* see errorinfo.c */
IUnknown *state; /* see CoSetState */
DWORD inits; /* number of times CoInitializeEx called */
};
extern void* StdGlobalInterfaceTable_Construct(void);
extern void StdGlobalInterfaceTable_Destroy(void* self);
extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv);
/* FIXME: these shouldn't be needed, except for 16-bit functions */
extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
extern void* StdGlobalInterfaceTableInstance;
......@@ -139,43 +163,6 @@ MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) {
HRESULT MARSHAL_Disconnect_Proxies(APARTMENT *apt);
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
/* Thread-safety Annotation Legend:
*
* RO - The value is read only. It never changes after creation, so no
* locking is required.
* LOCK - The value is written to only using Interlocked* functions.
* CS - The value is read or written to with a critical section held.
* The identifier following "CS" is the specific critical section that
* must be used.
*/
/* an interface stub */
struct ifstub
{
struct list entry; /* entry in stub_manager->ifstubs list (CS stub_manager->lock) */
IRpcStubBuffer *stubbuffer; /* RO */
IID iid; /* RO */
IPID ipid; /* RO */
IUnknown *iface; /* RO */
BOOL table; /* CS stub_manager->lock */
};
/* stub managers hold refs on the object and each interface stub */
struct stub_manager
{
struct list entry; /* entry in apartment stubmgr list (CS apt->cs) */
struct list ifstubs; /* list of active ifstubs for the object (CS lock) */
CRITICAL_SECTION lock;
APARTMENT *apt; /* owning apt (RO) */
ULONG extrefs; /* number of 'external' references (LOCK) */
ULONG refs; /* internal reference count (CS apt->cs) */
OID oid; /* apartment-scoped unique identifier (RO) */
IUnknown *object; /* the object we are managing the stub for (RO) */
ULONG next_ipid; /* currently unused (LOCK) */
};
ULONG stub_manager_int_addref(struct stub_manager *This);
ULONG stub_manager_int_release(struct stub_manager *This);
struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object);
......@@ -202,23 +189,12 @@ HRESULT WINAPI RunningObjectTableImpl_UnInitialize(void);
/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
/* compobj.c */
APARTMENT *COM_CreateApartment(DWORD model);
APARTMENT *COM_ApartmentFromOXID(OXID oxid, BOOL ref);
DWORD COM_ApartmentAddRef(struct apartment *apt);
DWORD COM_ApartmentRelease(struct apartment *apt);
/* this is what is stored in TEB->ReservedForOle */
struct oletls
{
struct apartment *apt;
IErrorInfo *errorinfo; /* see errorinfo.c */
IUnknown *state; /* see CoSetState */
DWORD inits; /* number of times CoInitializeEx called */
};
/*
* Per-thread values are stored in the TEB on offset 0xF80,
* see http://www.microsoft.com/msj/1099/bugslayer/bugslayer1099.htm
......
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