* Sync up to trunk HEAD (r62975).
[reactos.git] / include / psdk / objbase.h
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 #include <rpc.h>
20 #include <rpcndr.h>
21
22 #ifndef _OBJBASE_H_
23 #define _OBJBASE_H_
24
25 /*****************************************************************************
26 * Macros to define a COM interface
27 */
28 /*
29 * The goal of the following set of definitions is to provide a way to use the same
30 * header file definitions to provide both a C interface and a C++ object oriented
31 * interface to COM interfaces. The type of interface is selected automatically
32 * depending on the language but it is always possible to get the C interface in C++
33 * by defining CINTERFACE.
34 *
35 * It is based on the following assumptions:
36 * - all COM interfaces derive from IUnknown, this should not be a problem.
37 * - the header file only defines the interface, the actual fields are defined
38 * separately in the C file implementing the interface.
39 *
40 * The natural approach to this problem would be to make sure we get a C++ class and
41 * virtual methods in C++ and a structure with a table of pointer to functions in C.
42 * Unfortunately the layout of the virtual table is compiler specific, the layout of
43 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
44 * same as that generated by Visual C++. There are workarounds to make the virtual tables
45 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
46 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
47 *
48 * So the solution I finally adopted does not use virtual tables. Instead I use inline
49 * non virtual methods that dereference the method pointer themselves and perform the call.
50 *
51 * Let's take Direct3D as an example:
52 *
53 * #define INTERFACE IDirect3D
54 * DECLARE_INTERFACE_(IDirect3D,IUnknown)
55 * {
56 * // *** IUnknown methods *** //
57 * STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, void**) PURE;
58 * STDMETHOD_(ULONG,AddRef)(THIS) PURE;
59 * STDMETHOD_(ULONG,Release)(THIS) PURE;
60 * // *** IDirect3D methods *** //
61 * STDMETHOD(Initialize)(THIS_ REFIID) PURE;
62 * STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE;
63 * STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *, IUnknown *) PURE;
64 * STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL *, IUnknown *) PURE;
65 * STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT *, IUnknown *) PURE;
66 * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
67 * };
68 * #undef INTERFACE
69 *
70 * #ifdef COBJMACROS
71 * // *** IUnknown methods *** //
72 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
73 * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
74 * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
75 * // *** IDirect3D methods *** //
76 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
77 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
78 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
79 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
80 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
81 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
82 * #endif
83 *
84 * Comments:
85 * - The INTERFACE macro is used in the STDMETHOD macros to define the type of the 'this'
86 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
87 * name everywhere. Note however that because of the way macros work, a macro like STDMETHOD
88 * cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not
89 * 'IDirect3D_VTABLE'.
90 * - The DECLARE_INTERFACE declares all the structures necessary for the interface. We have to
91 * explicitly use the interface name for macro expansion reasons again. It defines the list of
92 * methods that are inheritable from this interface. It must be written manually (rather than
93 * using a macro to generate the equivalent code) to avoid macro recursion (which compilers
94 * don't like). It must start with the methods definition of the parent interface so that
95 * method inheritance works properly.
96 * - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros
97 * will not work.
98 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
99 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
100 * the inherited method definitions there. This time I could have used a trick to use only one
101 * macro whatever the number of parameters but I preferred to have it work the same way as above.
102 * - You probably have noticed that we don't define the fields we need to actually implement this
103 * interface: reference count, pointer to other resources and miscellaneous fields. That's
104 * because these interfaces are just that: interfaces. They may be implemented more than once, in
105 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
106 * that the interface contains some specific fields.
107 *
108 *
109 * In C this gives:
110 * typedef struct IDirect3DVtbl IDirect3DVtbl;
111 * struct IDirect3D {
112 * IDirect3DVtbl* lpVtbl;
113 * };
114 * struct IDirect3DVtbl {
115 * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
116 * ULONG (*AddRef)(IDirect3D* me);
117 * ULONG (*Release)(IDirect3D* me);
118 * HRESULT (*Initialize)(IDirect3D* me, REFIID a);
119 * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
120 * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
121 * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
122 * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
123 * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
124 * };
125 *
126 * #ifdef COBJMACROS
127 * // *** IUnknown methods *** //
128 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
129 * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
130 * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
131 * // *** IDirect3D methods *** //
132 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
133 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
134 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
135 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
136 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
137 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
138 * #endif
139 *
140 * Comments:
141 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
142 * the user needs to know to use the interface. Of course the structure we will define to
143 * implement this interface will have more fields but the first one will match this pointer.
144 * - The code generated by DECLARE_INTERFACE defines both the structure representing the interface and
145 * the structure for the jump table.
146 * - Each method is declared as a pointer to function field in the jump table. The implementation
147 * will fill this jump table with appropriate values, probably using a static variable, and
148 * initialize the lpVtbl field to point to this variable.
149 * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
150 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
151 * just as fast.
152 * - This C code should be quite compatible with the Windows headers both for code that uses COM
153 * interfaces and for code implementing a COM interface.
154 *
155 *
156 * And in C++ (with gcc's g++):
157 *
158 * typedef struct IDirect3D: public IUnknown {
159 * virtual HRESULT Initialize(REFIID a) = 0;
160 * virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) = 0;
161 * virtual HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) = 0;
162 * virtual HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) = 0;
163 * virtual HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) = 0;
164 * virtual HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) = 0;
165 * };
166 *
167 * Comments:
168 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
169 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
170 * macro is defined in which case we would not be here.
171 */
172
173 #if defined(__cplusplus) && !defined(CINTERFACE)
174
175 /* C++ interface */
176
177 #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
178 #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
179 #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
180 #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
181
182 #define PURE = 0
183 #define THIS_
184 #define THIS void
185
186 #define interface struct
187 #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
188 #define DECLARE_INTERFACE_(iface,ibase) interface DECLSPEC_NOVTABLE iface : public ibase
189 #define DECLARE_INTERFACE_IID_(iface, ibase, iid) interface DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE iface : public ibase
190
191 #define BEGIN_INTERFACE
192 #define END_INTERFACE
193
194 #else /* __cplusplus && !CINTERFACE */
195
196 /* C interface */
197
198 #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
199 #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
200 #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
201 #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
202
203 #define PURE
204 #define THIS_ INTERFACE *This,
205 #define THIS INTERFACE *This
206
207 #define interface struct
208
209 #ifdef __WINESRC__
210 #define CONST_VTABLE
211 #endif
212
213 #ifdef CONST_VTABLE
214 #undef CONST_VTBL
215 #define CONST_VTBL const
216 #define DECLARE_INTERFACE(iface) \
217 typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; \
218 typedef struct iface##Vtbl iface##Vtbl; \
219 struct iface##Vtbl
220 #else
221 #undef CONST_VTBL
222 #define CONST_VTBL
223 #define DECLARE_INTERFACE(iface) \
224 typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; \
225 typedef struct iface##Vtbl iface##Vtbl; \
226 struct iface##Vtbl
227 #endif
228 #define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
229 #define DECLARE_INTERFACE_IID_(iface, ibase, iid) DECLARE_INTERFACE_(iface, ibase)
230
231 #define BEGIN_INTERFACE
232 #define END_INTERFACE
233
234 #endif /* __cplusplus && !CINTERFACE */
235
236 #ifndef __IRpcStubBuffer_FWD_DEFINED__
237 #define __IRpcStubBuffer_FWD_DEFINED__
238 typedef interface IRpcStubBuffer IRpcStubBuffer;
239 #endif
240 #ifndef __IRpcChannelBuffer_FWD_DEFINED__
241 #define __IRpcChannelBuffer_FWD_DEFINED__
242 typedef interface IRpcChannelBuffer IRpcChannelBuffer;
243 #endif
244
245 #ifndef RC_INVOKED
246 /* For compatibility only, at least for now */
247 #include <stdlib.h>
248 #endif
249
250 #include <wtypes.h>
251 #include <unknwn.h>
252 #include <objidl.h>
253
254 #include <guiddef.h>
255 #ifndef INITGUID
256 #include <cguid.h>
257 #endif
258
259 #ifdef __cplusplus
260 extern "C" {
261 #endif
262
263 #ifndef NONAMELESSSTRUCT
264 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
265 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
266 #else
267 #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
268 #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
269 #endif
270
271 /*****************************************************************************
272 * Standard API
273 */
274 DWORD WINAPI CoBuildVersion(void);
275
276 typedef enum tagCOINIT
277 {
278 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
279 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
280 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
281 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
282 } COINIT;
283
284 _Check_return_ HRESULT WINAPI CoInitialize(_In_opt_ LPVOID lpReserved);
285
286 _Check_return_
287 HRESULT
288 WINAPI
289 CoInitializeEx(
290 _In_opt_ LPVOID lpReserved,
291 _In_ DWORD dwCoInit);
292
293 void WINAPI CoUninitialize(void);
294 DWORD WINAPI CoGetCurrentProcess(void);
295
296 HINSTANCE WINAPI CoLoadLibrary(_In_ LPOLESTR lpszLibName, _In_ BOOL bAutoFree);
297 void WINAPI CoFreeAllLibraries(void);
298 void WINAPI CoFreeLibrary(_In_ HINSTANCE hLibrary);
299 void WINAPI CoFreeUnusedLibraries(void);
300
301 void
302 WINAPI
303 CoFreeUnusedLibrariesEx(
304 _In_ DWORD dwUnloadDelay,
305 _In_ DWORD dwReserved);
306
307 _Check_return_
308 HRESULT
309 WINAPI
310 CoCreateInstance(
311 _In_ REFCLSID rclsid,
312 _In_opt_ LPUNKNOWN pUnkOuter,
313 _In_ DWORD dwClsContext,
314 _In_ REFIID iid,
315 _Outptr_ _At_(*ppv, _Post_readable_size_(_Inexpressible_(varies))) LPVOID *ppv);
316
317 _Check_return_
318 HRESULT
319 WINAPI
320 CoCreateInstanceEx(
321 _In_ REFCLSID rclsid,
322 _In_opt_ LPUNKNOWN pUnkOuter,
323 _In_ DWORD dwClsContext,
324 _In_opt_ COSERVERINFO *pServerInfo,
325 _In_ ULONG cmq,
326 _Inout_updates_(cmq) MULTI_QI *pResults);
327
328 _Check_return_
329 HRESULT
330 WINAPI
331 CoGetInstanceFromFile(
332 _In_opt_ COSERVERINFO *pServerInfo,
333 _In_opt_ CLSID *pClsid,
334 _In_opt_ IUnknown *punkOuter,
335 _In_ DWORD dwClsCtx,
336 _In_ DWORD grfMode,
337 _In_ _Null_terminated_ OLECHAR *pwszName,
338 _In_ DWORD dwCount,
339 _Inout_updates_(dwCount) MULTI_QI *pResults);
340
341 _Check_return_
342 HRESULT
343 WINAPI
344 CoGetInstanceFromIStorage(
345 _In_opt_ COSERVERINFO *pServerInfo,
346 _In_opt_ CLSID *pClsid,
347 _In_opt_ IUnknown *punkOuter,
348 _In_ DWORD dwClsCtx,
349 _In_ IStorage *pstg,
350 _In_ DWORD dwCount,
351 _Inout_updates_(dwCount) MULTI_QI *pResults);
352
353 _Check_return_
354 HRESULT
355 WINAPI
356 CoGetMalloc(
357 _In_ DWORD dwMemContext,
358 _Outptr_ LPMALLOC *lpMalloc);
359
360 _Ret_opt_
361 _Post_writable_byte_size_(size)
362 __drv_allocatesMem(Mem)
363 _Check_return_
364 LPVOID
365 WINAPI
366 CoTaskMemAlloc(_In_ ULONG size) __WINE_ALLOC_SIZE(1);
367
368 void
369 WINAPI
370 CoTaskMemFree(
371 _In_opt_ __drv_freesMem(Mem) _Post_invalid_ LPVOID ptr);
372
373 _Ret_opt_
374 _Post_writable_byte_size_(size)
375 _When_(size > 0, __drv_allocatesMem(Mem) _Check_return_)
376 LPVOID
377 WINAPI
378 CoTaskMemRealloc(
379 _In_opt_ __drv_freesMem(Mem) _Post_invalid_ LPVOID ptr,
380 _In_ ULONG size);
381
382 HRESULT WINAPI CoRegisterMallocSpy(_In_ LPMALLOCSPY pMallocSpy);
383 HRESULT WINAPI CoRevokeMallocSpy(void);
384
385 _Check_return_ HRESULT WINAPI CoGetContextToken(_Out_ ULONG_PTR *token);
386
387 /* class registration flags; passed to CoRegisterClassObject */
388 typedef enum tagREGCLS
389 {
390 REGCLS_SINGLEUSE = 0,
391 REGCLS_MULTIPLEUSE = 1,
392 REGCLS_MULTI_SEPARATE = 2,
393 REGCLS_SUSPENDED = 4,
394 REGCLS_SURROGATE = 8
395 } REGCLS;
396
397 _Check_return_
398 HRESULT
399 WINAPI
400 CoGetClassObject(
401 _In_ REFCLSID rclsid,
402 _In_ DWORD dwClsContext,
403 _In_opt_ COSERVERINFO *pServerInfo,
404 _In_ REFIID iid,
405 _Outptr_ LPVOID *ppv);
406
407 _Check_return_
408 HRESULT
409 WINAPI
410 CoRegisterClassObject(
411 _In_ REFCLSID rclsid,
412 _In_ LPUNKNOWN pUnk,
413 _In_ DWORD dwClsContext,
414 _In_ DWORD flags,
415 _Out_ LPDWORD lpdwRegister);
416
417 _Check_return_
418 HRESULT
419 WINAPI
420 CoRevokeClassObject(
421 _In_ DWORD dwRegister);
422
423 _Check_return_
424 HRESULT
425 WINAPI
426 CoGetPSClsid(
427 _In_ REFIID riid,
428 _Out_ CLSID *pclsid);
429
430 _Check_return_
431 HRESULT
432 WINAPI
433 CoRegisterPSClsid(
434 _In_ REFIID riid,
435 _In_ REFCLSID rclsid);
436
437 _Check_return_ HRESULT WINAPI CoRegisterSurrogate(_In_ LPSURROGATE pSurrogate);
438 _Check_return_ HRESULT WINAPI CoSuspendClassObjects(void);
439 _Check_return_ HRESULT WINAPI CoResumeClassObjects(void);
440 ULONG WINAPI CoAddRefServerProcess(void);
441 ULONG WINAPI CoReleaseServerProcess(void);
442
443 /* marshalling */
444
445 _Check_return_
446 HRESULT
447 WINAPI
448 CoCreateFreeThreadedMarshaler(
449 _In_opt_ LPUNKNOWN punkOuter,
450 _Outptr_ LPUNKNOWN *ppunkMarshal);
451
452 _Check_return_
453 HRESULT
454 WINAPI
455 CoGetInterfaceAndReleaseStream(
456 _In_ LPSTREAM pStm,
457 _In_ REFIID iid,
458 _Outptr_ LPVOID *ppv);
459
460 _Check_return_
461 HRESULT
462 WINAPI
463 CoGetMarshalSizeMax(
464 _Out_ ULONG *pulSize,
465 _In_ REFIID riid,
466 _In_ LPUNKNOWN pUnk,
467 _In_ DWORD dwDestContext,
468 _In_opt_ LPVOID pvDestContext,
469 _In_ DWORD mshlflags);
470
471 _Check_return_
472 HRESULT
473 WINAPI
474 CoGetStandardMarshal(
475 _In_ REFIID riid,
476 _In_ LPUNKNOWN pUnk,
477 _In_ DWORD dwDestContext,
478 _In_opt_ LPVOID pvDestContext,
479 _In_ DWORD mshlflags,
480 _Outptr_ LPMARSHAL *ppMarshal);
481
482 HRESULT WINAPI CoMarshalHresult(_In_ LPSTREAM pstm, _In_ HRESULT hresult);
483
484 _Check_return_
485 HRESULT
486 WINAPI
487 CoMarshalInterface(
488 _In_ LPSTREAM pStm,
489 _In_ REFIID riid,
490 _In_ LPUNKNOWN pUnk,
491 _In_ DWORD dwDestContext,
492 _In_opt_ LPVOID pvDestContext,
493 _In_ DWORD mshlflags);
494
495 _Check_return_
496 HRESULT
497 WINAPI
498 CoMarshalInterThreadInterfaceInStream(
499 _In_ REFIID riid,
500 _In_ LPUNKNOWN pUnk,
501 _Outptr_ LPSTREAM *ppStm);
502
503 _Check_return_ HRESULT WINAPI CoReleaseMarshalData(_In_ LPSTREAM pStm);
504
505 _Check_return_
506 HRESULT
507 WINAPI
508 CoDisconnectObject(
509 _In_ LPUNKNOWN lpUnk,
510 _In_ DWORD reserved);
511
512 HRESULT WINAPI CoUnmarshalHresult(_In_ LPSTREAM pstm, _Out_ HRESULT *phresult);
513
514 _Check_return_
515 HRESULT
516 WINAPI
517 CoUnmarshalInterface(
518 _In_ LPSTREAM pStm,
519 _In_ REFIID riid,
520 _Outptr_ LPVOID *ppv);
521
522 _Check_return_
523 HRESULT
524 WINAPI
525 CoLockObjectExternal(
526 _In_ LPUNKNOWN pUnk,
527 _In_ BOOL fLock,
528 _In_ BOOL fLastUnlockReleases);
529
530 BOOL WINAPI CoIsHandlerConnected(_In_ LPUNKNOWN pUnk);
531
532 /* security */
533
534 _Check_return_
535 HRESULT
536 WINAPI
537 CoInitializeSecurity(
538 _In_opt_ PSECURITY_DESCRIPTOR pSecDesc,
539 _In_ LONG cAuthSvc,
540 _In_reads_opt_(cAuthSvc) SOLE_AUTHENTICATION_SERVICE *asAuthSvc,
541 _In_opt_ void *pReserved1,
542 _In_ DWORD dwAuthnLevel,
543 _In_ DWORD dwImpLevel,
544 _In_opt_ void *pReserved2,
545 _In_ DWORD dwCapabilities,
546 _In_opt_ void *pReserved3);
547
548 _Check_return_
549 HRESULT
550 WINAPI
551 CoGetCallContext(
552 _In_ REFIID riid,
553 _Outptr_ void **ppInterface);
554
555 _Check_return_
556 HRESULT
557 WINAPI
558 CoSwitchCallContext(
559 _In_opt_ IUnknown *pContext,
560 _Outptr_ IUnknown **ppOldContext);
561
562 _Check_return_
563 HRESULT
564 WINAPI
565 CoQueryAuthenticationServices(
566 _Out_ DWORD *pcAuthSvc,
567 _Outptr_result_buffer_(*pcAuthSvc) SOLE_AUTHENTICATION_SERVICE **asAuthSvc);
568
569 _Check_return_
570 HRESULT
571 WINAPI
572 CoQueryProxyBlanket(
573 _In_ IUnknown *pProxy,
574 _Out_opt_ DWORD *pwAuthnSvc,
575 _Out_opt_ DWORD *pAuthzSvc,
576 _Outptr_opt_ OLECHAR **pServerPrincName,
577 _Out_opt_ DWORD *pAuthnLevel,
578 _Out_opt_ DWORD *pImpLevel,
579 _Out_opt_ RPC_AUTH_IDENTITY_HANDLE *pAuthInfo,
580 _Out_opt_ DWORD *pCapabilities);
581
582 _Check_return_
583 HRESULT
584 WINAPI
585 CoSetProxyBlanket(
586 _In_ IUnknown *pProxy,
587 _In_ DWORD dwAuthnSvc,
588 _In_ DWORD dwAuthzSvc,
589 _In_opt_ OLECHAR *pServerPrincName,
590 _In_ DWORD dwAuthnLevel,
591 _In_ DWORD dwImpLevel,
592 _In_opt_ RPC_AUTH_IDENTITY_HANDLE pAuthInfo,
593 _In_ DWORD dwCapabilities);
594
595 _Check_return_
596 HRESULT
597 WINAPI CoCopyProxy(
598 _In_ IUnknown *pProxy,
599 _Outptr_ IUnknown **ppCopy);
600
601 _Check_return_ HRESULT WINAPI CoImpersonateClient(void);
602
603 _Check_return_
604 HRESULT
605 WINAPI
606 CoQueryClientBlanket(
607 _Out_opt_ DWORD *pAuthnSvc,
608 _Out_opt_ DWORD *pAuthzSvc,
609 _Outptr_opt_ OLECHAR **pServerPrincName,
610 _Out_opt_ DWORD *pAuthnLevel,
611 _Out_opt_ DWORD *pImpLevel,
612 _Outptr_opt_ RPC_AUTHZ_HANDLE *pPrivs,
613 _Inout_opt_ DWORD *pCapabilities);
614
615 _Check_return_ HRESULT WINAPI CoRevertToSelf(void);
616
617 /* misc */
618
619 _Check_return_
620 HRESULT
621 WINAPI
622 CoGetTreatAsClass(
623 _In_ REFCLSID clsidOld,
624 _Out_ LPCLSID pClsidNew);
625
626 _Check_return_
627 HRESULT
628 WINAPI
629 CoTreatAsClass(
630 _In_ REFCLSID clsidOld,
631 _In_ REFCLSID clsidNew);
632
633 HRESULT
634 WINAPI
635 CoAllowSetForegroundWindow(
636 _In_ IUnknown *pUnk,
637 _In_opt_ LPVOID lpvReserved);
638
639 _Check_return_
640 HRESULT
641 WINAPI
642 CoGetObjectContext(
643 _In_ REFIID riid,
644 _Outptr_ LPVOID *ppv);
645
646 _Check_return_ HRESULT WINAPI CoCreateGuid(_Out_ GUID *pguid);
647 BOOL WINAPI CoIsOle1Class(_In_ REFCLSID rclsid);
648
649 BOOL
650 WINAPI
651 CoDosDateTimeToFileTime(
652 _In_ WORD nDosDate,
653 _In_ WORD nDosTime,
654 _Out_ FILETIME *lpFileTime);
655
656 BOOL
657 WINAPI
658 CoFileTimeToDosDateTime(
659 _In_ FILETIME *lpFileTime,
660 _Out_ WORD *lpDosDate,
661 _Out_ WORD *lpDosTime);
662
663 HRESULT WINAPI CoFileTimeNow(_Out_ FILETIME *lpFileTime);
664
665 _Check_return_
666 HRESULT
667 WINAPI
668 CoRegisterMessageFilter(
669 _In_opt_ LPMESSAGEFILTER lpMessageFilter,
670 _Outptr_opt_result_maybenull_ LPMESSAGEFILTER *lplpMessageFilter);
671
672 HRESULT
673 WINAPI
674 CoRegisterChannelHook(
675 _In_ REFGUID ExtensionGuid,
676 _In_ IChannelHook *pChannelHook);
677
678 typedef enum tagCOWAIT_FLAGS
679 {
680 COWAIT_WAITALL = 0x00000001,
681 COWAIT_ALERTABLE = 0x00000002
682 } COWAIT_FLAGS;
683
684 _Check_return_
685 HRESULT
686 WINAPI
687 CoWaitForMultipleHandles(
688 _In_ DWORD dwFlags,
689 _In_ DWORD dwTimeout,
690 _In_ ULONG cHandles,
691 _In_reads_(cHandles) LPHANDLE pHandles,
692 _Out_ LPDWORD lpdwindex);
693
694 /*****************************************************************************
695 * GUID API
696 */
697
698 _Check_return_
699 HRESULT
700 WINAPI
701 StringFromCLSID(
702 _In_ REFCLSID id,
703 _Outptr_ LPOLESTR*);
704
705 _Check_return_
706 HRESULT
707 WINAPI
708 CLSIDFromString(
709 _In_ LPCOLESTR,
710 _Out_ LPCLSID);
711
712 _Check_return_
713 HRESULT
714 WINAPI
715 CLSIDFromProgID(
716 _In_ LPCOLESTR progid,
717 _Out_ LPCLSID riid);
718
719 _Check_return_
720 HRESULT
721 WINAPI
722 ProgIDFromCLSID(
723 _In_ REFCLSID clsid,
724 _Outptr_ LPOLESTR *lplpszProgID);
725
726 _Check_return_
727 INT
728 WINAPI
729 StringFromGUID2(
730 _In_ REFGUID id,
731 _Out_writes_to_(cmax, return) LPOLESTR str,
732 _In_ INT cmax);
733
734 _Check_return_
735 HRESULT
736 WINAPI
737 IIDFromString(
738 _In_ LPCOLESTR lpsz,
739 _Out_ LPIID lpiid);
740
741 /*****************************************************************************
742 * COM Server dll - exports
743 */
744
745 _Check_return_
746 HRESULT
747 WINAPI
748 DllGetClassObject(
749 _In_ REFCLSID rclsid,
750 _In_ REFIID riid,
751 _Outptr_ LPVOID *ppv) DECLSPEC_HIDDEN;
752
753 HRESULT WINAPI DllCanUnloadNow(void) DECLSPEC_HIDDEN;
754
755 /* shouldn't be here, but is nice for type checking */
756 #ifdef __WINESRC__
757 HRESULT WINAPI DllRegisterServer(void) DECLSPEC_HIDDEN;
758 HRESULT WINAPI DllUnregisterServer(void) DECLSPEC_HIDDEN;
759 #endif
760
761
762 /*****************************************************************************
763 * Data Object
764 */
765
766 HRESULT
767 WINAPI
768 CreateDataAdviseHolder(
769 _Outptr_ LPDATAADVISEHOLDER *ppDAHolder);
770
771 HRESULT
772 WINAPI
773 CreateDataCache(
774 _In_opt_ LPUNKNOWN pUnkOuter,
775 _In_ REFCLSID rclsid,
776 _In_ REFIID iid,
777 _Out_ LPVOID *ppv);
778
779 /*****************************************************************************
780 * Moniker API
781 */
782
783 _Check_return_
784 HRESULT
785 WINAPI
786 BindMoniker(
787 _In_ LPMONIKER pmk,
788 _In_ DWORD grfOpt,
789 _In_ REFIID iidResult,
790 _Outptr_ LPVOID *ppvResult);
791
792 _Check_return_
793 HRESULT
794 WINAPI
795 CoGetObject(
796 _In_ LPCWSTR pszName,
797 _In_opt_ BIND_OPTS *pBindOptions,
798 _In_ REFIID riid,
799 _Outptr_ void **ppv);
800
801 _Check_return_ HRESULT WINAPI CreateAntiMoniker(_Outptr_ LPMONIKER *ppmk);
802
803 _Check_return_
804 HRESULT
805 WINAPI
806 CreateBindCtx(
807 _In_ DWORD reserved,
808 _Outptr_ LPBC *ppbc);
809
810 _Check_return_
811 HRESULT
812 WINAPI
813 CreateClassMoniker(
814 _In_ REFCLSID rclsid,
815 _Outptr_ LPMONIKER *ppmk);
816
817 _Check_return_
818 HRESULT
819 WINAPI
820 CreateFileMoniker(
821 _In_ LPCOLESTR lpszPathName,
822 _Outptr_ LPMONIKER *ppmk);
823
824 _Check_return_
825 HRESULT
826 WINAPI
827 CreateGenericComposite(
828 _In_opt_ LPMONIKER pmkFirst,
829 _In_opt_ LPMONIKER pmkRest,
830 _Outptr_ LPMONIKER *ppmkComposite);
831
832 _Check_return_
833 HRESULT
834 WINAPI
835 CreateItemMoniker(
836 _In_ LPCOLESTR lpszDelim,
837 _In_ LPCOLESTR lpszItem,
838 _Outptr_ LPMONIKER *ppmk);
839
840 _Check_return_
841 HRESULT
842 WINAPI
843 CreateObjrefMoniker(
844 _In_opt_ LPUNKNOWN punk,
845 _Outptr_ LPMONIKER *ppmk);
846
847 _Check_return_
848 HRESULT
849 WINAPI
850 CreatePointerMoniker(
851 _In_opt_ LPUNKNOWN punk,
852 _Outptr_ LPMONIKER *ppmk);
853
854 _Check_return_
855 HRESULT
856 WINAPI
857 GetClassFile(
858 _In_ LPCOLESTR filePathName,
859 _Out_ CLSID *pclsid);
860
861 _Check_return_
862 HRESULT
863 WINAPI
864 GetRunningObjectTable(
865 _In_ DWORD reserved,
866 _Outptr_ LPRUNNINGOBJECTTABLE *pprot);
867
868 _Check_return_
869 HRESULT
870 WINAPI
871 MkParseDisplayName(
872 _In_ LPBC pbc,
873 _In_ LPCOLESTR szUserName,
874 _Out_ ULONG *pchEaten,
875 _Outptr_ LPMONIKER *ppmk);
876
877 _Check_return_
878 HRESULT
879 WINAPI
880 MonikerCommonPrefixWith(
881 _In_ IMoniker *pmkThis,
882 _In_ IMoniker *pmkOther,
883 _Outptr_ IMoniker **ppmkCommon);
884
885 _Check_return_
886 HRESULT
887 WINAPI
888 MonikerRelativePathTo(
889 _In_ LPMONIKER pmkSrc,
890 _In_ LPMONIKER pmkDest,
891 _Outptr_ LPMONIKER *ppmkRelPath,
892 _In_ BOOL dwReserved);
893
894 /*****************************************************************************
895 * Storage API
896 */
897 #define STGM_DIRECT 0x00000000
898 #define STGM_TRANSACTED 0x00010000
899 #define STGM_SIMPLE 0x08000000
900 #define STGM_READ 0x00000000
901 #define STGM_WRITE 0x00000001
902 #define STGM_READWRITE 0x00000002
903 #define STGM_SHARE_DENY_NONE 0x00000040
904 #define STGM_SHARE_DENY_READ 0x00000030
905 #define STGM_SHARE_DENY_WRITE 0x00000020
906 #define STGM_SHARE_EXCLUSIVE 0x00000010
907 #define STGM_PRIORITY 0x00040000
908 #define STGM_DELETEONRELEASE 0x04000000
909 #define STGM_CREATE 0x00001000
910 #define STGM_CONVERT 0x00020000
911 #define STGM_FAILIFTHERE 0x00000000
912 #define STGM_NOSCRATCH 0x00100000
913 #define STGM_NOSNAPSHOT 0x00200000
914 #define STGM_DIRECT_SWMR 0x00400000
915
916 #define STGFMT_STORAGE 0
917 #define STGFMT_FILE 3
918 #define STGFMT_ANY 4
919 #define STGFMT_DOCFILE 5
920
921 typedef struct tagSTGOPTIONS
922 {
923 USHORT usVersion;
924 USHORT reserved;
925 ULONG ulSectorSize;
926 const WCHAR* pwcsTemplateFile;
927 } STGOPTIONS;
928
929 _Check_return_
930 HRESULT
931 WINAPI
932 StringFromIID(
933 _In_ REFIID rclsid,
934 _Outptr_ LPOLESTR *lplpsz);
935
936 _Check_return_
937 HRESULT
938 WINAPI
939 StgCreateDocfile(
940 _In_opt_ _Null_terminated_ LPCOLESTR pwcsName,
941 _In_ DWORD grfMode,
942 _Reserved_ DWORD reserved,
943 _Outptr_ IStorage **ppstgOpen);
944
945 _Check_return_
946 HRESULT
947 WINAPI
948 StgCreateStorageEx(
949 _In_opt_ _Null_terminated_ const WCHAR*,
950 _In_ DWORD,
951 _In_ DWORD,
952 _In_ DWORD,
953 _Inout_opt_ STGOPTIONS*,
954 _In_opt_ void*,
955 _In_ REFIID,
956 _Outptr_ void**);
957
958 _Check_return_
959 HRESULT
960 WINAPI
961 StgIsStorageFile(
962 _In_ _Null_terminated_ LPCOLESTR fn);
963
964 _Check_return_
965 HRESULT
966 WINAPI
967 StgIsStorageILockBytes(
968 _In_ ILockBytes *plkbyt);
969
970 _Check_return_
971 HRESULT
972 WINAPI
973 StgOpenStorage(
974 _In_opt_ _Null_terminated_ const OLECHAR *pwcsName,
975 _In_opt_ IStorage *pstgPriority,
976 _In_ DWORD grfMode,
977 _In_opt_z_ SNB snbExclude,
978 _In_ DWORD reserved,
979 _Outptr_ IStorage **ppstgOpen);
980
981 _Check_return_
982 HRESULT
983 WINAPI
984 StgOpenStorageEx(
985 _In_ _Null_terminated_ const WCHAR *pwcwName,
986 _In_ DWORD grfMode,
987 _In_ DWORD stgfmt,
988 _In_ DWORD grfAttrs,
989 _Inout_opt_ STGOPTIONS *pStgOptions,
990 _In_opt_ void *reserved,
991 _In_ REFIID riid,
992 _Outptr_ void **ppObjectOpen);
993
994 _Check_return_
995 HRESULT
996 WINAPI
997 StgCreateDocfileOnILockBytes(
998 _In_ ILockBytes *plkbyt,
999 _In_ DWORD grfMode,
1000 _In_ DWORD reserved,
1001 _Outptr_ IStorage **ppstgOpen);
1002
1003 _Check_return_
1004 HRESULT
1005 WINAPI
1006 StgOpenStorageOnILockBytes(
1007 _In_ ILockBytes *plkbyt,
1008 _In_opt_ IStorage *pstgPriority,
1009 _In_ DWORD grfMode,
1010 _In_opt_z_ SNB snbExclude,
1011 _Reserved_ DWORD reserved,
1012 _Outptr_ IStorage **ppstgOpen);
1013
1014 _Check_return_
1015 HRESULT
1016 WINAPI
1017 StgSetTimes(
1018 _In_ _Null_terminated_ OLECHAR const *lpszName,
1019 _In_opt_ FILETIME const *pctime,
1020 _In_opt_ FILETIME const *patime,
1021 _In_opt_ FILETIME const *pmtime);
1022
1023 #ifdef __cplusplus
1024 }
1025 #endif
1026
1027 #ifndef __WINESRC__
1028 # include <urlmon.h>
1029 #endif
1030 #include <propidl.h>
1031
1032 #ifndef __WINESRC__
1033
1034 #define FARSTRUCT
1035 #define HUGEP
1036
1037 #define WINOLEAPI STDAPI
1038 #define WINOLEAPI_(type) STDAPI_(type)
1039
1040 #endif /* __WINESRC__ */
1041
1042 #endif /* _OBJBASE_H_ */