Moved ICOM_THIS_MULTI definition out of objbase.h and into the files
[wine/multimedia.git] / include / objbase.h
blobb825f51c4bc81e0ce8c9dd75d5a13b9619c22032
1 /*
2 * Copyright (C) 1998-1999 François 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include <rpc.h>
20 #include <rpcndr.h>
22 #ifndef _OBJBASE_H_
23 #define _OBJBASE_H_
25 /*****************************************************************************
26 * define ICOM_MSVTABLE_COMPAT
27 * to implement the microsoft com vtable compatibility workaround for g++.
29 * NOTE: Turning this option on will produce a winelib that is incompatible
30 * with the binary emulator.
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++.
36 * If you aren't interested in Winelib C++ compatibility at all, leave both
37 * options off.
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 :)
44 /* #define ICOM_MSVTABLE_COMPAT 1 */
45 /* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */
48 /*****************************************************************************
49 * Macros to define a COM interface
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.
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.
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.
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.
74 * Let's take Direct3D as an example:
76 * #define INTERFACE IDirect3D
77 * #define IDirect3D_METHODS \
78 * IUnknown_METHODS \
79 * 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;
85 * DECLARE_INTERFACE_(IDirect3D,IUnknown) { IDirect3D_METHODS };
86 * #undef INTERFACE
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
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'.
108 * - ICOM_METHODS defines the list of methods that are inheritable from this interface. It must
109 * be written manually (rather than using a macro to generate the equivalent code) to avoid
110 * 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.
112 * - The DECLARE_INTERFACE finally declares all the structures necessary for the interface. We have
113 * to explicitly use the interface name for macro expansion reasons again.
114 * - 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.
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 * };
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
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 DECLARE_INTERFACE defines both the structure representing the interface and
163 * the structure for the jump table. DECLARE_INTERFACE uses the parent's Xxx_METHODS macro to
164 * 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.
176 * And in C++ (with gcc's g++):
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 * };
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.
193 * Implementing a COM interface.
195 * This continues the above example. This example assumes that the implementation is in C.
197 * typedef struct _IDirect3D {
198 * void* lpVtbl;
199 * // ...
201 * } _IDirect3D;
203 * static IDirect3DVtbl d3dvt;
205 * // implement the IDirect3D methods here
207 * int IDirect3D_QueryInterface(IDirect3D* me)
209 * ICOM_THIS(IDirect3D,me);
210 * // ...
213 * // ...
215 * static IDirect3DVtbl d3dvt = {
216 * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
217 * IDirect3D_QueryInterface,
218 * IDirect3D_Add,
219 * IDirect3D_Add2,
220 * IDirect3D_Initialize,
221 * IDirect3D_SetWidth
222 * };
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.
235 #if defined(__cplusplus) && !defined(CINTERFACE)
237 /* C++ interface */
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
244 #define PURE = 0
245 #define THIS_
246 #define THIS void
248 #define interface struct
249 #ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
250 #define DECLARE_INTERFACE(iface) interface __attribute__((com_interface)) iface
251 #else
252 #define DECLARE_INTERFACE(iface) interface iface
253 #endif
254 #define DECLARE_INTERFACE_(iface,ibase) interface iface : public ibase
256 #define BEGIN_INTERFACE
257 #define END_INTERFACE
259 #else /* __cplusplus && !CINTERFACE */
261 /* C interface */
263 #define COBJMACROS
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)
270 #define PURE
271 #define THIS_ INTERFACE *This,
272 #define THIS INTERFACE *This
274 #define interface struct
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)
293 #define BEGIN_INTERFACE
294 #define END_INTERFACE
296 #endif /* __cplusplus && !CINTERFACE */
298 /* Wine-specific macros */
300 #define ICOM_THIS(impl,iface) impl* const This=(impl*)(iface)
302 #include <objidl.h>
304 #ifndef RC_INVOKED
305 /* For compatibility only, at least for now */
306 #include <stdlib.h>
307 #endif
309 #ifndef INITGUID
310 #include <cguid.h>
311 #endif
313 #ifdef __cplusplus
314 extern "C" {
315 #endif
317 #ifndef NONAMELESSSTRUCT
318 #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
319 #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
320 #else
321 #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
322 #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
323 #endif
325 /*****************************************************************************
326 * Standard API
328 DWORD WINAPI CoBuildVersion(void);
330 typedef enum tagCOINIT
332 COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
333 COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
334 COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
335 COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
336 } COINIT;
338 HRESULT WINAPI CoInitialize(LPVOID lpReserved);
339 HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
340 void WINAPI CoUninitialize(void);
341 DWORD WINAPI CoGetCurrentProcess(void);
343 HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
344 void WINAPI CoFreeAllLibraries(void);
345 void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
346 void WINAPI CoFreeUnusedLibraries(void);
348 HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
349 HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
350 LPUNKNOWN pUnkOuter,
351 DWORD dwClsContext,
352 COSERVERINFO* pServerInfo,
353 ULONG cmq,
354 MULTI_QI* pResults);
356 HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults);
357 HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
359 HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
360 LPVOID WINAPI CoTaskMemAlloc(ULONG size);
361 void WINAPI CoTaskMemFree(LPVOID ptr);
362 LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
364 HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
365 HRESULT WINAPI CoRevokeMallocSpy(void);
367 /* class registration flags; passed to CoRegisterClassObject */
368 typedef enum tagREGCLS
370 REGCLS_SINGLEUSE = 0,
371 REGCLS_MULTIPLEUSE = 1,
372 REGCLS_MULTI_SEPARATE = 2,
373 REGCLS_SUSPENDED = 4
374 } REGCLS;
376 HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
377 HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
378 HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
379 HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
380 HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
381 HRESULT WINAPI CoSuspendClassObjects(void);
382 HRESULT WINAPI CoResumeClassObjects(void);
383 ULONG WINAPI CoAddRefServerProcess(void);
384 HRESULT WINAPI CoReleaseServerProcess(void);
386 /* marshalling */
387 HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
388 HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
389 HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
390 HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
391 HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
392 HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
393 HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
394 HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
395 HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
396 HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
397 HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
398 HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
399 BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
401 /* security */
402 HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
403 HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
404 HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
406 HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites);
407 HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
408 HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
410 HRESULT WINAPI CoImpersonateClient(void);
411 HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
412 HRESULT WINAPI CoRevertToSelf(void);
414 /* misc */
415 HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
416 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
418 HRESULT WINAPI CoCreateGuid(GUID* pguid);
419 BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
421 BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
422 BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
423 HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
424 HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
426 /*****************************************************************************
427 * GUID API
429 HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
430 HRESULT WINAPI CLSIDFromString(LPOLESTR, CLSID *);
431 HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
432 HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
434 INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
436 /*****************************************************************************
437 * COM Server dll - exports
439 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
440 HRESULT WINAPI DllCanUnloadNow(void);
442 /*****************************************************************************
443 * Data Object
445 HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
446 HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
448 /*****************************************************************************
449 * Moniker API
451 HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
453 HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
455 HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
457 HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
459 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
461 HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
463 HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
465 HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
467 HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk);
469 HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
471 HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
473 /*****************************************************************************
474 * Storage API
476 #define STGM_DIRECT 0x00000000
477 #define STGM_TRANSACTED 0x00010000
478 #define STGM_SIMPLE 0x08000000
479 #define STGM_READ 0x00000000
480 #define STGM_WRITE 0x00000001
481 #define STGM_READWRITE 0x00000002
482 #define STGM_SHARE_DENY_NONE 0x00000040
483 #define STGM_SHARE_DENY_READ 0x00000030
484 #define STGM_SHARE_DENY_WRITE 0x00000020
485 #define STGM_SHARE_EXCLUSIVE 0x00000010
486 #define STGM_PRIORITY 0x00040000
487 #define STGM_DELETEONRELEASE 0x04000000
488 #define STGM_CREATE 0x00001000
489 #define STGM_CONVERT 0x00020000
490 #define STGM_FAILIFTHERE 0x00000000
491 #define STGM_NOSCRATCH 0x00100000
492 #define STGM_NOSNAPSHOT 0x00200000
494 typedef struct tagSTGOPTIONS
496 USHORT usVersion;
497 USHORT reserved;
498 ULONG ulSectorSize;
499 const WCHAR* pwcsTemplateFile;
500 } STGOPTIONS;
502 HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
503 HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**);
504 HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
505 HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
506 HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
508 HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid);
509 HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid);
511 HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
512 HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
514 #ifdef __cplusplus
516 #endif
519 #ifndef __WINESRC__
521 #define FARSTRUCT
522 #define HUGEP
524 #define WINOLEAPI STDAPI
525 #define WINOLEAPI_(type) STDAPI_(type)
527 #endif /* __WINESRC__ */
529 #endif /* _OBJBASE_H_ */