Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

851 lines
30 KiB

  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. #endif
  358. #if DBG == 1
  359. WINOLEAPI_(ULONG) DebugCoGetRpcFault( void );
  360. WINOLEAPI_(void) DebugCoSetRpcFault( ULONG );
  361. #endif
  362. /* COM+ APIs */
  363. WINOLEAPI CoGetObjectContext(IN REFIID riid, OUT LPVOID FAR* ppv);
  364. /* register/revoke/get class objects */
  365. WINOLEAPI CoGetClassObject(IN REFCLSID rclsid, IN DWORD dwClsContext, IN LPVOID pvReserved,
  366. IN REFIID riid, OUT LPVOID FAR* ppv);
  367. WINOLEAPI CoRegisterClassObject(IN REFCLSID rclsid, IN LPUNKNOWN pUnk,
  368. IN DWORD dwClsContext, IN DWORD flags, OUT LPDWORD lpdwRegister);
  369. WINOLEAPI CoRevokeClassObject(IN DWORD dwRegister);
  370. WINOLEAPI CoResumeClassObjects(void);
  371. WINOLEAPI CoSuspendClassObjects(void);
  372. WINOLEAPI_(ULONG) CoAddRefServerProcess(void);
  373. WINOLEAPI_(ULONG) CoReleaseServerProcess(void);
  374. WINOLEAPI CoGetPSClsid(IN REFIID riid, OUT CLSID *pClsid);
  375. WINOLEAPI CoRegisterPSClsid(IN REFIID riid, IN REFCLSID rclsid);
  376. // Registering surrogate processes
  377. WINOLEAPI CoRegisterSurrogate(IN LPSURROGATE pSurrogate);
  378. /* marshaling interface pointers */
  379. WINOLEAPI CoGetMarshalSizeMax(OUT ULONG *pulSize, IN REFIID riid, IN LPUNKNOWN pUnk,
  380. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags);
  381. WINOLEAPI CoMarshalInterface(IN LPSTREAM pStm, IN REFIID riid, IN LPUNKNOWN pUnk,
  382. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags);
  383. WINOLEAPI CoUnmarshalInterface(IN LPSTREAM pStm, IN REFIID riid, OUT LPVOID FAR* ppv);
  384. WINOLEAPI CoMarshalHresult(IN LPSTREAM pstm, IN HRESULT hresult);
  385. WINOLEAPI CoUnmarshalHresult(IN LPSTREAM pstm, OUT HRESULT FAR * phresult);
  386. WINOLEAPI CoReleaseMarshalData(IN LPSTREAM pStm);
  387. WINOLEAPI CoDisconnectObject(IN LPUNKNOWN pUnk, IN DWORD dwReserved);
  388. WINOLEAPI CoLockObjectExternal(IN LPUNKNOWN pUnk, IN BOOL fLock, IN BOOL fLastUnlockReleases);
  389. WINOLEAPI CoGetStandardMarshal(IN REFIID riid, IN LPUNKNOWN pUnk,
  390. IN DWORD dwDestContext, IN LPVOID pvDestContext, IN DWORD mshlflags,
  391. OUT LPMARSHAL FAR* ppMarshal);
  392. WINOLEAPI CoGetStdMarshalEx(IN LPUNKNOWN pUnkOuter, IN DWORD smexflags,
  393. OUT LPUNKNOWN FAR* ppUnkInner);
  394. /* flags for CoGetStdMarshalEx */
  395. typedef enum tagSTDMSHLFLAGS
  396. {
  397. SMEXF_SERVER = 0x01, // server side aggregated std marshaler
  398. SMEXF_HANDLER = 0x02 // client side (handler) agg std marshaler
  399. } STDMSHLFLAGS;
  400. WINOLEAPI_(BOOL) CoIsHandlerConnected(IN LPUNKNOWN pUnk);
  401. // Apartment model inter-thread interface passing helpers
  402. WINOLEAPI CoMarshalInterThreadInterfaceInStream(IN REFIID riid, IN LPUNKNOWN pUnk,
  403. OUT LPSTREAM *ppStm);
  404. WINOLEAPI CoGetInterfaceAndReleaseStream(IN LPSTREAM pStm, IN REFIID iid,
  405. OUT LPVOID FAR* ppv);
  406. WINOLEAPI CoCreateFreeThreadedMarshaler(IN LPUNKNOWN punkOuter,
  407. OUT LPUNKNOWN *ppunkMarshal);
  408. /* dll loading helpers; keeps track of ref counts and unloads all on exit */
  409. WINOLEAPI_(HINSTANCE) CoLoadLibrary(IN LPOLESTR lpszLibName, IN BOOL bAutoFree);
  410. WINOLEAPI_(void) CoFreeLibrary(IN HINSTANCE hInst);
  411. WINOLEAPI_(void) CoFreeAllLibraries(void);
  412. WINOLEAPI_(void) CoFreeUnusedLibraries(void);
  413. #if (_WIN32_WINNT >= 0x0501 )
  414. WINOLEAPI_(void) CoFreeUnusedLibrariesEx(IN DWORD dwUnloadDelay, IN DWORD dwReserved);
  415. #endif
  416. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  417. /* Call Security. */
  418. WINOLEAPI CoInitializeSecurity(
  419. IN PSECURITY_DESCRIPTOR pSecDesc,
  420. IN LONG cAuthSvc,
  421. IN SOLE_AUTHENTICATION_SERVICE *asAuthSvc,
  422. IN void *pReserved1,
  423. IN DWORD dwAuthnLevel,
  424. IN DWORD dwImpLevel,
  425. IN void *pAuthList,
  426. IN DWORD dwCapabilities,
  427. IN void *pReserved3 );
  428. WINOLEAPI CoGetCallContext( IN REFIID riid, OUT void **ppInterface );
  429. WINOLEAPI CoQueryProxyBlanket(
  430. IN IUnknown *pProxy,
  431. OUT DWORD *pwAuthnSvc,
  432. OUT DWORD *pAuthzSvc,
  433. OUT OLECHAR **pServerPrincName,
  434. OUT DWORD *pAuthnLevel,
  435. OUT DWORD *pImpLevel,
  436. OUT RPC_AUTH_IDENTITY_HANDLE *pAuthInfo,
  437. OUT DWORD *pCapabilites );
  438. WINOLEAPI CoSetProxyBlanket(
  439. IN IUnknown *pProxy,
  440. IN DWORD dwAuthnSvc,
  441. IN DWORD dwAuthzSvc,
  442. IN OLECHAR *pServerPrincName,
  443. IN DWORD dwAuthnLevel,
  444. IN DWORD dwImpLevel,
  445. IN RPC_AUTH_IDENTITY_HANDLE pAuthInfo,
  446. IN DWORD dwCapabilities );
  447. WINOLEAPI CoCopyProxy(
  448. IN IUnknown *pProxy,
  449. OUT IUnknown **ppCopy );
  450. WINOLEAPI CoQueryClientBlanket(
  451. OUT DWORD *pAuthnSvc,
  452. OUT DWORD *pAuthzSvc,
  453. OUT OLECHAR **pServerPrincName,
  454. OUT DWORD *pAuthnLevel,
  455. OUT DWORD *pImpLevel,
  456. OUT RPC_AUTHZ_HANDLE *pPrivs,
  457. OUT DWORD *pCapabilities );
  458. WINOLEAPI CoImpersonateClient();
  459. WINOLEAPI CoRevertToSelf();
  460. WINOLEAPI CoQueryAuthenticationServices(
  461. OUT DWORD *pcAuthSvc,
  462. OUT SOLE_AUTHENTICATION_SERVICE **asAuthSvc );
  463. WINOLEAPI CoSwitchCallContext( IN IUnknown *pNewObject, OUT IUnknown **ppOldObject );
  464. #define COM_RIGHTS_EXECUTE 1
  465. #define COM_RIGHTS_SAFE_FOR_SCRIPTING 2
  466. #endif // DCOM
  467. /* helper for creating instances */
  468. WINOLEAPI CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
  469. IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv);
  470. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  471. WINOLEAPI CoGetInstanceFromFile(
  472. IN COSERVERINFO * pServerInfo,
  473. IN CLSID * pClsid,
  474. IN IUnknown * punkOuter, // only relevant locally
  475. IN DWORD dwClsCtx,
  476. IN DWORD grfMode,
  477. IN OLECHAR * pwszName,
  478. IN DWORD dwCount,
  479. IN OUT MULTI_QI * pResults );
  480. WINOLEAPI CoGetInstanceFromIStorage(
  481. IN COSERVERINFO * pServerInfo,
  482. IN CLSID * pClsid,
  483. IN IUnknown * punkOuter, // only relevant locally
  484. IN DWORD dwClsCtx,
  485. IN struct IStorage * pstg,
  486. IN DWORD dwCount,
  487. IN OUT MULTI_QI * pResults );
  488. WINOLEAPI CoCreateInstanceEx(
  489. IN REFCLSID Clsid,
  490. IN IUnknown * punkOuter, // only relevant locally
  491. IN DWORD dwClsCtx,
  492. IN COSERVERINFO * pServerInfo,
  493. IN DWORD dwCount,
  494. IN OUT MULTI_QI * pResults );
  495. #endif // DCOM
  496. /* Call related APIs */
  497. #if (_WIN32_WINNT >= 0x0500 ) || defined(_WIN32_DCOM) // DCOM
  498. WINOLEAPI CoGetCancelObject(IN DWORD dwThreadId, IN REFIID iid, OUT void **ppUnk);
  499. WINOLEAPI CoSetCancelObject(IN IUnknown *pUnk);
  500. WINOLEAPI CoCancelCall(IN DWORD dwThreadId, IN ULONG ulTimeout);
  501. WINOLEAPI CoTestCancel();
  502. WINOLEAPI CoEnableCallCancellation(IN LPVOID pReserved);
  503. WINOLEAPI CoDisableCallCancellation(IN LPVOID pReserved);
  504. WINOLEAPI CoAllowSetForegroundWindow(IN IUnknown *pUnk, IN LPVOID lpvReserved);
  505. WINOLEAPI DcomChannelSetHResult(IN LPVOID pvReserved, IN ULONG* pulReserved, IN HRESULT appsHR);
  506. #endif
  507. /* other helpers */
  508. WINOLEAPI StringFromCLSID(IN REFCLSID rclsid, OUT LPOLESTR FAR* lplpsz);
  509. WINOLEAPI CLSIDFromString(IN LPOLESTR lpsz, OUT LPCLSID pclsid);
  510. WINOLEAPI StringFromIID(IN REFIID rclsid, OUT LPOLESTR FAR* lplpsz);
  511. WINOLEAPI IIDFromString(IN LPOLESTR lpsz, OUT LPIID lpiid);
  512. WINOLEAPI_(BOOL) CoIsOle1Class(IN REFCLSID rclsid);
  513. WINOLEAPI ProgIDFromCLSID (IN REFCLSID clsid, OUT LPOLESTR FAR* lplpszProgID);
  514. WINOLEAPI CLSIDFromProgID (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid);
  515. WINOLEAPI CLSIDFromProgIDEx (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid);
  516. WINOLEAPI_(int) StringFromGUID2(IN REFGUID rguid, OUT LPOLESTR lpsz, IN int cchMax);
  517. WINOLEAPI CoCreateGuid(OUT GUID FAR *pguid);
  518. WINOLEAPI_(BOOL) CoFileTimeToDosDateTime(
  519. IN FILETIME FAR* lpFileTime, OUT LPWORD lpDosDate, OUT LPWORD lpDosTime);
  520. WINOLEAPI_(BOOL) CoDosDateTimeToFileTime(
  521. IN WORD nDosDate, IN WORD nDosTime, OUT FILETIME FAR* lpFileTime);
  522. WINOLEAPI CoFileTimeNow( OUT FILETIME FAR* lpFileTime );
  523. WINOLEAPI CoRegisterMessageFilter( IN LPMESSAGEFILTER lpMessageFilter,
  524. OUT LPMESSAGEFILTER FAR* lplpMessageFilter );
  525. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  526. WINOLEAPI CoRegisterChannelHook( IN REFGUID ExtensionUuid, IN IChannelHook *pChannelHook );
  527. #endif // DCOM
  528. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  529. /* Synchronization API */
  530. WINOLEAPI CoWaitForMultipleHandles (IN DWORD dwFlags,
  531. IN DWORD dwTimeout,
  532. IN ULONG cHandles,
  533. IN LPHANDLE pHandles,
  534. OUT LPDWORD lpdwindex);
  535. /* Flags for Synchronization API and Classes */
  536. typedef enum tagCOWAIT_FLAGS
  537. {
  538. COWAIT_WAITALL = 1,
  539. COWAIT_ALERTABLE = 2
  540. }COWAIT_FLAGS;
  541. #endif // DCOM
  542. /* TreatAs APIS */
  543. WINOLEAPI CoGetTreatAsClass(IN REFCLSID clsidOld, OUT LPCLSID pClsidNew);
  544. WINOLEAPI CoTreatAsClass(IN REFCLSID clsidOld, IN REFCLSID clsidNew);
  545. /* the server dlls must define their DllGetClassObject and DllCanUnloadNow
  546. * to match these; the typedefs are located here to ensure all are changed at
  547. * the same time.
  548. */
  549. //#ifdef _MAC
  550. //typedef STDAPICALLTYPE HRESULT (* LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  551. //#else
  552. typedef HRESULT (STDAPICALLTYPE * LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  553. //#endif
  554. //#ifdef _MAC
  555. //typedef STDAPICALLTYPE HRESULT (* LPFNCANUNLOADNOW)(void);
  556. //#else
  557. typedef HRESULT (STDAPICALLTYPE * LPFNCANUNLOADNOW)(void);
  558. //#endif
  559. STDAPI DllGetClassObject(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID FAR* ppv);
  560. STDAPI DllCanUnloadNow(void);
  561. /****** Default Memory Allocation ******************************************/
  562. WINOLEAPI_(LPVOID) CoTaskMemAlloc(IN SIZE_T cb);
  563. WINOLEAPI_(LPVOID) CoTaskMemRealloc(IN LPVOID pv, IN SIZE_T cb);
  564. WINOLEAPI_(void) CoTaskMemFree(IN LPVOID pv);
  565. /****** DV APIs ***********************************************************/
  566. WINOLEAPI CreateDataAdviseHolder(OUT LPDATAADVISEHOLDER FAR* ppDAHolder);
  567. WINOLEAPI CreateDataCache(IN LPUNKNOWN pUnkOuter, IN REFCLSID rclsid,
  568. IN REFIID iid, OUT LPVOID FAR* ppv);
  569. /****** Storage API Prototypes ********************************************/
  570. WINOLEAPI StgCreateDocfile(IN const OLECHAR FAR* pwcsName,
  571. IN DWORD grfMode,
  572. IN DWORD reserved,
  573. OUT IStorage FAR * FAR *ppstgOpen);
  574. WINOLEAPI StgCreateDocfileOnILockBytes(IN ILockBytes FAR *plkbyt,
  575. IN DWORD grfMode,
  576. IN DWORD reserved,
  577. OUT IStorage FAR * FAR *ppstgOpen);
  578. WINOLEAPI StgOpenStorage(IN const OLECHAR FAR* pwcsName,
  579. IN IStorage FAR *pstgPriority,
  580. IN DWORD grfMode,
  581. IN SNB snbExclude,
  582. IN DWORD reserved,
  583. OUT IStorage FAR * FAR *ppstgOpen);
  584. WINOLEAPI StgOpenStorageOnILockBytes(IN ILockBytes FAR *plkbyt,
  585. IN IStorage FAR *pstgPriority,
  586. IN DWORD grfMode,
  587. IN SNB snbExclude,
  588. IN DWORD reserved,
  589. OUT IStorage FAR * FAR *ppstgOpen);
  590. WINOLEAPI StgIsStorageFile(IN const OLECHAR FAR* pwcsName);
  591. WINOLEAPI StgIsStorageILockBytes(IN ILockBytes FAR* plkbyt);
  592. WINOLEAPI StgSetTimes(IN OLECHAR const FAR* lpszName,
  593. IN FILETIME const FAR* pctime,
  594. IN FILETIME const FAR* patime,
  595. IN FILETIME const FAR* pmtime);
  596. WINOLEAPI StgOpenAsyncDocfileOnIFillLockBytes( IN IFillLockBytes *pflb,
  597. IN DWORD grfMode,
  598. IN DWORD asyncFlags,
  599. OUT IStorage **ppstgOpen);
  600. WINOLEAPI StgGetIFillLockBytesOnILockBytes( IN ILockBytes *pilb,
  601. OUT IFillLockBytes **ppflb);
  602. WINOLEAPI StgGetIFillLockBytesOnFile(IN OLECHAR const *pwcsName,
  603. OUT IFillLockBytes **ppflb);
  604. WINOLEAPI StgOpenLayoutDocfile(IN OLECHAR const *pwcsDfName,
  605. IN DWORD grfMode,
  606. IN DWORD reserved,
  607. OUT IStorage **ppstgOpen);
  608. // STG initialization options for StgCreateStorageEx and StgOpenStorageEx
  609. #define STGOPTIONS_VERSION 2
  610. typedef struct tagSTGOPTIONS
  611. {
  612. USHORT usVersion; // Versions 1 and 2 supported
  613. USHORT reserved; // must be 0 for padding
  614. ULONG ulSectorSize; // docfile header sector size (512)
  615. const WCHAR *pwcsTemplateFile; // version 2 or above
  616. } STGOPTIONS;
  617. WINOLEAPI StgCreateStorageEx (IN const WCHAR* pwcsName,
  618. IN DWORD grfMode,
  619. IN DWORD stgfmt, // enum
  620. IN DWORD grfAttrs, // reserved
  621. IN STGOPTIONS * pStgOptions,
  622. IN void * reserved,
  623. IN REFIID riid,
  624. OUT void ** ppObjectOpen);
  625. WINOLEAPI StgOpenStorageEx (IN const WCHAR* pwcsName,
  626. IN DWORD grfMode,
  627. IN DWORD stgfmt, // enum
  628. IN DWORD grfAttrs, // reserved
  629. IN STGOPTIONS * pStgOptions,
  630. IN void * reserved,
  631. IN REFIID riid,
  632. OUT void ** ppObjectOpen);
  633. //
  634. // Moniker APIs
  635. //
  636. WINOLEAPI BindMoniker(IN LPMONIKER pmk, IN DWORD grfOpt, IN REFIID iidResult, OUT LPVOID FAR* ppvResult);
  637. WINOLEAPI CoInstall(
  638. IN IBindCtx * pbc,
  639. IN DWORD dwFlags,
  640. IN uCLSSPEC * pClassSpec,
  641. IN QUERYCONTEXT * pQuery,
  642. IN LPWSTR pszCodeBase);
  643. WINOLEAPI CoGetObject(IN LPCWSTR pszName, IN BIND_OPTS *pBindOptions, IN REFIID riid, OUT void **ppv);
  644. WINOLEAPI MkParseDisplayName(IN LPBC pbc, IN LPCOLESTR szUserName,
  645. OUT ULONG FAR * pchEaten, OUT LPMONIKER FAR * ppmk);
  646. WINOLEAPI MonikerRelativePathTo(IN LPMONIKER pmkSrc, IN LPMONIKER pmkDest, OUT LPMONIKER
  647. FAR* ppmkRelPath, IN BOOL dwReserved);
  648. WINOLEAPI MonikerCommonPrefixWith(IN LPMONIKER pmkThis, IN LPMONIKER pmkOther,
  649. OUT LPMONIKER FAR* ppmkCommon);
  650. WINOLEAPI CreateBindCtx(IN DWORD reserved, OUT LPBC FAR* ppbc);
  651. WINOLEAPI CreateGenericComposite(IN LPMONIKER pmkFirst, IN LPMONIKER pmkRest,
  652. OUT LPMONIKER FAR* ppmkComposite);
  653. WINOLEAPI GetClassFile (IN LPCOLESTR szFilename, OUT CLSID FAR* pclsid);
  654. WINOLEAPI CreateClassMoniker(IN REFCLSID rclsid, OUT LPMONIKER FAR* ppmk);
  655. WINOLEAPI CreateFileMoniker(IN LPCOLESTR lpszPathName, OUT LPMONIKER FAR* ppmk);
  656. WINOLEAPI CreateItemMoniker(IN LPCOLESTR lpszDelim, IN LPCOLESTR lpszItem,
  657. OUT LPMONIKER FAR* ppmk);
  658. WINOLEAPI CreateAntiMoniker(OUT LPMONIKER FAR* ppmk);
  659. WINOLEAPI CreatePointerMoniker(IN LPUNKNOWN punk, OUT LPMONIKER FAR* ppmk);
  660. WINOLEAPI CreateObjrefMoniker(IN LPUNKNOWN punk, OUT LPMONIKER FAR * ppmk);
  661. WINOLEAPI GetRunningObjectTable( IN DWORD reserved, OUT LPRUNNINGOBJECTTABLE FAR* pprot);
  662. #include <urlmon.h>
  663. #include <propidl.h>
  664. //
  665. // Standard Progress Indicator impolementation
  666. //
  667. WINOLEAPI CreateStdProgressIndicator(IN HWND hwndParent,
  668. IN LPCOLESTR pszTitle,
  669. IN IBindStatusCallback * pIbscCaller,
  670. OUT IBindStatusCallback ** ppIbsc);
  671. #ifndef RC_INVOKED
  672. #include <poppack.h>
  673. #endif // RC_INVOKED
  674. #endif // __OBJBASE_H__