Fix format specifiers for HDCs.
[wine/gsoc_dplay.git] / dlls / ole32 / compobj_private.h
blob9ff9258eaf469d142084874b41d3d5a8b68c3f0f
1 /*
2 * Copyright 1995 Martin von Loewis
3 * Copyright 1998 Justin Bradford
4 * Copyright 1999 Francis Beaudet
5 * Copyright 1999 Sylvain St-Germain
6 * Copyright 2002 Marcus Meissner
7 * Copyright 2003 Ove Kåven, TransGaming Technologies
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef __WINE_OLE_COMPOBJ_H
25 #define __WINE_OLE_COMPOBJ_H
27 /* All private prototype functions used by OLE will be added to this header file */
29 #include <stdarg.h>
31 #include "windef.h"
32 #include "winbase.h"
33 #include "wtypes.h"
34 #include "dcom.h"
35 #include "winreg.h"
36 #include "winternl.h"
38 /* exported interface */
39 typedef struct tagXIF {
40 struct tagXIF *next;
41 LPVOID iface; /* interface pointer */
42 IID iid; /* interface ID */
43 IPID ipid; /* exported interface ID */
44 LPRPCSTUBBUFFER stub; /* interface stub */
45 DWORD refs; /* external reference count */
46 HRESULT hres; /* result of stub creation attempt */
47 } XIF;
49 /* exported object */
50 typedef struct tagXOBJECT {
51 ICOM_VTABLE(IRpcStubBuffer) *lpVtbl;
52 struct tagAPARTMENT *parent;
53 struct tagXOBJECT *next;
54 LPUNKNOWN obj; /* object identity (IUnknown) */
55 OID oid; /* object ID */
56 DWORD ifc; /* interface ID counter */
57 XIF *ifaces; /* exported interfaces */
58 DWORD refs; /* external reference count */
59 } XOBJECT;
61 /* imported interface */
62 typedef struct tagIIF {
63 struct tagIIF *next;
64 LPVOID iface; /* interface pointer */
65 IID iid; /* interface ID */
66 IPID ipid; /* imported interface ID */
67 LPRPCPROXYBUFFER proxy; /* interface proxy */
68 DWORD refs; /* imported (public) references */
69 HRESULT hres; /* result of proxy creation attempt */
70 } IIF;
72 /* imported object */
73 typedef struct tagIOBJECT {
74 ICOM_VTABLE(IRemUnknown) *lpVtbl;
75 struct tagAPARTMENT *parent;
76 struct tagIOBJECT *next;
77 LPRPCCHANNELBUFFER chan; /* channel to object */
78 OXID oxid; /* object exported ID */
79 OID oid; /* object ID */
80 IPID ipid; /* first imported interface ID */
81 IIF *ifaces; /* imported interfaces */
82 DWORD refs; /* proxy reference count */
83 } IOBJECT;
85 /* apartment */
86 typedef struct tagAPARTMENT {
87 struct tagAPARTMENT *next, *prev, *parent;
88 DWORD model; /* threading model */
89 DWORD inits; /* CoInitialize count */
90 DWORD tid; /* thread id */
91 HANDLE thread; /* thread handle */
92 OXID oxid; /* object exporter ID */
93 OID oidc; /* object ID counter */
94 HWND win; /* message window */
95 CRITICAL_SECTION cs; /* thread safety */
96 LPMESSAGEFILTER filter; /* message filter */
97 XOBJECT *objs; /* exported objects */
98 IOBJECT *proxies; /* imported objects */
99 LPVOID ErrorInfo; /* thread error info */
100 } APARTMENT;
102 extern APARTMENT MTA, *apts;
104 extern void* StdGlobalInterfaceTable_Construct();
105 extern void StdGlobalInterfaceTable_Destroy(void* self);
106 extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv);
108 extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
109 extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
111 extern void* StdGlobalInterfaceTableInstance;
113 inline static HRESULT
114 get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) {
115 HRESULT hres;
116 CLSID pxclsid;
118 if ((hres = CoGetPSClsid(riid,&pxclsid)))
119 return hres;
120 return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf);
123 #define PIPEPREF "\\\\.\\pipe\\"
124 #define OLESTUBMGR PIPEPREF"WINE_OLE_StubMgr"
125 /* Standard Marshalling definitions */
126 typedef struct _wine_marshal_id {
127 DWORD processid;
128 DWORD objectid; /* unique value corresp. IUnknown of object */
129 IID iid;
130 } wine_marshal_id;
132 inline static BOOL
133 MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) {
134 return
135 (mid1->processid == mid2->processid) &&
136 (mid1->objectid == mid2->objectid) &&
137 IsEqualIID(&(mid1->iid),&(mid2->iid))
141 /* compare without interface compare */
142 inline static BOOL
143 MARSHAL_Compare_Mids_NoInterface(wine_marshal_id *mid1, wine_marshal_id *mid2) {
144 return
145 (mid1->processid == mid2->processid) &&
146 (mid1->objectid == mid2->objectid)
150 HRESULT MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub);
151 HRESULT MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk);
152 HRESULT MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN punk, IRpcStubBuffer *stub);
154 HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
156 typedef struct _wine_marshal_data {
157 DWORD dwDestContext;
158 DWORD mshlflags;
159 } wine_marshal_data;
162 #define REQTYPE_REQUEST 0
163 typedef struct _wine_rpc_request_header {
164 DWORD reqid;
165 wine_marshal_id mid;
166 DWORD iMethod;
167 DWORD cbBuffer;
168 } wine_rpc_request_header;
170 #define REQTYPE_RESPONSE 1
171 typedef struct _wine_rpc_response_header {
172 DWORD reqid;
173 DWORD cbBuffer;
174 DWORD retval;
175 } wine_rpc_response_header;
177 #define REQSTATE_START 0
178 #define REQSTATE_REQ_QUEUED 1
179 #define REQSTATE_REQ_WAITING_FOR_REPLY 2
180 #define REQSTATE_REQ_GOT 3
181 #define REQSTATE_INVOKING 4
182 #define REQSTATE_RESP_QUEUED 5
183 #define REQSTATE_RESP_GOT 6
184 #define REQSTATE_DONE 6
186 void STUBMGR_Start();
188 extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf);
190 /* This function initialize the Running Object Table */
191 HRESULT WINAPI RunningObjectTableImpl_Initialize();
193 /* This function uninitialize the Running Object Table */
194 HRESULT WINAPI RunningObjectTableImpl_UnInitialize();
196 /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
197 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
199 HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
202 * Per-thread values are stored in the TEB on offset 0xF80,
203 * see http://www.microsoft.com/msj/1099/bugslayer/bugslayer1099.htm
205 static inline APARTMENT* COM_CurrentInfo(void) WINE_UNUSED;
206 static inline APARTMENT* COM_CurrentInfo(void)
208 APARTMENT* apt = NtCurrentTeb()->ReservedForOle;
209 return apt;
211 static inline APARTMENT* COM_CurrentApt(void) WINE_UNUSED;
212 static inline APARTMENT* COM_CurrentApt(void)
214 APARTMENT* apt = COM_CurrentInfo();
215 if (apt && apt->parent) apt = apt->parent;
216 return apt;
219 /* compobj.c */
220 HWND COM_GetApartmentWin(OXID oxid);
222 #endif /* __WINE_OLE_COMPOBJ_H */