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

  1. //--vsof.h---------------------------------------------------------------------
  2. //
  3. // Virtual Stream On File interface header file.
  4. //
  5. //
  6. // Copyright (C) Microsoft Corp., 1986-1996.  All Rights Reserved.
  7. //    
  8. //-----------------------------------------------------------------------------
  9.  
  10. #ifndef __VSOF_H__
  11. #define __VSOF_H__
  12.  
  13. /* VirtualStreamOnFile (VSOF) */
  14.  
  15. /*
  16.  *    Methods and #define's for implementing an OLE 2.0 storage stream
  17.  *    (as defined in the OLE 2.0 specs) on top of a system file.
  18.  */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. // Flags unique to VSOF IStream implementation
  25. #define VSOF_CLONEABLE      ((ULONG) 0x40000000)    // allow stream to be cloned
  26. #define VSOF_UNIQUEFILENAME    ((ULONG) 0x80000000)    // Want unique temporary file name
  27.  
  28. //$--HrOpenVirtualStreamOnFile---------------------------------------------------
  29. //
  30. // DESCRIPTION:    Opens a virtual (buffered) stream on a file.
  31. //
  32. // INPUT:    lpAllocateBuffer    --    allocate routine
  33. //            lpFreeBuffer    --    de-allocation routine
  34. //            ulFlags    --    IStream interface flags--see notes
  35. //            lpszFileName    --    file name with complete path
  36. //            lpszPrefix    --    file name prefix
  37. //            
  38. //
  39. // OUTPUT:    lppStream    --    stream pointer
  40. //
  41. // RETURNS:    HRESULT    --    NOERROR if successful,
  42. //                        E_INVALIDARG if bad input,
  43. //                        E_FAIL otherwise.
  44. //
  45. // ulFlag notes:
  46. //
  47. // Specifying STGM_DELETEONRELEASE makes the file opened a temporary file (It
  48. // will be deleted when the stream is released).
  49. //
  50. // Specifying STGM_SHARE_EXCLUSIVE makes the file accessible by only one application
  51. // at a time.
  52. //
  53. // Specifying STGM_SHARE_DENY_READ makes the file readable by only one application
  54. // at a time.
  55. //
  56. // Specifying STGM_SHARE_DENY_WRITE makes the file writable by only one application
  57. // at a time.
  58. //
  59. // Failing to specify a STGM_SHARE flag makes the file readable and writable
  60. // by mutliple applications at the same time.
  61. //
  62. //-----------------------------------------------------------------------------
  63. STDMETHODIMP HrOpenVirtualStreamOnFile(
  64.     IN LPALLOCATEBUFFER    lpAllocateBuffer,    // allocation routine
  65.     IN LPFREEBUFFER        lpFreeBuffer,        // de-allocation routine
  66.     IN ULONG            ulFlags,            // stream interface flags
  67.     IN LPSTR            lpszFileName,        // file name
  68.     IN LPSTR            lpszPrefix,            // file name prefix
  69.     OUT LPSTREAM FAR *    lppStream);            // pointer to stream
  70.  
  71. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENVIRTUALSTREAMONFILE) 
  72. (
  73.     LPALLOCATEBUFFER    lpAllocateBuffer,
  74.     LPFREEBUFFER        lpFreeBuffer,
  75.     ULONG                ulFlags,
  76.     LPSTR                lpszFileName,
  77.     LPSTR                lpszPrefix,
  78.     LPSTREAM FAR *        lppStream
  79. );
  80.  
  81. // Special virtual stream interface extensions for performance...
  82. // There are certain situations where knowing if the stream has changed can be
  83. // used to make desicions that will improve performance.
  84.  
  85. //$--VSOF_SetClean-------------------------------------------------------------
  86. //
  87. // DESCRIPTION:    Unsets stream dirty flag
  88. //
  89. // INPUT:    lpStream    --    stream pointer
  90. //
  91. // RETURNS:    HRESULT    --    NOERROF if successful,
  92. //                        E_INVALIDARG if bad input.
  93. //
  94. //-----------------------------------------------------------------------------
  95. HRESULT VSOF_SetClean(
  96.     IN LPSTREAM lpStream);    // stream pointer
  97.  
  98. //$--VSOF_IsDirty-------------------------------------------------------------
  99. //
  100. // DESCRIPTION:    Returns stream dirty flag
  101. //
  102. // INPUT:    lpStream    --    stream pointer
  103. //
  104. // RETURNS:    HRESULT    --    NOERROF if successful,
  105. //                        E_INVALIDARG if bad input.
  106. //
  107. //-----------------------------------------------------------------------------
  108. HRESULT VSOF_IsDirty(    
  109.     IN LPSTREAM lpStream,        // stream pointer
  110.     OUT BOOL * pfDirty);        // dirty flag pointer
  111.  
  112. #ifdef    WIN32
  113. #define OPENVIRTUALSTREAMONFILE "HrOpenVirtualStreamOnFile"
  114. #endif
  115. #ifdef    WIN16
  116. #define OPENVIRTUALSTREAMONFILE "_OPENVIRTUALSTREAMONFILE"
  117. #endif
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122.   
  123. #endif //__VSOF_H__
  124.