blob: e5171e3ae6bda16fa16eff3c73035402ca2f3be9 [file] [log] [blame]
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00001/*
Ove Kaaven2a8bd722002-12-23 01:41:51 +00002 * Copyright (C) 1998-1999 François Gouget
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00003 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000019#include <rpc.h>
20#include <rpcndr.h>
François Gougetd604eb11998-12-18 16:00:03 +000021
Alexandre Julliarddc818a52002-12-05 22:11:43 +000022#ifndef _OBJBASE_H_
Paul Quinnaaa83061999-06-05 15:23:20 +000023#define _OBJBASE_H_
François Gougetd604eb11998-12-18 16:00:03 +000024
Ove Kaaven2a8bd722002-12-23 01:41:51 +000025/*****************************************************************************
Alexandre Julliard55379112003-04-10 21:13:58 +000026 * 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
Alexandre Julliard5d0160e2004-10-05 04:38:15 +000054 * 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;
Alexandre Julliard55379112003-04-10 21:13:58 +000066 * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
Alexandre Julliard5d0160e2004-10-05 04:38:15 +000067 * };
Alexandre Julliard55379112003-04-10 21:13:58 +000068 * #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'.
Alexandre Julliard5d0160e2004-10-05 04:38:15 +000090 * - 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.
Alexandre Julliard55379112003-04-10 21:13:58 +000096 * - 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 prefered 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 (*QueryInterface)(IDirect3D* me);
117 * ULONG (*QueryInterface)(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.
Alexandre Julliard616940e2004-08-12 03:33:30 +0000144 * - The code generated by DECLARE_INTERFACE defines both the structure representing the interface and
Alexandre Julliard5d0160e2004-10-05 04:38:15 +0000145 * the structure for the jump table.
Alexandre Julliard55379112003-04-10 21:13:58 +0000146 * - 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 * Implementing a COM interface.
174 *
175 * This continues the above example. This example assumes that the implementation is in C.
176 *
Alexandre Julliard241a4c32004-09-09 21:03:58 +0000177 * typedef struct IDirect3DImpl {
Alexandre Julliard55379112003-04-10 21:13:58 +0000178 * void* lpVtbl;
179 * // ...
180 *
Alexandre Julliard241a4c32004-09-09 21:03:58 +0000181 * } IDirect3DImpl;
Alexandre Julliard55379112003-04-10 21:13:58 +0000182 *
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000183 * static IDirect3DVtbl d3dvt;
Alexandre Julliard55379112003-04-10 21:13:58 +0000184 *
185 * // implement the IDirect3D methods here
186 *
187 * int IDirect3D_QueryInterface(IDirect3D* me)
188 * {
Alexandre Julliard241a4c32004-09-09 21:03:58 +0000189 * IDirect3DImpl *This = (IDirect3DImpl *)me;
Alexandre Julliard55379112003-04-10 21:13:58 +0000190 * // ...
191 * }
192 *
193 * // ...
194 *
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000195 * static IDirect3DVtbl d3dvt = {
Alexandre Julliard55379112003-04-10 21:13:58 +0000196 * IDirect3D_QueryInterface,
197 * IDirect3D_Add,
198 * IDirect3D_Add2,
199 * IDirect3D_Initialize,
200 * IDirect3D_SetWidth
201 * };
202 *
203 * Comments:
Alexandre Julliard241a4c32004-09-09 21:03:58 +0000204 * - We first define what the interface really contains. This is the IDirect3DImpl structure. The
Alexandre Julliard55379112003-04-10 21:13:58 +0000205 * first field must of course be the virtual table pointer. Everything else is free.
206 * - Then we predeclare our static virtual table variable, we will need its address in some
207 * methods to initialize the virtual table pointer of the returned interface objects.
208 * - Then we implement the interface methods. To match what has been declared in the header file
Alexandre Julliard241a4c32004-09-09 21:03:58 +0000209 * they must take a pointer to a IDirect3D structure and we must cast it to an IDirect3DImpl so
210 * that we can manipulate the fields.
Alexandre Julliard55379112003-04-10 21:13:58 +0000211 * - Finally we initialize the virtual table.
212 */
213
214#if defined(__cplusplus) && !defined(CINTERFACE)
215
216/* C++ interface */
217
218#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
219#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
220#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
221#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
222
223#define PURE = 0
224#define THIS_
225#define THIS void
226
227#define interface struct
228#define DECLARE_INTERFACE(iface) interface iface
229#define DECLARE_INTERFACE_(iface,ibase) interface iface : public ibase
230
231#define BEGIN_INTERFACE
232#define END_INTERFACE
233
Alexandre Julliard55379112003-04-10 21:13:58 +0000234#else /* __cplusplus && !CINTERFACE */
235
236/* C interface */
237
Alexandre Julliard55379112003-04-10 21:13:58 +0000238#define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
239#define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
240#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
241#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
242
243#define PURE
244#define THIS_ INTERFACE *This,
245#define THIS INTERFACE *This
246
247#define interface struct
248
249#ifdef CONST_VTABLE
250#undef CONST_VTBL
251#define CONST_VTBL const
252#define DECLARE_INTERFACE(iface) \
253 /*typedef*/ interface iface { const struct iface##Vtbl *lpVtbl; } /*iface*/; \
254 typedef const struct iface##Vtbl iface##Vtbl; \
255 const struct iface##Vtbl
256#else
257#undef CONST_VTBL
258#define CONST_VTBL
259#define DECLARE_INTERFACE(iface) \
260 /*typedef*/ interface iface { struct iface##Vtbl *lpVtbl; } /*iface*/; \
261 typedef struct iface##Vtbl iface##Vtbl; \
262 struct iface##Vtbl
263#endif
264#define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
265
Alexandre Julliard20486e12004-08-23 18:10:02 +0000266#define BEGIN_INTERFACE
Alexandre Julliard55379112003-04-10 21:13:58 +0000267#define END_INTERFACE
268
Alexandre Julliardaae3cb62003-04-11 00:31:02 +0000269#endif /* __cplusplus && !CINTERFACE */
270
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +0000271#include <objidl.h>
Paul Quinnea1640f1999-03-10 18:03:53 +0000272
Francois Gougetf2973ca2000-09-22 22:17:49 +0000273#ifndef RC_INVOKED
274/* For compatibility only, at least for now */
275#include <stdlib.h>
276#endif
277
Peter Hunnisett3d7cd872001-04-12 21:10:54 +0000278#ifndef INITGUID
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +0000279#include <cguid.h>
Peter Hunnisett3d7cd872001-04-12 21:10:54 +0000280#endif
François Gouget504973d2001-01-02 20:55:40 +0000281
Francois Gouget00628922000-10-19 20:32:18 +0000282#ifdef __cplusplus
283extern "C" {
284#endif
285
Ove Kaaven41dfa052002-12-06 19:49:56 +0000286#ifndef NONAMELESSSTRUCT
287#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
288#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
289#else
Ge van Geldorp399901e2004-01-23 01:51:33 +0000290#define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
291#define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
Ove Kaaven41dfa052002-12-06 19:49:56 +0000292#endif
293
294/*****************************************************************************
295 * Standard API
296 */
Ove Kaaven99c85262002-12-18 20:49:16 +0000297DWORD WINAPI CoBuildVersion(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000298
299typedef enum tagCOINIT
300{
301 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
302 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
303 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
304 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
305} COINIT;
306
Ove Kaaven99c85262002-12-18 20:49:16 +0000307HRESULT WINAPI CoInitialize(LPVOID lpReserved);
308HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
309void WINAPI CoUninitialize(void);
310DWORD WINAPI CoGetCurrentProcess(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000311
Ove Kaaven99c85262002-12-18 20:49:16 +0000312HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
313void WINAPI CoFreeAllLibraries(void);
314void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
315void WINAPI CoFreeUnusedLibraries(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000316
Ove Kaaven99c85262002-12-18 20:49:16 +0000317HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
318HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
319 LPUNKNOWN pUnkOuter,
320 DWORD dwClsContext,
321 COSERVERINFO* pServerInfo,
322 ULONG cmq,
323 MULTI_QI* pResults);
324
325HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults);
326HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
327
328HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
329LPVOID WINAPI CoTaskMemAlloc(ULONG size);
330void WINAPI CoTaskMemFree(LPVOID ptr);
331LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
332
333HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
334HRESULT WINAPI CoRevokeMallocSpy(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000335
336/* class registration flags; passed to CoRegisterClassObject */
337typedef enum tagREGCLS
338{
339 REGCLS_SINGLEUSE = 0,
340 REGCLS_MULTIPLEUSE = 1,
341 REGCLS_MULTI_SEPARATE = 2,
342 REGCLS_SUSPENDED = 4
343} REGCLS;
344
Ove Kaaven99c85262002-12-18 20:49:16 +0000345HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000346HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000347HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000348HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
Ove Kaaven99c85262002-12-18 20:49:16 +0000349HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
350HRESULT WINAPI CoSuspendClassObjects(void);
351HRESULT WINAPI CoResumeClassObjects(void);
352ULONG WINAPI CoAddRefServerProcess(void);
353HRESULT WINAPI CoReleaseServerProcess(void);
354
355/* marshalling */
356HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
357HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
358HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
359HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
360HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
361HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
362HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
363HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
Dave Belanger46f0d602003-08-28 19:42:24 +0000364HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
Ove Kaaven99c85262002-12-18 20:49:16 +0000365HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
366HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
367HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
368BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
369
370/* security */
371HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
372HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
373HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
374
375HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites);
376HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
377HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
378
379HRESULT WINAPI CoImpersonateClient(void);
Alexandre Julliardd07c1002004-01-23 22:51:41 +0000380HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
Ove Kaaven99c85262002-12-18 20:49:16 +0000381HRESULT WINAPI CoRevertToSelf(void);
382
383/* misc */
384HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
385HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
386
387HRESULT WINAPI CoCreateGuid(GUID* pguid);
388BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
389
390BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
391BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
392HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
Dave Belanger46f0d602003-08-28 19:42:24 +0000393HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000394
395/*****************************************************************************
Ove Kaaven99c85262002-12-18 20:49:16 +0000396 * GUID API
Ove Kaaven41dfa052002-12-06 19:49:56 +0000397 */
Ove Kaaven41dfa052002-12-06 19:49:56 +0000398HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
Ge van Geldorp100e1132004-01-23 20:57:26 +0000399HRESULT WINAPI CLSIDFromString(LPOLESTR, CLSID *);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000400HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000401HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
402
403INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
404
405/*****************************************************************************
406 * COM Server dll - exports
407 */
408HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
409HRESULT WINAPI DllCanUnloadNow(void);
410
411/*****************************************************************************
Ove Kaaven99c85262002-12-18 20:49:16 +0000412 * Data Object
413 */
414HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
415HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
416
417/*****************************************************************************
Ove Kaaven41dfa052002-12-06 19:49:56 +0000418 * Moniker API
419 */
François Gouget9a8c2e22000-12-15 21:29:41 +0000420HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
Noomen Hamzaed494ec1999-03-23 13:48:56 +0000421
Ove Kaaven99c85262002-12-18 20:49:16 +0000422HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
423
Ove Kaaven99c85262002-12-18 20:49:16 +0000424HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
425
Ove Kaaven99c85262002-12-18 20:49:16 +0000426HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
427
428HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
429
430HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
431
432HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
433
434HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
435
436HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk);
437
438HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
439
440HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
Ove Kaaven99c85262002-12-18 20:49:16 +0000441
442/*****************************************************************************
443 * Storage API
444 */
445#define STGM_DIRECT 0x00000000
446#define STGM_TRANSACTED 0x00010000
447#define STGM_SIMPLE 0x08000000
448#define STGM_READ 0x00000000
449#define STGM_WRITE 0x00000001
450#define STGM_READWRITE 0x00000002
451#define STGM_SHARE_DENY_NONE 0x00000040
452#define STGM_SHARE_DENY_READ 0x00000030
453#define STGM_SHARE_DENY_WRITE 0x00000020
454#define STGM_SHARE_EXCLUSIVE 0x00000010
455#define STGM_PRIORITY 0x00040000
456#define STGM_DELETEONRELEASE 0x04000000
457#define STGM_CREATE 0x00001000
458#define STGM_CONVERT 0x00020000
459#define STGM_FAILIFTHERE 0x00000000
460#define STGM_NOSCRATCH 0x00100000
461#define STGM_NOSNAPSHOT 0x00200000
462
Francois Gouget7a58c6e2004-04-30 18:32:20 +0000463typedef struct tagSTGOPTIONS
464{
465 USHORT usVersion;
466 USHORT reserved;
467 ULONG ulSectorSize;
468 const WCHAR* pwcsTemplateFile;
469} STGOPTIONS;
470
Ove Kaaven99c85262002-12-18 20:49:16 +0000471HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
Francois Gouget7a58c6e2004-04-30 18:32:20 +0000472HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**);
Ove Kaaven99c85262002-12-18 20:49:16 +0000473HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
474HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
Ove Kaaven99c85262002-12-18 20:49:16 +0000475HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
476
477HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid);
478HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid);
479
480HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
481HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
482
Francois Gouget00628922000-10-19 20:32:18 +0000483#ifdef __cplusplus
484}
485#endif
486
Francois Gouget83755cc2004-09-09 19:23:19 +0000487/* FIXME: #include <urlmon.h> */
488#include <propidl.h>
Ove Kaaven2a8bd722002-12-23 01:41:51 +0000489
Dimitrie O. Paun8b366812003-01-04 00:52:18 +0000490#ifndef __WINESRC__
Alexandre Julliardf00c46f2003-04-10 00:19:24 +0000491
Paul Quinnaaa83061999-06-05 15:23:20 +0000492#define FARSTRUCT
493#define HUGEP
494
Paul Quinnea1640f1999-03-10 18:03:53 +0000495#define WINOLEAPI STDAPI
496#define WINOLEAPI_(type) STDAPI_(type)
497
Dimitrie O. Paun8b366812003-01-04 00:52:18 +0000498#endif /* __WINESRC__ */
François Gougetd604eb11998-12-18 16:00:03 +0000499
Alexandre Julliarddc818a52002-12-05 22:11:43 +0000500#endif /* _OBJBASE_H_ */