Implement ResetDC and PHYSICALOFFSET[X|Y] devcaps.
[wine] / dlls / quartz / iunk.h
1 /*
2  * An implementation of IUnknown.
3  *
4  * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef WINE_DSHOW_IUNK_H
22 #define WINE_DSHOW_IUNK_H
23
24 /*
25         To avoid implementing IUnknown for all interfaces,
26
27   1) To give a method to get rel-offset of IUnknown.
28   2) The IUnknown knows all IIDs and offsets of interfaces.
29
30     So each implementation must have following two members
31     with the following order:
32
33   typedef struct IDispatchImpl
34   {
35     ICOM_VFIELD(IDispatch);     <-pointer of the interface.
36     size_t      ofsIUnknown;    <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
37   };
38
39  */
40
41 /* for InterlockedExchangeAdd. */
42 #include <pshpack4.h>
43
44 typedef struct QUARTZ_IFEntry
45 {
46         const IID*      piid;           /* interface ID. */
47         size_t          ofsVTPtr;       /* offset from IUnknown. */
48 } QUARTZ_IFEntry;
49
50 typedef struct QUARTZ_IFDelegation
51 {
52         struct QUARTZ_IFDelegation*     pNext;
53         HRESULT (*pOnQueryInterface)(
54                 IUnknown* punk, const IID* piid, void** ppobj );
55 } QUARTZ_IFDelegation;
56
57 typedef struct QUARTZ_IUnkImpl
58 {
59         /* pointer of IUnknown interface. */
60         ICOM_VFIELD(IUnknown);
61
62         /* array of supported IIDs and offsets. */
63         const QUARTZ_IFEntry*   pEntries;
64         DWORD   dwEntries;
65         /* list of delegation handlers. */
66         QUARTZ_IFDelegation*    pDelegationFirst;
67         /* called on final release. */
68         void (*pOnFinalRelease)(IUnknown* punk);
69
70         /* IUnknown fields. */
71         LONG    ref;
72         IUnknown*       punkControl;
73 } QUARTZ_IUnkImpl;
74
75 #include <poppack.h>
76
77
78 void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
79 void QUARTZ_IUnkAddDelegation(
80         QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
81
82
83 #endif  /* WINE_DSHOW_IUNK_H */