home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / OBJBASE.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  21KB  |  584 lines

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. //  File:       objbase.h
  7. //
  8. //  Contents:   Component object model defintions.
  9. //
  10. //----------------------------------------------------------------------------
  11.  
  12. #include <rpc.h>
  13. #include <rpcndr.h>
  14.  
  15. #if !defined( _OBJBASE_H_ )
  16. #define _OBJBASE_H_
  17.  
  18. #include <pshpack8.h>
  19.  
  20. // Component Object Model defines, and macros
  21.  
  22. #ifdef __cplusplus
  23.     #define EXTERN_C    extern "C"
  24. #else
  25.     #define EXTERN_C    extern
  26. #endif
  27.  
  28. #if defined (_WIN32) && !defined (__BORLANDC__)
  29.  
  30. // Win32 doesn't support __export
  31.  
  32. #define STDMETHODCALLTYPE       __stdcall
  33. #define STDMETHODVCALLTYPE      __cdecl
  34.  
  35. #define STDAPICALLTYPE          __stdcall
  36. #define STDAPIVCALLTYPE         __cdecl
  37.  
  38. #else
  39.  
  40. #define STDMETHODCALLTYPE       __export __stdcall
  41. #define STDMETHODVCALLTYPE      __export __cdecl
  42.  
  43. #define STDAPICALLTYPE          __export __stdcall
  44. #define STDAPIVCALLTYPE         __export __cdecl
  45.  
  46. #endif
  47.  
  48.  
  49. #define STDAPI                  EXTERN_C HRESULT STDAPICALLTYPE
  50. #define STDAPI_(type)           EXTERN_C type STDAPICALLTYPE
  51.  
  52. #define STDMETHODIMP            HRESULT STDMETHODCALLTYPE
  53. #define STDMETHODIMP_(type)     type STDMETHODCALLTYPE
  54.  
  55. // The 'V' versions allow Variable Argument lists.
  56.  
  57. #define STDAPIV                 EXTERN_C HRESULT STDAPIVCALLTYPE
  58. #define STDAPIV_(type)          EXTERN_C type STDAPIVCALLTYPE
  59.  
  60. #define STDMETHODIMPV           HRESULT STDMETHODVCALLTYPE
  61. #define STDMETHODIMPV_(type)    type STDMETHODVCALLTYPE
  62.  
  63. #ifdef _OLE32_
  64. #define WINOLEAPI        STDAPI
  65. #define WINOLEAPI_(type) STDAPI_(type)
  66. #else
  67. #define WINOLEAPI        EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  68. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  69. #endif
  70.  
  71. /****** Interface Declaration ***********************************************/
  72.  
  73. /*
  74.  *      These are macros for declaring interfaces.  They exist so that
  75.  *      a single definition of the interface is simulataneously a proper
  76.  *      declaration of the interface structures (C++ abstract classes)
  77.  *      for both C and C++.
  78.  *
  79.  *      DECLARE_INTERFACE(iface) is used to declare an interface that does
  80.  *      not derive from a base interface.
  81.  *      DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface
  82.  *      that does derive from a base interface.
  83.  *
  84.  *      By default if the source file has a .c extension the C version of
  85.  *      the interface declaratations will be expanded; if it has a .cpp
  86.  *      extension the C++ version will be expanded. if you want to force
  87.  *      the C version expansion even though the source file has a .cpp
  88.  *      extension, then define the macro "CINTERFACE".
  89.  *      eg.     cl -DCINTERFACE file.cpp
  90.  *
  91.  *      Example Interface declaration:
  92.  *
  93.  *          #undef  INTERFACE
  94.  *          #define INTERFACE   IClassFactory
  95.  *
  96.  *          DECLARE_INTERFACE_(IClassFactory, IUnknown)
  97.  *          {
  98.  *              // *** IUnknown methods ***
  99.  *              STDMETHOD(QueryInterface) (THIS_
  100.  *                                        REFIID riid,
  101.  *                                        LPVOID FAR* ppvObj) PURE;
  102.  *              STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  103.  *              STDMETHOD_(ULONG,Release) (THIS) PURE;
  104.  *
  105.  *              // *** IClassFactory methods ***
  106.  *              STDMETHOD(CreateInstance) (THIS_
  107.  *                                        LPUNKNOWN pUnkOuter,
  108.  *                                        REFIID riid,
  109.  *                                        LPVOID FAR* ppvObject) PURE;
  110.  *          };
  111.  *
  112.  *      Example C++ expansion:
  113.  *
  114.  *          struct FAR IClassFactory : public IUnknown
  115.  *          {
  116.  *              virtual HRESULT STDMETHODCALLTYPE QueryInterface(
  117.  *                                                  IID FAR& riid,
  118.  *                                                  LPVOID FAR* ppvObj) = 0;
  119.  *              virtual HRESULT STDMETHODCALLTYPE AddRef(void) = 0;
  120.  *              virtual HRESULT STDMETHODCALLTYPE Release(void) = 0;
  121.  *              virtual HRESULT STDMETHODCALLTYPE CreateInstance(
  122.  *                                              LPUNKNOWN pUnkOuter,
  123.  *                                              IID FAR& riid,
  124.  *                                              LPVOID FAR* ppvObject) = 0;
  125.  *          };
  126.  *
  127.  *          NOTE: Our documentation says '#define interface class' but we use
  128.  *          'struct' instead of 'class' to keep a lot of 'public:' lines
  129.  *          out of the interfaces.  The 'FAR' forces the 'this' pointers to
  130.  *          be far, which is what we need.
  131.  *
  132.  *      Example C expansion:
  133.  *
  134.  *          typedef struct IClassFactory
  135.  *          {
  136.  *              const struct IClassFactoryVtbl FAR* lpVtbl;
  137.  *          } IClassFactory;
  138.  *
  139.  *          typedef struct IClassFactoryVtbl IClassFactoryVtbl;
  140.  *
  141.  *          struct IClassFactoryVtbl
  142.  *          {
  143.  *              HRESULT (STDMETHODCALLTYPE * QueryInterface) (
  144.  *                                                  IClassFactory FAR* This,
  145.  *                                                  IID FAR* riid,
  146.  *                                                  LPVOID FAR* ppvObj) ;
  147.  *              HRESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ;
  148.  *              HRESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ;
  149.  *              HRESULT (STDMETHODCALLTYPE * CreateInstance) (
  150.  *                                                  IClassFactory FAR* This,
  151.  *                                                  LPUNKNOWN pUnkOuter,
  152.  *                                                  IID FAR* riid,
  153.  *                                                  LPVOID FAR* ppvObject);
  154.  *              HRESULT (STDMETHODCALLTYPE * LockServer) (
  155.  *                                                  IClassFactory FAR* This,
  156.  *                                                  BOOL fLock);
  157.  *          };
  158.  */
  159.  
  160.  
  161. #if defined(__cplusplus) && !defined(CINTERFACE)
  162. //#define interface               struct FAR
  163. #define interface struct
  164. #define STDMETHOD(method)       virtual HRESULT STDMETHODCALLTYPE method
  165. #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
  166. #ifndef RC_INVOKED
  167. #define PURE                    = 0
  168. #endif
  169. #define THIS_
  170. #define THIS                    void
  171. #define DECLARE_INTERFACE(iface)    interface iface
  172. #define DECLARE_INTERFACE_(iface, baseiface)    interface iface : public baseiface
  173.  
  174.  
  175.  
  176. #else
  177.  
  178. #define interface               struct
  179.  
  180. #define STDMETHOD(method)       HRESULT (STDMETHODCALLTYPE * method)
  181. #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method)
  182.  
  183.  
  184.  
  185.  
  186. #ifndef RC_INVOKED
  187. #define PURE
  188. #endif
  189. #define THIS_                   INTERFACE FAR* This,
  190. #define THIS                    INTERFACE FAR* This
  191. #ifdef CONST_VTABLE
  192. #define CONST_VTBL const
  193. #define DECLARE_INTERFACE(iface)    typedef interface iface { \
  194.                                     const struct iface##Vtbl FAR* lpVtbl; \
  195.                                 } iface; \
  196.                                 typedef const struct iface##Vtbl iface##Vtbl; \
  197.                                 const struct iface##Vtbl
  198. #else
  199. #define CONST_VTBL
  200. #define DECLARE_INTERFACE(iface)    typedef interface iface { \
  201.                                     struct iface##Vtbl FAR* lpVtbl; \
  202.                                 } iface; \
  203.                                 typedef struct iface##Vtbl iface##Vtbl; \
  204.                                 struct iface##Vtbl
  205. #endif
  206. #define DECLARE_INTERFACE_(iface, baseiface)    DECLARE_INTERFACE(iface)
  207.  
  208. #endif
  209.  
  210.  
  211.  
  212.  
  213. /****** Additional basic types **********************************************/
  214.  
  215.  
  216. #ifndef FARSTRUCT
  217. #ifdef __cplusplus
  218. #define FARSTRUCT   FAR
  219. #else
  220. #define FARSTRUCT
  221. #endif  // __cplusplus
  222. #endif  // FARSTRUCT
  223.  
  224.  
  225.  
  226. #ifndef HUGEP
  227. #ifdef _WIN32
  228. #define HUGEP
  229. #else
  230. #define HUGEP __huge
  231. #endif // _WIN32
  232. #endif // HUGEP
  233.  
  234.  
  235. #include <stdlib.h>
  236.  
  237. #if defined(_ANONYMOUS_STRUCT)
  238. #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
  239. #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
  240. #else
  241. #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v))
  242. #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v))
  243. #endif
  244.  
  245.  
  246. #define CLSCTX_ALL              (CLSCTX_INPROC_SERVER| \
  247.                                  CLSCTX_INPROC_HANDLER| \
  248.                                  CLSCTX_LOCAL_SERVER)
  249.  
  250. #define CLSCTX_INPROC           (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER)
  251.  
  252. #define CLSCTX_SERVER           (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER)
  253.  
  254.  
  255. // class registration flags; passed to CoRegisterClassObject
  256. typedef enum tagREGCLS
  257. {
  258.     REGCLS_SINGLEUSE = 0,       // class object only generates one instance
  259.     REGCLS_MULTIPLEUSE = 1,     // same class object genereates multiple inst.
  260.                                 // and local automatically goes into inproc tbl.
  261.     REGCLS_MULTI_SEPARATE = 2   // multiple use, but separate control over each
  262.                                 // context.
  263. } REGCLS;
  264.  
  265. // interface marshaling definitions
  266. #define MARSHALINTERFACE_MIN 500 // minimum number of bytes for interface marshl
  267.  
  268.  
  269. //
  270. // Common typedefs for paramaters used in Storage API's, gleamed from storage.h
  271. // Also contains Storage error codes, which should be moved into the storage
  272. // idl files.
  273. //
  274.  
  275.  
  276. #define CWCSTORAGENAME 32
  277.  
  278. /* Storage instantiation modes */
  279. #define STGM_DIRECT             0x00000000L
  280. #define STGM_TRANSACTED         0x00010000L
  281. #define STGM_SIMPLE             0x08000000L
  282.  
  283. #define STGM_READ               0x00000000L
  284. #define STGM_WRITE              0x00000001L
  285. #define STGM_READWRITE          0x00000002L
  286.  
  287. #define STGM_SHARE_DENY_NONE    0x00000040L
  288. #define STGM_SHARE_DENY_READ    0x00000030L
  289. #define STGM_SHARE_DENY_WRITE   0x00000020L
  290. #define STGM_SHARE_EXCLUSIVE    0x00000010L
  291.  
  292. #define STGM_PRIORITY           0x00040000L
  293. #define STGM_DELETEONRELEASE    0x04000000L
  294. #if (WINVER >= 400)
  295. #define STGM_NOSCRATCH          0x00100000L
  296. #endif /* WINVER */
  297.  
  298. #define STGM_CREATE             0x00001000L
  299. #define STGM_CONVERT            0x00020000L
  300. #define STGM_FAILIFTHERE        0x00000000L
  301.  
  302.  
  303. /* here is where we pull in the MIDL generated headers for the interfaces */
  304. typedef interface    IRpcStubBuffer     IRpcStubBuffer;
  305. typedef interface    IRpcChannelBuffer  IRpcChannelBuffer;
  306.  
  307. #include <wtypes.h>
  308. #include <unknwn.h>
  309. #include <objidl.h>
  310.  
  311.  
  312. // macros to define byte pattern for a GUID.
  313. //      Example: DEFINE_GUID(GUID_XXX, a, b, c, ...);
  314. //
  315. // Each dll/exe must initialize the GUIDs once.  This is done in one of
  316. // two ways.  If you are not using precompiled headers for the file(s) which
  317. // initializes the GUIDs, define INITGUID before including objbase.h.  This
  318. // is how OLE builds the initialized versions of the GUIDs which are included
  319. // in ole2.lib.  The GUIDs in ole2.lib are all defined in the same text
  320. // segment GUID_TEXT.
  321. //
  322. // The alternative (which some versions of the compiler don't handle properly;
  323. // they wind up with the initialized GUIDs in a data, not a text segment),
  324. // is to use a precompiled version of objbase.h and then include initguid.h
  325. // after objbase.h followed by one or more of the guid defintion files.
  326.  
  327. #ifndef INITGUID
  328. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  329.     EXTERN_C const GUID CDECL FAR name
  330. #else
  331.  
  332. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  333.         EXTERN_C const GUID CDECL name \
  334.                 = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
  335. #endif // INITGUID
  336.  
  337. #define DEFINE_OLEGUID(name, l, w1, w2) \
  338.     DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
  339.  
  340. #ifdef __cplusplus
  341. inline BOOL IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
  342. {
  343.     return !memcmp(&rguid1, &rguid2, sizeof(GUID));
  344. }
  345. #else   //  ! __cplusplus
  346. #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
  347. #endif  //  __cplusplus
  348.  
  349. #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
  350. #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
  351.  
  352. #ifdef __cplusplus
  353.  
  354. // because GUID is defined elsewhere in WIN32 land, the operator == and !=
  355. // are moved outside the class to global scope.
  356.  
  357. inline BOOL operator==(const GUID& guidOne, const GUID& guidOther)
  358. {
  359. #ifdef _WIN32
  360.     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
  361. #else
  362.     return !_fmemcmp(&guidOne,&guidOther,sizeof(GUID)); }
  363. #endif
  364. }
  365.  
  366. inline BOOL operator!=(const GUID& guidOne, const GUID& guidOther)
  367. {
  368.     return !(guidOne == guidOther);
  369. }
  370.  
  371. #endif // __cpluscplus
  372.  
  373.  
  374. #ifndef INITGUID
  375. #include <cguid.h>
  376. #endif
  377.  
  378.  
  379.  
  380. /****** STD Object API Prototypes *****************************************/
  381.  
  382. WINOLEAPI_(DWORD) CoBuildVersion( VOID );
  383.  
  384. /* init/uninit */
  385.  
  386. WINOLEAPI  CoInitialize(LPVOID pvReserved);
  387. WINOLEAPI_(void)  CoUninitialize(void);
  388. WINOLEAPI  CoGetMalloc(DWORD dwMemContext, LPMALLOC FAR* ppMalloc);
  389. WINOLEAPI_(DWORD) CoGetCurrentProcess(void);
  390. WINOLEAPI  CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
  391. WINOLEAPI  CoRevokeMallocSpy(void);
  392. WINOLEAPI  CoCreateStandardMalloc(DWORD memctx, IMalloc FAR* FAR* ppMalloc);
  393.  
  394. #if DBG == 1
  395. WINOLEAPI_(ULONG) DebugCoGetRpcFault( void );
  396. WINOLEAPI_(void) DebugCoSetRpcFault( ULONG );
  397. #endif
  398.  
  399. /* register/revoke/get class objects */
  400.  
  401. WINOLEAPI  CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved,
  402.                     REFIID riid, LPVOID FAR* ppv);
  403. WINOLEAPI  CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk,
  404.                     DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
  405. WINOLEAPI  CoRevokeClassObject(DWORD dwRegister);
  406.  
  407.  
  408. /* marshaling interface pointers */
  409.  
  410. WINOLEAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, LPUNKNOWN pUnk,
  411.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  412. WINOLEAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk,
  413.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  414. WINOLEAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID FAR* ppv);
  415. WINOLEAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
  416. WINOLEAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT FAR * phresult);
  417. WINOLEAPI CoReleaseMarshalData(LPSTREAM pStm);
  418. WINOLEAPI CoDisconnectObject(LPUNKNOWN pUnk, DWORD dwReserved);
  419. WINOLEAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
  420. WINOLEAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk,
  421.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags,
  422.                     LPMARSHAL FAR* ppMarshal);
  423.  
  424. WINOLEAPI_(BOOL) CoIsHandlerConnected(LPUNKNOWN pUnk);
  425. WINOLEAPI_(BOOL) CoHasStrongExternalConnections(LPUNKNOWN pUnk);
  426.  
  427. // Apartment model inter-thread interface passing helpers
  428. WINOLEAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk,
  429.                     LPSTREAM *ppStm);
  430.  
  431. WINOLEAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid,
  432.                     LPVOID FAR* ppv);
  433.  
  434. WINOLEAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN  punkOuter,
  435.                     LPUNKNOWN *ppunkMarshal);
  436.  
  437. /* dll loading helpers; keeps track of ref counts and unloads all on exit */
  438.  
  439. WINOLEAPI_(HINSTANCE) CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
  440. WINOLEAPI_(void) CoFreeLibrary(HINSTANCE hInst);
  441. WINOLEAPI_(void) CoFreeAllLibraries(void);
  442. WINOLEAPI_(void) CoFreeUnusedLibraries(void);
  443.  
  444.  
  445. /* helper for creating instances */
  446.  
  447. WINOLEAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
  448.                     DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv);
  449.  
  450.  
  451. /* other helpers */
  452.  
  453. WINOLEAPI StringFromCLSID(REFCLSID rclsid, LPOLESTR FAR* lplpsz);
  454. WINOLEAPI CLSIDFromString(LPOLESTR lpsz, LPCLSID pclsid);
  455. WINOLEAPI StringFromIID(REFIID rclsid, LPOLESTR FAR* lplpsz);
  456. WINOLEAPI IIDFromString(LPOLESTR lpsz, LPIID lpiid);
  457. WINOLEAPI_(BOOL) CoIsOle1Class(REFCLSID rclsid);
  458. WINOLEAPI ProgIDFromCLSID (REFCLSID clsid, LPOLESTR FAR* lplpszProgID);
  459. WINOLEAPI CLSIDFromProgID (LPCOLESTR lpszProgID, LPCLSID lpclsid);
  460. WINOLEAPI_(int) StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax);
  461.  
  462. WINOLEAPI CoCreateGuid(GUID FAR *pguid);
  463.  
  464. WINOLEAPI_(BOOL) CoFileTimeToDosDateTime(
  465.                  FILETIME FAR* lpFileTime, LPWORD lpDosDate, LPWORD lpDosTime);
  466. WINOLEAPI_(BOOL) CoDosDateTimeToFileTime(
  467.                        WORD nDosDate, WORD nDosTime, FILETIME FAR* lpFileTime);
  468. WINOLEAPI  CoFileTimeNow( FILETIME FAR* lpFileTime );
  469.  
  470.  
  471. WINOLEAPI CoRegisterMessageFilter( LPMESSAGEFILTER lpMessageFilter,
  472.                                 LPMESSAGEFILTER FAR* lplpMessageFilter );
  473.  
  474.  
  475. /* TreatAs APIS */
  476.  
  477. WINOLEAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
  478. WINOLEAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
  479.  
  480.  
  481. /* the server dlls must define their DllGetClassObject and DllCanUnloadNow
  482.  * to match these; the typedefs are located here to ensure all are changed at
  483.  * the same time.
  484.  */
  485.  
  486. #ifdef _MAC
  487. typedef STDAPICALLTYPE HRESULT (* LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  488. #else
  489. typedef HRESULT (STDAPICALLTYPE * LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  490. #endif
  491.  
  492. #ifdef _MAC
  493. typedef STDAPICALLTYPE HRESULT (* LPFNCANUNLOADNOW)(void);
  494. #else
  495. typedef HRESULT (STDAPICALLTYPE * LPFNCANUNLOADNOW)(void);
  496. #endif
  497.  
  498. STDAPI  DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID FAR* ppv);
  499.  
  500. STDAPI  DllCanUnloadNow(void);
  501.  
  502.  
  503. /****** Default Memory Allocation ******************************************/
  504. WINOLEAPI_(LPVOID) CoTaskMemAlloc(ULONG cb);
  505. WINOLEAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, ULONG cb);
  506. WINOLEAPI_(void)   CoTaskMemFree(LPVOID pv);
  507.  
  508. /****** DV APIs ***********************************************************/
  509.  
  510.  
  511. WINOLEAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER FAR* ppDAHolder);
  512.  
  513. WINOLEAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid,
  514.                                         REFIID iid, LPVOID FAR* ppv);
  515.  
  516.  
  517.  
  518.  
  519. /****** Storage API Prototypes ********************************************/
  520.  
  521.  
  522. WINOLEAPI StgCreateDocfile(const OLECHAR FAR* pwcsName,
  523.             DWORD grfMode,
  524.             DWORD reserved,
  525.             IStorage FAR * FAR *ppstgOpen);
  526.  
  527. WINOLEAPI StgCreateDocfileOnILockBytes(ILockBytes FAR *plkbyt,
  528.                     DWORD grfMode,
  529.                     DWORD reserved,
  530.                     IStorage FAR * FAR *ppstgOpen);
  531.  
  532. WINOLEAPI StgOpenStorage(const OLECHAR FAR* pwcsName,
  533.               IStorage FAR *pstgPriority,
  534.               DWORD grfMode,
  535.               SNB snbExclude,
  536.               DWORD reserved,
  537.               IStorage FAR * FAR *ppstgOpen);
  538. WINOLEAPI StgOpenStorageOnILockBytes(ILockBytes FAR *plkbyt,
  539.                   IStorage FAR *pstgPriority,
  540.                   DWORD grfMode,
  541.                   SNB snbExclude,
  542.                   DWORD reserved,
  543.                   IStorage FAR * FAR *ppstgOpen);
  544.  
  545. WINOLEAPI StgIsStorageFile(const OLECHAR FAR* pwcsName);
  546. WINOLEAPI StgIsStorageILockBytes(ILockBytes FAR* plkbyt);
  547.  
  548. WINOLEAPI StgSetTimes(OLECHAR const FAR* lpszName,
  549.                    FILETIME const FAR* pctime,
  550.                    FILETIME const FAR* patime,
  551.                    FILETIME const FAR* pmtime);
  552.  
  553.  
  554. //
  555. //  Moniker APIs
  556. //
  557.  
  558. WINOLEAPI  BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID FAR* ppvResult);
  559. WINOLEAPI  MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName,
  560.                 ULONG FAR * pchEaten, LPMONIKER FAR * ppmk);
  561. WINOLEAPI  MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER
  562.                 FAR* ppmkRelPath, BOOL dwReserved);
  563. WINOLEAPI  MonikerCommonPrefixWith(LPMONIKER pmkThis, LPMONIKER pmkOther,
  564.                 LPMONIKER FAR* ppmkCommon);
  565. WINOLEAPI  CreateBindCtx(DWORD reserved, LPBC FAR* ppbc);
  566. WINOLEAPI  CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest,
  567.     LPMONIKER FAR* ppmkComposite);
  568. WINOLEAPI  GetClassFile (LPCOLESTR szFilename, CLSID FAR* pclsid);
  569.  
  570. WINOLEAPI  CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER FAR* ppmk);
  571.  
  572. WINOLEAPI  CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem,
  573.     LPMONIKER FAR* ppmk);
  574. WINOLEAPI  CreateAntiMoniker(LPMONIKER FAR* ppmk);
  575. WINOLEAPI  CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER FAR* ppmk);
  576.  
  577. WINOLEAPI  GetRunningObjectTable( DWORD reserved, LPRUNNINGOBJECTTABLE FAR* pprot);
  578.  
  579. #ifndef RC_INVOKED
  580. #include <poppack.h>
  581. #endif // RC_INVOKED
  582.  
  583. #endif     // __OBJBASE_H__
  584.