ntdll/tests: Adjust test_extended_context() for Win11 results.
[wine.git] / include / objbase.h
blob15851a13550a1e1389c210f36712df1fcc5dd0bd
1 /*
2 * Copyright (C) 1998-1999 Francois Gouget
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.
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.
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
19 #include <rpc.h>
20 #include <rpcndr.h>
22 #ifndef _OBJBASE_H_
23 #define _OBJBASE_H_
25 /*****************************************************************************
26 * Macros to define a COM interface
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.
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.
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.
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.
51 * Let's take Direct3D as an example:
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
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
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.
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 * };
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
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 dereference 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.
156 * And in C++ (with gcc's g++):
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 * };
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.
173 #undef STDMETHOD
174 #undef STDMETHOD_
175 #undef PURE
176 #undef THIS_
177 #undef THIS
178 #undef DECLARE_INTERFACE
179 #undef DECLARE_INTERFACE_
181 #ifndef WINOLE32API
182 #ifdef _OLE32_
183 #define WINOLE32API
184 #else
185 #define WINOLE32API DECLSPEC_IMPORT
186 #endif
187 #endif
189 #if defined(__cplusplus) && !defined(CINTERFACE)
191 #ifdef COM_STDMETHOD_CAN_THROW
192 # define COM_DECLSPEC_NOTHROW
193 #else
194 # define COM_DECLSPEC_NOTHROW DECLSPEC_NOTHROW
195 #endif
197 /* C++ interface */
199 #define STDMETHOD(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method
200 #define STDMETHOD_(type,method) virtual COM_DECLSPEC_NOTHROW type STDMETHODCALLTYPE method
201 #define STDMETHODV(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODVCALLTYPE method
202 #define STDMETHODV_(type,method) virtual COM_DECLSPEC_NOTHROW type STDMETHODVCALLTYPE method
204 #define PURE = 0
205 #define THIS_
206 #define THIS void
208 #define interface struct
209 #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
210 #define DECLARE_INTERFACE_(iface,ibase) interface DECLSPEC_NOVTABLE iface : public ibase
211 #define DECLARE_INTERFACE_IID_(iface, ibase, iid) interface DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE iface : public ibase
213 #define BEGIN_INTERFACE
214 #define END_INTERFACE
216 #else /* __cplusplus && !CINTERFACE */
218 /* C interface */
220 #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
221 #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
222 #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
223 #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
225 #define PURE
226 #define THIS_ INTERFACE *This,
227 #define THIS INTERFACE *This
229 #define interface struct
231 #ifdef __WINESRC__
232 #define CONST_VTABLE
233 #endif
235 #ifdef CONST_VTABLE
236 #undef CONST_VTBL
237 #define CONST_VTBL const
238 #define DECLARE_INTERFACE(iface) \
239 typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; \
240 typedef struct iface##Vtbl iface##Vtbl; \
241 struct iface##Vtbl
242 #else
243 #undef CONST_VTBL
244 #define CONST_VTBL
245 #define DECLARE_INTERFACE(iface) \
246 typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; \
247 typedef struct iface##Vtbl iface##Vtbl; \
248 struct iface##Vtbl
249 #endif
250 #define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
251 #define DECLARE_INTERFACE_IID_(iface, ibase, iid) DECLARE_INTERFACE_(iface, ibase)
253 #define BEGIN_INTERFACE
254 #define END_INTERFACE
256 #endif /* __cplusplus && !CINTERFACE */
258 #ifndef __IRpcStubBuffer_FWD_DEFINED__
259 #define __IRpcStubBuffer_FWD_DEFINED__
260 typedef interface IRpcStubBuffer IRpcStubBuffer;
261 #endif
262 #ifndef __IRpcChannelBuffer_FWD_DEFINED__
263 #define __IRpcChannelBuffer_FWD_DEFINED__
264 typedef interface IRpcChannelBuffer IRpcChannelBuffer;
265 #endif
267 #include <combaseapi.h>
268 #include <wtypes.h>
269 #include <unknwn.h>
270 #include <objidl.h>
272 #ifdef __cplusplus
273 extern "C" {
274 #endif
276 #ifndef NONAMELESSSTRUCT
277 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
278 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
279 #else
280 #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
281 #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
282 #endif
284 /*****************************************************************************
285 * Standard API
287 WINOLE32API DWORD WINAPI CoBuildVersion(void);
289 typedef enum tagCOINIT
291 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
292 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
293 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
294 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
295 } COINIT;
297 DECLARE_HANDLE(CO_MTA_USAGE_COOKIE);
299 WINOLE32API HRESULT WINAPI CoInitialize(LPVOID lpReserved);
300 WINOLE32API HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
301 WINOLE32API void WINAPI CoUninitialize(void);
302 WINOLE32API DWORD WINAPI CoGetCurrentProcess(void);
303 WINOLE32API HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id);
304 WINOLE32API HRESULT WINAPI CoGetApartmentType(APTTYPE *type, APTTYPEQUALIFIER *qualifier);
305 WINOLE32API HRESULT WINAPI CoIncrementMTAUsage(CO_MTA_USAGE_COOKIE *cookie);
306 WINOLE32API HRESULT WINAPI CoDecrementMTAUsage(CO_MTA_USAGE_COOKIE cookie);
308 WINOLE32API HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
309 WINOLE32API void WINAPI CoFreeAllLibraries(void);
310 WINOLE32API void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
311 WINOLE32API void WINAPI CoFreeUnusedLibraries(void);
312 WINOLE32API void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved);
314 WINOLE32API HRESULT WINAPI CoCreateInstance(REFCLSID,LPUNKNOWN,DWORD,REFIID,LPVOID*);
315 WINOLE32API HRESULT WINAPI CoCreateInstanceEx(REFCLSID,LPUNKNOWN,DWORD,COSERVERINFO*,ULONG,MULTI_QI*);
316 WINOLE32API HRESULT WINAPI CoCreateInstanceFromApp(REFCLSID,IUnknown*,DWORD,void*,DWORD,MULTI_QI*);
317 WINOLE32API HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO*, CLSID*,IUnknown*,DWORD,DWORD,OLECHAR*,DWORD,MULTI_QI*);
318 WINOLE32API HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO*,CLSID*,IUnknown*,DWORD,IStorage*,DWORD,MULTI_QI*);
320 WINOLE32API HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
321 WINOLE32API void WINAPI CoTaskMemFree(LPVOID ptr);
322 WINOLE32API LPVOID WINAPI CoTaskMemAlloc(SIZE_T size) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(CoTaskMemFree) __WINE_MALLOC;
323 WINOLE32API LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(CoTaskMemFree);
325 WINOLE32API HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
326 WINOLE32API HRESULT WINAPI CoRevokeMallocSpy(void);
328 WINOLE32API HRESULT WINAPI CoGetContextToken( ULONG_PTR *token );
330 /* class registration flags; passed to CoRegisterClassObject */
331 typedef enum tagREGCLS
333 REGCLS_SINGLEUSE = 0,
334 REGCLS_MULTIPLEUSE = 1,
335 REGCLS_MULTI_SEPARATE = 2,
336 REGCLS_SUSPENDED = 4,
337 REGCLS_SURROGATE = 8
338 } REGCLS;
340 WINOLE32API HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
341 WINOLE32API HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
342 WINOLE32API HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
343 WINOLE32API HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
344 WINOLE32API HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
345 WINOLE32API HRESULT WINAPI CoRegisterSurrogate(LPSURROGATE pSurrogate);
346 WINOLE32API HRESULT WINAPI CoSuspendClassObjects(void);
347 WINOLE32API HRESULT WINAPI CoResumeClassObjects(void);
348 WINOLE32API ULONG WINAPI CoAddRefServerProcess(void);
349 WINOLE32API ULONG WINAPI CoReleaseServerProcess(void);
351 /* marshalling */
352 WINOLE32API HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
353 WINOLE32API HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
354 WINOLE32API HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
355 WINOLE32API HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
356 WINOLE32API HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
357 WINOLE32API HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
358 WINOLE32API HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
359 WINOLE32API HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
360 WINOLE32API HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
361 WINOLE32API HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
362 WINOLE32API HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
363 WINOLE32API HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
364 WINOLE32API BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
365 WINOLE32API HRESULT WINAPI CoDisableCallCancellation(void *reserved);
366 WINOLE32API HRESULT WINAPI CoEnableCallCancellation(void *reserved);
368 /* security */
369 WINOLE32API HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
370 WINOLE32API HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
371 WINOLE32API HRESULT WINAPI CoSwitchCallContext(IUnknown *pContext, IUnknown **ppOldContext);
372 WINOLE32API HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
374 WINOLE32API HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilities);
375 WINOLE32API HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
376 WINOLE32API HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
378 WINOLE32API HRESULT WINAPI CoImpersonateClient(void);
379 WINOLE32API HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
380 WINOLE32API HRESULT WINAPI CoRevertToSelf(void);
382 /* misc */
383 WINOLE32API HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
384 WINOLE32API HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
385 WINOLE32API HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, LPVOID lpvReserved);
386 WINOLE32API HRESULT WINAPI CoGetObjectContext(REFIID riid, LPVOID *ppv);
387 WINOLE32API HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie);
388 WINOLE32API HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie);
390 WINOLE32API HRESULT WINAPI CoCreateGuid(GUID* pguid);
391 WINOLE32API BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
393 WINOLE32API BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
394 WINOLE32API BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
395 WINOLE32API HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
396 WINOLE32API HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
397 WINOLE32API HRESULT WINAPI CoRegisterChannelHook(REFGUID ExtensionGuid, IChannelHook *pChannelHook);
399 typedef enum tagCOWAIT_FLAGS
401 COWAIT_DEFAULT = 0x00000000,
402 COWAIT_WAITALL = 0x00000001,
403 COWAIT_ALERTABLE = 0x00000002,
404 COWAIT_INPUTAVAILABLE = 0x00000004
405 } COWAIT_FLAGS;
407 WINOLE32API HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags,DWORD dwTimeout,ULONG cHandles,LPHANDLE pHandles,LPDWORD lpdwindex);
409 /*****************************************************************************
410 * GUID API
412 WINOLE32API HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
413 WINOLE32API HRESULT WINAPI CLSIDFromString(LPCOLESTR, LPCLSID);
414 WINOLE32API HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
415 WINOLE32API HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
416 WINOLE32API INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
417 WINOLE32API HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid);
418 WINOLE32API HRESULT WINAPI StringFromIID(REFIID riid, LPOLESTR*);
420 /*****************************************************************************
421 * COM Server dll - exports
423 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
424 HRESULT WINAPI DllCanUnloadNow(void) DECLSPEC_HIDDEN;
426 /*****************************************************************************
427 * Data Object
429 WINOLE32API HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
430 WINOLE32API HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
432 /*****************************************************************************
433 * Moniker API
435 WINOLE32API HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
436 WINOLE32API HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv);
437 WINOLE32API HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
438 WINOLE32API HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
439 WINOLE32API HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
440 WINOLE32API HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
441 WINOLE32API HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
442 WINOLE32API HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
443 WINOLE32API HRESULT WINAPI CreateObjrefMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
444 WINOLE32API HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
445 WINOLE32API HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
446 WINOLE32API HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
447 WINOLE32API HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName, ULONG * pchEaten, LPMONIKER * ppmk);
448 WINOLE32API HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
449 WINOLE32API HRESULT WINAPI MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER * ppmkRelPath, BOOL dwReserved);
451 /*****************************************************************************
452 * Storage API
454 #define STGM_DIRECT 0x00000000
455 #define STGM_TRANSACTED 0x00010000
456 #define STGM_SIMPLE 0x08000000
457 #define STGM_READ 0x00000000
458 #define STGM_WRITE 0x00000001
459 #define STGM_READWRITE 0x00000002
460 #define STGM_SHARE_DENY_NONE 0x00000040
461 #define STGM_SHARE_DENY_READ 0x00000030
462 #define STGM_SHARE_DENY_WRITE 0x00000020
463 #define STGM_SHARE_EXCLUSIVE 0x00000010
464 #define STGM_PRIORITY 0x00040000
465 #define STGM_DELETEONRELEASE 0x04000000
466 #define STGM_CREATE 0x00001000
467 #define STGM_CONVERT 0x00020000
468 #define STGM_FAILIFTHERE 0x00000000
469 #define STGM_NOSCRATCH 0x00100000
470 #define STGM_NOSNAPSHOT 0x00200000
471 #define STGM_DIRECT_SWMR 0x00400000
473 #define STGFMT_STORAGE 0
474 #define STGFMT_FILE 3
475 #define STGFMT_ANY 4
476 #define STGFMT_DOCFILE 5
478 typedef struct tagSTGOPTIONS
480 USHORT usVersion;
481 USHORT reserved;
482 ULONG ulSectorSize;
483 const WCHAR* pwcsTemplateFile;
484 } STGOPTIONS;
486 WINOLE32API HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
487 WINOLE32API HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**);
488 WINOLE32API HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
489 WINOLE32API HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
490 WINOLE32API HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
491 WINOLE32API HRESULT WINAPI StgOpenStorageEx(const WCHAR* pwcwName,DWORD grfMode,DWORD stgfmt,DWORD grfAttrs,STGOPTIONS *pStgOptions, void *reserved, REFIID riid, void **ppObjectOpen);
493 WINOLE32API HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
494 WINOLE32API HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
495 WINOLE32API HRESULT WINAPI StgSetTimes( OLECHAR const *lpszName, FILETIME const *pctime, FILETIME const *patime, FILETIME const *pmtime);
497 #ifdef __cplusplus
499 #endif
501 #ifndef __WINESRC__
502 # include <urlmon.h>
503 #endif
504 #include <propidl.h>
506 #ifndef __WINESRC__
508 #define FARSTRUCT
509 #define HUGEP
511 #define WINOLEAPI STDAPI
512 #define WINOLEAPI_(type) STDAPI_(type)
514 #endif /* __WINESRC__ */
516 #endif /* _OBJBASE_H_ */