blob: ef6575f6a28d8b9e091fe6f6b51e483a149a59ef [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
Alexandre Julliarddc818a52002-12-05 22:11:43 +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/*****************************************************************************
26 * define ICOM_MSVTABLE_COMPAT
27 * to implement the microsoft com vtable compatibility workaround for g++.
28 *
29 * NOTE: Turning this option on will produce a winelib that is incompatible
30 * with the binary emulator.
31 *
32 * If the compiler supports the com_interface attribute, leave this off, and
33 * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also
34 * require the addition of the -vtable-thunks option for g++.
35 *
36 * If you aren't interested in Winelib C++ compatibility at all, leave both
37 * options off.
38 *
39 * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro
40 * would be to define it only for your Winelib application. This allows you
41 * to have both binary and Winelib compatibility for C and C++ at the same
42 * time :)
43 */
44/* #define ICOM_MSVTABLE_COMPAT 1 */
45/* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
46
Alexandre Julliard55379112003-04-10 21:13:58 +000047
48/*****************************************************************************
49 * Macros to define a COM interface
50 */
51/*
52 * The goal of the following set of definitions is to provide a way to use the same
53 * header file definitions to provide both a C interface and a C++ object oriented
54 * interface to COM interfaces. The type of interface is selected automatically
55 * depending on the language but it is always possible to get the C interface in C++
56 * by defining CINTERFACE.
57 *
58 * It is based on the following assumptions:
59 * - all COM interfaces derive from IUnknown, this should not be a problem.
60 * - the header file only defines the interface, the actual fields are defined
61 * separately in the C file implementing the interface.
62 *
63 * The natural approach to this problem would be to make sure we get a C++ class and
64 * virtual methods in C++ and a structure with a table of pointer to functions in C.
65 * Unfortunately the layout of the virtual table is compiler specific, the layout of
66 * g++ virtual tables is not the same as that of an egcs virtual table which is not the
67 * same as that generated by Visual C+. There are workarounds to make the virtual tables
68 * compatible via padding but unfortunately the one which is imposed to the WINE emulator
69 * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
70 *
71 * So the solution I finally adopted does not use virtual tables. Instead I use inline
72 * non virtual methods that dereference the method pointer themselves and perform the call.
73 *
74 * Let's take Direct3D as an example:
75 *
76 * #define INTERFACE IDirect3D
77 * #define IDirect3D_METHODS \
Alexandre Julliardaae3cb62003-04-11 00:31:02 +000078 * IUnknown_METHODS \
Alexandre Julliard55379112003-04-10 21:13:58 +000079 * STDMETHOD(Initialize)(THIS_ REFIID) PURE; \
80 * STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE; \
81 * STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, IUnknown*) PURE; \
82 * STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL*, IUnknown*) PURE; \
83 * STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT*, IUnknown*) PURE; \
84 * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
Alexandre Julliard55379112003-04-10 21:13:58 +000085 * ICOM_DEFINE(IDirect3D,IUnknown)
86 * #undef INTERFACE
87 *
88 * #ifdef COBJMACROS
89 * // *** IUnknown methods *** //
90 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
91 * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
92 * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
93 * // *** IDirect3D methods *** //
94 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
95 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
96 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
97 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
98 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
99 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
100 * #endif
101 *
102 * Comments:
103 * - The INTERFACE macro is used in the STDMETHOD macros to define the type of the 'this'
104 * pointer. Defining this macro here saves us the trouble of having to repeat the interface
105 * name everywhere. Note however that because of the way macros work, a macro like STDMETHOD
106 * cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not
107 * 'IDirect3D_VTABLE'.
Alexandre Julliardaae3cb62003-04-11 00:31:02 +0000108 * - ICOM_METHODS defines the list of methods that are inheritable from this interface. It must
Alexandre Julliard55379112003-04-10 21:13:58 +0000109 * be written manually (rather than using a macro to generate the equivalent code) to avoid
Alexandre Julliardaae3cb62003-04-11 00:31:02 +0000110 * macro recursion (which compilers don't like). It must start with the METHODS definition
111 * of the parent interface so that method inheritance works properly.
Alexandre Julliard55379112003-04-10 21:13:58 +0000112 * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
113 * explicitly use the interface name for macro expansion reasons again.
Alexandre Julliard55379112003-04-10 21:13:58 +0000114 * - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros
115 * will not work.
116 * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
117 * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
118 * the inherited method definitions there. This time I could have used a trick to use only one
119 * macro whatever the number of parameters but I prefered to have it work the same way as above.
120 * - You probably have noticed that we don't define the fields we need to actually implement this
121 * interface: reference count, pointer to other resources and miscellaneous fields. That's
122 * because these interfaces are just that: interfaces. They may be implemented more than once, in
123 * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
124 * that the interface contains some specific fields.
125 *
126 *
127 * In C this gives:
128 * typedef struct IDirect3DVtbl IDirect3DVtbl;
129 * struct IDirect3D {
130 * IDirect3DVtbl* lpVtbl;
131 * };
132 * struct IDirect3DVtbl {
133 * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
134 * ULONG (*QueryInterface)(IDirect3D* me);
135 * ULONG (*QueryInterface)(IDirect3D* me);
136 * HRESULT (*Initialize)(IDirect3D* me, REFIID a);
137 * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
138 * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
139 * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
140 * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
141 * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
142 * };
143 *
144 * #ifdef COBJMACROS
145 * // *** IUnknown methods *** //
146 * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
147 * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
148 * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
149 * // *** IDirect3D methods *** //
150 * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
151 * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
152 * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
153 * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
154 * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
155 * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
156 * #endif
157 *
158 * Comments:
159 * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
160 * the user needs to know to use the interface. Of course the structure we will define to
161 * implement this interface will have more fields but the first one will match this pointer.
162 * - The code generated by ICOM_DEFINE defines both the structure representing the interface and
Alexandre Julliardaae3cb62003-04-11 00:31:02 +0000163 * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_METHODS macro to
Alexandre Julliard55379112003-04-10 21:13:58 +0000164 * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
165 * to define the IDirect3D methods.
166 * - Each method is declared as a pointer to function field in the jump table. The implementation
167 * will fill this jump table with appropriate values, probably using a static variable, and
168 * initialize the lpVtbl field to point to this variable.
169 * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
170 * corresponding to the macro name. This emulates the behavior of a virtual table and should be
171 * just as fast.
172 * - This C code should be quite compatible with the Windows headers both for code that uses COM
173 * interfaces and for code implementing a COM interface.
174 *
175 *
176 * And in C++ (with gcc's g++):
177 *
178 * typedef struct IDirect3D: public IUnknown {
179 * virtual HRESULT Initialize(REFIID a) = 0;
180 * virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) = 0;
181 * virtual HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) = 0;
182 * virtual HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) = 0;
183 * virtual HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) = 0;
184 * virtual HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) = 0;
185 * };
186 *
187 * Comments:
188 * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
189 * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
190 * macro is defined in which case we would not be here.
191 *
192 *
193 * Implementing a COM interface.
194 *
195 * This continues the above example. This example assumes that the implementation is in C.
196 *
197 * typedef struct _IDirect3D {
198 * void* lpVtbl;
199 * // ...
200 *
201 * } _IDirect3D;
202 *
203 * static ICOM_VTABLE(IDirect3D) d3dvt;
204 *
205 * // implement the IDirect3D methods here
206 *
207 * int IDirect3D_QueryInterface(IDirect3D* me)
208 * {
209 * ICOM_THIS(IDirect3D,me);
210 * // ...
211 * }
212 *
213 * // ...
214 *
215 * static ICOM_VTABLE(IDirect3D) d3dvt = {
216 * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
217 * IDirect3D_QueryInterface,
218 * IDirect3D_Add,
219 * IDirect3D_Add2,
220 * IDirect3D_Initialize,
221 * IDirect3D_SetWidth
222 * };
223 *
224 * Comments:
225 * - We first define what the interface really contains. This is th e_IDirect3D structure. The
226 * first field must of course be the virtual table pointer. Everything else is free.
227 * - Then we predeclare our static virtual table variable, we will need its address in some
228 * methods to initialize the virtual table pointer of the returned interface objects.
229 * - Then we implement the interface methods. To match what has been declared in the header file
230 * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that
231 * we can manipulate the fields. This is performed by the ICOM_THIS macro.
232 * - Finally we initialize the virtual table.
233 */
234
235#if defined(__cplusplus) && !defined(CINTERFACE)
236
237/* C++ interface */
238
239#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
240#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
241#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
242#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
243
244#define PURE = 0
245#define THIS_
246#define THIS void
247
248#define interface struct
Alexandre Julliard2d5519f2003-04-12 00:09:14 +0000249#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
250#define DECLARE_INTERFACE(iface) interface __attribute__((com_interface)) iface
251#else
Alexandre Julliard55379112003-04-10 21:13:58 +0000252#define DECLARE_INTERFACE(iface) interface iface
Alexandre Julliard2d5519f2003-04-12 00:09:14 +0000253#endif
Alexandre Julliard55379112003-04-10 21:13:58 +0000254#define DECLARE_INTERFACE_(iface,ibase) interface iface : public ibase
255
256#define BEGIN_INTERFACE
257#define END_INTERFACE
258
Alexandre Julliard55379112003-04-10 21:13:58 +0000259#else /* __cplusplus && !CINTERFACE */
260
261/* C interface */
262
263#define COBJMACROS
264
265#define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
266#define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
267#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
268#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
269
270#define PURE
271#define THIS_ INTERFACE *This,
272#define THIS INTERFACE *This
273
274#define interface struct
275
276#ifdef CONST_VTABLE
277#undef CONST_VTBL
278#define CONST_VTBL const
279#define DECLARE_INTERFACE(iface) \
280 /*typedef*/ interface iface { const struct iface##Vtbl *lpVtbl; } /*iface*/; \
281 typedef const struct iface##Vtbl iface##Vtbl; \
282 const struct iface##Vtbl
283#else
284#undef CONST_VTBL
285#define CONST_VTBL
286#define DECLARE_INTERFACE(iface) \
287 /*typedef*/ interface iface { struct iface##Vtbl *lpVtbl; } /*iface*/; \
288 typedef struct iface##Vtbl iface##Vtbl; \
289 struct iface##Vtbl
290#endif
291#define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
292
293#define BEGIN_INTERFACE
294#define END_INTERFACE
295
Alexandre Julliardaae3cb62003-04-11 00:31:02 +0000296#endif /* __cplusplus && !CINTERFACE */
297
Alexandre Julliard55379112003-04-10 21:13:58 +0000298/* Wine-specific macros */
299
Alexandre Julliard2d5519f2003-04-12 00:09:14 +0000300#define ICOM_DEFINE(iface,ibase) DECLARE_INTERFACE_(iface,ibase) { iface##_METHODS };
Alexandre Julliard55379112003-04-10 21:13:58 +0000301#define ICOM_VTABLE(iface) iface##Vtbl
302#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
Alexandre Julliard2d5519f2003-04-12 00:09:14 +0000303#define ICOM_THIS(impl,iface) impl* const This=(impl*)(iface)
Alexandre Julliard55379112003-04-10 21:13:58 +0000304#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
Alexandre Julliard55379112003-04-10 21:13:58 +0000305
Ove Kaaven1f5315c2002-12-05 20:33:07 +0000306#include "objidl.h"
Paul Quinnea1640f1999-03-10 18:03:53 +0000307
Francois Gougetf2973ca2000-09-22 22:17:49 +0000308#ifndef RC_INVOKED
309/* For compatibility only, at least for now */
310#include <stdlib.h>
311#endif
312
Peter Hunnisett3d7cd872001-04-12 21:10:54 +0000313#ifndef INITGUID
François Gouget504973d2001-01-02 20:55:40 +0000314#include "cguid.h"
Peter Hunnisett3d7cd872001-04-12 21:10:54 +0000315#endif
François Gouget504973d2001-01-02 20:55:40 +0000316
Francois Gouget00628922000-10-19 20:32:18 +0000317#ifdef __cplusplus
318extern "C" {
319#endif
320
Ove Kaaven41dfa052002-12-06 19:49:56 +0000321#ifndef NONAMELESSSTRUCT
322#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
323#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
324#else
325#define LISet32(li, v) ((li).s.HighPart = (v) < 0 ? -1 : 0, (li).s.LowPart = (v))
326#define ULISet32(li, v) ((li).s.HighPart = 0, (li).s.LowPart = (v))
327#endif
328
329/*****************************************************************************
330 * Standard API
331 */
Ove Kaaven99c85262002-12-18 20:49:16 +0000332DWORD WINAPI CoBuildVersion(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000333
334typedef enum tagCOINIT
335{
336 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
337 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
338 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
339 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
340} COINIT;
341
Ove Kaaven99c85262002-12-18 20:49:16 +0000342HRESULT WINAPI CoInitialize(LPVOID lpReserved);
343HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
344void WINAPI CoUninitialize(void);
345DWORD WINAPI CoGetCurrentProcess(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000346
Ove Kaaven99c85262002-12-18 20:49:16 +0000347HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
348void WINAPI CoFreeAllLibraries(void);
349void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
350void WINAPI CoFreeUnusedLibraries(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000351
Ove Kaaven99c85262002-12-18 20:49:16 +0000352HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
353HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
354 LPUNKNOWN pUnkOuter,
355 DWORD dwClsContext,
356 COSERVERINFO* pServerInfo,
357 ULONG cmq,
358 MULTI_QI* pResults);
359
360HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults);
361HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
362
363HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
364LPVOID WINAPI CoTaskMemAlloc(ULONG size);
365void WINAPI CoTaskMemFree(LPVOID ptr);
366LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
367
368HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
369HRESULT WINAPI CoRevokeMallocSpy(void);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000370
371/* class registration flags; passed to CoRegisterClassObject */
372typedef enum tagREGCLS
373{
374 REGCLS_SINGLEUSE = 0,
375 REGCLS_MULTIPLEUSE = 1,
376 REGCLS_MULTI_SEPARATE = 2,
377 REGCLS_SUSPENDED = 4
378} REGCLS;
379
Ove Kaaven99c85262002-12-18 20:49:16 +0000380HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000381HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000382HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000383HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
Ove Kaaven99c85262002-12-18 20:49:16 +0000384HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
385HRESULT WINAPI CoSuspendClassObjects(void);
386HRESULT WINAPI CoResumeClassObjects(void);
387ULONG WINAPI CoAddRefServerProcess(void);
388HRESULT WINAPI CoReleaseServerProcess(void);
389
390/* marshalling */
391HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
392HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
393HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
394HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
395HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
396HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
397HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
398HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
399HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
400HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
401HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
402BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
403
404/* security */
405HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
406HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
407HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
408
409HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites);
410HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
411HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
412
413HRESULT WINAPI CoImpersonateClient(void);
414HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR16** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
415HRESULT WINAPI CoRevertToSelf(void);
416
417/* misc */
418HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
419HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
420
421HRESULT WINAPI CoCreateGuid(GUID* pguid);
422BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
423
424BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
425BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
426HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
Ove Kaaven41dfa052002-12-06 19:49:56 +0000427
428/*****************************************************************************
Ove Kaaven99c85262002-12-18 20:49:16 +0000429 * GUID API
Ove Kaaven41dfa052002-12-06 19:49:56 +0000430 */
431HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*);
432HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
433
434HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
435HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *);
436
437HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid);
438HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
439
440HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
441
442INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
443
444/*****************************************************************************
445 * COM Server dll - exports
446 */
447HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
448HRESULT WINAPI DllCanUnloadNow(void);
449
450/*****************************************************************************
Ove Kaaven99c85262002-12-18 20:49:16 +0000451 * Data Object
452 */
453HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
454HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
455
456/*****************************************************************************
Ove Kaaven41dfa052002-12-06 19:49:56 +0000457 * Moniker API
458 */
François Gouget9a8c2e22000-12-15 21:29:41 +0000459HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
Noomen Hamzaed494ec1999-03-23 13:48:56 +0000460
Ove Kaaven99c85262002-12-18 20:49:16 +0000461HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC* ppbc);
462HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
463
464HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName, LPMONIKER* ppmk);
465HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
466
467HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
468HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
469
470HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
471
472HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
473
474HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
475
476HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
477
478HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk);
479
480HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
481
482HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
483HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
484
485/*****************************************************************************
486 * Storage API
487 */
488#define STGM_DIRECT 0x00000000
489#define STGM_TRANSACTED 0x00010000
490#define STGM_SIMPLE 0x08000000
491#define STGM_READ 0x00000000
492#define STGM_WRITE 0x00000001
493#define STGM_READWRITE 0x00000002
494#define STGM_SHARE_DENY_NONE 0x00000040
495#define STGM_SHARE_DENY_READ 0x00000030
496#define STGM_SHARE_DENY_WRITE 0x00000020
497#define STGM_SHARE_EXCLUSIVE 0x00000010
498#define STGM_PRIORITY 0x00040000
499#define STGM_DELETEONRELEASE 0x04000000
500#define STGM_CREATE 0x00001000
501#define STGM_CONVERT 0x00020000
502#define STGM_FAILIFTHERE 0x00000000
503#define STGM_NOSCRATCH 0x00100000
504#define STGM_NOSNAPSHOT 0x00200000
505
506HRESULT WINAPI StgCreateDocFile16(LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved,IStorage16 **ppstgOpen);
507HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
508
509HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn);
510HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
511HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
512
513HRESULT WINAPI StgOpenStorage16(const OLECHAR16* pwcsName,IStorage16* pstgPriority,DWORD grfMode,SNB16 snbExclude,DWORD reserved,IStorage16**ppstgOpen);
514HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
515
516HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid);
517HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid);
518
519HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
520HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
521
Francois Gouget00628922000-10-19 20:32:18 +0000522#ifdef __cplusplus
523}
524#endif
525
Ove Kaaven2a8bd722002-12-23 01:41:51 +0000526
Dimitrie O. Paun8b366812003-01-04 00:52:18 +0000527#ifndef __WINESRC__
Alexandre Julliardf00c46f2003-04-10 00:19:24 +0000528
Paul Quinnaaa83061999-06-05 15:23:20 +0000529#define FARSTRUCT
530#define HUGEP
531
Paul Quinnea1640f1999-03-10 18:03:53 +0000532#define WINOLEAPI STDAPI
533#define WINOLEAPI_(type) STDAPI_(type)
534
Dimitrie O. Paun8b366812003-01-04 00:52:18 +0000535#endif /* __WINESRC__ */
François Gougetd604eb11998-12-18 16:00:03 +0000536
Alexandre Julliarddc818a52002-12-05 22:11:43 +0000537#endif /* _OBJBASE_H_ */