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.

89 lines
4.2 KiB

  1. // --------------------------------------------------------------------------------
  2. // Ibdylock.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Steven J. Bailey
  5. // --------------------------------------------------------------------------------
  6. #ifndef __IBDYLOCK_H
  7. #define __IBDYLOCK_H
  8. // --------------------------------------------------------------------------------
  9. // Forward Decls
  10. // --------------------------------------------------------------------------------
  11. typedef struct tagTREENODEINFO *LPTREENODEINFO;
  12. typedef enum tagBINDNODESTATE BINDNODESTATE;
  13. // --------------------------------------------------------------------------------
  14. // CBodyLockBytes - {62A83703-52A2-11d0-8205-00C04FD85AB4}
  15. // --------------------------------------------------------------------------------
  16. DEFINE_GUID(IID_CBodyLockBytes, 0x62a83703, 0x52a2, 0x11d0, 0x82, 0x5, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);
  17. // --------------------------------------------------------------------------------
  18. // BODYLOCK_xxx States
  19. // --------------------------------------------------------------------------------
  20. #define BODYLOCK_HANDSONSTORAGE FLAG01
  21. // -----------------------------------------------------------------------------
  22. // Wraps a MIME stream object, and provides thread safe access to the
  23. // a shared stream. When this object wraps a message stream, it is owned by
  24. // IMimeBody
  25. // -----------------------------------------------------------------------------
  26. class CBodyLockBytes : public ILockBytes
  27. {
  28. public:
  29. // -------------------------------------------------------------------------
  30. // Construction
  31. // -------------------------------------------------------------------------
  32. CBodyLockBytes(ILockBytes *pLockBytes, LPTREENODEINFO pNode);
  33. ~CBodyLockBytes(void);
  34. // -------------------------------------------------------------------------
  35. // IUnknown
  36. // -------------------------------------------------------------------------
  37. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  38. STDMETHODIMP_(ULONG) AddRef(void);
  39. STDMETHODIMP_(ULONG) Release(void);
  40. // -------------------------------------------------------------------------
  41. // ILockBytes methods
  42. // -------------------------------------------------------------------------
  43. #ifndef WIN16
  44. STDMETHODIMP ReadAt(ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead);
  45. #else
  46. STDMETHODIMP ReadAt(ULARGE_INTEGER ulOffset, void HUGEP *pv, ULONG cb, ULONG *pcbRead);
  47. #endif // !WIN16
  48. STDMETHODIMP Stat(STATSTG *, DWORD);
  49. STDMETHODIMP SetSize(ULARGE_INTEGER cb) {
  50. return E_NOTIMPL; }
  51. STDMETHODIMP Flush(void) {
  52. return E_NOTIMPL; }
  53. STDMETHODIMP LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  54. return E_NOTIMPL; }
  55. STDMETHODIMP UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) {
  56. return E_NOTIMPL; }
  57. #ifndef WIN16
  58. STDMETHODIMP WriteAt(ULARGE_INTEGER, void const *, ULONG, ULONG *) {
  59. #else
  60. STDMETHODIMP WriteAt(ULARGE_INTEGER, void const HUGEP *, ULONG, ULONG *) {
  61. #endif // !WIN16
  62. return TrapError(STG_E_ACCESSDENIED); }
  63. // -------------------------------------------------------------------------
  64. // CMimeLockBytes methods
  65. // -------------------------------------------------------------------------
  66. HRESULT HrHandsOffStorage(void);
  67. void OnDataAvailable(LPTREENODEINFO pNode);
  68. private:
  69. // -------------------------------------------------------------------------
  70. // Private Data
  71. // -------------------------------------------------------------------------
  72. LONG m_cRef; // Reference count
  73. DWORD m_dwState; // State
  74. BINDNODESTATE m_bindstate; // Current bind state
  75. ULARGE_INTEGER m_uliBodyStart; // Offset to start of body in m_pLockBytes
  76. ULARGE_INTEGER m_uliBodyEnd; // Offset to end of body in m_pLockBytes
  77. ILockBytes *m_pLockBytes; // Actual lockbytes implementation (CMimeMessageTree or CStreamLockBytes)
  78. CRITICAL_SECTION m_cs; // Critical Section for m_pStream
  79. };
  80. #endif // __IBDYLOCK_H