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.

97 lines
2.7 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: stream.hxx
  4. //
  5. // Contents: Stream class on a file.
  6. //
  7. // Classes: CStreamOnFile
  8. //
  9. // History: 08-08-95 Rickhi Created
  10. //
  11. //--------------------------------------------------------------------
  12. #ifndef __STREAMONFILE_HXX__
  13. #define __STREAMONFILE_HXX__
  14. //+-------------------------------------------------------------------
  15. //
  16. // Class: CStreamOnFile
  17. //
  18. // Purpose: Stream wrapper for a flat file.
  19. //
  20. // History: 30-Jan-93 Ricksa Created
  21. //
  22. //--------------------------------------------------------------------
  23. class CStreamOnFile : public IStream
  24. {
  25. public:
  26. CStreamOnFile(const TCHAR *pwszFileName, SCODE &sc, BOOL fRead);
  27. ~CStreamOnFile(void);
  28. STDMETHOD(QueryInterface)(
  29. REFIID iidInterface,
  30. void FAR* FAR* ppvObj);
  31. STDMETHOD_(ULONG,AddRef)(void);
  32. STDMETHOD_(ULONG,Release)(void);
  33. STDMETHOD(Read)(
  34. VOID HUGEP* pv,
  35. ULONG cb,
  36. ULONG FAR* pcbRead);
  37. STDMETHOD(Write)(
  38. VOID const HUGEP* pv,
  39. ULONG cb,
  40. ULONG FAR* pcbWritten);
  41. STDMETHOD(Seek)(
  42. LARGE_INTEGER dlibMove,
  43. DWORD dwOrigin,
  44. ULARGE_INTEGER FAR* plibNewPosition);
  45. STDMETHOD(SetSize) (ULARGE_INTEGER cb);
  46. STDMETHOD(CopyTo)(
  47. IStream FAR* pstm,
  48. ULARGE_INTEGER cb,
  49. ULARGE_INTEGER FAR* pcbRead,
  50. ULARGE_INTEGER FAR* pcbWritten);
  51. STDMETHOD(Commit)(DWORD grfCommitFlags);
  52. STDMETHOD(Revert)(void);
  53. STDMETHOD(LockRegion)(
  54. ULARGE_INTEGER libOffset,
  55. ULARGE_INTEGER cb,
  56. DWORD dwLockType);
  57. STDMETHOD(UnlockRegion)(
  58. ULARGE_INTEGER libOffset,
  59. ULARGE_INTEGER cb,
  60. DWORD dwLockType);
  61. STDMETHOD(Stat)(
  62. STATSTG FAR* pstatstg,
  63. DWORD statflag);
  64. STDMETHOD(Clone)(IStream FAR * FAR *ppstm);
  65. private:
  66. LONG _clRefs; // reference count
  67. HANDLE _hFile; // file handle
  68. BOOL _fRead; // read or write side
  69. ULONG _lOffset; // current seek ptr
  70. ULONG _cSize; // number of bytes written
  71. ULONG _cbData; // size of data
  72. BYTE *_pbData; // ptr to data
  73. };
  74. #endif // _STREAMONFILE_HXX__
  75.