ObjBase.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // File: objbase.h
  7. //
  8. // Contents: Component object model defintions.
  9. //
  10. //----------------------------------------------------------------------------
  11. #include <rpc.h>
  12. #include <rpcndr.h>
  13. #if !defined( _OBJBASE_H_ )
  14. #define _OBJBASE_H_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #include <pshpack8.h>
  19. #ifdef _MAC
  20. #ifndef _WLM_NOFORCE_LIBS
  21. #ifdef _WLMDLL
  22. #ifdef _DEBUG
  23. #pragma comment(lib, "oledlgd.lib")
  24. #pragma comment(lib, "msvcoled.lib")
  25. #else
  26. #pragma comment(lib, "oledlg.lib")
  27. #pragma comment(lib, "msvcole.lib")
  28. #endif
  29. #else
  30. #ifdef _DEBUG
  31. #pragma comment(lib, "wlmoled.lib")
  32. #pragma comment(lib, "ole2uid.lib")
  33. #else
  34. #pragma comment(lib, "wlmole.lib")
  35. #pragma comment(lib, "ole2ui.lib")
  36. #endif
  37. #pragma data_seg(".drectve")
  38. static char _gszWlmOLEUIResourceDirective[] = "/macres:ole2ui.rsc";
  39. #pragma data_seg()
  40. #endif
  41. #pragma comment(lib, "uuid.lib")
  42. #ifdef _DEBUG
  43. #pragma comment(lib, "ole2d.lib")
  44. #pragma comment(lib, "ole2autd.lib")
  45. #else
  46. #pragma comment(lib, "ole2.lib")
  47. #pragma comment(lib, "ole2auto.lib")
  48. #endif
  49. #endif // !_WLM_NOFORCE_LIBS
  50. #endif // _MAC
  51. #ifdef _OLE32_
  52. #define WINOLEAPI STDAPI
  53. #define WINOLEAPI_(type) STDAPI_(type)
  54. #else
  55. #ifdef _68K_
  56. #ifndef REQUIRESAPPLEPASCAL
  57. #define WINOLEAPI EXTERN_C DECLSPEC_IMPORT HRESULT PASCAL
  58. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type PASCAL
  59. #else
  60. #define WINOLEAPI EXTERN_C DECLSPEC_IMPORT PASCAL HRESULT
  61. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT PASCAL type
  62. #endif
  63. #else
  64. #define WINOLEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  65. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  66. #endif
  67. #endif
  68. /****** Interface Declaration ***********************************************/
  69. /*
  70. * These are macros for declaring interfaces. They exist so that
  71. * a single definition of the interface is simulataneously a proper
  72. * declaration of the interface structures (C++ abstract classes)
  73. * for both C and C++.
  74. *
  75. * DECLARE_INTERFACE(iface) is used to declare an interface that does
  76. * not derive from a base interface.
  77. * DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface
  78. * that does derive from a base interface.
  79. *
  80. * By default if the source file has a .c extension the C version of
  81. * the interface declaratations will be expanded; if it has a .cpp
  82. * extension the C++ version will be expanded. if you want to force
  83. * the C version expansion even though the source file has a .cpp
  84. * extension, then define the macro "CINTERFACE".
  85. * eg. cl -DCINTERFACE file.cpp
  86. *
  87. * Example Interface declaration:
  88. *
  89. * #undef INTERFACE
  90. * #define INTERFACE IClassFactory
  91. *
  92. * DECLARE_INTERFACE_(IClassFactory, IUnknown)
  93. * {
  94. * // *** IUnknown methods ***
  95. * STDMETHOD(QueryInterface) (THIS_
  96. * REFIID riid,
  97. * LPVOID FAR* ppvObj) PURE;
  98. * STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  99. * STDMETHOD_(ULONG,Release) (THIS) PURE;
  100. *
  101. * // *** IClassFactory methods ***
  102. * STDMETHOD(CreateInstance) (THIS_
  103. * LPUNKNOWN pUnkOuter,
  104. * REFIID riid,
  105. * LPVOID FAR* ppvObject) PURE;
  106. * };
  107. *
  108. * Example C++ expansion:
  109. *
  110. * struct FAR IClassFactory : public IUnknown
  111. * {
  112. * virtual HRESULT STDMETHODCALLTYPE QueryInterface(
  113. * IID FAR& riid,
  114. * LPVOID FAR* ppvObj) = 0;
  115. * virtual HRESULT STDMETHODCALLTYPE AddRef(void) = 0;
  116. * virtual HRESULT STDMETHODCALLTYPE Release(void) = 0;
  117. * virtual HRESULT STDMETHODCALLTYPE CreateInstance(
  118. * LPUNKNOWN pUnkOuter,
  119. * IID FAR& riid,
  120. * LPVOID FAR* ppvObject) = 0;
  121. * };
  122. *
  123. * NOTE: Our documentation says '#define interface class' but we use
  124. * 'struct' instead of 'class' to keep a lot of 'public:' lines
  125. * out of the interfaces. The 'FAR' forces the 'this' pointers to
  126. * be far, which is what we need.
  127. *
  128. * Example C expansion:
  129. *
  130. * typedef struct IClassFactory
  131. * {
  132. * const struct IClassFactoryVtbl FAR* lpVtbl;
  133. * } IClassFactory;
  134. *
  135. * typedef struct IClassFactoryVtbl IClassFactoryVtbl;
  136. *
  137. * struct IClassFactoryVtbl
  138. * {
  139. * HRESULT (STDMETHODCALLTYPE * QueryInterface) (
  140. * IClassFactory FAR* This,
  141. * IID FAR* riid,
  142. * LPVOID FAR* ppvObj) ;
  143. * HRESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ;
  144. * HRESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ;
  145. * HRESULT (STDMETHODCALLTYPE * CreateInstance) (
  146. * IClassFactory FAR* This,
  147. * LPUNKNOWN pUnkOuter,
  148. * IID FAR* riid,
  149. * LPVOID FAR* ppvObject);
  150. * HRESULT (STDMETHODCALLTYPE * LockServer) (
  151. * IClassFactory FAR* This,
  152. * BOOL fLock);
  153. * };
  154. */
  155. #if defined(__cplusplus) && !defined(CINTERFACE)
  156. //#define interface struct FAR
  157. #define interface struct
  158. #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
  159. #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
  160. #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
  161. #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
  162. #define PURE = 0
  163. #define THIS_
  164. #define THIS void
  165. #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
  166. #define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface
  167. #if !defined(BEGIN_INTERFACE)
  168. #if defined(_MPPC_) && \
  169. ( (defined(_MSC_VER) || defined(__SC__) || defined(__MWERKS__)) && \
  170. !defined(NO_NULL_VTABLE_ENTRY) )
  171. #define BEGIN_INTERFACE virtual void a() {}
  172. #define END_INTERFACE
  173. #else
  174. #define BEGIN_INTERFACE
  175. #define END_INTERFACE
  176. #endif
  177. #endif
  178. #else
  179. #define interface struct
  180. #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE * method)
  181. #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method)
  182. #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE * method)
  183. #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE * method)
  184. #if !defined(BEGIN_INTERFACE)
  185. #if defined(_MPPC_)
  186. #define BEGIN_INTERFACE void *b;
  187. #define END_INTERFACE
  188. #else
  189. #define BEGIN_INTERFACE
  190. #define END_INTERFACE
  191. #endif
  192. #endif
  193. #define PURE
  194. #define THIS_ INTERFACE FAR* This,
  195. #define THIS INTERFACE FAR* This
  196. #ifdef CONST_VTABLE
  197. #undef CONST_VTBL
  198. #define CONST_VTBL const
  199. #define DECLARE_INTERFACE(iface) typedef interface iface { \
  200. const struct iface##Vtbl FAR* lpVtbl; \
  201. } iface; \
  202. typedef const struct iface##Vtbl iface##Vtbl; \
  203. const struct iface##Vtbl
  204. #else
  205. #undef CONST_VTBL
  206. #define CONST_VTBL
  207. #define DECLARE_INTERFACE(iface) typedef interface iface { \
  208. struct iface##Vtbl FAR* lpVtbl; \
  209. } iface; \
  210. typedef struct iface##Vtbl iface##Vtbl; \
  211. struct iface##Vtbl
  212. #endif
  213. #define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface)
  214. #endif
  215. /****** Additional basic types **********************************************/
  216. #ifndef FARSTRUCT
  217. #ifdef __cplusplus
  218. #define FARSTRUCT FAR
  219. #else
  220. #define FARSTRUCT
  221. #endif // __cplusplus
  222. #endif // FARSTRUCT
  223. #ifndef HUGEP
  224. #if defined(_WIN32) || defined(_MPPC_)
  225. #define HUGEP
  226. #else
  227. #define HUGEP __huge
  228. #endif // WIN32
  229. #endif // HUGEP
  230. #ifdef _MAC
  231. #if !defined(OLE2ANSI)
  232. #define OLE2ANSI
  233. #endif
  234. #endif
  235. #include <stdlib.h>
  236. #define LISet32(li, v) ((li).HighPart = ((LONG) (v)) < 0 ? -1 : 0, (li).LowPart = (v))
  237. #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
  238. #define CLSCTX_INPROC (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER)
  239. // With DCOM, CLSCTX_REMOTE_SERVER should be included
  240. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  241. #define CLSCTX_ALL (CLSCTX_INPROC_SERVER| \
  242. CLSCTX_INPROC_HANDLER| \
  243. CLSCTX_LOCAL_SERVER| \
  244. CLSCTX_REMOTE_SERVER)
  245. #define CLSCTX_SERVER (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER)
  246. #else
  247. #define CLSCTX_ALL (CLSCTX_INPROC_SERVER| \
  248. CLSCTX_INPROC_HANDLER| \
  249. CLSCTX_LOCAL_SERVER )
  250. #define CLSCTX_SERVER (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER)
  251. #endif
  252. // class registration flags; passed to CoRegisterClassObject
  253. typedef enum tagREGCLS
  254. {
  255. REGCLS_SINGLEUSE = 0, // class object only generates one instance
  256. REGCLS_MULTIPLEUSE = 1, // same class object genereates multiple inst.
  257. // and local automatically goes into inproc tbl.
  258. REGCLS_MULTI_SEPARATE = 2, // multiple use, but separate control over each
  259. // context.
  260. REGCLS_SUSPENDED = 4, // register is as suspended, will be activated
  261. // when app calls CoResumeClassObjects
  262. REGCLS_SURROGATE = 8 // must be used when a surrogate process
  263. // is registering a class object that will be
  264. // loaded in the surrogate
  265. } REGCLS;
  266. // interface marshaling definitions
  267. #define MARSHALINTERFACE_MIN 500 // minimum number of bytes for interface marshl
  268. //
  269. // Common typedefs for paramaters used in Storage API's, gleamed from storage.h
  270. // Also contains Storage error codes, which should be moved into the storage
  271. // idl files.
  272. //
  273. #define CWCSTORAGENAME 32
  274. /* Storage instantiation modes */
  275. #define STGM_DIRECT 0x00000000L
  276. #define STGM_TRANSACTED 0x00010000L
  277. #define STGM_SIMPLE 0x08000000L
  278. #define STGM_READ 0x00000000L
  279. #define STGM_WRITE 0x00000001L
  280. #define STGM_READWRITE 0x00000002L
  281. #define STGM_SHARE_DENY_NONE 0x00000040L
  282. #define STGM_SHARE_DENY_READ 0x00000030L
  283. #define STGM_SHARE_DENY_WRITE 0x00000020L
  284. #define STGM_SHARE_EXCLUSIVE 0x00000010L
  285. #define STGM_PRIORITY 0x00040000L
  286. #define STGM_DELETEONRELEASE 0x04000000L
  287. #if (WINVER >= 400)
  288. #define STGM_NOSCRATCH 0x00100000L
  289. #endif /* WINVER */
  290. #define STGM_CREATE 0x00001000L
  291. #define STGM_CONVERT 0x00020000L
  292. #define STGM_FAILIFTHERE 0x00000000L
  293. #define STGM_NOSNAPSHOT 0x00200000L
  294. #if (_WIN32_WINNT >= 0x0500)
  295. #define STGM_DIRECT_SWMR 0x00400000L
  296. #endif
  297. /* flags for internet asyncronous and layout docfile */
  298. #define ASYNC_MODE_COMPATIBILITY 0x00000001L
  299. #define ASYNC_MODE_DEFAULT 0x00000000L
  300. #define STGTY_REPEAT 0x00000100L
  301. #define STG_TOEND 0xFFFFFFFFL
  302. #define STG_LAYOUT_SEQUENTIAL 0x00000000L
  303. #define STG_LAYOUT_INTERLEAVED 0x00000001L
  304. #define STGFMT_STORAGE 0
  305. #define STGFMT_NATIVE 1
  306. #define STGFMT_FILE 3
  307. #define STGFMT_ANY 4
  308. #define STGFMT_DOCFILE 5
  309. // This is a legacy define to allow old component to builds
  310. #define STGFMT_DOCUMENT 0
  311. /* here is where we pull in the MIDL generated headers for the interfaces */
  312. typedef interface IRpcStubBuffer IRpcStubBuffer;
  313. typedef interface IRpcChannelBuffer IRpcChannelBuffer;
  314. #include <wtypes.h>
  315. #include <unknwn.h>
  316. #include <objidl.h>
  317. #ifdef _OLE32_
  318. #ifdef _OLE32PRIV_
  319. BOOL _fastcall wIsEqualGUID(REFGUID rguid1, REFGUID rguid2);
  320. #define IsEqualGUID(rguid1, rguid2) wIsEqualGUID(rguid1, rguid2)
  321. #else
  322. #define __INLINE_ISEQUAL_GUID
  323. #endif // _OLE32PRIV_
  324. #endif // _OLE32_
  325. #include <guiddef.h>
  326. #ifndef INITGUID
  327. #include <cguid.h>
  328. #endif
  329. // COM initialization flags; passed to CoInitialize.
  330. typedef enum tagCOINIT
  331. {
  332. COINIT_APARTMENTTHREADED = 0x2, // Apartment model
  333. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  334. // These constants are only valid on Windows NT 4.0
  335. COINIT_MULTITHREADED = 0x0, // OLE calls objects on any thread.
  336. COINIT_DISABLE_OLE1DDE = 0x4, // Don't use DDE for Ole1 support.
  337. COINIT_SPEED_OVER_MEMORY = 0x8, // Trade memory for speed.
  338. #endif // DCOM
  339. } COINIT;
  340. /****** STD Object API Prototypes *****************************************/
  341. WINOLEAPI_(DWORD) CoBuildVersion( VOID );
  342. /* init/uninit */
  343. WINOLEAPI CoInitialize(IN LPVOID pvReserved);
  344. WINOLEAPI_(void) CoUninitialize(void);
  345. WINOLEAPI CoGetMalloc(IN DWORD dwMemContext, OUT LPMALLOC FAR* ppMalloc);
  346. WINOLEAPI_(DWORD) CoGetCurrentProcess(void);
  347. WINOLEAPI CoRegisterMallocSpy(IN LPMALLOCSPY pMallocSpy);
  348. WINOLEAPI CoRevokeMallocSpy(void);
  349. WINOLEAPI CoCreateStandardMalloc(IN DWORD memctx, OUT IMalloc FAR* FAR* ppMalloc);
  350. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  351. WINOLEAPI CoInitializeEx(IN LPVOID pvReserved, IN DWORD dwCoInit);
  352. WINOLEAPI CoGetCallerTID( LPDWORD lpdwTID );
  353. #endif // DCOM
  354. #if (_WIN32_WINNT >= 0x0501)
  355. WINOLEAPI CoRegisterInitializeSpy(IN LPINITIALIZESPY pSpy, OUT ULARGE_INTEGER *puliCookie);
  356. WINOLEAPI CoRevokeInitializeSpy(IN ULARGE_INTEGER uliCookie);
  357. // COM System Security Descriptors (used when the corresponding registry
  358. // entries are absent)
  359. typedef enum tagCOMSD
  360. {
  361. SD_LAUNCHPERMISSIONS = 0, // Machine wide launch permissions
  362. SD_ACCESSPERMISSIONS = 1, // Machine wide acesss permissions
  363. SD_LAUNCHRESTRICTIONS = 2, // Machine wide launch limits
  364. SD_ACCESSRESTRICTIONS = 3 // Machine wide access limits
  365. } COMSD;
  366. WINOLEAPI CoGetSystemSecurityPermissions(COMSD comSDType, PSECURITY_DESCRIPTOR *ppSD);
  367. #endif
  368. #if DBG == 1
  369. WINOLEAPI_(ULONG) DebugCoGetRpcFault( void );
  370. WINOLEAPI_(void) DebugCoSetRpcFault( ULONG );
  371. #endif
  372. /* COM+ APIs */
  373. WINOLEAPI CoGetObjectContext(IN REFIID riid, OUT LPVOID FAR* ppv);
  374. /* register/revoke/get class objects */
  375. WINOLEAPI CoGetClassObject(IN REFCLSID rclsid, IN DWORD dwClsContext, IN LPVOID pvReserved,
  376. IN REFIID riid, OUT LPVOID FAR* ppv);
  377. WINOLEAPI CoRegisterClassObject(IN REFCLSID rclsid, IN LPUNKNOWN pUnk,
  378. IN DWORD dwClsContext, IN DWORD flags, OUT LPDWORD lpdwRegister);
  379. WINOLEAPI CoRevokeClassObject(IN DWORD dwRegister);
  380. WINOLEAPI CoResumeClassObjects(void);
  381. WINOLEAPI CoSuspendClassObjects(void);
  382. WINOLEAPI_(ULONG) CoAddRefServerProcess(void);
  383. WINOLEAPI_(ULONG) CoReleaseServerProcess(void);
  384. WINOLEAPI CoGetPSClsid(IN REFIID riid, OUT CLSID *pClsid);
  385. WINOLEAPI CoRegisterPSClsid(IN REFIID riid, IN REFCLSID rclsid);
  386. // Registering surrogate processes
  387. WINOLEAPI CoRegisterSurrogate(IN LPSURROGATE pSurrogate);
  388. /* marshaling interface pointers */
  389. WINOLEAPI CoGetMarshalSizeMax(OUT ULONG *pulSize, IN REFIID riid, IN LPUNKNOWN pUnk,
  390. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags);
  391. WINOLEAPI CoMarshalInterface(IN LPSTREAM pStm, IN REFIID riid, IN LPUNKNOWN pUnk,
  392. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags);
  393. WINOLEAPI CoUnmarshalInterface(IN LPSTREAM pStm, IN REFIID riid, OUT LPVOID FAR* ppv);
  394. WINOLEAPI CoMarshalHresult(IN LPSTREAM pstm, IN HRESULT hresult);
  395. WINOLEAPI CoUnmarshalHresult(IN LPSTREAM pstm, OUT HRESULT FAR * phresult);
  396. WINOLEAPI CoReleaseMarshalData(IN LPSTREAM pStm);
  397. WINOLEAPI CoDisconnectObject(IN LPUNKNOWN pUnk, IN DWORD dwReserved);
  398. WINOLEAPI CoLockObjectExternal(IN LPUNKNOWN pUnk, IN BOOL fLock, IN BOOL fLastUnlockReleases);
  399. WINOLEAPI CoGetStandardMarshal(IN REFIID riid, IN LPUNKNOWN pUnk,
  400. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags,
  401. OUT LPMARSHAL FAR* ppMarshal);
  402. WINOLEAPI CoGetStdMarshalEx(IN LPUNKNOWN pUnkOuter, IN DWORD smexflags,
  403. OUT LPUNKNOWN FAR* ppUnkInner);
  404. /* flags for CoGetStdMarshalEx */
  405. typedef enum tagSTDMSHLFLAGS
  406. {
  407. SMEXF_SERVER = 0x01, // server side aggregated std marshaler
  408. SMEXF_HANDLER = 0x02 // client side (handler) agg std marshaler
  409. } STDMSHLFLAGS;
  410. WINOLEAPI_(BOOL) CoIsHandlerConnected(IN LPUNKNOWN pUnk);
  411. // Apartment model inter-thread interface passing helpers
  412. WINOLEAPI CoMarshalInterThreadInterfaceInStream(IN REFIID riid, IN LPUNKNOWN pUnk,
  413. OUT LPSTREAM *ppStm);
  414. WINOLEAPI CoGetInterfaceAndReleaseStream(IN LPSTREAM pStm, IN REFIID iid,
  415. OUT LPVOID FAR* ppv);
  416. WINOLEAPI CoCreateFreeThreadedMarshaler(IN LPUNKNOWN punkOuter,
  417. OUT LPUNKNOWN *ppunkMarshal);
  418. /* dll loading helpers; keeps track of ref counts and unloads all on exit */
  419. WINOLEAPI_(HINSTANCE) CoLoadLibrary(IN LPOLESTR lpszLibName, IN BOOL bAutoFree);
  420. WINOLEAPI_(void) CoFreeLibrary(IN HINSTANCE hInst);
  421. WINOLEAPI_(void) CoFreeAllLibraries(void);
  422. WINOLEAPI_(void) CoFreeUnusedLibraries(void);
  423. #if (_WIN32_WINNT >= 0x0501 )
  424. WINOLEAPI_(void) CoFreeUnusedLibrariesEx(IN DWORD dwUnloadDelay, IN DWORD dwReserved);
  425. #endif
  426. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  427. /* Call Security. */
  428. WINOLEAPI CoInitializeSecurity(
  429. IN PSECURITY_DESCRIPTOR pSecDesc,
  430. IN LONG cAuthSvc,
  431. IN SOLE_AUTHENTICATION_SERVICE *asAuthSvc,
  432. IN void *pReserved1,
  433. IN DWORD dwAuthnLevel,
  434. IN DWORD dwImpLevel,
  435. IN void *pAuthList,
  436. IN DWORD dwCapabilities,
  437. IN void *pReserved3 );
  438. WINOLEAPI CoGetCallContext( IN REFIID riid, OUT void **ppInterface );
  439. WINOLEAPI CoQueryProxyBlanket(
  440. IN IUnknown *pProxy,
  441. OUT DWORD *pwAuthnSvc,
  442. OUT DWORD *pAuthzSvc,
  443. OUT OLECHAR **pServerPrincName,
  444. OUT DWORD *pAuthnLevel,
  445. OUT DWORD *pImpLevel,
  446. OUT RPC_AUTH_IDENTITY_HANDLE *pAuthInfo,
  447. OUT DWORD *pCapabilites );
  448. WINOLEAPI CoSetProxyBlanket(
  449. IN IUnknown *pProxy,
  450. IN DWORD dwAuthnSvc,
  451. IN DWORD dwAuthzSvc,
  452. IN OLECHAR *pServerPrincName,
  453. IN DWORD dwAuthnLevel,
  454. IN DWORD dwImpLevel,
  455. IN RPC_AUTH_IDENTITY_HANDLE pAuthInfo,
  456. IN DWORD dwCapabilities );
  457. WINOLEAPI CoCopyProxy(
  458. IN IUnknown *pProxy,
  459. OUT IUnknown **ppCopy );
  460. WINOLEAPI CoQueryClientBlanket(
  461. OUT DWORD *pAuthnSvc,
  462. OUT DWORD *pAuthzSvc,
  463. OUT OLECHAR **pServerPrincName,
  464. OUT DWORD *pAuthnLevel,
  465. OUT DWORD *pImpLevel,
  466. OUT RPC_AUTHZ_HANDLE *pPrivs,
  467. OUT DWORD *pCapabilities );
  468. WINOLEAPI CoImpersonateClient();
  469. WINOLEAPI CoRevertToSelf();
  470. WINOLEAPI CoQueryAuthenticationServices(
  471. OUT DWORD *pcAuthSvc,
  472. OUT SOLE_AUTHENTICATION_SERVICE **asAuthSvc );
  473. WINOLEAPI CoSwitchCallContext( IN IUnknown *pNewObject, OUT IUnknown **ppOldObject );
  474. #define COM_RIGHTS_EXECUTE 1
  475. #define COM_RIGHTS_EXECUTE_LOCAL 2
  476. #define COM_RIGHTS_EXECUTE_REMOTE 4
  477. #define COM_RIGHTS_ACTIVATE_LOCAL 8
  478. #define COM_RIGHTS_ACTIVATE_REMOTE 16
  479. #endif // DCOM
  480. /* helper for creating instances */
  481. WINOLEAPI CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
  482. IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv);
  483. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  484. WINOLEAPI CoGetInstanceFromFile(
  485. IN COSERVERINFO * pServerInfo,
  486. IN CLSID * pClsid,
  487. IN IUnknown * punkOuter, // only relevant locally
  488. IN DWORD dwClsCtx,
  489. IN DWORD grfMode,
  490. IN OLECHAR * pwszName,
  491. IN DWORD dwCount,
  492. IN OUT MULTI_QI * pResults );
  493. WINOLEAPI CoGetInstanceFromIStorage(
  494. IN COSERVERINFO * pServerInfo,
  495. IN CLSID * pClsid,
  496. IN IUnknown * punkOuter, // only relevant locally
  497. IN DWORD dwClsCtx,
  498. IN struct IStorage * pstg,
  499. IN DWORD dwCount,
  500. IN OUT MULTI_QI * pResults );
  501. WINOLEAPI CoCreateInstanceEx(
  502. IN REFCLSID Clsid,
  503. IN IUnknown * punkOuter, // only relevant locally
  504. IN DWORD dwClsCtx,
  505. IN COSERVERINFO * pServerInfo,
  506. IN DWORD dwCount,
  507. IN OUT MULTI_QI * pResults );
  508. #endif // DCOM
  509. /* Call related APIs */
  510. #if (_WIN32_WINNT >= 0x0500 ) || defined(_WIN32_DCOM) // DCOM
  511. WINOLEAPI CoGetCancelObject(IN DWORD dwThreadId, IN REFIID iid, OUT void **ppUnk);
  512. WINOLEAPI CoSetCancelObject(IN IUnknown *pUnk);
  513. WINOLEAPI CoCancelCall(IN DWORD dwThreadId, IN ULONG ulTimeout);
  514. WINOLEAPI CoTestCancel();
  515. WINOLEAPI CoEnableCallCancellation(IN LPVOID pReserved);
  516. WINOLEAPI CoDisableCallCancellation(IN LPVOID pReserved);
  517. WINOLEAPI CoAllowSetForegroundWindow(IN IUnknown *pUnk, IN LPVOID lpvReserved);
  518. WINOLEAPI DcomChannelSetHResult(IN LPVOID pvReserved, IN ULONG* pulReserved, IN HRESULT appsHR);
  519. #endif
  520. /* other helpers */
  521. WINOLEAPI StringFromCLSID(IN REFCLSID rclsid, OUT LPOLESTR FAR* lplpsz);
  522. WINOLEAPI CLSIDFromString(IN LPOLESTR lpsz, OUT LPCLSID pclsid);
  523. WINOLEAPI StringFromIID(IN REFIID rclsid, OUT LPOLESTR FAR* lplpsz);
  524. WINOLEAPI IIDFromString(IN LPOLESTR lpsz, OUT LPIID lpiid);
  525. WINOLEAPI_(BOOL) CoIsOle1Class(IN REFCLSID rclsid);
  526. WINOLEAPI ProgIDFromCLSID (IN REFCLSID clsid, OUT LPOLESTR FAR* lplpszProgID);
  527. WINOLEAPI CLSIDFromProgID (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid);
  528. WINOLEAPI CLSIDFromProgIDEx (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid);
  529. WINOLEAPI_(int) StringFromGUID2(IN REFGUID rguid, OUT LPOLESTR lpsz, IN int cchMax);
  530. WINOLEAPI CoCreateGuid(OUT GUID FAR *pguid);
  531. WINOLEAPI_(BOOL) CoFileTimeToDosDateTime(
  532. IN FILETIME FAR* lpFileTime, OUT LPWORD lpDosDate, OUT LPWORD lpDosTime);
  533. WINOLEAPI_(BOOL) CoDosDateTimeToFileTime(
  534. IN WORD nDosDate, IN WORD nDosTime, OUT FILETIME FAR* lpFileTime);
  535. WINOLEAPI CoFileTimeNow( OUT FILETIME FAR* lpFileTime );
  536. WINOLEAPI CoRegisterMessageFilter( IN LPMESSAGEFILTER lpMessageFilter,
  537. OUT LPMESSAGEFILTER FAR* lplpMessageFilter );
  538. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  539. WINOLEAPI CoRegisterChannelHook( IN REFGUID ExtensionUuid, IN IChannelHook *pChannelHook );
  540. #endif // DCOM
  541. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  542. /* Synchronization API */
  543. WINOLEAPI CoWaitForMultipleHandles (IN DWORD dwFlags,
  544. IN DWORD dwTimeout,
  545. IN ULONG cHandles,
  546. IN LPHANDLE pHandles,
  547. OUT LPDWORD lpdwindex);
  548. /* Flags for Synchronization API and Classes */
  549. typedef enum tagCOWAIT_FLAGS
  550. {
  551. COWAIT_WAITALL = 1,
  552. COWAIT_ALERTABLE = 2
  553. }COWAIT_FLAGS;
  554. #endif // DCOM
  555. /* TreatAs APIS */
  556. WINOLEAPI CoGetTreatAsClass(IN REFCLSID clsidOld, OUT LPCLSID pClsidNew);
  557. WINOLEAPI CoTreatAsClass(IN REFCLSID clsidOld, IN REFCLSID clsidNew);
  558. /* the server dlls must define their DllGetClassObject and DllCanUnloadNow
  559. * to match these; the typedefs are located here to ensure all are changed at
  560. * the same time.
  561. */
  562. //#ifdef _MAC
  563. //typedef STDAPICALLTYPE HRESULT (* LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  564. //#else
  565. typedef HRESULT (STDAPICALLTYPE * LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  566. //#endif
  567. //#ifdef _MAC
  568. //typedef STDAPICALLTYPE HRESULT (* LPFNCANUNLOADNOW)(void);
  569. //#else
  570. typedef HRESULT (STDAPICALLTYPE * LPFNCANUNLOADNOW)(void);
  571. //#endif
  572. STDAPI DllGetClassObject(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID FAR* ppv);
  573. STDAPI DllCanUnloadNow(void);
  574. /****** Default Memory Allocation ******************************************/
  575. WINOLEAPI_(LPVOID) CoTaskMemAlloc(IN SIZE_T cb);
  576. WINOLEAPI_(LPVOID) CoTaskMemRealloc(IN LPVOID pv, IN SIZE_T cb);
  577. WINOLEAPI_(void) CoTaskMemFree(IN LPVOID pv);
  578. /****** DV APIs ***********************************************************/
  579. WINOLEAPI CreateDataAdviseHolder(OUT LPDATAADVISEHOLDER FAR* ppDAHolder);
  580. WINOLEAPI CreateDataCache(IN LPUNKNOWN pUnkOuter, IN REFCLSID rclsid,
  581. IN REFIID iid, OUT LPVOID FAR* ppv);
  582. /****** Storage API Prototypes ********************************************/
  583. WINOLEAPI StgCreateDocfile(IN const OLECHAR FAR* pwcsName,
  584. IN DWORD grfMode,
  585. IN DWORD reserved,
  586. OUT IStorage FAR * FAR *ppstgOpen);
  587. WINOLEAPI StgCreateDocfileOnILockBytes(IN ILockBytes FAR *plkbyt,
  588. IN DWORD grfMode,
  589. IN DWORD reserved,
  590. OUT IStorage FAR * FAR *ppstgOpen);
  591. WINOLEAPI StgOpenStorage(IN const OLECHAR FAR* pwcsName,
  592. IN IStorage FAR *pstgPriority,
  593. IN DWORD grfMode,
  594. IN SNB snbExclude,
  595. IN DWORD reserved,
  596. OUT IStorage FAR * FAR *ppstgOpen);
  597. WINOLEAPI StgOpenStorageOnILockBytes(IN ILockBytes FAR *plkbyt,
  598. IN IStorage FAR *pstgPriority,
  599. IN DWORD grfMode,
  600. IN SNB snbExclude,
  601. IN DWORD reserved,
  602. OUT IStorage FAR * FAR *ppstgOpen);
  603. WINOLEAPI StgIsStorageFile(IN const OLECHAR FAR* pwcsName);
  604. WINOLEAPI StgIsStorageILockBytes(IN ILockBytes FAR* plkbyt);
  605. WINOLEAPI StgSetTimes(IN OLECHAR const FAR* lpszName,
  606. IN FILETIME const FAR* pctime,
  607. IN FILETIME const FAR* patime,
  608. IN FILETIME const FAR* pmtime);
  609. WINOLEAPI StgOpenAsyncDocfileOnIFillLockBytes( IN IFillLockBytes *pflb,
  610. IN DWORD grfMode,
  611. IN DWORD asyncFlags,
  612. OUT IStorage **ppstgOpen);
  613. WINOLEAPI StgGetIFillLockBytesOnILockBytes( IN ILockBytes *pilb,
  614. OUT IFillLockBytes **ppflb);
  615. WINOLEAPI StgGetIFillLockBytesOnFile(IN OLECHAR const *pwcsName,
  616. OUT IFillLockBytes **ppflb);
  617. WINOLEAPI StgOpenLayoutDocfile(IN OLECHAR const *pwcsDfName,
  618. IN DWORD grfMode,
  619. IN DWORD reserved,
  620. OUT IStorage **ppstgOpen);
  621. // STG initialization options for StgCreateStorageEx and StgOpenStorageEx
  622. #define STGOPTIONS_VERSION 2
  623. typedef struct tagSTGOPTIONS
  624. {
  625. USHORT usVersion; // Versions 1 and 2 supported
  626. USHORT reserved; // must be 0 for padding
  627. ULONG ulSectorSize; // docfile header sector size (512)
  628. const WCHAR *pwcsTemplateFile; // version 2 or above
  629. } STGOPTIONS;
  630. WINOLEAPI StgCreateStorageEx (IN const WCHAR* pwcsName,
  631. IN DWORD grfMode,
  632. IN DWORD stgfmt, // enum
  633. IN DWORD grfAttrs, // reserved
  634. IN STGOPTIONS * pStgOptions,
  635. IN void * reserved,
  636. IN REFIID riid,
  637. OUT void ** ppObjectOpen);
  638. WINOLEAPI StgOpenStorageEx (IN const WCHAR* pwcsName,
  639. IN DWORD grfMode,
  640. IN DWORD stgfmt, // enum
  641. IN DWORD grfAttrs, // reserved
  642. IN STGOPTIONS * pStgOptions,
  643. IN void * reserved,
  644. IN REFIID riid,
  645. OUT void ** ppObjectOpen);
  646. //
  647. // Moniker APIs
  648. //
  649. WINOLEAPI BindMoniker(IN LPMONIKER pmk, IN DWORD grfOpt, IN REFIID iidResult, OUT LPVOID FAR* ppvResult);
  650. WINOLEAPI CoInstall(
  651. IN IBindCtx * pbc,
  652. IN DWORD dwFlags,
  653. IN uCLSSPEC * pClassSpec,
  654. IN QUERYCONTEXT * pQuery,
  655. IN LPWSTR pszCodeBase);
  656. WINOLEAPI CoGetObject(IN LPCWSTR pszName, IN BIND_OPTS *pBindOptions, IN REFIID riid, OUT void **ppv);
  657. WINOLEAPI MkParseDisplayName(IN LPBC pbc, IN LPCOLESTR szUserName,
  658. OUT ULONG FAR * pchEaten, OUT LPMONIKER FAR * ppmk);
  659. WINOLEAPI MonikerRelativePathTo(IN LPMONIKER pmkSrc, IN LPMONIKER pmkDest, OUT LPMONIKER
  660. FAR* ppmkRelPath, IN BOOL dwReserved);
  661. WINOLEAPI MonikerCommonPrefixWith(IN LPMONIKER pmkThis, IN LPMONIKER pmkOther,
  662. OUT LPMONIKER FAR* ppmkCommon);
  663. WINOLEAPI CreateBindCtx(IN DWORD reserved, OUT LPBC FAR* ppbc);
  664. WINOLEAPI CreateGenericComposite(IN LPMONIKER pmkFirst, IN LPMONIKER pmkRest,
  665. OUT LPMONIKER FAR* ppmkComposite);
  666. WINOLEAPI GetClassFile (IN LPCOLESTR szFilename, OUT CLSID FAR* pclsid);
  667. WINOLEAPI CreateClassMoniker(IN REFCLSID rclsid, OUT LPMONIKER FAR* ppmk);
  668. WINOLEAPI CreateFileMoniker(IN LPCOLESTR lpszPathName, OUT LPMONIKER FAR* ppmk);
  669. WINOLEAPI CreateItemMoniker(IN LPCOLESTR lpszDelim, IN LPCOLESTR lpszItem,
  670. OUT LPMONIKER FAR* ppmk);
  671. WINOLEAPI CreateAntiMoniker(OUT LPMONIKER FAR* ppmk);
  672. WINOLEAPI CreatePointerMoniker(IN LPUNKNOWN punk, OUT LPMONIKER FAR* ppmk);
  673. WINOLEAPI CreateObjrefMoniker(IN LPUNKNOWN punk, OUT LPMONIKER FAR * ppmk);
  674. WINOLEAPI GetRunningObjectTable( IN DWORD reserved, OUT LPRUNNINGOBJECTTABLE FAR* pprot);
  675. #include <urlmon.h>
  676. #include <propidl.h>
  677. //
  678. // Standard Progress Indicator impolementation
  679. //
  680. WINOLEAPI CreateStdProgressIndicator(IN HWND hwndParent,
  681. IN LPCOLESTR pszTitle,
  682. IN IBindStatusCallback * pIbscCaller,
  683. OUT IBindStatusCallback ** ppIbsc);
  684. #ifndef RC_INVOKED
  685. #include <poppack.h>
  686. #endif // RC_INVOKED
  687. #endif // __OBJBASE_H__