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.

80 lines
3.4 KiB

  1. // --------------------------------------------------------------------------------
  2. // Vstream.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Ronald E. Gray
  5. // --------------------------------------------------------------------------------
  6. #ifndef __VSTREAM_H
  7. #define __VSTREAM_H
  8. // --------------------------------------------------------------------------------
  9. // CVirtualStream
  10. // --------------------------------------------------------------------------------
  11. class CVirtualStream : public IStream
  12. {
  13. private:
  14. ULONG m_cRef; // Reference count
  15. DWORD m_cbSize; // Current size of the stream
  16. DWORD m_cbCommitted; // Amount of virtual space committed
  17. DWORD m_cbAlloc; // Amount of virtual space reserved
  18. DWORD m_dwOffset; // Current location in stream
  19. IStream * m_pstm; // File backed stream for overflow
  20. LPBYTE m_pb; // pointer to memory part of stream
  21. BOOL m_fFileErr; // the pointer in the file stream may not
  22. // be in sync with our pointer. Try to sync
  23. // before any other operation.
  24. CRITICAL_SECTION m_cs; // Thread Safety
  25. // -------------------------------------------------------------------------
  26. // Utilities
  27. // -------------------------------------------------------------------------
  28. HRESULT SyncFileStream();
  29. public:
  30. // -------------------------------------------------------------------------
  31. // Construction
  32. // -------------------------------------------------------------------------
  33. CVirtualStream(void);
  34. ~CVirtualStream(void);
  35. // -------------------------------------------------------------------------
  36. // IUnknown
  37. // -------------------------------------------------------------------------
  38. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  39. STDMETHODIMP_(ULONG) AddRef(void);
  40. STDMETHODIMP_(ULONG) Release(void);
  41. // -------------------------------------------------------------------------
  42. // IStream
  43. // -------------------------------------------------------------------------
  44. #ifndef WIN16
  45. STDMETHODIMP Read(LPVOID, ULONG, ULONG *);
  46. #else
  47. STDMETHODIMP Read (VOID HUGEP *, ULONG, ULONG*);
  48. #endif // !WIN16
  49. STDMETHODIMP Seek(LARGE_INTEGER, DWORD, ULARGE_INTEGER *);
  50. #ifndef WIN16
  51. STDMETHODIMP Write(const void *, ULONG, ULONG *);
  52. #else
  53. STDMETHODIMP Write (const void HUGEP *, ULONG, ULONG*);
  54. #endif // !WIN16
  55. STDMETHODIMP Stat(STATSTG *, DWORD);
  56. STDMETHODIMP Commit(DWORD) {
  57. return S_OK; }
  58. STDMETHODIMP SetSize(ULARGE_INTEGER);
  59. STDMETHODIMP CopyTo(LPSTREAM, ULARGE_INTEGER, ULARGE_INTEGER *, ULARGE_INTEGER *);
  60. STDMETHODIMP Revert(void) {
  61. return E_NOTIMPL; }
  62. STDMETHODIMP LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  63. return E_NOTIMPL; }
  64. STDMETHODIMP UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  65. return E_NOTIMPL; }
  66. STDMETHODIMP Clone(LPSTREAM *) {
  67. return E_NOTIMPL; }
  68. // -------------------------------------------------------------------------
  69. // CVirtualStream
  70. // -------------------------------------------------------------------------
  71. void QueryStat(ULARGE_INTEGER *puliOffset, ULARGE_INTEGER *pulSize);
  72. };
  73. #endif // __VSTREAM_H