2 * Copyright (C) 1998-1999 François Gouget
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 /*****************************************************************************
26 * define ICOM_MSVTABLE_COMPAT
27 * to implement the microsoft com vtable compatibility workaround for g++.
29 * NOTE: Turning this option on will produce a winelib that is incompatible
30 * with the binary emulator.
32 * If the compiler supports the com_interface attribute, leave this off, and
33 * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also
34 * require the addition of the -vtable-thunks option for g++.
36 * If you aren't interested in Winelib C++ compatibility at all, leave both
39 * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro
40 * would be to define it only for your Winelib application. This allows you
41 * to have both binary and Winelib compatibility for C and C++ at the same
44 /* #define ICOM_MSVTABLE_COMPAT 1 */
45 /* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
50 /* For compatibility only, at least for now */
62 #ifndef NONAMELESSSTRUCT
63 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
64 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
66 #define LISet32(li, v) ((li).s.HighPart = (v) < 0 ? -1 : 0, (li).s.LowPart = (v))
67 #define ULISet32(li, v) ((li).s.HighPart = 0, (li).s.LowPart = (v))
70 /*****************************************************************************
73 DWORD WINAPI
CoBuildVersion(void);
75 typedef enum tagCOINIT
77 COINIT_APARTMENTTHREADED
= 0x2, /* Apartment model */
78 COINIT_MULTITHREADED
= 0x0, /* OLE calls objects on any thread */
79 COINIT_DISABLE_OLE1DDE
= 0x4, /* Don't use DDE for Ole1 support */
80 COINIT_SPEED_OVER_MEMORY
= 0x8 /* Trade memory for speed */
83 HRESULT WINAPI
CoInitialize(LPVOID lpReserved
);
84 HRESULT WINAPI
CoInitializeEx(LPVOID lpReserved
, DWORD dwCoInit
);
85 void WINAPI
CoUninitialize(void);
86 DWORD WINAPI
CoGetCurrentProcess(void);
88 HINSTANCE WINAPI
CoLoadLibrary(LPOLESTR lpszLibName
, BOOL bAutoFree
);
89 void WINAPI
CoFreeAllLibraries(void);
90 void WINAPI
CoFreeLibrary(HINSTANCE hLibrary
);
91 void WINAPI
CoFreeUnusedLibraries(void);
93 HRESULT WINAPI
CoCreateInstance(REFCLSID rclsid
, LPUNKNOWN pUnkOuter
, DWORD dwClsContext
, REFIID iid
, LPVOID
*ppv
);
94 HRESULT WINAPI
CoCreateInstanceEx(REFCLSID rclsid
,
97 COSERVERINFO
* pServerInfo
,
101 HRESULT WINAPI
CoGetInstanceFromFile(COSERVERINFO
* pServerInfo
, CLSID
* pClsid
, IUnknown
* punkOuter
, DWORD dwClsCtx
, DWORD grfMode
, OLECHAR
* pwszName
, DWORD dwCount
, MULTI_QI
* pResults
);
102 HRESULT WINAPI
CoGetInstanceFromIStorage(COSERVERINFO
* pServerInfo
, CLSID
* pClsid
, IUnknown
* punkOuter
, DWORD dwClsCtx
, IStorage
* pstg
, DWORD dwCount
, MULTI_QI
* pResults
);
104 HRESULT WINAPI
CoGetMalloc(DWORD dwMemContext
, LPMALLOC
* lpMalloc
);
105 LPVOID WINAPI
CoTaskMemAlloc(ULONG size
);
106 void WINAPI
CoTaskMemFree(LPVOID ptr
);
107 LPVOID WINAPI
CoTaskMemRealloc(LPVOID ptr
, ULONG size
);
109 HRESULT WINAPI
CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy
);
110 HRESULT WINAPI
CoRevokeMallocSpy(void);
112 /* class registration flags; passed to CoRegisterClassObject */
113 typedef enum tagREGCLS
115 REGCLS_SINGLEUSE
= 0,
116 REGCLS_MULTIPLEUSE
= 1,
117 REGCLS_MULTI_SEPARATE
= 2,
121 HRESULT WINAPI
CoGetClassObject(REFCLSID rclsid
, DWORD dwClsContext
, COSERVERINFO
*pServerInfo
, REFIID iid
, LPVOID
*ppv
);
122 HRESULT WINAPI
CoRegisterClassObject(REFCLSID rclsid
,LPUNKNOWN pUnk
,DWORD dwClsContext
,DWORD flags
,LPDWORD lpdwRegister
);
123 HRESULT WINAPI
CoRevokeClassObject(DWORD dwRegister
);
124 HRESULT WINAPI
CoGetPSClsid(REFIID riid
,CLSID
*pclsid
);
125 HRESULT WINAPI
CoRegisterPSClsid(REFIID riid
, REFCLSID rclsid
);
126 HRESULT WINAPI
CoSuspendClassObjects(void);
127 HRESULT WINAPI
CoResumeClassObjects(void);
128 ULONG WINAPI
CoAddRefServerProcess(void);
129 HRESULT WINAPI
CoReleaseServerProcess(void);
132 HRESULT WINAPI
CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter
, LPUNKNOWN
* ppunkMarshal
);
133 HRESULT WINAPI
CoGetInterfaceAndReleaseStream(LPSTREAM pStm
, REFIID iid
, LPVOID
* ppv
);
134 HRESULT WINAPI
CoGetMarshalSizeMax(ULONG
* pulSize
, REFIID riid
, LPUNKNOWN pUnk
, DWORD dwDestContext
, LPVOID pvDestContext
, DWORD mshlflags
);
135 HRESULT WINAPI
CoGetStandardMarshal(REFIID riid
, LPUNKNOWN pUnk
, DWORD dwDestContext
, LPVOID pvDestContext
, DWORD mshlflags
, LPMARSHAL
* ppMarshal
);
136 HRESULT WINAPI
CoMarshalHresult(LPSTREAM pstm
, HRESULT hresult
);
137 HRESULT WINAPI
CoMarshalInterface(LPSTREAM pStm
, REFIID riid
, LPUNKNOWN pUnk
, DWORD dwDestContext
, LPVOID pvDestContext
, DWORD mshlflags
);
138 HRESULT WINAPI
CoMarshalInterThreadInterfaceInStream(REFIID riid
, LPUNKNOWN pUnk
, LPSTREAM
* ppStm
);
139 HRESULT WINAPI
CoReleaseMarshalData(LPSTREAM pStm
);
140 HRESULT WINAPI
CoUnmarshalHresult(LPSTREAM pstm
, HRESULT
* phresult
);
141 HRESULT WINAPI
CoUnmarshalInterface(LPSTREAM pStm
, REFIID riid
, LPVOID
* ppv
);
142 HRESULT WINAPI
CoLockObjectExternal(LPUNKNOWN pUnk
, BOOL fLock
, BOOL fLastUnlockReleases
);
143 BOOL WINAPI
CoIsHandlerConnected(LPUNKNOWN pUnk
);
146 HRESULT WINAPI
CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc
, LONG cAuthSvc
, SOLE_AUTHENTICATION_SERVICE
* asAuthSvc
, void* pReserved1
, DWORD dwAuthnLevel
, DWORD dwImpLevel
, void* pReserved2
, DWORD dwCapabilities
, void* pReserved3
);
147 HRESULT WINAPI
CoGetCallContext(REFIID riid
, void** ppInterface
);
148 HRESULT WINAPI
CoQueryAuthenticationServices(DWORD
* pcAuthSvc
, SOLE_AUTHENTICATION_SERVICE
** asAuthSvc
);
150 HRESULT WINAPI
CoQueryProxyBlanket(IUnknown
* pProxy
, DWORD
* pwAuthnSvc
, DWORD
* pAuthzSvc
, OLECHAR
** pServerPrincName
, DWORD
* pAuthnLevel
, DWORD
* pImpLevel
, RPC_AUTH_IDENTITY_HANDLE
* pAuthInfo
, DWORD
* pCapabilites
);
151 HRESULT WINAPI
CoSetProxyBlanket(IUnknown
* pProxy
, DWORD dwAuthnSvc
, DWORD dwAuthzSvc
, OLECHAR
* pServerPrincName
, DWORD dwAuthnLevel
, DWORD dwImpLevel
, RPC_AUTH_IDENTITY_HANDLE pAuthInfo
, DWORD dwCapabilities
);
152 HRESULT WINAPI
CoCopyProxy(IUnknown
* pProxy
, IUnknown
** ppCopy
);
154 HRESULT WINAPI
CoImpersonateClient(void);
155 HRESULT WINAPI
CoQueryClientBlanket(DWORD
* pAuthnSvc
, DWORD
* pAuthzSvc
, OLECHAR16
** pServerPrincName
, DWORD
* pAuthnLevel
, DWORD
* pImpLevel
, RPC_AUTHZ_HANDLE
* pPrivs
, DWORD
* pCapabilities
);
156 HRESULT WINAPI
CoRevertToSelf(void);
159 HRESULT WINAPI
CoGetTreatAsClass(REFCLSID clsidOld
, LPCLSID pClsidNew
);
160 HRESULT WINAPI
CoTreatAsClass(REFCLSID clsidOld
, REFCLSID clsidNew
);
162 HRESULT WINAPI
CoCreateGuid(GUID
* pguid
);
163 BOOL WINAPI
CoIsOle1Class(REFCLSID rclsid
);
165 BOOL WINAPI
CoDosDateTimeToFileTime(WORD nDosDate
, WORD nDosTime
, FILETIME
* lpFileTime
);
166 BOOL WINAPI
CoFileTimeToDosDateTime(FILETIME
* lpFileTime
, WORD
* lpDosDate
, WORD
* lpDosTime
);
167 HRESULT WINAPI
CoFileTimeNow(FILETIME
* lpFileTime
);
169 /*****************************************************************************
172 HRESULT WINAPI
StringFromCLSID16(REFCLSID id
, LPOLESTR16
*);
173 HRESULT WINAPI
StringFromCLSID(REFCLSID id
, LPOLESTR
*);
175 HRESULT WINAPI
CLSIDFromString16(LPCOLESTR16
, CLSID
*);
176 HRESULT WINAPI
CLSIDFromString(LPCOLESTR
, CLSID
*);
178 HRESULT WINAPI
CLSIDFromProgID16(LPCOLESTR16 progid
, LPCLSID riid
);
179 HRESULT WINAPI
CLSIDFromProgID(LPCOLESTR progid
, LPCLSID riid
);
181 HRESULT WINAPI
ProgIDFromCLSID(REFCLSID clsid
, LPOLESTR
*lplpszProgID
);
183 INT WINAPI
StringFromGUID2(REFGUID id
, LPOLESTR str
, INT cmax
);
185 /*****************************************************************************
186 * COM Server dll - exports
188 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
);
189 HRESULT WINAPI
DllCanUnloadNow(void);
191 /*****************************************************************************
194 HRESULT WINAPI
CreateDataAdviseHolder(LPDATAADVISEHOLDER
* ppDAHolder
);
195 HRESULT WINAPI
CreateDataCache(LPUNKNOWN pUnkOuter
, REFCLSID rclsid
, REFIID iid
, LPVOID
* ppv
);
197 /*****************************************************************************
200 HRESULT WINAPI
GetClassFile(LPCOLESTR filePathName
,CLSID
*pclsid
);
202 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
);
203 HRESULT WINAPI
CreateBindCtx(DWORD reserved
, LPBC
* ppbc
);
205 HRESULT WINAPI
CreateFileMoniker16(LPCOLESTR16 lpszPathName
, LPMONIKER
* ppmk
);
206 HRESULT WINAPI
CreateFileMoniker(LPCOLESTR lpszPathName
, LPMONIKER
* ppmk
);
208 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
, LPCOLESTR lpszItem
, LPMONIKER
* ppmk
);
209 HRESULT WINAPI
CreateItemMoniker(LPCOLESTR lpszDelim
, LPCOLESTR lpszItem
, LPMONIKER
* ppmk
);
211 HRESULT WINAPI
CreateAntiMoniker(LPMONIKER
* ppmk
);
213 HRESULT WINAPI
CreateGenericComposite(LPMONIKER pmkFirst
, LPMONIKER pmkRest
, LPMONIKER
* ppmkComposite
);
215 HRESULT WINAPI
BindMoniker(LPMONIKER pmk
, DWORD grfOpt
, REFIID iidResult
, LPVOID
* ppvResult
);
217 HRESULT WINAPI
CreateClassMoniker(REFCLSID rclsid
, LPMONIKER
* ppmk
);
219 HRESULT WINAPI
CreatePointerMoniker(LPUNKNOWN punk
, LPMONIKER
* ppmk
);
221 HRESULT WINAPI
MonikerCommonPrefixWith(IMoniker
* pmkThis
,IMoniker
* pmkOther
,IMoniker
** ppmkCommon
);
223 HRESULT WINAPI
GetRunningObjectTable(DWORD reserved
, LPRUNNINGOBJECTTABLE
*pprot
);
224 HRESULT WINAPI
GetRunningObjectTable16(DWORD reserved
, LPRUNNINGOBJECTTABLE
*pprot
);
226 /*****************************************************************************
229 #define STGM_DIRECT 0x00000000
230 #define STGM_TRANSACTED 0x00010000
231 #define STGM_SIMPLE 0x08000000
232 #define STGM_READ 0x00000000
233 #define STGM_WRITE 0x00000001
234 #define STGM_READWRITE 0x00000002
235 #define STGM_SHARE_DENY_NONE 0x00000040
236 #define STGM_SHARE_DENY_READ 0x00000030
237 #define STGM_SHARE_DENY_WRITE 0x00000020
238 #define STGM_SHARE_EXCLUSIVE 0x00000010
239 #define STGM_PRIORITY 0x00040000
240 #define STGM_DELETEONRELEASE 0x04000000
241 #define STGM_CREATE 0x00001000
242 #define STGM_CONVERT 0x00020000
243 #define STGM_FAILIFTHERE 0x00000000
244 #define STGM_NOSCRATCH 0x00100000
245 #define STGM_NOSNAPSHOT 0x00200000
247 HRESULT WINAPI
StgCreateDocFile16(LPCOLESTR16 pwcsName
,DWORD grfMode
,DWORD reserved
,IStorage16
**ppstgOpen
);
248 HRESULT WINAPI
StgCreateDocfile(LPCOLESTR pwcsName
,DWORD grfMode
,DWORD reserved
,IStorage
**ppstgOpen
);
250 HRESULT WINAPI
StgIsStorageFile16(LPCOLESTR16 fn
);
251 HRESULT WINAPI
StgIsStorageFile(LPCOLESTR fn
);
252 HRESULT WINAPI
StgIsStorageILockBytes(ILockBytes
*plkbyt
);
254 HRESULT WINAPI
StgOpenStorage16(const OLECHAR16
* pwcsName
,IStorage16
* pstgPriority
,DWORD grfMode
,SNB16 snbExclude
,DWORD reserved
,IStorage16
**ppstgOpen
);
255 HRESULT WINAPI
StgOpenStorage(const OLECHAR
* pwcsName
,IStorage
* pstgPriority
,DWORD grfMode
,SNB snbExclude
,DWORD reserved
,IStorage
**ppstgOpen
);
257 HRESULT WINAPI
WriteClassStg(IStorage
* pStg
, REFCLSID rclsid
);
258 HRESULT WINAPI
ReadClassStg(IStorage
*pstg
,CLSID
*pclsid
);
260 HRESULT WINAPI
StgCreateDocfileOnILockBytes(ILockBytes
*plkbyt
,DWORD grfMode
, DWORD reserved
, IStorage
** ppstgOpen
);
261 HRESULT WINAPI
StgOpenStorageOnILockBytes(ILockBytes
*plkbyt
, IStorage
*pstgPriority
, DWORD grfMode
, SNB snbExclude
, DWORD reserved
, IStorage
**ppstgOpen
);
267 /*****************************************************************************
268 * Macros to define a COM interface
271 * The goal of the following set of definitions is to provide a way to use the same
272 * header file definitions to provide both a C interface and a C++ object oriented
273 * interface to COM interfaces. The type of interface is selected automatically
274 * depending on the language but it is always possible to get the C interface in C++
275 * by defining CINTERFACE.
277 * It is based on the following assumptions:
278 * - all COM interfaces derive from IUnknown, this should not be a problem.
279 * - the header file only defines the interface, the actual fields are defined
280 * separately in the C file implementing the interface.
282 * The natural approach to this problem would be to make sure we get a C++ class and
283 * virtual methods in C++ and a structure with a table of pointer to functions in C.
284 * Unfortunately the layout of the virtual table is compiler specific, the layout of
285 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
286 * same as that generated by Visual C+. There are workarounds to make the virtual tables
287 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
288 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
290 * So the solution I finally adopted does not use virtual tables. Instead I use inline
291 * non virtual methods that dereference the method pointer themselves and perform the call.
293 * Let's take Direct3D as an example:
295 * #define ICOM_INTERFACE IDirect3D
296 * #define IDirect3D_METHODS \
297 * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \
298 * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \
299 * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \
300 * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \
301 * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \
302 * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,)
303 * #define IDirect3D_IMETHODS \
304 * IUnknown_IMETHODS \
306 * ICOM_DEFINE(IDirect3D,IUnknown)
307 * #undef ICOM_INTERFACE
309 * #ifdef ICOM_CINTERFACE
310 * // *** IUnknown methods *** //
311 * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
312 * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p)
313 * #define IDirect3D_Release(p) ICOM_CALL (Release,p)
314 * // *** IDirect3D methods *** //
315 * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a)
316 * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b)
317 * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b)
318 * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
319 * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
320 * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b)
324 * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this'
325 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
326 * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1
327 * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not
328 * 'IDirect3D_VTABLE'.
329 * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the
330 * inherited methods to form ICOM_IMETHODS.
331 * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must
332 * be written manually (rather than using a macro to generate the equivalent code) to avoid
333 * macro recursion (which compilers don't like).
334 * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
335 * explicitly use the interface name for macro expansion reasons again.
336 * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's
337 * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance
338 * is taken care of by the language.
339 * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer
340 * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The
341 * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and
342 * to have it take only the type information (with const if necessary) as parameters.
343 * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following
344 * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once
345 * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone
347 * - You may have noticed the double commas after each parameter type. This allows you to put the
348 * name of that parameter which I think is good for documentation. It is not required and since
349 * I did not know what to put there for this example (I could only find doc about IDirect3D2),
351 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
352 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
353 * the inherited method definitions there. This time I could have used a trick to use only one
354 * macro whatever the number of parameters but I prefered to have it work the same way as above.
355 * - You probably have noticed that we don't define the fields we need to actually implement this
356 * interface: reference count, pointer to other resources and miscellaneous fields. That's
357 * because these interfaces are just that: interfaces. They may be implemented more than once, in
358 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
359 * that the interface contains some specific fields.
363 * typedef struct IDirect3DVtbl IDirect3DVtbl;
365 * IDirect3DVtbl* lpVtbl;
367 * struct IDirect3DVtbl {
368 * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
369 * ULONG (*QueryInterface)(IDirect3D* me);
370 * ULONG (*QueryInterface)(IDirect3D* me);
371 * HRESULT (*Initialize)(IDirect3D* me, REFIID a);
372 * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
373 * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
374 * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
375 * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
376 * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
379 * #ifdef ICOM_CINTERFACE
380 * // *** IUnknown methods *** //
381 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
382 * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
383 * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
384 * // *** IDirect3D methods *** //
385 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
386 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
387 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
388 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
389 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
390 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
394 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
395 * the user needs to know to use the interface. Of course the structure we will define to
396 * implement this interface will have more fields but the first one will match this pointer.
397 * - The code generated by ICOM_DEFINE defines both the structure representing the interface and
398 * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to
399 * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
400 * to define the IDirect3D methods.
401 * - Each method is declared as a pointer to function field in the jump table. The implementation
402 * will fill this jump table with appropriate values, probably using a static variable, and
403 * initialize the lpVtbl field to point to this variable.
404 * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
405 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
407 * - This C code should be quite compatible with the Windows headers both for code that uses COM
408 * interfaces and for code implementing a COM interface.
411 * And in C++ (with gcc's g++):
413 * typedef struct IDirect3D: public IUnknown {
414 * private: HRESULT (*Initialize)(IDirect3D* me, REFIID a);
415 * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpVtbl)->Initialize(this,a); };
416 * private: HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
417 * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
418 * { return ((IDirect3D*)t.lpVtbl)->EnumDevices(this,a,b); };
419 * private: HRESULT (*freateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
420 * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
421 * { return ((IDirect3D*)t.lpVtbl)->CreateLight(this,a,b); };
422 * private: HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
423 * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
424 * { return ((IDirect3D*)t.lpVtbl)->CreateMaterial(this,a,b); };
425 * private: HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
426 * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
427 * { return ((IDirect3D*)t.lpVtbl)->CreateViewport(this,a,b); };
428 * private: HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
429 * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
430 * { return ((IDirect3D*)t.lpVtbl)->FindDevice(this,a,b); };
434 * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface
435 * definition. The reason for this is to avoid having to duplicate the mehod definitions: once
436 * to have the function pointers in the jump table and once to have the methods in the interface
437 * class. Here one macro can generate both. This means though that the first pointer, t.lpVtbl
438 * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the
439 * structure as the the interface class, and as the function pointer to the QueryInterface
440 * method, t.QueryInterface, if we interpret the structure as the jump table. Fortunately this
441 * gymnastic is entirely taken care of in the header of IUnknown.
442 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
443 * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and
444 * a non-vritual inline method which dereferences it and calls it. This way this method behaves
445 * just like a virtual method but does not create a true C++ virtual table which would break the
446 * structure layout. If you look at the implementation of these methods you'll notice that they
447 * would not work for void functions. We have to return something and fortunately this seems to
448 * be what all the COM methods do (otherwise we would need another set of macros).
449 * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter
450 * names and the method invocation using only the formal parameter name. This is the reason why
451 * we need different macros to handle different numbers of parameters.
452 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
453 * macro is defined in which case we would not be here.
454 * - This C++ code works well for code that just uses COM interfaces. But it will not work with
455 * C++ code implement a COM interface. That's because such code assumes the interface methods
456 * are declared as virtual C++ methods which is not the case here.
459 * Implementing a COM interface.
461 * This continues the above example. This example assumes that the implementation is in C.
463 * typedef struct _IDirect3D {
469 * static ICOM_VTABLE(IDirect3D) d3dvt;
471 * // implement the IDirect3D methods here
473 * int IDirect3D_QueryInterface(IDirect3D* me)
475 * ICOM_THIS(IDirect3D,me);
481 * static ICOM_VTABLE(IDirect3D) d3dvt = {
482 * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
483 * IDirect3D_QueryInterface,
486 * IDirect3D_Initialize,
491 * - We first define what the interface really contains. This is th e_IDirect3D structure. The
492 * first field must of course be the virtual table pointer. Everything else is free.
493 * - Then we predeclare our static virtual table variable, we will need its address in some
494 * methods to initialize the virtual table pointer of the returned interface objects.
495 * - Then we implement the interface methods. To match what has been declared in the header file
496 * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that
497 * we can manipulate the fields. This is performed by the ICOM_THIS macro.
498 * - Finally we initialize the virtual table.
503 #if !defined(__cplusplus) || defined(CINTERFACE)
504 #define ICOM_CINTERFACE 1
507 #ifndef ICOM_CINTERFACE
510 #define ICOM_METHOD(ret,xfn) \
511 public: virtual ret CALLBACK (xfn)(void) = 0;
512 #define ICOM_METHOD1(ret,xfn,ta,na) \
513 public: virtual ret CALLBACK (xfn)(ta a) = 0;
514 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
515 public: virtual ret CALLBACK (xfn)(ta a,tb b) = 0;
516 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
517 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c) = 0;
518 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
519 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0;
520 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
521 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0;
522 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
523 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
524 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
525 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
526 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
527 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
528 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
529 public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0;
530 #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) \
531 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;
532 #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) \
533 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;
534 #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) \
535 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;
536 #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) \
537 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;
538 #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) \
539 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;
540 #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) \
541 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;
542 #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) \
543 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;
544 #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) \
545 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;
546 #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) \
547 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;
548 #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) \
549 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;
550 #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) \
551 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;
552 #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) \
553 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;
554 #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) \
555 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;
556 #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) \
557 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;
558 #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) \
559 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;
560 #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) \
561 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;
562 #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) \
563 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;
566 #define ICOM_VMETHOD(xfn) \
567 public: virtual void CALLBACK (xfn)(void) = 0;
568 #define ICOM_VMETHOD1(xfn,ta,na) \
569 public: virtual void CALLBACK (xfn)(ta a) = 0;
570 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
571 public: virtual void CALLBACK (xfn)(ta a,tb b) = 0;
572 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
573 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c) = 0;
574 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
575 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0;
576 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
577 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0;
578 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
579 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0;
580 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
581 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0;
582 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
583 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0;
584 #define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
585 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0;
586 #define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \
587 public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j) = 0;
588 #define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \
589 public: virtual void 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;
590 #define ICOM_VMETHOD12(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) \
591 public: virtual void 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;
592 #define ICOM_VMETHOD13(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) \
593 public: virtual void 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;
594 #define ICOM_VMETHOD14(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) \
595 public: virtual void 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;
596 #define ICOM_VMETHOD15(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) \
597 public: virtual void 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;
598 #define ICOM_VMETHOD16(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) \
599 public: virtual void 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;
600 #define ICOM_VMETHOD17(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) \
601 public: virtual void 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;
602 #define ICOM_VMETHOD18(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) \
603 public: virtual void 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;
604 #define ICOM_VMETHOD19(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) \
605 public: virtual void 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;
606 #define ICOM_VMETHOD20(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) \
607 public: virtual void 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;
608 #define ICOM_VMETHOD21(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) \
609 public: virtual void 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;
610 #define ICOM_VMETHOD22(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) \
611 public: virtual void 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;
612 #define ICOM_VMETHOD23(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) \
613 public: virtual void 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;
614 #define ICOM_VMETHOD24(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) \
615 public: virtual void 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;
616 #define ICOM_VMETHOD25(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) \
617 public: virtual void 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;
618 #define ICOM_VMETHOD26(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) \
619 public: virtual void 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;
622 #define ICOM_DEFINE(iface,ibase) \
623 struct iface: public ibase { \
625 } ICOM_COM_INTERFACE_ATTRIBUTE;
626 #define ICOM_DEFINE1(iface) \
629 } ICOM_COM_INTERFACE_ATTRIBUTE;
631 #define ICOM_VTBL(iface) (iface)
636 #define ICOM_METHOD(ret,xfn) \
637 ret (CALLBACK *xfn)(ICOM_INTERFACE* me);
638 #define ICOM_METHOD1(ret,xfn,ta,na) \
639 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a);
640 #define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
641 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b);
642 #define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
643 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
644 #define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
645 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
646 #define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
647 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
648 #define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
649 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
650 #define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
651 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
652 #define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \
653 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
654 #define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \
655 ret (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i);
656 #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) \
657 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);
658 #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) \
659 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,tk k);
660 #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) \
661 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,tk k,tl l);
662 #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) \
663 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,tk k,tl l,tm m);
664 #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) \
665 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,tk k,tl l,tm m,tn n);
666 #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) \
667 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,tk k,tl l,tm m,tn n,to o);
668 #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) \
669 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,tk k,tl l,tm m,tn n,to o,tp p);
670 #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) \
671 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,tk k,tl l,tm m,tn n,to o,tp p,tq q);
672 #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) \
673 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r);
674 #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) \
675 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s);
676 #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) \
677 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t);
678 #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) \
679 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u);
680 #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) \
681 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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v);
682 #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) \
683 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,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);
684 #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) \
685 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,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);
686 #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) \
687 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,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);
688 #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) \
689 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,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);
691 #define ICOM_VMETHOD(xfn) \
692 void (CALLBACK *xfn)(ICOM_INTERFACE* me);
693 #define ICOM_VMETHOD1(xfn,ta,na) \
694 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a);
695 #define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
696 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b);
697 #define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
698 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
699 #define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
700 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
701 #define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
702 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
703 #define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
704 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
705 #define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
706 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
707 #define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \
708 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h);
709 #define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \
710 void (CALLBACK *xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i);
711 #define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \
712 void (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);
713 #define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \
714 void (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,tk k);
715 #define ICOM_VMETHOD12(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) \
716 void (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,tk k,tl l);
717 #define ICOM_VMETHOD13(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) \
718 void (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,tk k,tl l,tm m);
719 #define ICOM_VMETHOD14(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) \
720 void (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,tk k,tl l,tm m,tn n);
721 #define ICOM_VMETHOD15(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) \
722 void (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,tk k,tl l,tm m,tn n,to o);
723 #define ICOM_VMETHOD16(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) \
724 void (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,tk k,tl l,tm m,tn n,to o,tp p);
725 #define ICOM_VMETHOD17(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) \
726 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q);
727 #define ICOM_VMETHOD18(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) \
728 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r);
729 #define ICOM_VMETHOD19(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) \
730 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s);
731 #define ICOM_VMETHOD20(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) \
732 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t);
733 #define ICOM_VMETHOD21(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) \
734 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u);
735 #define ICOM_VMETHOD22(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) \
736 void (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,tk k,tl l,tm m,tn n,to o,tp p,tq q,tr r,ts s,tt t,tu u,tv v);
737 #define ICOM_VMETHOD23(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) \
738 void (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,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);
739 #define ICOM_VMETHOD24(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) \
740 void (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,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);
741 #define ICOM_VMETHOD25(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) \
742 void (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,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);
743 #define ICOM_VMETHOD26(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) \
744 void (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,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);
747 #define ICOM_VTABLE(iface) iface##Vtbl
748 #define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
749 #define ICOM_VTBL(iface) (iface)->lpVtbl
751 #define ICOM_DEFINE(iface,ibase) \
752 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
754 const ICOM_VFIELD(iface); \
756 struct ICOM_VTABLE(iface) { \
757 ICOM_MSVTABLE_COMPAT_FIELDS \
761 #define ICOM_DEFINE1(iface) \
762 typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
764 const ICOM_VFIELD(iface); \
766 struct ICOM_VTABLE(iface) { \
767 ICOM_MSVTABLE_COMPAT_FIELDS \
771 #define ICOM_THIS(impl,iface) impl* const This=(impl*)(iface)
772 #define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)(iface)
774 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
775 #define ICOM_CTHIS_MULTI(impl,field,iface) const impl* const This=(const impl*)((char*)(iface) - offsetof(impl,field))
777 #endif /*ICOM_CINTERFACE */
779 #define ICOM_CALL(xfn, ptr) ICOM_VTBL(ptr)->xfn(ptr)
780 #define ICOM_CALL1(xfn, ptr,a) ICOM_VTBL(ptr)->xfn(ptr,a)
781 #define ICOM_CALL2(xfn, ptr,a,b) ICOM_VTBL(ptr)->xfn(ptr,a,b)
782 #define ICOM_CALL3(xfn, ptr,a,b,c) ICOM_VTBL(ptr)->xfn(ptr,a,b,c)
783 #define ICOM_CALL4(xfn, ptr,a,b,c,d) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d)
784 #define ICOM_CALL5(xfn, ptr,a,b,c,d,e) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e)
785 #define ICOM_CALL6(xfn, ptr,a,b,c,d,e,f) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f)
786 #define ICOM_CALL7(xfn, ptr,a,b,c,d,e,f,g) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g)
787 #define ICOM_CALL8(xfn, ptr,a,b,c,d,e,f,g,h) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h)
788 #define ICOM_CALL9(xfn, ptr,a,b,c,d,e,f,g,h,i) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i)
789 #define ICOM_CALL10(xfn, ptr,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j)
790 #define ICOM_CALL11(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k)
791 #define ICOM_CALL12(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l)
792 #define ICOM_CALL13(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m)
793 #define ICOM_CALL14(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
794 #define ICOM_CALL15(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
795 #define ICOM_CALL16(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
796 #define ICOM_CALL17(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q)
797 #define ICOM_CALL18(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r)
798 #define ICOM_CALL19(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s)
799 #define ICOM_CALL20(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t)
800 #define ICOM_CALL21(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u)
801 #define ICOM_CALL22(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v)
802 #define ICOM_CALL23(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w)
803 #define ICOM_CALL24(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x)
804 #define ICOM_CALL25(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y)
805 #define ICOM_CALL26(xfn, ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) ICOM_VTBL(ptr)->xfn(ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
809 /* These macros are msdev's way of defining COM objects.
810 * They are provided here for use by Winelib developpers.
815 #define WINOLEAPI STDAPI
816 #define WINOLEAPI_(type) STDAPI_(type)
818 #if defined(__cplusplus) && !defined(CINTERFACE)
819 #define interface struct
820 #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
821 #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
825 #define DECLARE_INTERFACE(iface) interface iface
826 #define DECLARE_INTERFACE_(iface, baseiface) interface iface : public baseiface
828 #define BEGIN_INTERFACE
829 #define END_INTERFACE
833 #define interface struct
834 #define STDMETHOD(method) HRESULT STDMETHODCALLTYPE (*method)
835 #define STDMETHOD_(type,method) type STDMETHODCALLTYPE (*method)
837 #define THIS_ INTERFACE FAR* This,
838 #define THIS INTERFACE FAR* This
842 #define CONST_VTBL const
843 #define DECLARE_INTERFACE(iface) \
844 typedef interface iface { const struct iface##Vtbl FAR* lpVtbl; } iface; \
845 typedef const struct iface##Vtbl iface##Vtbl; \
846 const struct iface##Vtbl
850 #define DECLARE_INTERFACE(iface) \
851 typedef interface iface { struct iface##Vtbl FAR* lpVtbl; } iface; \
852 typedef struct iface##Vtbl iface##Vtbl; \
855 #define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface)
857 #define BEGIN_INTERFACE
858 #define END_INTERFACE
860 #endif /* __cplusplus && !CINTERFACE */
862 #endif /* __WINESRC__ */
864 #endif /* _OBJBASE_H_ */