2 * An implementation of IUnknown.
4 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef WINE_DSHOW_IUNK_H
22 #define WINE_DSHOW_IUNK_H
25 To avoid implementing IUnknown for all interfaces,
27 1) To give a method to get rel-offset of IUnknown.
28 2) The IUnknown knows all IIDs and offsets of interfaces.
30 So each implementation must have following two members
31 with the following order:
33 typedef struct IDispatchImpl
35 ICOM_VFIELD(IDispatch); <-pointer of the interface.
36 size_t ofsIUnknown; <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
41 /* for InterlockedExchangeAdd. */
44 typedef struct QUARTZ_IFEntry
46 const IID* piid; /* interface ID. */
47 size_t ofsVTPtr; /* offset from IUnknown. */
50 typedef struct QUARTZ_IFDelegation
52 struct QUARTZ_IFDelegation* pNext;
53 HRESULT (*pOnQueryInterface)(
54 IUnknown* punk, const IID* piid, void** ppobj );
55 } QUARTZ_IFDelegation;
57 typedef struct QUARTZ_IUnkImpl
59 /* pointer of IUnknown interface. */
60 ICOM_VFIELD(IUnknown);
62 /* array of supported IIDs and offsets. */
63 const QUARTZ_IFEntry* pEntries;
65 /* list of delegation handlers. */
66 QUARTZ_IFDelegation* pDelegationFirst;
67 /* called on final release. */
68 void (*pOnFinalRelease)(IUnknown* punk);
70 /* IUnknown fields. */
72 IUnknown* punkControl;
78 void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
79 void QUARTZ_IUnkAddDelegation(
80 QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
83 #endif /* WINE_DSHOW_IUNK_H */