2 * An implementation of IUnknown.
4 * hidenori@a2.ctktv.ne.jp
7 #ifndef WINE_DSHOW_IUNK_H
8 #define WINE_DSHOW_IUNK_H
11 To avoid implementing IUnknown for all interfaces,
13 1) To give a method to get rel-offset of IUnknown.
14 2) The IUnknown knows all IIDs and offsets of interfaces.
16 So each implementation must have following two members
17 with the following order:
19 typedef struct IDispatchImpl
21 ICOM_VFIELD(IDispatch); <-pointer of the interface.
22 size_t ofsIUnknown; <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
27 /* for InterlockedExchangeAdd. */
30 typedef struct QUARTZ_IFEntry
32 const IID* piid; /* interface ID. */
33 size_t ofsVTPtr; /* offset from IUnknown. */
36 typedef struct QUARTZ_IFDelegation
38 struct QUARTZ_IFDelegation* pNext;
39 HRESULT (*pOnQueryInterface)(
40 IUnknown* punk, const IID* piid, void** ppobj );
41 } QUARTZ_IFDelegation;
43 typedef struct QUARTZ_IUnkImpl
45 /* pointer of IUnknown interface. */
46 ICOM_VFIELD(IUnknown);
48 /* array of supported IIDs and offsets. */
49 const QUARTZ_IFEntry* pEntries;
51 /* list of delegation handlers. */
52 QUARTZ_IFDelegation* pDelegationFirst;
53 /* called on final release. */
54 void (*pOnFinalRelease)(IUnknown* punk);
56 /* IUnknown fields. */
58 IUnknown* punkControl;
64 void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
65 void QUARTZ_IUnkAddDelegation(
66 QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
69 #endif /* WINE_DSHOW_IUNK_H */