2 * This file defines the macros and types necessary to define COM interfaces,
3 * and the three most basic COM interfaces: IUnknown, IMalloc and IClassFactory.
6 #ifndef __WINE_WINE_OBJ_BASE_H
7 #define __WINE_WINE_OBJ_BASE_H
9 /*****************************************************************************
10 * define ICOM_MSVTABLE_COMPAT
11 * to implement the microsoft com vtable compatibility workaround for g++.
13 * NOTE: Turning this option on will produce a winelib that is incompatible
14 * with the binary emulator.
16 * If the compiler supports the com_interface attribute, leave this off, and
17 * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also
18 * require the addition of the -vtable-thunks option for g++.
20 * If you aren't interested in WineLib C++ compatability at all, leave both
23 * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro
24 * would be to define it only for your WineLib application. This allows you
25 * to have both binary and WineLib compatibility for C and C++ at the same
28 /* #define ICOM_MSVTABLE_COMPAT 1 */
29 /* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
31 /*****************************************************************************
32 * Defines the basic types
37 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
38 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
40 /*****************************************************************************
41 * Macros to declare the GUIDs
44 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
46 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
48 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
49 extern const GUID name
52 #define DEFINE_OLEGUID(name, l, w1, w2) \
53 DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
55 #define DEFINE_SHLGUID(name, l, w1, w2) DEFINE_OLEGUID(name,l,w1,w2)
58 /*****************************************************************************
61 HRESULT WINAPI
StringFromCLSID16(REFCLSID id
, LPOLESTR16
*);
62 HRESULT WINAPI
StringFromCLSID(REFCLSID id
, LPOLESTR
*);
64 HRESULT WINAPI
CLSIDFromString16(LPCOLESTR16
, CLSID
*);
65 HRESULT WINAPI
CLSIDFromString(LPCOLESTR
, CLSID
*);
67 HRESULT WINAPI
CLSIDFromProgID16(LPCOLESTR16 progid
, LPCLSID riid
);
68 HRESULT WINAPI
CLSIDFromProgID(LPCOLESTR progid
, LPCLSID riid
);
70 HRESULT WINAPI
ProgIDFromCLSID(REFCLSID clsid
, LPOLESTR
*lplpszProgID
);
73 INT WINAPI
StringFromGUID2(REFGUID id
, LPOLESTR str
, INT cmax
);
75 BOOL16 WINAPI
IsEqualGUID16(GUID
* g1
,GUID
* g2
);
76 BOOL WINAPI
IsEqualGUID32(REFGUID rguid1
,REFGUID rguid2
);
77 /*#define IsEqualGUID WINELIB_NAME(IsEqualGUID)*/
78 #if defined(__cplusplus) && !defined(CINTERFACE)
79 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
80 #else /* defined(__cplusplus) && !defined(CINTERFACE) */
81 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
82 #endif /* defined(__cplusplus) && !defined(CINTERFACE) */
83 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
84 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
86 #if defined(__cplusplus) && !defined(CINTERFACE)
87 inline BOOL
operator==(const GUID
& guidOne
, const GUID
& guidOther
)
89 return !memcmp(&guidOne
,&guidOther
,sizeof(GUID
));
91 inline BOOL
operator!=(const GUID
& guidOne
, const GUID
& guidOther
)
93 return !(guidOne
== guidOther
);
98 /*****************************************************************************
99 * Macros to define a COM interface
102 * The goal of the following set of definitions is to provide a way to use the same
103 * header file definitions to provide both a C interface and a C++ object oriented
104 * interface to COM interfaces. The type of interface is selected automatically
105 * depending on the language but it is always possible to get the C interface in C++
106 * by defining CINTERFACE.
108 * It is based on the following assumptions:
109 * - all COM interfaces derive from IUnknown, this should not be a problem.
110 * - the header file only defines the interface, the actual fields are defined
111 * separately in the C file implementing the interface.
113 * The natural approach to this problem would be to make sure we get a C++ class and
114 * virtual methods in C++ and a structure with a table of pointer to functions in C.
115 * Unfortunately the layout of the virtual table is compiler specific, the layout of
116 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
117 * same as that generated by Visual C+. There are workarounds to make the virtual tables
118 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
119 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
121 * So the solution I finally adopted does not use virtual tables. Instead I use inline
122 * non virtual methods that dereference the method pointer themselves and perform the call.
124 * Let's take Direct3D as an example:
126 * #define ICOM_INTERFACE IDirect3D
127 * #define IDirect3D_METHODS \
128 * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \
129 * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \
130 * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \
131 * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \
132 * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \
133 * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,)
134 * #define IDirect3D_IMETHODS \
135 * IUnknown_IMETHODS \
137 * ICOM_DEFINE(IDirect3D,IUnknown)
138 * #undef ICOM_INTERFACE
140 * #ifdef ICOM_CINTERFACE
141 * // *** IUnknown methods *** //
142 * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
143 * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p)
144 * #define IDirect3D_Release(p) ICOM_CALL (Release,p)
145 * // *** IDirect3D methods *** //
146 * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a)
147 * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b)
148 * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b)
149 * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
150 * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
151 * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b)
155 * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this'
156 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
157 * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1
158 * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not
159 * 'IDirect3D_VTABLE'.
160 * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the
161 * inherited methods to form ICOM_IMETHODS.
162 * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must
163 * be written manually (rather than using a macro to generate the equivalent code) to avoid
164 * macro recursion (which compilers don't like).
165 * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
166 * explicitly use the interface name for macro expansion reasons again.
167 * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's
168 * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance
169 * is taken care of by the language.
170 * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer
171 * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The
172 * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and
173 * to have it take only the type information (with const if necessary) as parameters.
174 * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following
175 * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once
176 * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone
178 * - You may have noticed the double commas after each parameter type. This allows you to put the
179 * name of that parameter which I think is good for documentation. It is not required and since
180 * I did not know what to put there for this example (I could only find doc about IDirect3D2),
182 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
183 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
184 * the inherited method definitions there. This time I could have used a trick to use only one
185 * macro whatever the number of parameters but I prefered to have it work the same way as above.
186 * - You probably have noticed that we don't define the fields we need to actually implement this
187 * interface: reference count, pointer to other resources and miscellaneous fields. That's
188 * because these interfaces are just that: interfaces. They may be implemented more than once, in
189 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
190 * that the interface contains some specific fields.
194 * typedef struct IDirect3DVtbl IDirect3DVtbl;
196 * IDirect3DVtbl* lpVtbl;
198 * struct IDirect3DVtbl {
199 * HRESULT (*fnQueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
200 * ULONG (*fnQueryInterface)(IDirect3D* me);
201 * ULONG (*fnQueryInterface)(IDirect3D* me);
202 * HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
203 * HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
204 * HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
205 * HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
206 * HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
207 * HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
210 * #ifdef ICOM_CINTERFACE
211 * // *** IUnknown methods *** //
212 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->fnQueryInterface(p,a,b)
213 * #define IDirect3D_AddRef(p) (p)->lpVtbl->fnAddRef(p)
214 * #define IDirect3D_Release(p) (p)->lpVtbl->fnRelease(p)
215 * // *** IDirect3D methods *** //
216 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->fnInitialize(p,a)
217 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->fnEnumDevice(p,a,b)
218 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->fnCreateLight(p,a,b)
219 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->fnCreateMaterial(p,a,b)
220 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->fnCreateViewport(p,a,b)
221 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->fnFindDevice(p,a,b)
225 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
226 * the user needs to know to use the interface. Of course the structure we will define to
227 * implement this interface will have more fields but the first one will match this pointer.
228 * - The code generated by ICOM_DEFINE defines both the structure representing the interface and
229 * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to
230 * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
231 * to define the IDirect3D methods.
232 * - Each method is declared as a pointer to function field in the jump table. The implementation
233 * will fill this jump table with appropriate values, probably using a static variable, and
234 * initialize the lpVtbl field to point to this variable.
235 * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
236 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
238 * - This C code should be quite compatible with the Windows headers both for code that uses COM
239 * interfaces and for code implementing a COM interface.
242 * And in C++ (with gcc's g++):
244 * typedef struct IDirect3D: public IUnknown {
245 * private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
246 * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpVtbl)->fnInitialize(this,a); };
247 * private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
248 * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
249 * { return ((IDirect3D*)t.lpVtbl)->fnEnumDevices(this,a,b); };
250 * private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
251 * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
252 * { return ((IDirect3D*)t.lpVtbl)->fnCreateLight(this,a,b); };
253 * private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
254 * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
255 * { return ((IDirect3D*)t.lpVtbl)->fnCreateMaterial(this,a,b); };
256 * private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
257 * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
258 * { return ((IDirect3D*)t.lpVtbl)->fnCreateViewport(this,a,b); };
259 * private: HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
260 * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
261 * { return ((IDirect3D*)t.lpVtbl)->fnFindDevice(this,a,b); };
265 * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface
266 * definition. The reason for this is to avoid having to duplicate the mehod definitions: once
267 * to have the function pointers in the jump table and once to have the methods in the interface
268 * class. Here one macro can generate both. This means though that the first pointer, t.lpVtbl
269 * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the
270 * structure as the the interface class, and as the function pointer to the QueryInterface
271 * method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this
272 * gymnastic is entirely taken care of in the header of IUnknown.
273 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
274 * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and
275 * a non-vritual inline method which dereferences it and calls it. This way this method behaves
276 * just like a virtual method but does not create a true C++ virtual table which would break the
277 * structure layout. If you look at the implementation of these methods you'll notice that they
278 * would not work for void functions. We have to return something and fortunately this seems to
279 * be what all the COM methods do (otherwise we would need another set of macros).
280 * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter
281 * names and the method invocation using only the formal parameter name. This is the reason why
282 * we need different macros to handle different numbers of parameters.
283 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
284 * macro is defined in which case we would not be here.
285 * - This C++ code works well for code that just uses COM interfaces. But it will not work with
286 * C++ code implement a COM interface. That's because such code assumes the interface methods
287 * are declared as virtual C++ methods which is not the case here.
290 * Implementing a COM interface.
292 * This continues the above example. This example assumes that the implementation is in C.
294 * typedef struct _IDirect3D {
300 * static ICOM_VTABLE(IDirect3D) d3dvt;
302 * // implement the IDirect3D methods here
304 * int IDirect3D_fnQueryInterface(IDirect3D* me)
306 * ICOM_THIS(IDirect3D,me);
312 * static ICOM_VTABLE(IDirect3D) d3dvt = {
313 * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
314 * IDirect3D_fnQueryInterface,
317 * IDirect3D_fnInitialize,
318 * IDirect3D_fnSetWidth
322 * - We first define what the interface really contains. This is th e_IDirect3D structure. The
323 * first field must of course be the virtual table pointer. Everything else is free.
324 * - Then we predeclare our static virtual table variable, we will need its address in some
325 * methods to initialize the virtual table pointer of the returned interface objects.
326 * - Then we implement the interface methods. To match what has been declared in the header file
327 * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that
328 * we can manipulate the fields. This is performed by the ICOM_THIS macro.
329 * - Finally we initialize the virtual table.
333 #define ICOM_VTABLE(iface) iface##Vtbl
334 #define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
335 #define ICOM_VTBL(iface) (iface)->lpVtbl
338 #if !defined(__cplusplus) || defined(CINTERFACE)
339 #define ICOM_CINTERFACE 1
342 #ifndef ICOM_CINTERFACE
345 #define ICOM_METHOD(ret,xfn) \
346 public: virtual ret (CALLBACK xfn)(void) = 0;
347 #define ICOM_METHOD1(ret,xfn,ta,na) \
348 public: virtual ret (CALLBACK xfn)(ta a) = 0;
349 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
350 public: virtual ret (CALLBACK xfn)(ta a,tb b) = 0;
351 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
352 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) = 0;
353 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
354 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
355 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
356 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
357 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
358 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
359 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
360 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
361 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
362 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
363 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
364 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0;
365 #define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \
366 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j) = 0;
369 #define ICOM_CMETHOD(ret,xfn) \
370 public: virtual ret (CALLBACK xfn)(void) const = 0;
371 #define ICOM_CMETHOD1(ret,xfn,ta,na) \
372 public: virtual ret (CALLBACK xfn)(ta a) const = 0;
373 #define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
374 public: virtual ret (CALLBACK xfn)(ta a,tb b) const = 0;
375 #define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
376 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
377 #define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
378 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
379 #define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
380 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const = 0;
381 #define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
382 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const = 0;
383 #define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
384 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const = 0;
385 #define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
386 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) const = 0;
389 #define ICOM_VMETHOD(xfn) \
390 public: virtual void (CALLBACK xfn)(void) = 0;
391 #define ICOM_VMETHOD1(xfn,ta,na) \
392 public: virtual void (CALLBACK xfn)(ta a) = 0;
393 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
394 public: virtual void (CALLBACK xfn)(ta a,tb b) = 0;
395 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
396 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) = 0;
397 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
398 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
399 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
400 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
401 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
402 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
403 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
404 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
405 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
406 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
409 #define ICOM_CVMETHOD(xfn) \
410 public: virtual void (CALLBACK xfn)(void) const = 0;
411 #define ICOM_CVMETHOD1(xfn,ta,na) \
412 public: virtual void (CALLBACK xfn)(ta a) const = 0;
413 #define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
414 public: virtual void (CALLBACK xfn)(ta a,tb b) const = 0;
415 #define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
416 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
417 #define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
418 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
419 #define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
420 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const = 0;
421 #define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
422 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const = 0;
423 #define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
424 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const = 0;
425 #define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
426 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) const = 0;
428 #ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
430 #define ICOM_DEFINE(iface,ibase) \
431 typedef struct iface: public ibase { \
433 } __attribute__ ((com_interface));
437 #define ICOM_DEFINE(iface,ibase) \
438 typedef struct iface: public ibase { \
442 #endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */
444 #define ICOM_CALL(xfn, p) (p)->xfn()
445 #define ICOM_CALL1(xfn, p,a) (p)->xfn(a)
446 #define ICOM_CALL2(xfn, p,a,b) (p)->xfn(a,b)
447 #define ICOM_CALL3(xfn, p,a,b,c) (p)->xfn(a,b,c)
448 #define ICOM_CALL4(xfn, p,a,b,c,d) (p)->xfn(a,b,c,d)
449 #define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->xfn(a,b,c,d,e)
450 #define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->xfn(a,b,c,d,e,f)
451 #define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->xfn(a,b,c,d,e,f,g)
452 #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->xfn(a,b,c,d,e,f,g,h)
461 #define ICOM_METHOD(ret,xfn) \
462 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
463 #define ICOM_METHOD1(ret,xfn,ta,na) \
464 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
465 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
466 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
467 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
468 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
469 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
470 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
471 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
472 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
473 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
474 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
475 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
476 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
477 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
478 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
479 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
480 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i);
481 #define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \
482 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j);
484 #define ICOM_CMETHOD(ret,xfn) \
485 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
486 #define ICOM_CMETHOD1(ret,xfn,ta,na) \
487 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
488 #define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
489 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
490 #define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
491 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
492 #define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
493 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
494 #define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
495 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
496 #define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
497 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
498 #define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
499 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
500 #define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
501 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
503 #define ICOM_VMETHOD(xfn) \
504 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
505 #define ICOM_VMETHOD1(xfn,ta,na) \
506 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
507 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
508 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
509 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
510 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
511 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
512 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
513 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
514 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
515 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
516 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
517 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
518 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
519 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
520 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
522 #define ICOM_CVMETHOD(xfn) \
523 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
524 #define ICOM_CVMETHOD1(xfn,ta,na) \
525 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
526 #define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
527 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
528 #define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
529 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
530 #define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
531 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
532 #define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
533 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
534 #define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
535 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
536 #define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
537 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
538 #define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
539 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
541 #define ICOM_CALL(xfn, p) ICOM_VTBL(p)->fn##xfn(p)
542 #define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->fn##xfn(p,a)
543 #define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->fn##xfn(p,a,b)
544 #define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->fn##xfn(p,a,b,c)
545 #define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d)
546 #define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e)
547 #define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f)
548 #define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g)
549 #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h)
550 #define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i)
551 #define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i,j)
557 #define ICOM_METHOD(ret,xfn) \
558 ret (CALLBACK *xfn)(ICOM_INTERFACE* me);
559 #define ICOM_METHOD1(ret,xfn,ta,na) \
560 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a);
561 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
562 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b);
563 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
564 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
565 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
566 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
567 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
568 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
569 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
570 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
571 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
572 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
573 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
574 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
575 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
576 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i);
577 #define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \
578 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j);
580 #define ICOM_CMETHOD(ret,xfn) \
581 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me);
582 #define ICOM_CMETHOD1(ret,xfn,ta,na) \
583 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a);
584 #define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
585 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b);
586 #define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
587 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
588 #define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
589 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
590 #define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
591 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
592 #define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
593 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
594 #define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
595 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
596 #define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
597 ret (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
599 #define ICOM_VMETHOD(xfn) \
600 void (CALLBACK *xfn)(ICOM_INTERFACE* me);
601 #define ICOM_VMETHOD1(xfn,ta,na) \
602 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a);
603 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
604 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b);
605 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
606 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
607 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
608 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
609 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
610 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
611 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
612 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
613 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
614 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
615 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
616 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
618 #define ICOM_CVMETHOD(xfn) \
619 void (CALLBACK *xfn)(const ICOM_INTERFACE* me);
620 #define ICOM_CVMETHOD1(xfn,ta,na) \
621 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a);
622 #define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
623 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b);
624 #define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
625 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
626 #define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
627 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
628 #define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
629 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
630 #define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
631 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
632 #define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
633 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
634 #define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
635 void (CALLBACK *xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
637 #define ICOM_CALL(xfn, p) ICOM_VTBL(p)->xfn(p)
638 #define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->xfn(p,a)
639 #define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->xfn(p,a,b)
640 #define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->xfn(p,a,b,c)
641 #define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->xfn(p,a,b,c,d)
642 #define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->xfn(p,a,b,c,d,e)
643 #define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f)
644 #define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g)
645 #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h)
646 #define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i)
647 #define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j)
649 #endif /* __WINE__ */
651 #ifdef ICOM_MSVTABLE_COMPAT
652 #define ICOM_DEFINE(iface,ibase) \
653 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
655 const ICOM_VFIELD(iface); \
657 struct ICOM_VTABLE(iface) { \
663 #define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0,
666 #define ICOM_DEFINE(iface,ibase) \
667 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
669 const ICOM_VFIELD(iface); \
671 struct ICOM_VTABLE(iface) { \
675 #define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
676 #endif /* ICOM_MSVTABLE_COMPAT */
679 #define ICOM_THIS(impl,iface) impl* const This=(impl*)iface
680 #define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface
685 /*****************************************************************************
686 * Predeclare the interfaces
688 DEFINE_OLEGUID(IID_IClassFactory
, 0x00000001L
, 0, 0);
689 typedef struct IClassFactory IClassFactory
, *LPCLASSFACTORY
;
691 DEFINE_OLEGUID(IID_IMalloc
, 0x00000002L
, 0, 0);
692 typedef struct IMalloc16 IMalloc16
,*LPMALLOC16
;
693 typedef struct IMalloc IMalloc
,*LPMALLOC
;
695 DEFINE_OLEGUID(IID_IUnknown
, 0x00000000L
, 0, 0);
696 typedef struct IUnknown IUnknown
, *LPUNKNOWN
;
699 /*****************************************************************************
702 #define ICOM_INTERFACE IUnknown
703 #define IUnknown_IMETHODS \
704 ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \
705 ICOM_METHOD (ULONG,AddRef) \
706 ICOM_METHOD (ULONG,Release)
707 #ifdef ICOM_CINTERFACE
708 typedef struct ICOM_VTABLE(IUnknown
) ICOM_VTABLE(IUnknown
);
710 ICOM_VFIELD(IUnknown
);
711 #if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE)
712 } __attribute__ ((com_interface
));
715 #endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */
717 struct ICOM_VTABLE(IUnknown
) {
718 #ifdef ICOM_MSVTABLE_COMPAT
721 #endif /* ICOM_MSVTABLE_COMPAT */
723 #else /* ICOM_CINTERFACE */
726 #endif /* ICOM_CINTERFACE */
728 ICOM_METHOD2(HRESULT
,QueryInterface
,REFIID
,riid
, LPVOID
*,ppvObj
)
729 ICOM_METHOD (ULONG
,AddRef
)
730 ICOM_METHOD (ULONG
,Release
)
731 #if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE)
732 } __attribute__ ((com_interface
));
735 #endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */
737 #undef ICOM_INTERFACE
739 /*** IUnknown methods ***/
740 #define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
741 #define IUnknown_AddRef(p) ICOM_CALL (AddRef,p)
742 #define IUnknown_Release(p) ICOM_CALL (Release,p)
744 /*****************************************************************************
745 * IClassFactory interface
747 #define ICOM_INTERFACE IClassFactory
748 #define IClassFactory_METHODS \
749 ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \
750 ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock)
751 #define IClassFactory_IMETHODS \
753 IClassFactory_METHODS
754 ICOM_DEFINE(IClassFactory
,IUnknown
)
755 #undef ICOM_INTERFACE
757 /*** IUnknown methods ***/
758 #define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
759 #define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p)
760 #define IClassFactory_Release(p) ICOM_CALL (Release,p)
761 /*** IClassFactory methods ***/
762 #define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c)
763 #define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a)
766 /*****************************************************************************
769 #define ICOM_INTERFACE IMalloc16
770 #define IMalloc16_METHODS \
771 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
772 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
773 ICOM_VMETHOD1( Free, LPVOID,pv) \
774 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
775 ICOM_CMETHOD1(INT16, DidAlloc, LPVOID,pv) \
776 ICOM_METHOD (LPVOID,HeapMinimize)
777 #define IMalloc16_IMETHODS \
780 ICOM_DEFINE(IMalloc16
,IUnknown
)
781 #undef ICOM_INTERFACE
783 /*** IUnknown methods ***/
784 #define IMalloc16_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
785 #define IMalloc16_AddRef(p) ICOM_CALL (AddRef,p)
786 #define IMalloc16_Release(p) ICOM_CALL (Release,p)
787 /*** IMalloc16 methods ***/
788 #define IMalloc16_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
789 #define IMalloc16_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
790 #define IMalloc16_Free(p,a) ICOM_CALL1(Free,p,a)
791 #define IMalloc16_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
792 #define IMalloc16_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
793 #define IMalloc16_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
796 #define ICOM_INTERFACE IMalloc
797 #define IMalloc_METHODS \
798 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
799 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
800 ICOM_VMETHOD1( Free, LPVOID,pv) \
801 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
802 ICOM_CMETHOD1(INT, DidAlloc, LPVOID,pv) \
803 ICOM_METHOD (LPVOID,HeapMinimize)
804 #define IMalloc_IMETHODS \
807 ICOM_DEFINE(IMalloc
,IUnknown
)
808 #undef ICOM_INTERFACE
810 /*** IUnknown methods ***/
811 #define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
812 #define IMalloc_AddRef(p) ICOM_CALL (AddRef,p)
813 #define IMalloc_Release(p) ICOM_CALL (Release,p)
814 /*** IMalloc32 methods ***/
815 #define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
816 #define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
817 #define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a)
818 #define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
819 #define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
820 #define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
823 HRESULT WINAPI
CoCreateStandardMalloc16(DWORD dwMemContext
, LPMALLOC16
* lpMalloc
);
825 HRESULT WINAPI
CoGetMalloc16(DWORD dwMemContext
,LPMALLOC16
* lpMalloc
);
826 HRESULT WINAPI
CoGetMalloc(DWORD dwMemContext
,LPMALLOC
* lpMalloc
);
828 LPVOID WINAPI
CoTaskMemAlloc(ULONG size
);
830 void WINAPI
CoTaskMemFree(LPVOID ptr
);
832 /* FIXME: unimplemented */
833 LPVOID WINAPI
CoTaskMemRealloc(LPVOID ptr
, ULONG size
);
836 /*****************************************************************************
840 HRESULT WINAPI
CoCreateGuid(GUID
* pguid
);
842 void WINAPI
CoFreeAllLibraries(void);
844 void WINAPI
CoFreeLibrary(HINSTANCE hLibrary
);
846 void WINAPI
CoFreeUnusedLibraries(void);
848 HRESULT WINAPI
CoCreateInstance(REFCLSID rclsid
, LPUNKNOWN pUnkOuter
, DWORD dwClsContext
, REFIID iid
, LPVOID
*ppv
);
850 HRESULT WINAPI
CoGetClassObject(REFCLSID rclsid
, DWORD dwClsContext
, LPVOID pvReserved
, REFIID iid
, LPVOID
*ppv
);
852 HRESULT WINAPI
CoInitialize16(LPVOID lpReserved
);
853 HRESULT WINAPI
CoInitialize(LPVOID lpReserved
);
854 HRESULT WINAPI
CoInitializeEx(LPVOID lpReserved
, DWORD dwCoInit
);
856 void WINAPI
CoUninitialize16(void);
857 void WINAPI
CoUninitialize(void);
859 typedef enum tagCOINIT
861 COINIT_APARTMENTTHREADED
= 0x2, /* Apartment model */
862 COINIT_MULTITHREADED
= 0x0, /* OLE calls objects on any thread */
863 COINIT_DISABLE_OLE1DDE
= 0x4, /* Don't use DDE for Ole1 support */
864 COINIT_SPEED_OVER_MEMORY
= 0x8 /* Trade memory for speed */
868 /* FIXME: not implemented */
869 BOOL WINAPI
CoIsOle1Class(REFCLSID rclsid
);
871 HINSTANCE WINAPI
CoLoadLibrary(LPOLESTR16 lpszLibName
, BOOL bAutoFree
);
873 HRESULT WINAPI
CoLockObjectExternal16(LPUNKNOWN pUnk
, BOOL16 fLock
, BOOL16 fLastUnlockReleases
);
874 HRESULT WINAPI
CoLockObjectExternal(LPUNKNOWN pUnk
, BOOL fLock
, BOOL fLastUnlockReleases
);
876 /* class registration flags; passed to CoRegisterClassObject */
877 typedef enum tagREGCLS
879 REGCLS_SINGLEUSE
= 0,
880 REGCLS_MULTIPLEUSE
= 1,
881 REGCLS_MULTI_SEPARATE
= 2,
885 HRESULT WINAPI
CoRegisterClassObject16(REFCLSID rclsid
, LPUNKNOWN pUnk
, DWORD dwClsContext
, DWORD flags
, LPDWORD lpdwRegister
);
886 HRESULT WINAPI
CoRegisterClassObject(REFCLSID rclsid
,LPUNKNOWN pUnk
,DWORD dwClsContext
,DWORD flags
,LPDWORD lpdwRegister
);
888 HRESULT WINAPI
CoRevokeClassObject(DWORD dwRegister
);
890 void WINAPI
CoUninitialize16(void);
891 void WINAPI
CoUninitialize(void);
893 /*****************************************************************************
894 * COM Server dll - exports
896 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
);
897 HRESULT WINAPI
DllCanUnloadNow(void);
899 /*****************************************************************************
903 HRESULT
WINE_StringFromCLSID(const CLSID
*id
, LPSTR
);
906 #endif /* __WINE_WINE_OBJ_BASE_H */