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.
19 * If you aren't interested in WineLib C++ compatability at all, leave both
22 /* #define ICOM_MSVTABLE_COMPAT 1 */
23 /* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
25 /*****************************************************************************
26 * Defines the basic types
31 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
32 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
34 /*****************************************************************************
35 * Macros to declare the GUIDs
38 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
40 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
42 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
43 extern const GUID name
46 #define DEFINE_OLEGUID(name, l, w1, w2) \
47 DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
49 #define DEFINE_SHLGUID(name, l, w1, w2) DEFINE_OLEGUID(name,l,w1,w2)
52 /*****************************************************************************
55 HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*);
56 HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
58 HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
59 HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *);
61 HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid);
62 HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
64 INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
66 BOOL16 WINAPI IsEqualGUID16(GUID* g1,GUID* g2);
67 BOOL WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
68 /*#define IsEqualGUID WINELIB_NAME(IsEqualGUID)*/
69 #if defined(__cplusplus) && !defined(CINTERFACE)
70 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
71 #else /* defined(__cplusplus) && !defined(CINTERFACE) */
72 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
73 #endif /* defined(__cplusplus) && !defined(CINTERFACE) */
74 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
75 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
77 #if defined(__cplusplus) && !defined(CINTERFACE)
78 inline BOOL operator==(const GUID& guidOne, const GUID& guidOther)
80 return !memcmp(&guidOne,&guidOther,sizeof(GUID));
82 inline BOOL operator!=(const GUID& guidOne, const GUID& guidOther)
84 return !(guidOne == guidOther);
89 /*****************************************************************************
90 * Macros to define a COM interface
93 * The goal of the following set of definitions is to provide a way to use the same
94 * header file definitions to provide both a C interface and a C++ object oriented
95 * interface to COM interfaces. The type of interface is selected automatically
96 * depending on the language but it is always possible to get the C interface in C++
97 * by defining CINTERFACE.
99 * It is based on the following assumptions:
100 * - all COM interfaces derive from IUnknown, this should not be a problem.
101 * - the header file only defines the interface, the actual fields are defined
102 * separately in the C file implementing the interface.
104 * The natural approach to this problem would be to make sure we get a C++ class and
105 * virtual methods in C++ and a structure with a table of pointer to functions in C.
106 * Unfortunately the layout of the virtual table is compiler specific, the layout of
107 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
108 * same as that generated by Visual C+. There are workarounds to make the virtual tables
109 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
110 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
112 * So the solution I finally adopted does not use virtual tables. Instead I use inline
113 * non virtual methods that dereference the method pointer themselves and perform the call.
115 * Let's take Direct3D as an example:
117 * #define ICOM_INTERFACE IDirect3D
118 * #define IDirect3D_METHODS \
119 * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \
120 * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \
121 * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \
122 * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \
123 * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \
124 * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,)
125 * #define IDirect3D_IMETHODS \
126 * IUnknown_IMETHODS \
128 * ICOM_DEFINE(IDirect3D,IUnknown)
129 * #undef ICOM_INTERFACE
131 * #ifdef ICOM_CINTERFACE
132 * // *** IUnknown methods *** //
133 * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
134 * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p)
135 * #define IDirect3D_Release(p) ICOM_CALL (Release,p)
136 * // *** IDirect3D methods *** //
137 * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a)
138 * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b)
139 * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b)
140 * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
141 * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
142 * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b)
146 * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this'
147 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
148 * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1
149 * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not
150 * 'IDirect3D_VTABLE'.
151 * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the
152 * inherited methods to form ICOM_IMETHODS.
153 * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must
154 * be written manually (rather than using a macro to generate the equivalent code) to avoid
155 * macro recursion (which compilers don't like).
156 * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
157 * explicitly use the interface name for macro expansion reasons again.
158 * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's
159 * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance
160 * is taken care of by the language.
161 * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer
162 * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The
163 * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and
164 * to have it take only the type information (with const if necessary) as parameters.
165 * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following
166 * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once
167 * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone
169 * - You may have noticed the double commas after each parameter type. This allows you to put the
170 * name of that parameter which I think is good for documentation. It is not required and since
171 * I did not know what to put there for this example (I could only find doc about IDirect3D2),
173 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
174 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
175 * the inherited method definitions there. This time I could have used a trick to use only one
176 * macro whatever the number of parameters but I prefered to have it work the same way as above.
177 * - You probably have noticed that we don't define the fields we need to actually implement this
178 * interface: reference count, pointer to other resources and miscellaneous fields. That's
179 * because these interfaces are just that: interfaces. They may be implemented more than once, in
180 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
181 * that the interface contains some specific fields.
185 * typedef struct IDirect3DVtbl IDirect3DVtbl;
187 * IDirect3DVtbl* lpvtbl;
189 * struct IDirect3DVtbl {
190 * HRESULT (*fnQueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
191 * ULONG (*fnQueryInterface)(IDirect3D* me);
192 * ULONG (*fnQueryInterface)(IDirect3D* me);
193 * HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
194 * HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
195 * HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
196 * HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
197 * HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
198 * HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
201 * #ifdef ICOM_CINTERFACE
202 * // *** IUnknown methods *** //
203 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpvtbl->fnQueryInterface(p,a,b)
204 * #define IDirect3D_AddRef(p) (p)->lpvtbl->fnAddRef(p)
205 * #define IDirect3D_Release(p) (p)->lpvtbl->fnRelease(p)
206 * // *** IDirect3D methods *** //
207 * #define IDirect3D_Initialize(p,a) (p)->lpvtbl->fnInitialize(p,a)
208 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpvtbl->fnEnumDevice(p,a,b)
209 * #define IDirect3D_CreateLight(p,a,b) (p)->lpvtbl->fnCreateLight(p,a,b)
210 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpvtbl->fnCreateMaterial(p,a,b)
211 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpvtbl->fnCreateViewport(p,a,b)
212 * #define IDirect3D_FindDevice(p,a,b) (p)->lpvtbl->fnFindDevice(p,a,b)
216 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
217 * the user needs to know to use the interface. Of course the structure we will define to
218 * implement this interface will have more fields but the first one will match this pointer.
219 * - The code generated by ICOM_DEFINE defines both the structure representing the interface and
220 * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to
221 * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
222 * to define the IDirect3D methods.
223 * - Each method is declared as a pointer to function field in the jump table. The implementation
224 * will fill this jump table with appropriate values, probably using a static variable, and
225 * initialize the lpvtbl field to point to this variable.
226 * - The IDirect3D_Xxx macros then just derefence the lpvtbl pointer and use the function pointer
227 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
229 * - This C code should be quite compatible with the Windows headers both for code that uses COM
230 * interfaces and for code implementing a COM interface.
233 * And in C++ (with gcc's g++):
235 * typedef struct IDirect3D: public IUnknown {
236 * private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
237 * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpvtbl)->fnInitialize(this,a); };
238 * private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
239 * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
240 * { return ((IDirect3D*)t.lpvtbl)->fnEnumDevices(this,a,b); };
241 * private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
242 * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
243 * { return ((IDirect3D*)t.lpvtbl)->fnCreateLight(this,a,b); };
244 * private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
245 * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
246 * { return ((IDirect3D*)t.lpvtbl)->fnCreateMaterial(this,a,b); };
247 * private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
248 * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
249 * { return ((IDirect3D*)t.lpvtbl)->fnCreateViewport(this,a,b); };
250 * private: HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
251 * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
252 * { return ((IDirect3D*)t.lpvtbl)->fnFindDevice(this,a,b); };
256 * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface
257 * definition. The reason for this is to avoid having to duplicate the mehod definitions: once
258 * to have the function pointers in the jump table and once to have the methods in the interface
259 * class. Here one macro can generate both. This means though that the first pointer, t.lpvtbl
260 * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the
261 * structure as the the interface class, and as the function pointer to the QueryInterface
262 * method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this
263 * gymnastic is entirely taken care of in the header of IUnknown.
264 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
265 * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and
266 * a non-vritual inline method which dereferences it and calls it. This way this method behaves
267 * just like a virtual method but does not create a true C++ virtual table which would break the
268 * structure layout. If you look at the implementation of these methods you'll notice that they
269 * would not work for void functions. We have to return something and fortunately this seems to
270 * be what all the COM methods do (otherwise we would need another set of macros).
271 * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter
272 * names and the method invocation using only the formal parameter name. This is the reason why
273 * we need different macros to handle different numbers of parameters.
274 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
275 * macro is defined in which case we would not be here.
276 * - This C++ code works well for code that just uses COM interfaces. But it will not work with
277 * C++ code implement a COM interface. That's because such code assumes the interface methods
278 * are declared as virtual C++ methods which is not the case here.
281 * Implementing a COM interface.
283 * This continues the above example. This example assumes that the implementation is in C.
285 * typedef struct _IDirect3D {
291 * static ICOM_VTABLE(IDirect3D) d3dvt;
293 * // implement the IDirect3D methods here
295 * int IDirect3D_fnQueryInterface(IDirect3D* me)
297 * ICOM_THIS(IDirect3D,me);
303 * static ICOM_VTABLE(IDirect3D) d3dvt = {
304 * IDirect3D_fnQueryInterface,
307 * IDirect3D_fnInitialize,
308 * IDirect3D_fnSetWidth
312 * - We first define what the interface really contains. This is th e_IDirect3D structure. The
313 * first field must of course be the virtual table pointer. Everything else is free.
314 * - Then we predeclare our static virtual table variable, we will need its address in some
315 * methods to initialize the virtual table pointer of the returned interface objects.
316 * - Then we implement the interface methods. To match what has been declared in the header file
317 * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that
318 * we can manipulate the fields. This is performed by the ICOM_THIS macro.
319 * - Finally we initialize the virtual table.
323 #define ICOM_VTABLE(iface) iface##Vtbl
326 #if !defined(__cplusplus) || defined(CINTERFACE)
327 #define ICOM_CINTERFACE 1
330 #ifndef ICOM_CINTERFACE
333 #define ICOM_METHOD(ret,xfn) \
334 public: virtual ret (CALLBACK xfn)(void) = 0;
336 #define ICOM_METHOD1(ret,xfn,ta,na) \
337 public: virtual ret (CALLBACK xfn)(ta a) = 0;
339 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
340 public: virtual ret (CALLBACK xfn)(ta a,tb b) = 0;
342 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
343 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) = 0;
345 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
346 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
348 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
349 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
351 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
352 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
354 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
355 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
357 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
358 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
360 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
361 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0;
363 #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) \
364 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;
367 #define ICOM_CMETHOD(ret,xfn) \
368 public: virtual ret (CALLBACK xfn)(void) const = 0;
370 #define ICOM_CMETHOD1(ret,xfn,ta,na) \
371 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;
376 #define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
377 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
379 #define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
380 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
382 #define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
383 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const = 0;
385 #define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
386 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const = 0;
388 #define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
389 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const = 0;
391 #define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
392 public: virtual ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) const = 0;
395 #define ICOM_VMETHOD(xfn) \
396 public: virtual void (CALLBACK xfn)(void) = 0;
398 #define ICOM_VMETHOD1(xfn,ta,na) \
399 public: virtual void (CALLBACK xfn)(ta a) = 0;
401 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
402 public: virtual void (CALLBACK xfn)(ta a,tb b) = 0;
404 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
405 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) = 0;
407 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
408 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) = 0;
410 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
411 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) = 0;
413 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
414 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
416 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
417 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
419 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
420 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
423 #define ICOM_CVMETHOD(xfn) \
424 public: virtual void (CALLBACK xfn)(void) const = 0;
426 #define ICOM_CVMETHOD1(xfn,ta,na) \
427 public: virtual void (CALLBACK xfn)(ta a) const = 0;
429 #define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
430 public: virtual void (CALLBACK xfn)(ta a,tb b) const = 0;
432 #define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
433 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c) const = 0;
435 #define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
436 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d) const = 0;
438 #define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
439 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const = 0;
441 #define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
442 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const = 0;
444 #define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
445 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const = 0;
447 #define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
448 public: virtual void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) const = 0;
450 #ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
452 #define ICOM_DEFINE(iface,ibase) \
453 typedef struct iface: public ibase { \
455 } __attribute__ ((com_interface));
459 #define ICOM_DEFINE(iface,ibase) \
460 typedef struct iface: public ibase { \
464 #endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */
466 #define ICOM_CALL(xfn, p) (p)->fn##xfn()
467 #define ICOM_CALL1(xfn, p,a) (p)->fn##xfn(a)
468 #define ICOM_CALL2(xfn, p,a,b) (p)->fn##xfn(a,b)
469 #define ICOM_CALL3(xfn, p,a,b,c) (p)->fn##xfn(a,b,c)
470 #define ICOM_CALL4(xfn, p,a,b,c,d) (p)->fn##xfn(a,b,c,d)
471 #define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->fn##xfn(a,b,c,d,e)
472 #define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->fn##xfn(a,b,c,d,e,f)
473 #define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->fn##xfn(a,b,c,d,e,f,g)
474 #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->fn##xfn(a,b,c,d,e,f,g,h)
481 #define ICOM_METHOD(ret,xfn) \
482 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
484 #define ICOM_METHOD1(ret,xfn,ta,na) \
485 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
487 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
488 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
490 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
491 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
493 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
494 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
496 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
497 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
499 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
500 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
502 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
503 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
505 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
506 ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
508 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
509 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);
511 #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) \
512 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);
515 #define ICOM_CMETHOD(ret,xfn) \
516 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
518 #define ICOM_CMETHOD1(ret,xfn,ta,na) \
519 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
521 #define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
522 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
524 #define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
525 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
527 #define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
528 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
530 #define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
531 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
533 #define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
534 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
536 #define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
537 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
539 #define ICOM_CMETHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
540 ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
543 #define ICOM_VMETHOD(xfn) \
544 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
546 #define ICOM_VMETHOD1(xfn,ta,na) \
547 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
549 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
550 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
552 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
553 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
555 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
556 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
558 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
559 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
561 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
562 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
564 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
565 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
567 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
568 void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
571 #define ICOM_CVMETHOD(xfn) \
572 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
574 #define ICOM_CVMETHOD1(xfn,ta,na) \
575 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
577 #define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
578 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
580 #define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
581 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
583 #define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
584 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
586 #define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
587 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
589 #define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
590 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
592 #define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
593 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
595 #define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
596 void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
599 #ifdef ICOM_MSVTABLE_COMPAT
600 #define ICOM_DEFINE(iface,ibase) \
601 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
603 const ICOM_VTABLE(iface)* lpvtbl; \
605 struct ICOM_VTABLE(iface) { \
611 #define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0,
614 #define ICOM_DEFINE(iface,ibase) \
615 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
617 const ICOM_VTABLE(iface)* lpvtbl; \
619 struct ICOM_VTABLE(iface) { \
623 #define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
624 #endif /* ICOM_MSVTABLE_COMPAT */
627 #define ICOM_CALL(xfn, p) (p)->lpvtbl->fn##xfn(p)
628 #define ICOM_CALL1(xfn, p,a) (p)->lpvtbl->fn##xfn(p,a)
629 #define ICOM_CALL2(xfn, p,a,b) (p)->lpvtbl->fn##xfn(p,a,b)
630 #define ICOM_CALL3(xfn, p,a,b,c) (p)->lpvtbl->fn##xfn(p,a,b,c)
631 #define ICOM_CALL4(xfn, p,a,b,c,d) (p)->lpvtbl->fn##xfn(p,a,b,c,d)
632 #define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e)
633 #define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f)
634 #define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g)
635 #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h)
636 #define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h,i)
637 #define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h,i,j)
640 #define ICOM_THIS(impl,iface) impl* const This=(impl*)iface
641 #define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface
646 /*****************************************************************************
647 * Predeclare the interfaces
649 DEFINE_OLEGUID(IID_IClassFactory, 0x00000001L, 0, 0);
650 typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY;
652 DEFINE_OLEGUID(IID_IMalloc, 0x00000002L, 0, 0);
653 typedef struct IMalloc16 IMalloc16,*LPMALLOC16;
654 typedef struct IMalloc IMalloc,*LPMALLOC;
656 DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0);
657 typedef struct IUnknown IUnknown, *LPUNKNOWN;
660 /*****************************************************************************
663 #define ICOM_INTERFACE IUnknown
664 #define IUnknown_IMETHODS \
665 ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \
666 ICOM_METHOD (ULONG,AddRef) \
667 ICOM_METHOD (ULONG,Release)
668 #ifdef ICOM_CINTERFACE
669 typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown);
671 ICOM_VTABLE(IUnknown)* lpvtbl;
672 #if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) && !defined(ICOM_CINTERFACE)
673 } __attribute__ ((com_interface));
676 #endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE, !ICOM_CINTERFACE */
678 struct ICOM_VTABLE(IUnknown) {
679 #ifdef ICOM_MSVTABLE_COMPAT
682 #endif /* ICOM_MSVTABLE_COMPAT */
684 #else /* ICOM_CINTERFACE */
687 #endif /* ICOM_CINTERFACE */
689 ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj)
690 ICOM_METHOD (ULONG,AddRef)
691 ICOM_METHOD (ULONG,Release)
693 #undef ICOM_INTERFACE
695 /*** IUnknown methods ***/
696 #define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
697 #define IUnknown_AddRef(p) ICOM_CALL (AddRef,p)
698 #define IUnknown_Release(p) ICOM_CALL (Release,p)
700 /*****************************************************************************
701 * IClassFactory interface
703 #define ICOM_INTERFACE IClassFactory
704 #define IClassFactory_METHODS \
705 ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \
706 ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock)
707 #define IClassFactory_IMETHODS \
709 IClassFactory_METHODS
710 ICOM_DEFINE(IClassFactory,IUnknown)
711 #undef ICOM_INTERFACE
713 /*** IUnknown methods ***/
714 #define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
715 #define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p)
716 #define IClassFactory_Release(p) ICOM_CALL (Release,p)
717 /*** IClassFactory methods ***/
718 #define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c)
719 #define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a)
722 /*****************************************************************************
725 #define ICOM_INTERFACE IMalloc16
726 #define IMalloc16_METHODS \
727 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
728 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
729 ICOM_VMETHOD1( Free, LPVOID,pv) \
730 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
731 ICOM_CMETHOD1(INT16, DidAlloc, LPVOID,pv) \
732 ICOM_METHOD (LPVOID,HeapMinimize)
733 #define IMalloc16_IMETHODS \
736 ICOM_DEFINE(IMalloc16,IUnknown)
737 #undef ICOM_INTERFACE
739 /*** IUnknown methods ***/
740 #define IMalloc16_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
741 #define IMalloc16_AddRef(p) ICOM_CALL (AddRef,p)
742 #define IMalloc16_Release(p) ICOM_CALL (Release,p)
743 /*** IMalloc16 methods ***/
744 #define IMalloc16_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
745 #define IMalloc16_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
746 #define IMalloc16_Free(p,a) ICOM_CALL1(Free,p,a)
747 #define IMalloc16_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
748 #define IMalloc16_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
749 #define IMalloc16_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
752 #define ICOM_INTERFACE IMalloc
753 #define IMalloc_METHODS \
754 ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \
755 ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \
756 ICOM_VMETHOD1( Free, LPVOID,pv) \
757 ICOM_CMETHOD1(DWORD, GetSize, LPVOID,pv) \
758 ICOM_CMETHOD1(INT, DidAlloc, LPVOID,pv) \
759 ICOM_METHOD (LPVOID,HeapMinimize)
760 #define IMalloc_IMETHODS \
763 ICOM_DEFINE(IMalloc,IUnknown)
764 #undef ICOM_INTERFACE
766 /*** IUnknown methods ***/
767 #define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
768 #define IMalloc_AddRef(p) ICOM_CALL (AddRef,p)
769 #define IMalloc_Release(p) ICOM_CALL (Release,p)
770 /*** IMalloc32 methods ***/
771 #define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a)
772 #define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b)
773 #define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a)
774 #define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a)
775 #define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a)
776 #define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
779 HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, LPMALLOC16* lpMalloc);
781 HRESULT WINAPI CoGetMalloc16(DWORD dwMemContext,LPMALLOC16* lpMalloc);
782 HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc);
784 LPVOID WINAPI CoTaskMemAlloc(ULONG size);
786 void WINAPI CoTaskMemFree(LPVOID ptr);
788 /* FIXME: unimplemented */
789 LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
792 /*****************************************************************************
796 HRESULT WINAPI CoCreateGuid(GUID* pguid);
798 void WINAPI CoFreeAllLibraries(void);
800 void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
802 void WINAPI CoFreeUnusedLibraries(void);
804 HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
806 HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID iid, LPVOID *ppv);
808 HRESULT WINAPI CoInitialize16(LPVOID lpReserved);
809 HRESULT WINAPI CoInitialize(LPVOID lpReserved);
810 HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
812 void WINAPI CoUninitialize16(void);
813 void WINAPI CoUninitialize(void);
815 typedef enum tagCOINIT
817 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
818 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
819 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
820 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
824 /* FIXME: not implemented */
825 BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
827 HINSTANCE WINAPI CoLoadLibrary(LPOLESTR16 lpszLibName, BOOL bAutoFree);
829 HRESULT WINAPI CoLockObjectExternal16(LPUNKNOWN pUnk, BOOL16 fLock, BOOL16 fLastUnlockReleases);
830 HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
832 /* class registration flags; passed to CoRegisterClassObject */
833 typedef enum tagREGCLS
835 REGCLS_SINGLEUSE = 0,
836 REGCLS_MULTIPLEUSE = 1,
837 REGCLS_MULTI_SEPARATE = 2,
841 HRESULT WINAPI CoRegisterClassObject16(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
842 HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
844 HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
846 void WINAPI CoUninitialize16(void);
847 void WINAPI CoUninitialize(void);
849 /*****************************************************************************
850 * COM Server dll - exports
852 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
853 HRESULT WINAPI DllCanUnloadNow(void);
855 /*****************************************************************************
859 HRESULT WINE_StringFromCLSID(const CLSID *id, LPSTR);
862 #endif /* __WINE_WINE_OBJ_BASE_H */