Leaked source code of windows server 2003
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.

971 lines
35 KiB

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