- Implemented IMallocSpy hooks in IMalloc.
[wine] / include / wine / obj_misc.h
1 /*
2  * Defines miscellaneous COM interfaces and APIs defined in objidl.h.
3  * These did not really fit into the other categories, whould have
4  * required their own specific category or are too rarely used to be
5  * put in 'obj_base.h'.
6  *
7  * Copyright (C) the Wine project
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #ifndef __WINE_WINE_OBJ_MISC_H
25 #define __WINE_WINE_OBJ_MISC_H
26
27 #include "wine/obj_base.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* defined(__cplusplus) */
32
33 /*****************************************************************************
34  * Predeclare the interfaces
35  */
36 DEFINE_OLEGUID(IID_IEnumString,         0x00000101L, 0, 0);
37 typedef struct IEnumString IEnumString,*LPENUMSTRING;
38
39 DEFINE_OLEGUID(IID_IEnumUnknown,        0x00000100L, 0, 0);
40 typedef struct IEnumUnknown IEnumUnknown,*LPENUMUNKNOWN;
41
42 DEFINE_OLEGUID(IID_IMallocSpy,          0x0000001dL, 0, 0);
43 typedef struct IMallocSpy IMallocSpy,*LPMALLOCSPY;
44
45 DEFINE_OLEGUID(IID_IMultiQI,            0x00000020L, 0, 0);
46 typedef struct IMultiQI IMultiQI,*LPMULTIQI;
47
48
49 /*****************************************************************************
50  * IEnumString interface
51  */
52 #define ICOM_INTERFACE IEnumString
53 #define IEnumString_METHODS \
54     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, LPOLESTR*,rgelt, ULONG*,pceltFethed) \
55     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
56     ICOM_METHOD (HRESULT,Reset) \
57     ICOM_METHOD1(HRESULT, Clone, IEnumString**, ppenum)
58 #define IEnumString_IMETHODS \
59     IUnknown_IMETHODS \
60     IEnumString_METHODS
61 ICOM_DEFINE(IEnumString,IUnknown)
62 #undef ICOM_INTERFACE
63
64 /*** IUnknown methods ***/
65 #define IEnumString_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
66 #define IEnumString_AddRef(p)             ICOM_CALL (AddRef,p)
67 #define IEnumString_Release(p)            ICOM_CALL (Release,p)
68 /*** IEnumString methods ***/
69 #define IEnumString_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
70 #define IEnumString_Skip(p,a)     ICOM_CALL1(Skip,p,a)
71 #define IEnumString_Reset(p)      ICOM_CALL (Reset,p)
72 #define IEnumString_Clone(p,a)    ICOM_CALL1(Clone,p,a)
73
74
75
76 /*****************************************************************************
77  * IEnumUnknown interface
78  */
79 #define ICOM_INTERFACE IEnumUnknown
80 #define IEnumUnknown_METHODS \
81     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, IUnknown**,rgelt, ULONG*,pceltFethed) \
82     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
83     ICOM_METHOD (HRESULT,Reset) \
84     ICOM_METHOD1(HRESULT,Clone, IEnumUnknown**,ppenum)
85 #define IEnumUnknown_IMETHODS \
86     IUnknown_IMETHODS \
87     IEnumUnknown_METHODS
88 ICOM_DEFINE(IEnumUnknown,IUnknown)
89 #undef ICOM_INTERFACE
90
91 /*** IUnknown methods ***/
92 #define IEnumUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
93 #define IEnumUnknown_AddRef(p)             ICOM_CALL (AddRef,p)
94 #define IEnumUnknown_Release(p)            ICOM_CALL (Release,p)
95 /*** IEnumUnknown methods ***/
96 #define IEnumUnknown_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
97 #define IEnumUnknown_Skip(p,a)     ICOM_CALL1(Skip,p,a)
98 #define IEnumUnknown_Reset(p)      ICOM_CALL (Reset,p)
99 #define IEnumUnknown_Clone(p,a)    ICOM_CALL1(Clone,p,a)
100
101
102 /*****************************************************************************
103  * IMallocSpy interface
104  */
105 #define ICOM_INTERFACE IMallocSpy
106 #define IMallocSpy_METHODS \
107     ICOM_METHOD1 (ULONG,PreAlloc,        ULONG,cbRequest) \
108     ICOM_METHOD1 (PVOID,PostAlloc,       void*,pActual) \
109     ICOM_METHOD2 (PVOID,PreFree,         void*,pRequest, BOOL,fSpyed) \
110     ICOM_VMETHOD1(      PostFree,        BOOL,fSpyed) \
111     ICOM_METHOD4 (ULONG,PreRealloc,      void*,pRequest, ULONG,cbRequest, void**,ppNewRequest, BOOL,fSpyed) \
112     ICOM_METHOD2 (PVOID,PostRealloc,     void*,pActual, BOOL,fSpyed) \
113     ICOM_METHOD2 (PVOID,PreGetSize,      void*,pRequest, BOOL,fSpyed) \
114     ICOM_METHOD2 (ULONG,PostGetSize,     ULONG,cbActual, BOOL,fSpyed) \
115     ICOM_METHOD2 (PVOID,PreDidAlloc,     void*,pRequest, BOOL,fSpyed) \
116     ICOM_METHOD3 (int,  PostDidAlloc,    void*,pRequest, BOOL,fSpyed, int,fActual) \
117     ICOM_METHOD  (int,  PreHeapMinimize) \
118     ICOM_METHOD  (int,  PostHeapMinimize)
119 #define IMallocSpy_IMETHODS \
120     IUnknown_IMETHODS \
121     IMallocSpy_METHODS
122 ICOM_DEFINE(IMallocSpy,IUnknown)
123 #undef ICOM_INTERFACE
124
125 /*** IUnknown methods ***/
126 #define IMallocSpy_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
127 #define IMallocSpy_AddRef(p)             ICOM_CALL (AddRef,p)
128 #define IMallocSpy_Release(p)            ICOM_CALL (Release,p)
129 /*** IMallocSpy methods ***/
130 #define IMallocSpy_PreAlloc(p,a)         ICOM_CALL1(PreAlloc,p,a)
131 #define IMallocSpy_PostAlloc(p,a)        ICOM_CALL1(PostAlloc,p,a)
132 #define IMallocSpy_PreFree(p,a,b)        ICOM_CALL2(PreFree,p,a,b)
133 #define IMallocSpy_PostFree(p,a)         ICOM_CALL1(PostFree,p,a)
134 #define IMallocSpy_PreRealloc(p,a,b,c,d) ICOM_CALL4(PreRealloc,p,a,b,c,d)
135 #define IMallocSpy_PostRealloc(p,a,b)    ICOM_CALL2(PostRealloc,p,a,b)
136 #define IMallocSpy_PreGetSize(p,a,b)     ICOM_CALL2(PreGetSize,p,a,b)
137 #define IMallocSpy_PostGetSize(p,a,b)    ICOM_CALL2(PostGetSize,p,a,b)
138 #define IMallocSpy_PreDidAlloc(p,a,b)    ICOM_CALL2(PreDidAlloc,p,a,b)
139 #define IMallocSpy_PostDidAlloc(p,a,b,c) ICOM_CALL3(PostDidAlloc,p,a,b,c)
140 #define IMallocSpy_PreHeapMinimize(p)    ICOM_CALL (PreHeapMinimize,p)
141 #define IMallocSpy_PostHeapMinimize(p)   ICOM_CALL (PostHeapMinimize,p)
142
143 /* FIXME: not implemented */
144 HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
145
146 /* FIXME: not implemented */
147 HRESULT WINAPI CoRevokeMallocSpy(void);
148
149 HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
150
151
152 /*****************************************************************************
153  * IMultiQI interface
154  */
155 typedef struct tagMULTI_QI
156 {
157     const IID* pIID;
158     IUnknown* pItf;
159     HRESULT hr;
160 } MULTI_QI;
161
162 #define ICOM_INTERFACE IMultiQI
163 #define IMultiQI_METHODS \
164     ICOM_METHOD2(HRESULT,QueryMultipleInterfaces, ULONG,cMQIs, MULTI_QI*,pMQIs)
165 #define IMultiQI_IMETHODS \
166     IUnknown_IMETHODS \
167     IMultiQI_METHODS
168 ICOM_DEFINE(IMultiQI,IUnknown)
169 #undef ICOM_INTERFACE
170
171 /*** IUnknown methods ***/
172 #define IMultiQI_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
173 #define IMultiQI_AddRef(p)             ICOM_CALL (AddRef,p)
174 #define IMultiQI_Release(p)            ICOM_CALL (Release,p)
175 /*** IMultiQI methods ***/
176 #define IMultiQI_QueryMultipleInterfaces(p,a,b) ICOM_CALL2(QueryMultipleInterfaces,p,a,b)
177
178
179 /*****************************************************************************
180  * Additional API
181  */
182
183 DWORD WINAPI CoBuildVersion(void);
184
185 DWORD WINAPI CoGetCurrentProcess(void);
186
187 /* FIXME: unimplemented */
188 HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
189
190 /* FIXME: unimplemented */
191 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
192
193 HRESULT WINAPI CoCreateInstanceEx(REFCLSID      rclsid,
194                                   LPUNKNOWN     pUnkOuter,
195                                   DWORD         dwClsContext,
196                                   COSERVERINFO* pServerInfo,
197                                   ULONG         cmq,
198                                   MULTI_QI*     pResults);
199 #ifdef __cplusplus
200 } /*  extern "C" */
201 #endif /* defined(__cplusplus) */
202
203 #endif /* __WINE_WINE_OBJ_MISC_H */