Do not define MZ_SUPPORTED if we do not have sys/vm86.h for all the
[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_IMalloc,             0x00000002L, 0, 0);
43 typedef struct IMalloc IMalloc,*LPMALLOC;
44
45 DEFINE_OLEGUID(IID_IMallocSpy,          0x0000001dL, 0, 0);
46 typedef struct IMallocSpy IMallocSpy,*LPMALLOCSPY;
47
48 DEFINE_OLEGUID(IID_IMultiQI,            0x00000020L, 0, 0);
49 typedef struct IMultiQI IMultiQI,*LPMULTIQI;
50
51
52 /*****************************************************************************
53  * IEnumString interface
54  */
55 #define ICOM_INTERFACE IEnumString
56 #define IEnumString_METHODS \
57     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, LPOLESTR*,rgelt, ULONG*,pceltFethed) \
58     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
59     ICOM_METHOD (HRESULT,Reset) \
60     ICOM_METHOD1(HRESULT, Clone, IEnumString**, ppenum)
61 #define IEnumString_IMETHODS \
62     IUnknown_IMETHODS \
63     IEnumString_METHODS
64 ICOM_DEFINE(IEnumString,IUnknown)
65 #undef ICOM_INTERFACE
66
67 /*** IUnknown methods ***/
68 #define IEnumString_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
69 #define IEnumString_AddRef(p)             ICOM_CALL (AddRef,p)
70 #define IEnumString_Release(p)            ICOM_CALL (Release,p)
71 /*** IEnumString methods ***/
72 #define IEnumString_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
73 #define IEnumString_Skip(p,a)     ICOM_CALL1(Skip,p,a)
74 #define IEnumString_Reset(p)      ICOM_CALL (Reset,p)
75 #define IEnumString_Clone(p,a)    ICOM_CALL1(Clone,p,a)
76
77
78
79 /*****************************************************************************
80  * IEnumUnknown interface
81  */
82 #define ICOM_INTERFACE IEnumUnknown
83 #define IEnumUnknown_METHODS \
84     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, IUnknown**,rgelt, ULONG*,pceltFethed) \
85     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
86     ICOM_METHOD (HRESULT,Reset) \
87     ICOM_METHOD1(HRESULT,Clone, IEnumUnknown**,ppenum)
88 #define IEnumUnknown_IMETHODS \
89     IUnknown_IMETHODS \
90     IEnumUnknown_METHODS
91 ICOM_DEFINE(IEnumUnknown,IUnknown)
92 #undef ICOM_INTERFACE
93
94 /*** IUnknown methods ***/
95 #define IEnumUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
96 #define IEnumUnknown_AddRef(p)             ICOM_CALL (AddRef,p)
97 #define IEnumUnknown_Release(p)            ICOM_CALL (Release,p)
98 /*** IEnumUnknown methods ***/
99 #define IEnumUnknown_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
100 #define IEnumUnknown_Skip(p,a)     ICOM_CALL1(Skip,p,a)
101 #define IEnumUnknown_Reset(p)      ICOM_CALL (Reset,p)
102 #define IEnumUnknown_Clone(p,a)    ICOM_CALL1(Clone,p,a)
103
104
105 /*****************************************************************************
106  * IMalloc interface
107  */
108 #define ICOM_INTERFACE IMalloc
109 #define IMalloc_METHODS \
110     ICOM_METHOD1 (LPVOID,Alloc,       DWORD,cb) \
111     ICOM_METHOD2 (LPVOID,Realloc,     LPVOID,pv, DWORD,cb) \
112     ICOM_VMETHOD1(       Free,        LPVOID,pv) \
113     ICOM_METHOD1(DWORD, GetSize,     LPVOID,pv) \
114     ICOM_METHOD1(INT, DidAlloc,    LPVOID,pv) \
115     ICOM_METHOD  (VOID,  HeapMinimize)
116 #define IMalloc_IMETHODS \
117     IUnknown_IMETHODS \
118     IMalloc_METHODS
119 ICOM_DEFINE(IMalloc,IUnknown)
120 #undef ICOM_INTERFACE
121
122 /*** IUnknown methods ***/
123 #define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
124 #define IMalloc_AddRef(p)             ICOM_CALL (AddRef,p)
125 #define IMalloc_Release(p)            ICOM_CALL (Release,p)
126 /*** IMalloc methods ***/
127 #define IMalloc_Alloc(p,a)      ICOM_CALL1(Alloc,p,a)
128 #define IMalloc_Realloc(p,a,b)  ICOM_CALL2(Realloc,p,a,b)
129 #define IMalloc_Free(p,a)       ICOM_CALL1(Free,p,a)
130 #define IMalloc_GetSize(p,a)    ICOM_CALL1(GetSize,p,a)
131 #define IMalloc_DidAlloc(p,a)   ICOM_CALL1(DidAlloc,p,a)
132 #define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
133
134
135 /* values passed to CoGetMalloc */
136 #define MEMCTX_TASK             1 /* private task memory */
137 #define MEMCTX_SHARED           2 /* shared memory */
138 #ifdef _MAC
139 #define MEMCTX_MACSYSTEM        3 /* system heap on mac */
140 #endif
141 /* mainly for internal use... */
142 #define MEMCTX_UNKNOWN          -1
143 #define MEMCTX_SAME             -2
144
145 HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc);
146
147 LPVOID WINAPI CoTaskMemAlloc(ULONG size);
148
149 void WINAPI CoTaskMemFree(LPVOID ptr);
150
151 /* FIXME: unimplemented */
152 LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
153
154
155 /*****************************************************************************
156  * IMallocSpy interface
157  */
158 #define ICOM_INTERFACE IMallocSpy
159 #define IMallocSpy_METHODS \
160     ICOM_METHOD1 (ULONG,PreAlloc,        ULONG,cbRequest) \
161     ICOM_METHOD1 (PVOID,PostAlloc,       void*,pActual) \
162     ICOM_METHOD2 (PVOID,PreFree,         void*,pRequest, BOOL,fSpyed) \
163     ICOM_VMETHOD1(      PostFree,        BOOL,fSpyed) \
164     ICOM_METHOD4 (ULONG,PreRealloc,      void*,pRequest, ULONG,cbRequest, void**,ppNewRequest, BOOL,fSpyed) \
165     ICOM_METHOD2 (PVOID,PostRealloc,     void*,pActual, BOOL,fSpyed) \
166     ICOM_METHOD2 (PVOID,PreGetSize,      void*,pRequest, BOOL,fSpyed) \
167     ICOM_METHOD2 (ULONG,PostGetSize,     ULONG,cbActual, BOOL,fSpyed) \
168     ICOM_METHOD2 (PVOID,PreDidAlloc,     void*,pRequest, BOOL,fSpyed) \
169     ICOM_METHOD3 (int,  PostDidAlloc,    void*,pRequest, BOOL,fSpyed, int,fActual) \
170     ICOM_METHOD  (int,  PreHeapMinimize) \
171     ICOM_METHOD  (int,  PostHeapMinimize)
172 #define IMallocSpy_IMETHODS \
173     IUnknown_IMETHODS \
174     IMallocSpy_METHODS
175 ICOM_DEFINE(IMallocSpy,IUnknown)
176 #undef ICOM_INTERFACE
177
178 /*** IUnknown methods ***/
179 #define IMallocSpy_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
180 #define IMallocSpy_AddRef(p)             ICOM_CALL (AddRef,p)
181 #define IMallocSpy_Release(p)            ICOM_CALL (Release,p)
182 /*** IMallocSpy methods ***/
183 #define IMallocSpy_PreAlloc(p,a)         ICOM_CALL1(PreAlloc,p,a)
184 #define IMallocSpy_PostAlloc(p,a)        ICOM_CALL1(PostAlloc,p,a)
185 #define IMallocSpy_PreFree(p,a,b)        ICOM_CALL2(PreFree,p,a,b)
186 #define IMallocSpy_PostFree(p,a)         ICOM_CALL1(PostFree,p,a)
187 #define IMallocSpy_PreRealloc(p,a,b,c,d) ICOM_CALL4(PreRealloc,p,a,b,c,d)
188 #define IMallocSpy_PostRealloc(p,a,b)    ICOM_CALL2(PostRealloc,p,a,b)
189 #define IMallocSpy_PreGetSize(p,a,b)     ICOM_CALL2(PreGetSize,p,a,b)
190 #define IMallocSpy_PostGetSize(p,a,b)    ICOM_CALL2(PostGetSize,p,a,b)
191 #define IMallocSpy_PreDidAlloc(p,a,b)    ICOM_CALL2(PreDidAlloc,p,a,b)
192 #define IMallocSpy_PostDidAlloc(p,a,b,c) ICOM_CALL3(PostDidAlloc,p,a,b,c)
193 #define IMallocSpy_PreHeapMinimize(p)    ICOM_CALL (PreHeapMinimize,p)
194 #define IMallocSpy_PostHeapMinimize(p)   ICOM_CALL (PostHeapMinimize,p)
195
196 /* FIXME: not implemented */
197 HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
198
199 /* FIXME: not implemented */
200 HRESULT WINAPI CoRevokeMallocSpy(void);
201
202 HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
203
204
205 /*****************************************************************************
206  * IMultiQI interface
207  */
208 typedef struct tagMULTI_QI
209 {
210     const IID* pIID;
211     IUnknown* pItf;
212     HRESULT hr;
213 } MULTI_QI;
214
215 #define ICOM_INTERFACE IMultiQI
216 #define IMultiQI_METHODS \
217     ICOM_METHOD2(HRESULT,QueryMultipleInterfaces, ULONG,cMQIs, MULTI_QI*,pMQIs)
218 #define IMultiQI_IMETHODS \
219     IUnknown_IMETHODS \
220     IMultiQI_METHODS
221 ICOM_DEFINE(IMultiQI,IUnknown)
222 #undef ICOM_INTERFACE
223
224 /*** IUnknown methods ***/
225 #define IMultiQI_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
226 #define IMultiQI_AddRef(p)             ICOM_CALL (AddRef,p)
227 #define IMultiQI_Release(p)            ICOM_CALL (Release,p)
228 /*** IMultiQI methods ***/
229 #define IMultiQI_QueryMultipleInterfaces(p,a,b) ICOM_CALL2(QueryMultipleInterfaces,p,a,b)
230
231
232 /*****************************************************************************
233  * Additional API
234  */
235
236 DWORD WINAPI CoBuildVersion(void);
237
238 DWORD WINAPI CoGetCurrentProcess(void);
239
240 /* FIXME: unimplemented */
241 HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
242
243 /* FIXME: unimplemented */
244 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
245
246 HRESULT WINAPI CoCreateInstanceEx(REFCLSID      rclsid,
247                                   LPUNKNOWN     pUnkOuter,
248                                   DWORD         dwClsContext,
249                                   COSERVERINFO* pServerInfo,
250                                   ULONG         cmq,
251                                   MULTI_QI*     pResults);
252 #ifdef __cplusplus
253 } /*  extern "C" */
254 #endif /* defined(__cplusplus) */
255
256 #endif /* __WINE_WINE_OBJ_MISC_H */