source: trunk/include/win/wine/obj_base.h

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 51.2 KB
Line 
1/*
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.
4 */
5
6#ifndef RC_INVOKED
7#include "rpc.h"
8#include "rpcndr.h"
9#endif
10
11#ifndef __WINE_WINE_OBJ_BASE_H
12#define __WINE_WINE_OBJ_BASE_H
13
14/*****************************************************************************
15 * define ICOM_MSVTABLE_COMPAT
16 * to implement the microsoft com vtable compatibility workaround for g++.
17 *
18 * NOTE: Turning this option on will produce a winelib that is incompatible
19 * with the binary emulator.
20 *
21 * If the compiler supports the com_interface attribute, leave this off, and
22 * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below.
23 *
24 * If you aren't interested in WineLib C++ compatability at all, leave both
25 * options off.
26 */
27/* #define ICOM_MSVTABLE_COMPAT 1 */
28/* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
29
30/*****************************************************************************
31 * Defines the basic types
32 */
33/* @@@AH workaround for wrc.problem */
34#ifndef RC_INVOKED
35#include <string.h>
36#endif
37
38#include "wtypes.h"
39
40#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
41#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
42
43/*****************************************************************************
44 * Macros to define a COM interface
45 */
46/*
47 * The goal of the following set of definitions is to provide a way to use the same
48 * header file definitions to provide both a C interface and a C++ object oriented
49 * interface to COM interfaces. The type of interface is selected automatically
50 * depending on the language but it is always possible to get the C interface in C++
51 * by defining CINTERFACE.
52 *
53 * It is based on the following assumptions:
54 * - all COM interfaces derive from IUnknown, this should not be a problem.
55 * - the header file only defines the interface, the actual fields are defined
56 * separately in the C file implementing the interface.
57 *
58 * The natural approach to this problem would be to make sure we get a C++ class and
59 * virtual methods in C++ and a structure with a table of pointer to functions in C.
60 * Unfortunately the layout of the virtual table is compiler specific, the layout of
61 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
62 * same as that generated by Visual C+. There are workarounds to make the virtual tables
63 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
64 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
65 *
66 * So the solution I finally adopted does not use virtual tables. Instead I use inline
67 * non virtual methods that dereference the method pointer themselves and perform the call.
68 *
69 * Let's take Direct3D as an example:
70 *
71 * #define ICOM_INTERFACE IDirect3D
72 * #define IDirect3D_METHODS \
73 * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \
74 * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \
75 * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \
76 * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \
77 * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \
78 * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,)
79 * #define IDirect3D_IMETHODS \
80 * IUnknown_IMETHODS \
81 * IDirect3D_METHODS
82 * ICOM_DEFINE(IDirect3D,IUnknown)
83 * #undef ICOM_INTERFACE
84 *
85 * #ifdef ICOM_CINTERFACE
86 * // *** IUnknown methods *** //
87 * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
88 * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p)
89 * #define IDirect3D_Release(p) ICOM_CALL (Release,p)
90 * // *** IDirect3D methods *** //
91 * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a)
92 * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b)
93 * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b)
94 * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
95 * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
96 * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b)
97 * #endif
98 *
99 * Comments:
100 * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this'
101 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
102 * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1
103 * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not
104 * 'IDirect3D_VTABLE'.
105 * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the
106 * inherited methods to form ICOM_IMETHODS.
107 * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must
108 * be written manually (rather than using a macro to generate the equivalent code) to avoid
109 * macro recursion (which compilers don't like).
110 * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
111 * explicitly use the interface name for macro expansion reasons again.
112 * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's
113 * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance
114 * is taken care of by the language.
115 * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer
116 * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The
117 * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and
118 * to have it take only the type information (with const if necessary) as parameters.
119 * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following
120 * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once
121 * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone
122 * anyway.
123 * - You may have noticed the double commas after each parameter type. This allows you to put the
124 * name of that parameter which I think is good for documentation. It is not required and since
125 * I did not know what to put there for this example (I could only find doc about IDirect3D2),
126 * I left them blank.
127 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
128 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
129 * the inherited method definitions there. This time I could have used a trick to use only one
130 * macro whatever the number of parameters but I prefered to have it work the same way as above.
131 * - You probably have noticed that we don't define the fields we need to actually implement this
132 * interface: reference count, pointer to other resources and miscellaneous fields. That's
133 * because these interfaces are just that: interfaces. They may be implemented more than once, in
134 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
135 * that the interface contains some specific fields.
136 *
137 *
138 * In C this gives:
139 * typedef struct IDirect3DVtbl IDirect3DVtbl;
140 * struct IDirect3D {
141 * IDirect3DVtbl* lpvtbl;
142 * };
143 * struct IDirect3DVtbl {
144 * HRESULT (*fnQueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
145 * ULONG (*fnQueryInterface)(IDirect3D* me);
146 * ULONG (*fnQueryInterface)(IDirect3D* me);
147 * HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
148 * HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
149 * HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
150 * HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
151 * HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
152 * HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
153 * };
154 *
155 * #ifdef ICOM_CINTERFACE
156 * // *** IUnknown methods *** //
157 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpvtbl->fnQueryInterface(p,a,b)
158 * #define IDirect3D_AddRef(p) (p)->lpvtbl->fnAddRef(p)
159 * #define IDirect3D_Release(p) (p)->lpvtbl->fnRelease(p)
160 * // *** IDirect3D methods *** //
161 * #define IDirect3D_Initialize(p,a) (p)->lpvtbl->fnInitialize(p,a)
162 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpvtbl->fnEnumDevice(p,a,b)
163 * #define IDirect3D_CreateLight(p,a,b) (p)->lpvtbl->fnCreateLight(p,a,b)
164 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpvtbl->fnCreateMaterial(p,a,b)
165 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpvtbl->fnCreateViewport(p,a,b)
166 * #define IDirect3D_FindDevice(p,a,b) (p)->lpvtbl->fnFindDevice(p,a,b)
167 * #endif
168 *
169 * Comments:
170 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
171 * the user needs to know to use the interface. Of course the structure we will define to
172 * implement this interface will have more fields but the first one will match this pointer.
173 * - The code generated by ICOM_DEFINE defines both the structure representing the interface and
174 * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to
175 * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
176 * to define the IDirect3D methods.
177 * - Each method is declared as a pointer to function field in the jump table. The implementation
178 * will fill this jump table with appropriate values, probably using a static variable, and
179 * initialize the lpvtbl field to point to this variable.
180 * - The IDirect3D_Xxx macros then just derefence the lpvtbl pointer and use the function pointer
181 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
182 * just as fast.
183 * - This C code should be quite compatible with the Windows headers both for code that uses COM
184 * interfaces and for code implementing a COM interface.
185 *
186 *
187 * And in C++ (with gcc's g++):
188 *
189 * typedef struct IDirect3D: public IUnknown {
190 * private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
191 * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpvtbl)->fnInitialize(this,a); };
192 * private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
193 * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
194 * { return ((IDirect3D*)t.lpvtbl)->fnEnumDevices(this,a,b); };
195 * private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
196 * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
197 * { return ((IDirect3D*)t.lpvtbl)->fnCreateLight(this,a,b); };
198 * private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
199 * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
200 * { return ((IDirect3D*)t.lpvtbl)->fnCreateMaterial(this,a,b); };
201 * private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
202 * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
203 * { return ((IDirect3D*)t.lpvtbl)->fnCreateViewport(this,a,b); };
204 * private: HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
205 * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
206 * { return ((IDirect3D*)t.lpvtbl)->fnFindDevice(this,a,b); };
207 * };
208 *
209 * Comments:
210 * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface
211 * definition. The reason for this is to avoid having to duplicate the mehod definitions: once
212 * to have the function pointers in the jump table and once to have the methods in the interface
213 * class. Here one macro can generate both. This means though that the first pointer, t.lpvtbl
214 * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the
215 * structure as the the interface class, and as the function pointer to the QueryInterface
216 * method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this
217 * gymnastic is entirely taken care of in the header of IUnknown.
218 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
219 * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and
220 * a non-vritual inline method which dereferences it and calls it. This way this method behaves
221 * just like a virtual method but does not create a true C++ virtual table which would break the
222 * structure layout. If you look at the implementation of these methods you'll notice that they
223 * would not work for void functions. We have to return something and fortunately this seems to
224 * be what all the COM methods do (otherwise we would need another set of macros).
225 * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter
226 * names and the method invocation using only the formal parameter name. This is the reason why
227 * we need different macros to handle different numbers of parameters.
228 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
229 * macro is defined in which case we would not be here.
230 * - This C++ code works well for code that just uses COM interfaces. But it will not work with
231 * C++ code implement a COM interface. That's because such code assumes the interface methods
232 * are declared as virtual C++ methods which is not the case here.
233 *
234 *
235 * Implementing a COM interface.
236 *
237 * This continues the above example. This example assumes that the implementation is in C.
238 *
239 * typedef struct _IDirect3D {
240 * void* lpvtbl;
241 * // ...
242 *
243 * } _IDirect3D;
244 *
245 * static ICOM_VTABLE(IDirect3D) d3dvt;
246 *
247 * // implement the IDirect3D methods here
248 *
249 * int IDirect3D_fnQueryInterface(IDirect3D* me)
250 * {
251 * ICOM_THIS(IDirect3D,me);
252 * // ...
253 * }
254 *
255 * // ...
256 *
257 * static ICOM_VTABLE(IDirect3D) d3dvt = {
258 * IDirect3D_fnQueryInterface,
259 * IDirect3D_fnAdd,
260 * IDirect3D_fnAdd2,
261 * IDirect3D_fnInitialize,
262 * IDirect3D_fnSetWidth
263 * };
264 *
265 * Comments:
266 * - We first define what the interface really contains. This is th e_IDirect3D structure. The
267 * first field must of course be the virtual table pointer. Everything else is free.
268 * - Then we predeclare our static virtual table variable, we will need its address in some
269 * methods to initialize the virtual table pointer of the returned interface objects.
270 * - Then we implement the interface methods. To match what has been declared in the header file
271 * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that
272 * we can manipulate the fields. This is performed by the ICOM_THIS macro.
273 * - Finally we initialize the virtual table.
274 */
275
276
277#define ICOM_VTABLE(iface) iface##Vtbl
278#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
279#define ICOM_VTBL(iface) (iface)->lpVtbl
280
281
282#if !defined(__cplusplus) || defined(CINTERFACE)
283#define ICOM_CINTERFACE 1
284#endif
285
286#ifndef ICOM_CINTERFACE
287/* C++ interface */
288
289#define ICOM_METHOD(ret,xfn) \
290 public: virtual ret (CALLBACK xfn)(void) = 0;
291#define ICOM_METHOD1(ret,xfn,ta,na) \
292 public: virtual ret (CALLBACK xfn)(ta a) = 0;
293#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
294 public: virtual ret (CALLBACK xfn)(ta a,tb b) = 0;
295#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
296 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) = 0;
297#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
298 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
299#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
300 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
301#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
302 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
303#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
304 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
305#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
306 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
307#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
308 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0;
309#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) \
310 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;
311#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \
312 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,tk k) = 0;
313#define ICOM_METHOD12(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl) \
314 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,tk k,tl l) = 0;
315#define ICOM_METHOD13(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm) \
316 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,tk k,tl l,tm m) = 0;
317#define ICOM_METHOD14(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn) \
318 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,tk k,tl l,tm m,tn n) = 0;
319#define ICOM_METHOD15(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no) \
320 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,tk k,tl l,tm m,tn n,to o) = 0;
321#define ICOM_METHOD16(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np) \
322 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,tk k,tl l,tm m,tn n,to o,tp p) = 0;
323#define ICOM_METHOD17(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq) \
324 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,tk k,tl l,tm m,tn n,to o,tp p,tq q) = 0;
325#define ICOM_METHOD18(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr) \
326 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r) = 0;
327#define ICOM_METHOD19(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns) \
328 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s) = 0;
329#define ICOM_METHOD20(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt) \
330 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t) = 0;
331#define ICOM_METHOD21(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu) \
332 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u) = 0;
333#define ICOM_METHOD22(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv) \
334 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v) = 0;
335#define ICOM_METHOD23(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw) \
336 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w) = 0;
337#define ICOM_METHOD24(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx) \
338 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x) = 0;
339#define ICOM_METHOD25(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx,ty,ny) \
340 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x,ty y) = 0;
341#define ICOM_METHOD26(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx,ty,ny,tz,nz) \
342 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x,ty y,tz z) = 0;
343
344
345#define ICOM_CMETHOD(ret,xfn) \
346 public: virtual ret (CALLBACK xfn)(void) const = 0;
347#define ICOM_CMETHOD1(ret,xfn,ta,na) \
348 public: virtual ret (CALLBACK xfn)(ta a) const = 0;
349#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
350 public: virtual ret (CALLBACK xfn)(ta a,tb b) const = 0;
351#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
352 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
353#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
354 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
355#define ICOM_CMETHOD5(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) const = 0;
357#define ICOM_CMETHOD6(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) const = 0;
359#define ICOM_CMETHOD7(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) const = 0;
361#define ICOM_CMETHOD8(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) const = 0;
363
364
365#define ICOM_VMETHOD(xfn) \
366 public: virtual void (CALLBACK xfn)(void) = 0;
367#define ICOM_VMETHOD1(xfn,ta,na) \
368 public: virtual void (CALLBACK xfn)(ta a) = 0;
369#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
370 public: virtual void (CALLBACK xfn)(ta a,tb b) = 0;
371#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
372 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) = 0;
373#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
374 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
375#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
376 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
377#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
378 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
379#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
380 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
381#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
382 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
383
384
385#define ICOM_CVMETHOD(xfn) \
386 public: virtual void (CALLBACK xfn)(void) const = 0;
387#define ICOM_CVMETHOD1(xfn,ta,na) \
388 public: virtual void (CALLBACK xfn)(ta a) const = 0;
389#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
390 public: virtual void (CALLBACK xfn)(ta a,tb b) const = 0;
391#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
392 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
393#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
394 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
395#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
396 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const = 0;
397#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
398 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const = 0;
399#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
400 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const = 0;
401#define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
402 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) const = 0;
403
404#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
405
406#define ICOM_DEFINE(iface,ibase) \
407 struct iface: public ibase { \
408 iface##_METHODS \
409 } __attribute__ ((com_interface));
410
411#else
412
413#define ICOM_DEFINE(iface,ibase) \
414 struct iface: public ibase { \
415 iface##_METHODS \
416 };
417
418#endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */
419
420#define ICOM_CALL(xfn, p) (p)->xfn()
421#define ICOM_CALL1(xfn, p,a) (p)->xfn(a)
422#define ICOM_CALL2(xfn, p,a,b) (p)->xfn(a,b)
423#define ICOM_CALL3(xfn, p,a,b,c) (p)->xfn(a,b,c)
424#define ICOM_CALL4(xfn, p,a,b,c,d) (p)->xfn(a,b,c,d)
425#define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->xfn(a,b,c,d,e)
426#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->xfn(a,b,c,d,e,f)
427#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->xfn(a,b,c,d,e,f,g)
428#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->xfn(a,b,c,d,e,f,g,h)
429
430
431#else
432/* C interface */
433
434
435#ifdef __WINE__
436
437#define ICOM_METHOD(ret,xfn) \
438 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me);
439#define ICOM_METHOD1(ret,xfn,ta,na) \
440 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a);
441#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
442 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
443#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
444 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
445#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
446 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
447#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
448 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
449#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
450 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
451#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
452 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
453#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
454 ret (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
455#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
456 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);
457#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) \
458 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);
459#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \
460 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,tk k);
461#define ICOM_METHOD12(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl) \
462 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,tk k,tl l);
463#define ICOM_METHOD13(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm) \
464 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,tk k,tl l,tm m);
465#define ICOM_METHOD14(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn) \
466 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,tk k,tl l,tm m,tn n);
467#define ICOM_METHOD15(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no) \
468 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,tk k,tl l,tm m,tn n,to o);
469#define ICOM_METHOD16(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np) \
470 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,tk k,tl l,tm m,tn n,to o,tp p);
471#define ICOM_METHOD17(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq) \
472 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,tk k,tl l,tm m,tn n,to o,tp p,tq q);
473#define ICOM_METHOD18(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr) \
474 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r);
475#define ICOM_METHOD19(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns) \
476 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s);
477#define ICOM_METHOD20(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt) \
478 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t);
479#define ICOM_METHOD21(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu) \
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,tj j,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u);
481#define ICOM_METHOD22(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv) \
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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v);
483#define ICOM_METHOD23(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw) \
484 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w);
485#define ICOM_METHOD24(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx) \
486 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x);
487#define ICOM_METHOD25(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx,ty,ny) \
488 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x,ty y);
489#define ICOM_METHOD26(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk,tl,nl,tm,nm,tn,nn,to,no,tp,np,tq,nq,tr,nr,ts,ns,tt,nt,tu,nu,tv,nv,tw,nw,tx,nx,ty,ny,tz,nz) \
490 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v,tw w,tx x,ty y,tz z);
491
492#define ICOM_CMETHOD(ret,xfn) \
493 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me);
494#define ICOM_CMETHOD1(ret,xfn,ta,na) \
495 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a);
496#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
497 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
498#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
499 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
500#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
501 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
502#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
503 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
504#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
505 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
506#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
507 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
508#define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
509 ret (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
510
511#define ICOM_VMETHOD(xfn) \
512 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me);
513#define ICOM_VMETHOD1(xfn,ta,na) \
514 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a);
515#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
516 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
517#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
518 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
519#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
520 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
521#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
522 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
523#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
524 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
525#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
526 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
527#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
528 void (* CALLBACK fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
529
530#define ICOM_CVMETHOD(xfn) \
531 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me);
532#define ICOM_CVMETHOD1(xfn,ta,na) \
533 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a);
534#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
535 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
536#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
537 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
538#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
539 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
540#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
541 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
542#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
543 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
544#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
545 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
546#define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
547 void (* CALLBACK fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
548
549#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->fn##xfn(p)
550#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->fn##xfn(p,a)
551#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->fn##xfn(p,a,b)
552#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->fn##xfn(p,a,b,c)
553#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d)
554#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e)
555#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f)
556#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)
557#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)
558#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)
559#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)
560
561#else
562
563/* WINELIB case */
564
565#define ICOM_METHOD(ret,xfn) \
566 ret (* CALLBACK xfn)(ICOM_INTERFACE* me);
567#define ICOM_METHOD1(ret,xfn,ta,na) \
568 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a);
569#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
570 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b);
571#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
572 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
573#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
574 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
575#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
576 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
577#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
578 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
579#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
580 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
581#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
582 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
583#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
584 ret (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i);
585#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) \
586 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);
587
588#define ICOM_CMETHOD(ret,xfn) \
589 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me);
590#define ICOM_CMETHOD1(ret,xfn,ta,na) \
591 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a);
592#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
593 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b);
594#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
595 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
596#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
597 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
598#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
599 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
600#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
601 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
602#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
603 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
604#define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
605 ret (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
606
607#define ICOM_VMETHOD(xfn) \
608 void (* CALLBACK xfn)(ICOM_INTERFACE* me);
609#define ICOM_VMETHOD1(xfn,ta,na) \
610 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a);
611#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
612 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b);
613#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
614 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
615#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
616 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
617#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
618 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
619#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
620 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
621#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
622 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
623#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
624 void (* CALLBACK xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
625
626#define ICOM_CVMETHOD(xfn) \
627 void (* CALLBACK xfn)(const ICOM_INTERFACE* me);
628#define ICOM_CVMETHOD1(xfn,ta,na) \
629 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a);
630#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
631 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b);
632#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
633 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
634#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
635 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
636#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
637 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
638#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
639 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
640#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
641 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
642#define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
643 void (* CALLBACK xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
644
645#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->xfn(p)
646#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->xfn(p,a)
647#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->xfn(p,a,b)
648#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->xfn(p,a,b,c)
649#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->xfn(p,a,b,c,d)
650#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->xfn(p,a,b,c,d,e)
651#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f)
652#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g)
653#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)
654#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)
655#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)
656
657#endif /* __WINE__ */
658
659#ifdef ICOM_MSVTABLE_COMPAT
660#define ICOM_DEFINE(iface,ibase) \
661 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
662 struct iface { \
663 const ICOM_VFIELD(iface); \
664 }; \
665 struct ICOM_VTABLE(iface) { \
666 long dummyRTTI1; \
667 long dummyRTTI2; \
668 ibase##_IMETHODS \
669 iface##_METHODS \
670 };
671#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0,
672
673#else
674#define ICOM_DEFINE(iface,ibase) \
675 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
676 struct iface { \
677 const ICOM_VFIELD(iface); \
678 }; \
679 struct ICOM_VTABLE(iface) { \
680 ibase##_IMETHODS \
681 iface##_METHODS \
682 };
683#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
684#endif /* ICOM_MSVTABLE_COMPAT */
685
686
687#define ICOM_THIS(impl,iface) impl* const This=(impl*)iface
688#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface
689
690#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
691#define ICOM_CTHIS_MULTI(impl,field,iface) const impl* const This=(const impl*)((char*)(iface) - offsetof(impl,field))
692
693#endif
694
695
696/*****************************************************************************
697 * Predeclare the interfaces
698 */
699DEFINE_OLEGUID(IID_IClassFactory, 0x00000001L, 0, 0);
700typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY;
701
702DEFINE_OLEGUID(IID_IMalloc, 0x00000002L, 0, 0);
703typedef struct IMalloc16 IMalloc16,*LPMALLOC16;
704typedef struct IMalloc IMalloc,*LPMALLOC;
705typedef const IMalloc *LPCMALLOC;
706
707DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0);
708typedef struct IUnknown IUnknown, *LPUNKNOWN;
709
710
711/*****************************************************************************
712 * IUnknown interface
713 */
714#define ICOM_INTERFACE IUnknown
715#define IUnknown_IMETHODS \
716 ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \
717 ICOM_METHOD (ULONG,AddRef) \
718 ICOM_METHOD (ULONG,Release)
719#ifdef ICOM_CINTERFACE
720typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown);
721struct IUnknown {
722 ICOM_VFIELD(IUnknown);
723#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) && !defined(ICOM_CINTERFACE)
724} __attribute__ ((com_interface));
725#else
726};
727#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE, !ICOM_CINTERFACE */
728
729struct ICOM_VTABLE(IUnknown) {
730#ifdef ICOM_MSVTABLE_COMPAT
731 long dummyRTTI1;
732 long dummyRTTI2;
733#endif /* ICOM_MSVTABLE_COMPAT */
734
735#else /* ICOM_CINTERFACE */
736struct IUnknown {
737
738#endif /* ICOM_CINTERFACE */
739
740 ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj)
741 ICOM_METHOD (ULONG,AddRef)
742 ICOM_METHOD (ULONG,Release)
743};
744#undef ICOM_INTERFACE
745
746/*** IUnknown methods ***/
747#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
748#define IUnknown_AddRef(p) ICOM_CALL (AddRef,p)
749#define IUnknown_Release(p) ICOM_CALL (Release,p)
750
751/*****************************************************************************
752 * IClassFactory interface
753 */
754#define ICOM_INTERFACE IClassFactory
755#define IClassFactory_METHODS \
756 ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \
757 ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock)
758#define IClassFactory_IMETHODS \
759 IUnknown_IMETHODS \
760 IClassFactory_METHODS
761ICOM_DEFINE(IClassFactory,IUnknown)
762#undef ICOM_INTERFACE
763
764/*** IUnknown methods ***/
765#define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
766#define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p)
767#define IClassFactory_Release(p) ICOM_CALL (Release,p)
768/*** IClassFactory methods ***/
769#define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c)
770#define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a)
771
772
773/*****************************************************************************
774 * IMalloc interface
775 */
776#define ICOM_INTERFACE IMalloc16
777#define IMalloc16_METHODS \
778 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
779 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
780 ICOM_VMETHOD1( Free, LPVOID,pv) \
781 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
782 ICOM_CMETHOD1(INT16, DidAlloc, LPVOID,pv) \
783 ICOM_METHOD (LPVOID,HeapMinimize)
784#define IMalloc16_IMETHODS \
785 IUnknown_IMETHODS \
786 IMalloc16_METHODS
787ICOM_DEFINE(IMalloc16,IUnknown)
788#undef ICOM_INTERFACE
789
790/*** IUnknown methods ***/
791#define IMalloc16_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
792#define IMalloc16_AddRef(p) ICOM_CALL (AddRef,p)
793#define IMalloc16_Release(p) ICOM_CALL (Release,p)
794/*** IMalloc16 methods ***/
795#define IMalloc16_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
796#define IMalloc16_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
797#define IMalloc16_Free(p,a) ICOM_CALL1(Free,p,a)
798#define IMalloc16_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
799#define IMalloc16_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
800#define IMalloc16_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
801
802
803#define ICOM_INTERFACE IMalloc
804#define IMalloc_METHODS \
805 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
806 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
807 ICOM_VMETHOD1( Free, LPVOID,pv) \
808 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
809 ICOM_CMETHOD1(INT, DidAlloc, LPVOID,pv) \
810 ICOM_METHOD (LPVOID,HeapMinimize)
811#define IMalloc_IMETHODS \
812 IUnknown_IMETHODS \
813 IMalloc_METHODS
814ICOM_DEFINE(IMalloc,IUnknown)
815#undef ICOM_INTERFACE
816
817/*** IUnknown methods ***/
818#define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
819#define IMalloc_AddRef(p) ICOM_CALL (AddRef,p)
820#define IMalloc_Release(p) ICOM_CALL (Release,p)
821/*** IMalloc32 methods ***/
822#define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
823#define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
824#define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a)
825#define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
826#define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
827#define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
828
829/*****************************************************************************
830 */
831
832#ifdef __cplusplus
833extern "C" {
834#endif /* defined(__cplusplus) */
835
836/* values passed to CoGetMalloc */
837#define MEMCTX_TASK 1 /* private task memory */
838#define MEMCTX_SHARED 2 /* shared memory */
839#ifdef _MAC
840#define MEMCTX_MACSYSTEM 3 /* system heap on mac */
841#endif
842/* mainly for internal use... */
843#define MEMCTX_UNKNOWN -1
844#define MEMCTX_SAME -2
845
846HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, LPMALLOC16* lpMalloc);
847
848HRESULT WINAPI CoGetMalloc16(DWORD dwMemContext,LPMALLOC16* lpMalloc);
849HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc);
850
851LPVOID WINAPI CoTaskMemAlloc(ULONG size);
852
853void WINAPI CoTaskMemFree(LPVOID ptr);
854
855/* FIXME: unimplemented */
856LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
857
858/*****************************************************************************
859 * GUID API
860 */
861
862HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*);
863HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
864
865HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
866HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *);
867HRESULT WINAPI CLSIDFromStringA(LPCSTR, CLSID *);
868
869HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid);
870HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
871
872HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
873
874INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
875
876BOOL16 WINAPI IsEqualGUID16(GUID* g1,GUID* g2);
877BOOL WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
878
879/*****************************************************************************
880 * Additional API
881 */
882
883HRESULT WINAPI CoCreateGuid(GUID* pguid);
884
885void WINAPI CoFreeAllLibraries(void);
886
887void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
888
889void WINAPI CoFreeUnusedLibraries(void);
890
891HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
892
893HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
894
895HRESULT WINAPI CoInitialize16(LPVOID lpReserved);
896HRESULT WINAPI CoInitialize(LPVOID lpReserved);
897HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
898
899void WINAPI CoUninitialize16(void);
900void WINAPI CoUninitialize(void);
901
902typedef enum tagCOINIT
903{
904 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
905 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
906 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
907 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
908} COINIT;
909
910
911/* FIXME: not implemented */
912BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
913
914HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
915
916HRESULT WINAPI CoLockObjectExternal16(LPUNKNOWN pUnk, BOOL16 fLock, BOOL16 fLastUnlockReleases);
917HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
918
919/* class registration flags; passed to CoRegisterClassObject */
920typedef enum tagREGCLS
921{
922 REGCLS_SINGLEUSE = 0,
923 REGCLS_MULTIPLEUSE = 1,
924 REGCLS_MULTI_SEPARATE = 2,
925 REGCLS_SUSPENDED = 4
926} REGCLS;
927
928HRESULT WINAPI CoRegisterClassObject16(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
929HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
930
931HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
932
933/*****************************************************************************
934 * COM Server dll - exports
935 */
936HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
937HRESULT WINAPI DllCanUnloadNow(void);
938
939/*****************************************************************************
940 * Internal WINE API
941 */
942#ifdef __WINE__
943HRESULT WINAPI WINE_StringFromCLSID(const CLSID *id, LPSTR);
944#endif
945
946#ifdef __cplusplus
947} /* extern "C" */
948#endif /* defined(__cplusplus) */
949
950#endif /* __WINE_WINE_OBJ_BASE_H */
Note: See TracBrowser for help on using the repository browser.