home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / vsop.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  5KB  |  163 lines

  1. //--vsop.h-----------------------------------------------------------------
  2. //
  3. // Header file for the property stream wrapper class.
  4. //
  5. // Copyright (C) Microsoft Corp., 1986-1996.  All rights reserved.
  6. //
  7. //-----------------------------------------------------------------------------
  8.  
  9. #ifndef _VSOP_H
  10. #define _VSOP_H
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. //$--IEDKVirtualStreamOnProperty---------------------------------------------------------
  17. //
  18. // Buffers access to a property stream
  19. //
  20. //----------------------------------------------------------------------------
  21.  
  22. #undef         INTERFACE
  23. #define         INTERFACE  IEDKVirtualStreamOnProperty
  24.  
  25. DECLARE_INTERFACE_(IEDKVirtualStreamOnProperty, IUnknown)
  26. {
  27.     // Notes:  Order IS important.  The IEDKVirtualStreamOnProperty interface
  28.     // must have the same vtable order as the IStream interface.
  29.     //
  30.     // The Read(), Write(), CopyTo() and Commit() methods will return
  31.     // MAPI_E_* error codes if an attempt to access the underlying property
  32.     // fails.  Otherwise, the IStream methods will return IStream STG_E_* errors.
  33.      
  34. #ifndef NO_BASEINTERFACE_FUNCS
  35.  
  36.     /* IUnknown methods */
  37.  
  38.     STDMETHOD(QueryInterface)(
  39.         THIS_
  40.         REFIID riid,
  41.         LPVOID * ppvObj
  42.         )                                        PURE;
  43.  
  44.     STDMETHOD_(ULONG, AddRef)(
  45.         THIS
  46.         )                                        PURE;
  47.  
  48.     STDMETHOD_(ULONG, Release)(
  49.         THIS
  50.         )                                        PURE;
  51.  
  52. #endif
  53.  
  54.     // IEDKVirtualStreamOnProperty methods (same as IStream methods)
  55.  
  56.     STDMETHOD(Read)(
  57.         THIS_
  58.         IN LPVOID pv,       // output buffer pointer
  59.         IN ULONG cb,        // maximum # of bytes to read
  60.         OUT ULONG * pcb     // # of bytes read
  61.         )                                                    PURE;
  62.  
  63.     STDMETHOD(Write)(
  64.         THIS_
  65.         IN VOID const * pv, // data to write
  66.         IN ULONG cb,        // # bytes to write
  67.         OUT ULONG *pcb      // # bytes written
  68.         )                                                    PURE;
  69.  
  70.     STDMETHOD(Seek)(
  71.         THIS_
  72.         IN LARGE_INTEGER cbOffset,      // byte offset
  73.         IN DWORD dwOrigin,              // origin
  74.         OUT ULARGE_INTEGER * pcbPos     // new position
  75.         )                                                    PURE;
  76.  
  77.     STDMETHOD(SetSize)(
  78.         THIS_
  79.         IN ULARGE_INTEGER nSize     // new size
  80.         )                                                    PURE;
  81.  
  82.     STDMETHOD(CopyTo)(
  83.         THIS_
  84.         IN LPSTREAM pStrm,              // destination stream pointer
  85.         IN ULARGE_INTEGER cb,           // # bytes to copy
  86.         OUT ULARGE_INTEGER * pcbRead,   // # bytes read
  87.         OUT ULARGE_INTEGER * pcbWritten // # bytes written
  88.         )                                                    PURE;
  89.  
  90.     STDMETHOD(Commit)(
  91.         THIS_
  92.         IN DWORD dwFlags    // flags
  93.         )                                                    PURE;
  94.  
  95.     STDMETHOD(Revert)(
  96.         THIS
  97.         )                                                    PURE;
  98.  
  99.     STDMETHOD(LockRegion)(
  100.         THIS_
  101.         IN ULARGE_INTEGER cbOffset, // offset
  102.         IN ULARGE_INTEGER cbLength, // length
  103.         IN DWORD dwFlags            // flags
  104.         )                                                    PURE;
  105.  
  106.     STDMETHOD(UnlockRegion)(
  107.         THIS_
  108.         IN ULARGE_INTEGER cbOffset, // offset
  109.         IN ULARGE_INTEGER cbLength, // length
  110.         IN DWORD dwFlags            // flags
  111.         )                                                    PURE;
  112.  
  113.     STDMETHOD(Stat)(
  114.         THIS_
  115.         OUT STATSTG * pStatStg,     // stream statistic pointer
  116.         IN DWORD dwFlags            // flags
  117.         )                                                    PURE;
  118.  
  119.     STDMETHOD(Clone)(
  120.         THIS_
  121.         OUT LPSTREAM * ppStrm       // pointer to new stream
  122.         )                                                    PURE;
  123.  
  124. };
  125.  
  126. //$--PVIRTUALSTREAMONPROPERTY-----------------------------------------------------------
  127. //
  128. // Pointer to IEDKVirtualStreamOnProperty interface.
  129. //
  130. //----------------------------------------------------------------------------
  131.  
  132. typedef IEDKVirtualStreamOnProperty * PVIRTUALSTREAMONPROPERTY;
  133.  
  134. //$--HrOpenVirtualStreamOnProperty------------------------------------------
  135. //
  136. // DESCRIPTION:
  137. // API to open a buffered stream on a binary or string property
  138. // Callable from "C" or "C++"
  139. //
  140. // INPUT:    pPropObject    --    MAPI property object pointer
  141. //            ulPropTag    --    property tag to open stream on
  142. //            ulFlags        --    MAPI property flags (MAPI_MODIFY, MAPI_CREATE)
  143. //
  144. // OUTPUT:    ppVirtualStreamOnProperty    --     pointer to buffered stream on property
  145. //
  146. // RETURNS:    HRESULT    --    NOERROR if successful,
  147. //                        E_INVALIDARG if bad input,
  148. //                        E_OUTOFMEMORY if memory problems,
  149. //                        E_FAIL otherwise
  150. //
  151. //-----------------------------------------------------------------------------
  152. STDAPI HrOpenVirtualStreamOnProperty(
  153.     IN LPMAPIPROP pPropObject,    // MAPI property object pointer
  154.     IN ULONG ulPropTag,         // property tag to open virtual stream on
  155.     IN ULONG ulFlags,            // MAPI property flags
  156.     OUT PVIRTUALSTREAMONPROPERTY * ppVirtualStreamOnProperty);  // pointer buffered stream
  157.  
  158. #ifdef __cplusplus
  159. }
  160. #endif
  161.  
  162. #endif
  163.