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.

95 lines
3.8 KiB

  1. // --------------------------------------------------------------------------------
  2. // BINDSTM.H
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Steven J. Bailey
  5. // --------------------------------------------------------------------------------
  6. #ifndef __BINDSTM_H
  7. #define __BINDSTM_H
  8. // --------------------------------------------------------------------------------
  9. // Depends
  10. // --------------------------------------------------------------------------------
  11. #include "vstream.h"
  12. // --------------------------------------------------------------------------------
  13. // CBindStream
  14. // --------------------------------------------------------------------------------
  15. class CBindStream : public IStream
  16. {
  17. public:
  18. // -------------------------------------------------------------------------
  19. // Construction
  20. // -------------------------------------------------------------------------
  21. CBindStream(IStream *pSource);
  22. ~CBindStream(void);
  23. // -------------------------------------------------------------------------
  24. // IUnknown
  25. // -------------------------------------------------------------------------
  26. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  27. STDMETHODIMP_(ULONG) AddRef(void);
  28. STDMETHODIMP_(ULONG) Release(void);
  29. // -------------------------------------------------------------------------
  30. // IStream
  31. // -------------------------------------------------------------------------
  32. STDMETHODIMP Read(void HUGEP_16 *, ULONG, ULONG *);
  33. STDMETHODIMP Seek(LARGE_INTEGER, DWORD, ULARGE_INTEGER *);
  34. STDMETHODIMP Stat(STATSTG *, DWORD);
  35. STDMETHODIMP Write(const void HUGEP_16 *, ULONG, ULONG *) {
  36. return TrapError(STG_E_ACCESSDENIED); }
  37. STDMETHODIMP SetSize(ULARGE_INTEGER) {
  38. return E_NOTIMPL; }
  39. STDMETHODIMP CopyTo(LPSTREAM, ULARGE_INTEGER, ULARGE_INTEGER *, ULARGE_INTEGER *) {
  40. return E_NOTIMPL; }
  41. STDMETHODIMP Commit(DWORD) {
  42. return E_NOTIMPL; }
  43. STDMETHODIMP Revert(void) {
  44. return E_NOTIMPL; }
  45. STDMETHODIMP LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  46. return E_NOTIMPL; }
  47. STDMETHODIMP UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  48. return E_NOTIMPL; }
  49. STDMETHODIMP Clone(LPSTREAM *) {
  50. return E_NOTIMPL; }
  51. // -------------------------------------------------------------------------
  52. // CBindStream Methods
  53. // -------------------------------------------------------------------------
  54. void HandsOffSource(void) {
  55. EnterCriticalSection(&m_cs);
  56. SafeRelease(m_pSource);
  57. LeaveCriticalSection(&m_cs);
  58. }
  59. // -------------------------------------------------------------------------
  60. // CBindStream Debug Methods
  61. // -------------------------------------------------------------------------
  62. #ifdef DEBUG
  63. void DebugDumpDestStream(LPCSTR pszFile);
  64. #endif
  65. private:
  66. // -------------------------------------------------------------------------
  67. // Private Methods
  68. // -------------------------------------------------------------------------
  69. #ifdef DEBUG
  70. void DebugAssertOffset(void);
  71. #endif
  72. private:
  73. // -------------------------------------------------------------------------
  74. // Private Data
  75. // -------------------------------------------------------------------------
  76. LONG m_cRef; // Reference count
  77. CVirtualStream m_cDest; // The Destination Stream
  78. IStream *m_pSource; // The Source Stream
  79. DWORD m_dwDstOffset; // CBindStream Offset
  80. DWORD m_dwSrcOffset; // Source Offset
  81. #ifdef DEBUG
  82. IStream *m_pDebug;
  83. #endif
  84. CRITICAL_SECTION m_cs; // Critical Section for m_pStream
  85. };
  86. #endif // __BINDSTM_H