objbase.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. /*
  2. * Copyright (C) 1998-1999 François Gouget
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #include <rpc.h>
  19. #include <rpcndr.h>
  20. #ifndef _OBJBASE_H_
  21. #define _OBJBASE_H_
  22. /*****************************************************************************
  23. * Macros to define a COM interface
  24. */
  25. /*
  26. * The goal of the following set of definitions is to provide a way to use the same
  27. * header file definitions to provide both a C interface and a C++ object oriented
  28. * interface to COM interfaces. The type of interface is selected automatically
  29. * depending on the language but it is always possible to get the C interface in C++
  30. * by defining CINTERFACE.
  31. *
  32. * It is based on the following assumptions:
  33. * - all COM interfaces derive from IUnknown, this should not be a problem.
  34. * - the header file only defines the interface, the actual fields are defined
  35. * separately in the C file implementing the interface.
  36. *
  37. * The natural approach to this problem would be to make sure we get a C++ class and
  38. * virtual methods in C++ and a structure with a table of pointer to functions in C.
  39. * Unfortunately the layout of the virtual table is compiler specific, the layout of
  40. * g++ virtual tables is not the same as that of an egcs virtual table which is not the
  41. * same as that generated by Visual C+. There are workarounds to make the virtual tables
  42. * compatible via padding but unfortunately the one which is imposed to the WINE emulator
  43. * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
  44. *
  45. * So the solution I finally adopted does not use virtual tables. Instead I use inline
  46. * non virtual methods that dereference the method pointer themselves and perform the call.
  47. *
  48. * Let's take Direct3D as an example:
  49. *
  50. * #define INTERFACE IDirect3D
  51. * DECLARE_INTERFACE_(IDirect3D,IUnknown)
  52. * {
  53. * // *** IUnknown methods *** //
  54. * STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, void**) PURE;
  55. * STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  56. * STDMETHOD_(ULONG,Release)(THIS) PURE;
  57. * // *** IDirect3D methods *** //
  58. * STDMETHOD(Initialize)(THIS_ REFIID) PURE;
  59. * STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE;
  60. * STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *, IUnknown *) PURE;
  61. * STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL *, IUnknown *) PURE;
  62. * STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT *, IUnknown *) PURE;
  63. * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
  64. * };
  65. * #undef INTERFACE
  66. *
  67. * #ifdef COBJMACROS
  68. * // *** IUnknown methods *** //
  69. * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  70. * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
  71. * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
  72. * // *** IDirect3D methods *** //
  73. * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
  74. * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
  75. * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
  76. * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
  77. * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
  78. * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
  79. * #endif
  80. *
  81. * Comments:
  82. * - The INTERFACE macro is used in the STDMETHOD macros to define the type of the 'this'
  83. * pointer. Defining this macro here saves us the trouble of having to repeat the interface
  84. * name everywhere. Note however that because of the way macros work, a macro like STDMETHOD
  85. * cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not
  86. * 'IDirect3D_VTABLE'.
  87. * - The DECLARE_INTERFACE declares all the structures necessary for the interface. We have to
  88. * explicitly use the interface name for macro expansion reasons again. It defines the list of
  89. * methods that are inheritable from this interface. It must be written manually (rather than
  90. * using a macro to generate the equivalent code) to avoid macro recursion (which compilers
  91. * don't like). It must start with the methods definition of the parent interface so that
  92. * method inheritance works properly.
  93. * - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros
  94. * will not work.
  95. * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
  96. * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate
  97. * the inherited method definitions there. This time I could have used a trick to use only one
  98. * macro whatever the number of parameters but I prefered to have it work the same way as above.
  99. * - You probably have noticed that we don't define the fields we need to actually implement this
  100. * interface: reference count, pointer to other resources and miscellaneous fields. That's
  101. * because these interfaces are just that: interfaces. They may be implemented more than once, in
  102. * different contexts and sometimes not even in Wine. Thus it would not make sense to impose
  103. * that the interface contains some specific fields.
  104. *
  105. *
  106. * In C this gives:
  107. * typedef struct IDirect3DVtbl IDirect3DVtbl;
  108. * struct IDirect3D {
  109. * IDirect3DVtbl* lpVtbl;
  110. * };
  111. * struct IDirect3DVtbl {
  112. * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj);
  113. * ULONG (*QueryInterface)(IDirect3D* me);
  114. * ULONG (*QueryInterface)(IDirect3D* me);
  115. * HRESULT (*Initialize)(IDirect3D* me, REFIID a);
  116. * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
  117. * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
  118. * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
  119. * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
  120. * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
  121. * };
  122. *
  123. * #ifdef COBJMACROS
  124. * // *** IUnknown methods *** //
  125. * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  126. * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p)
  127. * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p)
  128. * // *** IDirect3D methods *** //
  129. * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
  130. * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b)
  131. * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b)
  132. * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
  133. * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b)
  134. * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b)
  135. * #endif
  136. *
  137. * Comments:
  138. * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing
  139. * the user needs to know to use the interface. Of course the structure we will define to
  140. * implement this interface will have more fields but the first one will match this pointer.
  141. * - The code generated by DECLARE_INTERFACE defines both the structure representing the interface and
  142. * the structure for the jump table.
  143. * - Each method is declared as a pointer to function field in the jump table. The implementation
  144. * will fill this jump table with appropriate values, probably using a static variable, and
  145. * initialize the lpVtbl field to point to this variable.
  146. * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer
  147. * corresponding to the macro name. This emulates the behavior of a virtual table and should be
  148. * just as fast.
  149. * - This C code should be quite compatible with the Windows headers both for code that uses COM
  150. * interfaces and for code implementing a COM interface.
  151. *
  152. *
  153. * And in C++ (with gcc's g++):
  154. *
  155. * typedef struct IDirect3D: public IUnknown {
  156. * virtual HRESULT Initialize(REFIID a) = 0;
  157. * virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) = 0;
  158. * virtual HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) = 0;
  159. * virtual HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) = 0;
  160. * virtual HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) = 0;
  161. * virtual HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) = 0;
  162. * };
  163. *
  164. * Comments:
  165. * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions.
  166. * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE
  167. * macro is defined in which case we would not be here.
  168. *
  169. *
  170. * Implementing a COM interface.
  171. *
  172. * This continues the above example. This example assumes that the implementation is in C.
  173. *
  174. * typedef struct IDirect3DImpl {
  175. * void* lpVtbl;
  176. * // ...
  177. *
  178. * } IDirect3DImpl;
  179. *
  180. * static IDirect3DVtbl d3dvt;
  181. *
  182. * // implement the IDirect3D methods here
  183. *
  184. * int IDirect3D_QueryInterface(IDirect3D* me)
  185. * {
  186. * IDirect3DImpl *This = (IDirect3DImpl *)me;
  187. * // ...
  188. * }
  189. *
  190. * // ...
  191. *
  192. * static IDirect3DVtbl d3dvt = {
  193. * IDirect3D_QueryInterface,
  194. * IDirect3D_Add,
  195. * IDirect3D_Add2,
  196. * IDirect3D_Initialize,
  197. * IDirect3D_SetWidth
  198. * };
  199. *
  200. * Comments:
  201. * - We first define what the interface really contains. This is the IDirect3DImpl structure. The
  202. * first field must of course be the virtual table pointer. Everything else is free.
  203. * - Then we predeclare our static virtual table variable, we will need its address in some
  204. * methods to initialize the virtual table pointer of the returned interface objects.
  205. * - Then we implement the interface methods. To match what has been declared in the header file
  206. * they must take a pointer to a IDirect3D structure and we must cast it to an IDirect3DImpl so
  207. * that we can manipulate the fields.
  208. * - Finally we initialize the virtual table.
  209. */
  210. #if defined(__cplusplus) && !defined(CINTERFACE)
  211. /* C++ interface */
  212. #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
  213. #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
  214. #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
  215. #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
  216. #define PURE = 0
  217. #define THIS_
  218. #define THIS void
  219. #define interface struct
  220. #define DECLARE_INTERFACE(iface) interface iface
  221. #define DECLARE_INTERFACE_(iface,ibase) interface iface : public ibase
  222. #define BEGIN_INTERFACE
  223. #define END_INTERFACE
  224. #else /* __cplusplus && !CINTERFACE */
  225. /* C interface */
  226. #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
  227. #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method)
  228. #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
  229. #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method)
  230. #define PURE
  231. #define THIS_ INTERFACE *This,
  232. #define THIS INTERFACE *This
  233. #define interface struct
  234. #ifdef CONST_VTABLE
  235. #undef CONST_VTBL
  236. #define CONST_VTBL const
  237. #define DECLARE_INTERFACE(iface) \
  238. /*typedef*/ interface iface { const struct iface##Vtbl *lpVtbl; } /*iface*/; \
  239. typedef const struct iface##Vtbl iface##Vtbl; \
  240. const struct iface##Vtbl
  241. #else
  242. #undef CONST_VTBL
  243. #define CONST_VTBL
  244. #define DECLARE_INTERFACE(iface) \
  245. /*typedef*/ interface iface { struct iface##Vtbl *lpVtbl; } /*iface*/; \
  246. typedef struct iface##Vtbl iface##Vtbl; \
  247. struct iface##Vtbl
  248. #endif
  249. #define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface)
  250. #define BEGIN_INTERFACE
  251. #define END_INTERFACE
  252. #endif /* __cplusplus && !CINTERFACE */
  253. #include <objidl.h>
  254. #ifndef RC_INVOKED
  255. /* For compatibility only, at least for now */
  256. #include <stdlib.h>
  257. #endif
  258. #ifndef INITGUID
  259. #include <cguid.h>
  260. #endif
  261. #ifdef __cplusplus
  262. extern "C" {
  263. #endif
  264. #ifndef NONAMELESSSTRUCT
  265. #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
  266. #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
  267. #else
  268. #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
  269. #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
  270. #endif
  271. /*****************************************************************************
  272. * Standard API
  273. */
  274. DWORD WINAPI CoBuildVersion(void);
  275. typedef enum tagCOINIT
  276. {
  277. COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */
  278. COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */
  279. COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */
  280. COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
  281. } COINIT;
  282. HRESULT WINAPI CoInitialize(LPVOID lpReserved);
  283. HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
  284. void WINAPI CoUninitialize(void);
  285. DWORD WINAPI CoGetCurrentProcess(void);
  286. HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
  287. void WINAPI CoFreeAllLibraries(void);
  288. void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
  289. void WINAPI CoFreeUnusedLibraries(void);
  290. HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
  291. HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
  292. LPUNKNOWN pUnkOuter,
  293. DWORD dwClsContext,
  294. COSERVERINFO* pServerInfo,
  295. ULONG cmq,
  296. MULTI_QI* pResults);
  297. HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults);
  298. HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
  299. HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
  300. LPVOID WINAPI CoTaskMemAlloc(ULONG size);
  301. void WINAPI CoTaskMemFree(LPVOID ptr);
  302. LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size);
  303. HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
  304. HRESULT WINAPI CoRevokeMallocSpy(void);
  305. /* class registration flags; passed to CoRegisterClassObject */
  306. typedef enum tagREGCLS
  307. {
  308. REGCLS_SINGLEUSE = 0,
  309. REGCLS_MULTIPLEUSE = 1,
  310. REGCLS_MULTI_SEPARATE = 2,
  311. REGCLS_SUSPENDED = 4
  312. } REGCLS;
  313. HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv);
  314. HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
  315. HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
  316. HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid);
  317. HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
  318. HRESULT WINAPI CoSuspendClassObjects(void);
  319. HRESULT WINAPI CoResumeClassObjects(void);
  320. ULONG WINAPI CoAddRefServerProcess(void);
  321. ULONG WINAPI CoReleaseServerProcess(void);
  322. /* marshalling */
  323. HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal);
  324. HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv);
  325. HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  326. HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal);
  327. HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
  328. HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  329. HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm);
  330. HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm);
  331. HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
  332. HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult);
  333. HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv);
  334. HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
  335. BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk);
  336. /* security */
  337. HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3);
  338. HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface);
  339. HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc);
  340. HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites);
  341. HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
  342. HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy);
  343. HRESULT WINAPI CoImpersonateClient(void);
  344. HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities);
  345. HRESULT WINAPI CoRevertToSelf(void);
  346. /* misc */
  347. HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
  348. HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
  349. HRESULT WINAPI CoCreateGuid(GUID* pguid);
  350. BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
  351. BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime);
  352. BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime);
  353. HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime);
  354. HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
  355. /*****************************************************************************
  356. * GUID API
  357. */
  358. HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*);
  359. HRESULT WINAPI CLSIDFromString(LPOLESTR, CLSID *);
  360. HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid);
  361. HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID);
  362. INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax);
  363. /*****************************************************************************
  364. * COM Server dll - exports
  365. */
  366. HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
  367. HRESULT WINAPI DllCanUnloadNow(void);
  368. /*****************************************************************************
  369. * Data Object
  370. */
  371. HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
  372. HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
  373. /*****************************************************************************
  374. * Moniker API
  375. */
  376. HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
  377. HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv);
  378. HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
  379. HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
  380. HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
  381. HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
  382. HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
  383. HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
  384. HRESULT WINAPI CreateObjrefMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
  385. HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER * ppmk);
  386. HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid);
  387. HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot);
  388. HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName, ULONG * pchEaten, LPMONIKER * ppmk);
  389. HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
  390. HRESULT WINAPI MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER * ppmkRelPath, BOOL dwReserved);
  391. /*****************************************************************************
  392. * Storage API
  393. */
  394. #define STGM_DIRECT 0x00000000
  395. #define STGM_TRANSACTED 0x00010000
  396. #define STGM_SIMPLE 0x08000000
  397. #define STGM_READ 0x00000000
  398. #define STGM_WRITE 0x00000001
  399. #define STGM_READWRITE 0x00000002
  400. #define STGM_SHARE_DENY_NONE 0x00000040
  401. #define STGM_SHARE_DENY_READ 0x00000030
  402. #define STGM_SHARE_DENY_WRITE 0x00000020
  403. #define STGM_SHARE_EXCLUSIVE 0x00000010
  404. #define STGM_PRIORITY 0x00040000
  405. #define STGM_DELETEONRELEASE 0x04000000
  406. #define STGM_CREATE 0x00001000
  407. #define STGM_CONVERT 0x00020000
  408. #define STGM_FAILIFTHERE 0x00000000
  409. #define STGM_NOSCRATCH 0x00100000
  410. #define STGM_NOSNAPSHOT 0x00200000
  411. typedef struct tagSTGOPTIONS
  412. {
  413. USHORT usVersion;
  414. USHORT reserved;
  415. ULONG ulSectorSize;
  416. const WCHAR* pwcsTemplateFile;
  417. } STGOPTIONS;
  418. HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen);
  419. HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**);
  420. HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn);
  421. HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt);
  422. HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen);
  423. HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid);
  424. HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid);
  425. HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen);
  426. HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen);
  427. #ifdef __cplusplus
  428. }
  429. #endif
  430. /* FIXME: #include <urlmon.h> */
  431. #include <propidl.h>
  432. #ifndef __WINESRC__
  433. #define FARSTRUCT
  434. #define HUGEP
  435. #define WINOLEAPI STDAPI
  436. #define WINOLEAPI_(type) STDAPI_(type)
  437. #endif /* __WINESRC__ */
  438. #endif /* _OBJBASE_H_ */