1 | /*
|
---|
2 | * Copyright (C) 1998-1999 Francois Gouget
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #include <rpc.h>
|
---|
29 | #include <rpcndr.h>
|
---|
30 |
|
---|
31 | #ifndef _OBJBASE_H_
|
---|
32 | #define _OBJBASE_H_
|
---|
33 |
|
---|
34 | /*****************************************************************************
|
---|
35 | * Macros to define a COM interface
|
---|
36 | */
|
---|
37 | /*
|
---|
38 | * The goal of the following set of definitions is to provide a way to use the same
|
---|
39 | * header file definitions to provide both a C interface and a C++ object oriented
|
---|
40 | * interface to COM interfaces. The type of interface is selected automatically
|
---|
41 | * depending on the language but it is always possible to get the C interface in C++
|
---|
42 | * by defining CINTERFACE.
|
---|
43 | *
|
---|
44 | * It is based on the following assumptions:
|
---|
45 | * - all COM interfaces derive from IUnknown, this should not be a problem.
|
---|
46 | * - the header file only defines the interface, the actual fields are defined
|
---|
47 | * separately in the C file implementing the interface.
|
---|
48 | *
|
---|
49 | * The natural approach to this problem would be to make sure we get a C++ class and
|
---|
50 | * virtual methods in C++ and a structure with a table of pointer to functions in C.
|
---|
51 | * Unfortunately the layout of the virtual table is compiler specific, the layout of
|
---|
52 | * g++ virtual tables is not the same as that of an egcs virtual table which is not the
|
---|
53 | * same as that generated by Visual C+. There are workarounds to make the virtual tables
|
---|
54 | * compatible via padding but unfortunately the one which is imposed to the WINE emulator
|
---|
55 | * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
|
---|
56 | *
|
---|
57 | * So the solution I finally adopted does not use virtual tables. Instead I use inline
|
---|
58 | * non virtual methods that dereference the method pointer themselves and perform the call.
|
---|
59 | *
|
---|
60 | * Let's take Direct3D as an example:
|
---|
61 | *
|
---|
62 | * #define INTERFACE IDirect3D
|
---|
63 | * DECLARE_INTERFACE_(IDirect3D,IUnknown)
|
---|
64 | * {
|
---|
65 | * // *** IUnknown methods *** //
|
---|
66 | * STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, void**) PURE;
|
---|
67 | * STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
---|
68 | * STDMETHOD_(ULONG,Release)(THIS) PURE;
|
---|
69 | * // *** IDirect3D methods *** //
|
---|
70 | * STDMETHOD(Initialize)(THIS_ REFIID) PURE;
|
---|
71 | * STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE;
|
---|
72 | * STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *, IUnknown *) PURE;
|
---|
73 | * STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL *, IUnknown *) PURE;
|
---|
74 | * STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT *, IUnknown *) PURE;
|
---|
75 | * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
|
---|
76 | * };
|
---|
77 | * #undef INTERFACE
|
---|
78 | *
|
---|
79 | * #ifdef COBJMACROS
|
---|
80 | * // *** IUnknown methods *** //
|
---|
81 | * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
---|
82 | * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
|
---|
83 | * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
|
---|
84 | * // *** IDirect3D methods *** //
|
---|
85 | * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
|
---|
86 | * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
|
---|
87 | * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
|
---|
88 | * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
|
---|
89 | * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
|
---|
90 | * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
|
---|
91 | * #endif
|
---|
92 | *
|
---|
93 | * Comments:
|
---|
94 | * - The INTERFACE macro is used in the STDMETHOD macros to define the type of the 'this'
|
---|
95 | * pointer. Defining this macro here saves us the trouble of having to repeat the interface
|
---|
96 | * name everywhere. Note however that because of the way macros work, a macro like STDMETHOD
|
---|
97 | * cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not
|
---|
98 | * 'IDirect3D_VTABLE'.
|
---|
99 | * - The DECLARE_INTERFACE declares all the structures necessary for the interface. We have to
|
---|
100 | * explicitly use the interface name for macro expansion reasons again. It defines the list of
|
---|
101 | * methods that are inheritable from this interface. It must be written manually (rather than
|
---|
102 | * using a macro to generate the equivalent code) to avoid macro recursion (which compilers
|
---|
103 | * don't like). It must start with the methods definition of the parent interface so that
|
---|
104 | * method inheritance works properly.
|
---|
105 | * - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros
|
---|
106 | * will not work.
|
---|
107 | * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
|
---|
108 | * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
|
---|
109 | * the inherited method definitions there. This time I could have used a trick to use only one
|
---|
110 | * macro whatever the number of parameters but I preferred to have it work the same way as above.
|
---|
111 | * - You probably have noticed that we don't define the fields we need to actually implement this
|
---|
112 | * interface: reference count, pointer to other resources and miscellaneous fields. That's
|
---|
113 | * because these interfaces are just that: interfaces. They may be implemented more than once, in
|
---|
114 | * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
|
---|
115 | * that the interface contains some specific fields.
|
---|
116 | *
|
---|
117 | *
|
---|
118 | * In C this gives:
|
---|
119 | * typedef struct IDirect3DVtbl IDirect3DVtbl;
|
---|
120 | * struct IDirect3D {
|
---|
121 | * IDirect3DVtbl* lpVtbl;
|
---|
122 | * };
|
---|
123 | * struct IDirect3DVtbl {
|
---|
124 | * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
|
---|
125 | * ULONG (*AddRef)(IDirect3D* me);
|
---|
126 | * ULONG (*Release)(IDirect3D* me);
|
---|
127 | * HRESULT (*Initialize)(IDirect3D* me, REFIID a);
|
---|
128 | * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
|
---|
129 | * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
|
---|
130 | * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
|
---|
131 | * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
|
---|
132 | * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
|
---|
133 | * };
|
---|
134 | *
|
---|
135 | * #ifdef COBJMACROS
|
---|
136 | * // *** IUnknown methods *** //
|
---|
137 | * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
---|
138 | * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
|
---|
139 | * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
|
---|
140 | * // *** IDirect3D methods *** //
|
---|
141 | * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
|
---|
142 | * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
|
---|
143 | * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
|
---|
144 | * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
|
---|
145 | * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
|
---|
146 | * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
|
---|
147 | * #endif
|
---|
148 | *
|
---|
149 | * Comments:
|
---|
150 | * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
|
---|
151 | * the user needs to know to use the interface. Of course the structure we will define to
|
---|
152 | * implement this interface will have more fields but the first one will match this pointer.
|
---|
153 | * - The code generated by DECLARE_INTERFACE defines both the structure representing the interface and
|
---|
154 | * the structure for the jump table.
|
---|
155 | * - Each method is declared as a pointer to function field in the jump table. The implementation
|
---|
156 | * will fill this jump table with appropriate values, probably using a static variable, and
|
---|
157 | * initialize the lpVtbl field to point to this variable.
|
---|
158 | * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
|
---|
159 | * corresponding to the macro name. This emulates the behavior of a virtual table and should be
|
---|
160 | * just as fast.
|
---|
161 | * - This C code should be quite compatible with the Windows headers both for code that uses COM
|
---|
162 | * interfaces and for code implementing a COM interface.
|
---|
163 | *
|
---|
164 | *
|
---|
165 | * And in C++ (with gcc's g++):
|
---|
166 | *
|
---|
167 | * typedef struct IDirect3D: public IUnknown {
|
---|
168 | * virtual HRESULT Initialize(REFIID a) = 0;
|
---|
169 | * virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) = 0;
|
---|
170 | * virtual HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) = 0;
|
---|
171 | * virtual HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) = 0;
|
---|
172 | * virtual HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) = 0;
|
---|
173 | * virtual HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) = 0;
|
---|
174 | * };
|
---|
175 | *
|
---|
176 | * Comments:
|
---|
177 | * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
|
---|
178 | * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
|
---|
179 | * macro is defined in which case we would not be here.
|
---|
180 | *
|
---|
181 | *
|
---|
182 | * Implementing a COM interface.
|
---|
183 | *
|
---|
184 | * This continues the above example. This example assumes that the implementation is in C.
|
---|
185 | *
|
---|
186 | * typedef struct IDirect3DImpl {
|
---|
187 | * void* lpVtbl;
|
---|
188 | * // ...
|
---|
189 | *
|
---|
190 | * } IDirect3DImpl;
|
---|
191 | *
|
---|
192 | * static IDirect3DVtbl d3dvt;
|
---|
193 | *
|
---|
194 | * // implement the IDirect3D methods here
|
---|
195 | *
|
---|
196 | * int IDirect3D_QueryInterface(IDirect3D* me)
|
---|
197 | * {
|
---|
198 | * IDirect3DImpl *This = (IDirect3DImpl *)me;
|
---|
199 | * // ...
|
---|
200 | * }
|
---|
201 | *
|
---|
202 | * // ...
|
---|
203 | *
|
---|
204 | * static IDirect3DVtbl d3dvt = {
|
---|
205 | * IDirect3D_QueryInterface,
|
---|
206 | * IDirect3D_Add,
|
---|
207 | * IDirect3D_Add2,
|
---|
208 | * IDirect3D_Initialize,
|
---|
209 | * IDirect3D_SetWidth
|
---|
210 | * };
|
---|
211 | *
|
---|
212 | * Comments:
|
---|
213 | * - We first define what the interface really contains. This is the IDirect3DImpl structure. The
|
---|
214 | * first field must of course be the virtual table pointer. Everything else is free.
|
---|
215 | * - Then we predeclare our static virtual table variable, we will need its address in some
|
---|
216 | * methods to initialize the virtual table pointer of the returned interface objects.
|
---|
217 | * - Then we implement the interface methods. To match what has been declared in the header file
|
---|
218 | * they must take a pointer to an IDirect3D structure and we must cast it to an IDirect3DImpl so
|
---|
219 | * that we can manipulate the fields.
|
---|
220 | * - Finally we initialize the virtual table.
|
---|
221 | */
|
---|
222 |
|
---|
223 | #if defined(__cplusplus) && !defined(CINTERFACE)
|
---|
224 |
|
---|
225 | /* C++ interface */
|
---|
226 |
|
---|
227 | #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
|
---|
228 | #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
|
---|
229 | #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
|
---|
230 | #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
|
---|
231 |
|
---|
232 | #define PURE = 0
|
---|
233 | #define THIS_
|
---|
234 | #define THIS void
|
---|
235 |
|
---|
236 | #define interface struct
|
---|
237 | #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
|
---|
238 | #define DECLARE_INTERFACE_(iface,ibase) interface DECLSPEC_NOVTABLE iface : public ibase
|
---|
239 | #define DECLARE_INTERFACE_IID_(iface, ibase, iid) interface DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE iface : public ibase
|
---|
240 |
|
---|
241 | #define BEGIN_INTERFACE
|
---|
242 | #define END_INTERFACE
|
---|
243 |
|
---|
244 | #else /* __cplusplus && !CINTERFACE */
|
---|
245 |
|
---|
246 | /* C interface */
|
---|
247 |
|
---|
248 | #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
|
---|
249 | #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
|
---|
250 | #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
|
---|
251 | #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
|
---|
252 |
|
---|
253 | #define PURE
|
---|
254 | #define THIS_ INTERFACE *This,
|
---|
255 | #define THIS INTERFACE *This
|
---|
256 |
|
---|
257 | #define interface struct
|
---|
258 |
|
---|
259 | #ifdef __WINESRC__
|
---|
260 | #define CONST_VTABLE
|
---|
261 | #endif
|
---|
262 |
|
---|
263 | #ifdef CONST_VTABLE
|
---|
264 | #undef CONST_VTBL
|
---|
265 | #define CONST_VTBL const
|
---|
266 | #define DECLARE_INTERFACE(iface) \
|
---|
267 | typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; \
|
---|
268 | typedef struct iface##Vtbl iface##Vtbl; \
|
---|
269 | struct iface##Vtbl
|
---|
270 | #else
|
---|
271 | #undef CONST_VTBL
|
---|
272 | #define CONST_VTBL
|
---|
273 | #define DECLARE_INTERFACE(iface) \
|
---|
274 | typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; \
|
---|
275 | typedef struct iface##Vtbl iface##Vtbl; \
|
---|
276 | struct iface##Vtbl
|
---|
277 | #endif
|
---|
278 | #define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
|
---|
279 | #define DECLARE_INTERFACE_IID_(iface, ibase, iid) DECLARE_INTERFACE_(iface, ibase)
|
---|
280 |
|
---|
281 | #define BEGIN_INTERFACE
|
---|
282 | #define END_INTERFACE
|
---|
283 |
|
---|
284 | #endif /* __cplusplus && !CINTERFACE */
|
---|
285 |
|
---|
286 | #ifndef __IRpcStubBuffer_FWD_DEFINED__
|
---|
287 | #define __IRpcStubBuffer_FWD_DEFINED__
|
---|
288 | typedef interface IRpcStubBuffer IRpcStubBuffer;
|
---|
289 | #endif
|
---|
290 | #ifndef __IRpcChannelBuffer_FWD_DEFINED__
|
---|
291 | #define __IRpcChannelBuffer_FWD_DEFINED__
|
---|
292 | typedef interface IRpcChannelBuffer IRpcChannelBuffer;
|
---|
293 | #endif
|
---|
294 |
|
---|
295 | #ifndef RC_INVOKED
|
---|
296 | /* For compatibility only, at least for now */
|
---|
297 | #include <stdlib.h>
|
---|
298 | #endif
|
---|
299 |
|
---|
300 | #include <wtypes.h>
|
---|
301 | #include <unknwn.h>
|
---|
302 | #include <objidl.h>
|
---|
303 |
|
---|
304 | #include <guiddef.h>
|
---|
305 | #ifndef INITGUID
|
---|
306 | #include <cguid.h>
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | #ifdef __cplusplus
|
---|
310 | extern "C" {
|
---|
311 | #endif
|
---|
312 |
|
---|
313 | #ifndef NONAMELESSSTRUCT
|
---|
314 | #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
|
---|
315 | #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
|
---|
316 | #else
|
---|
317 | #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
|
---|
318 | #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
|
---|
319 | #endif
|
---|
320 |
|
---|
321 | /*****************************************************************************
|
---|
322 | * Standard API
|
---|
323 | */
|
---|
324 | DWORD WINAPI CoBuildVersion(void);
|
---|
325 |
|
---|
326 | typedef enum tagCOINIT
|
---|
327 | {
|
---|
328 | COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
|
---|
329 | COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
|
---|
330 | COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
|
---|
331 | COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
|
---|
332 | } COINIT;
|
---|
333 |
|
---|
334 | HRESULT WINAPI CoInitialize(LPVOID lpReserved);
|
---|
335 | HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
|
---|
336 | void WINAPI CoUninitialize(void);
|
---|
337 | DWORD WINAPI CoGetCurrentProcess(void);
|
---|
338 |
|
---|
339 | HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
|
---|
340 | void WINAPI CoFreeAllLibraries(void);
|
---|
341 | void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
|
---|
342 | void WINAPI CoFreeUnusedLibraries(void);
|
---|
343 | void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved);
|
---|
344 |
|
---|
345 | HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
|
---|
346 | HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
|
---|
347 | LPUNKNOWN pUnkOuter,
|
---|
348 | DWORD dwClsContext,
|
---|
349 | COSERVERINFO* pServerInfo,
|
---|
350 | ULONG cmq,
|
---|
351 | MULTI_QI* pResults);
|
---|
352 |
|
---|
353 | HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults);
|
---|
354 | HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
|
---|
355 |
|
---|
356 | HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
|
---|
357 | LPVOID WINAPI CoTaskMemAlloc(ULONG size) __WINE_ALLOC_SIZE(1);
|
---|
358 | void WINAPI CoTaskMemFree(LPVOID ptr);
|
---|
359 | LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
|
---|
360 |
|
---|
361 | HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
|
---|
362 | HRESULT WINAPI CoRevokeMallocSpy(void);
|
---|
363 |
|
---|
364 | HRESULT WINAPI CoGetContextToken( ULONG_PTR *token );
|
---|
365 |
|
---|
366 | /* class registration flags; passed to CoRegisterClassObject */
|
---|
367 | typedef enum tagREGCLS
|
---|
368 | {
|
---|
369 | REGCLS_SINGLEUSE = 0,
|
---|
370 | REGCLS_MULTIPLEUSE = 1,
|
---|
371 | REGCLS_MULTI_SEPARATE = 2,
|
---|
372 | REGCLS_SUSPENDED = 4,
|
---|
373 | REGCLS_SURROGATE = 8
|
---|
374 | } REGCLS;
|
---|
375 |
|
---|
376 | HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
|
---|
377 | HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
|
---|
378 | HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
|
---|
379 | HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
|
---|
380 | HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
|
---|
381 | HRESULT WINAPI CoRegisterSurrogate(LPSURROGATE pSurrogate);
|
---|
382 | HRESULT WINAPI CoSuspendClassObjects(void);
|
---|
383 | HRESULT WINAPI CoResumeClassObjects(void);
|
---|
384 | ULONG WINAPI CoAddRefServerProcess(void);
|
---|
385 | ULONG WINAPI CoReleaseServerProcess(void);
|
---|
386 |
|
---|
387 | /* marshalling */
|
---|
388 | HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
|
---|
389 | HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
|
---|
390 | HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
|
---|
391 | HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
|
---|
392 | HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
|
---|
393 | HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
|
---|
394 | HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
|
---|
395 | HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
|
---|
396 | HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
|
---|
397 | HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
|
---|
398 | HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
|
---|
399 | HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
|
---|
400 | BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
|
---|
401 |
|
---|
402 | /* security */
|
---|
403 | HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
|
---|
404 | HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
|
---|
405 | HRESULT WINAPI CoSwitchCallContext(IUnknown *pContext, IUnknown **ppOldContext);
|
---|
406 | HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
|
---|
407 |
|
---|
408 | HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilities);
|
---|
409 | HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
|
---|
410 | HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
|
---|
411 |
|
---|
412 | HRESULT WINAPI CoImpersonateClient(void);
|
---|
413 | HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
|
---|
414 | HRESULT WINAPI CoRevertToSelf(void);
|
---|
415 |
|
---|
416 | /* misc */
|
---|
417 | HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
|
---|
418 | HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
|
---|
419 | HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, LPVOID lpvReserved);
|
---|
420 | HRESULT WINAPI CoGetObjectContext(REFIID riid, LPVOID *ppv);
|
---|
421 |
|
---|
422 | HRESULT WINAPI CoCreateGuid(GUID* pguid);
|
---|
423 | BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
|
---|
424 |
|
---|
425 | BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
|
---|
426 | BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
|
---|
427 | HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
|
---|
428 | HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
|
---|
429 | HRESULT WINAPI CoRegisterChannelHook(REFGUID ExtensionGuid, IChannelHook *pChannelHook);
|
---|
430 |
|
---|
431 | typedef enum tagCOWAIT_FLAGS
|
---|
432 | {
|
---|
433 | COWAIT_WAITALL = 0x00000001,
|
---|
434 | COWAIT_ALERTABLE = 0x00000002
|
---|
435 | } COWAIT_FLAGS;
|
---|
436 |
|
---|
437 | HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags,DWORD dwTimeout,ULONG cHandles,LPHANDLE pHandles,LPDWORD lpdwindex);
|
---|
438 |
|
---|
439 | /*****************************************************************************
|
---|
440 | * GUID API
|
---|
441 | */
|
---|
442 | HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
|
---|
443 | HRESULT WINAPI CLSIDFromString(LPCOLESTR, LPCLSID);
|
---|
444 | HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
|
---|
445 | HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
|
---|
446 |
|
---|
447 | INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
|
---|
448 |
|
---|
449 | /*****************************************************************************
|
---|
450 | * COM Server dll - exports
|
---|
451 | */
|
---|
452 | HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
|
---|
453 | HRESULT WINAPI DllCanUnloadNow(void) DECLSPEC_HIDDEN;
|
---|
454 |
|
---|
455 | /* shouldn't be here, but is nice for type checking */
|
---|
456 | #ifdef __WINESRC__
|
---|
457 | HRESULT WINAPI DllRegisterServer(void) DECLSPEC_HIDDEN;
|
---|
458 | HRESULT WINAPI DllUnregisterServer(void) DECLSPEC_HIDDEN;
|
---|
459 | #endif
|
---|
460 |
|
---|
461 |
|
---|
462 | /*****************************************************************************
|
---|
463 | * Data Object
|
---|
464 | */
|
---|
465 | HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
|
---|
466 | HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
|
---|
467 |
|
---|
468 | /*****************************************************************************
|
---|
469 | * Moniker API
|
---|
470 | */
|
---|
471 | HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
|
---|
472 | HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv);
|
---|
473 | HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
|
---|
474 | HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
|
---|
475 | HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
|
---|
476 | HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
|
---|
477 | HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
|
---|
478 | HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
|
---|
479 | HRESULT WINAPI CreateObjrefMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
|
---|
480 | HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
|
---|
481 | HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
|
---|
482 | HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
|
---|
483 | HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName, ULONG * pchEaten, LPMONIKER * ppmk);
|
---|
484 | HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
|
---|
485 | HRESULT WINAPI MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER * ppmkRelPath, BOOL dwReserved);
|
---|
486 |
|
---|
487 | /*****************************************************************************
|
---|
488 | * Storage API
|
---|
489 | */
|
---|
490 | #define STGM_DIRECT 0x00000000
|
---|
491 | #define STGM_TRANSACTED 0x00010000
|
---|
492 | #define STGM_SIMPLE 0x08000000
|
---|
493 | #define STGM_READ 0x00000000
|
---|
494 | #define STGM_WRITE 0x00000001
|
---|
495 | #define STGM_READWRITE 0x00000002
|
---|
496 | #define STGM_SHARE_DENY_NONE 0x00000040
|
---|
497 | #define STGM_SHARE_DENY_READ 0x00000030
|
---|
498 | #define STGM_SHARE_DENY_WRITE 0x00000020
|
---|
499 | #define STGM_SHARE_EXCLUSIVE 0x00000010
|
---|
500 | #define STGM_PRIORITY 0x00040000
|
---|
501 | #define STGM_DELETEONRELEASE 0x04000000
|
---|
502 | #define STGM_CREATE 0x00001000
|
---|
503 | #define STGM_CONVERT 0x00020000
|
---|
504 | #define STGM_FAILIFTHERE 0x00000000
|
---|
505 | #define STGM_NOSCRATCH 0x00100000
|
---|
506 | #define STGM_NOSNAPSHOT 0x00200000
|
---|
507 | #define STGM_DIRECT_SWMR 0x00400000
|
---|
508 |
|
---|
509 | #define STGFMT_STORAGE 0
|
---|
510 | #define STGFMT_FILE 3
|
---|
511 | #define STGFMT_ANY 4
|
---|
512 | #define STGFMT_DOCFILE 5
|
---|
513 |
|
---|
514 | typedef struct tagSTGOPTIONS
|
---|
515 | {
|
---|
516 | USHORT usVersion;
|
---|
517 | USHORT reserved;
|
---|
518 | ULONG ulSectorSize;
|
---|
519 | const WCHAR* pwcsTemplateFile;
|
---|
520 | } STGOPTIONS;
|
---|
521 |
|
---|
522 | HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
|
---|
523 | HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**);
|
---|
524 | HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
|
---|
525 | HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
|
---|
526 | HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
|
---|
527 | HRESULT WINAPI StgOpenStorageEx(const WCHAR* pwcwName,DWORD grfMode,DWORD stgfmt,DWORD grfAttrs,STGOPTIONS *pStgOptions, void *reserved, REFIID riid, void **ppObjectOpen);
|
---|
528 |
|
---|
529 | HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
|
---|
530 | HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
|
---|
531 | HRESULT WINAPI StgSetTimes( OLECHAR const *lpszName, FILETIME const *pctime, FILETIME const *patime, FILETIME const *pmtime);
|
---|
532 |
|
---|
533 | #ifdef __cplusplus
|
---|
534 | }
|
---|
535 | #endif
|
---|
536 |
|
---|
537 | #ifndef __WINESRC__
|
---|
538 | # include <urlmon.h>
|
---|
539 | #endif
|
---|
540 | #include <propidl.h>
|
---|
541 |
|
---|
542 | #ifndef __WINESRC__
|
---|
543 |
|
---|
544 | #define FARSTRUCT
|
---|
545 | #define HUGEP
|
---|
546 |
|
---|
547 | #define WINOLEAPI STDAPI
|
---|
548 | #define WINOLEAPI_(type) STDAPI_(type)
|
---|
549 |
|
---|
550 | #endif /* __WINESRC__ */
|
---|
551 |
|
---|
552 | #endif /* _OBJBASE_H_ */
|
---|