Source code of Windows XP (NT5)
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.

86 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. stream.h
  5. Abstract:
  6. This module contains the definition for the Server
  7. Extension Object Stream class.
  8. Author:
  9. Don Dumitru (dondu@microsoft.com)
  10. Revision History:
  11. dondu 03/29/97 created
  12. --*/
  13. // stream.h : Declaration of the CSEOStream
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CStream
  16. class ATL_NO_VTABLE __declspec(uuid("2DF59671-3D15-11d1-AA51-00AA006BC80B")) CSEOStream :
  17. public CComObjectRoot,
  18. public IStream
  19. // , public CComCoClass<CSEOStream, &CLSID_CSEOStream>
  20. {
  21. public:
  22. HRESULT FinalConstruct();
  23. void FinalRelease();
  24. void Cleanup();
  25. HRESULT Init(HANDLE hFile, LPCSTR pszFile, ULARGE_INTEGER libOffset, CSEOStream *pSubStream);
  26. HRESULT Init(HANDLE hFile, LPCWSTR pszFile, ULARGE_INTEGER libOffset, CSEOStream *pSubStream);
  27. HRESULT Open();
  28. HRESULT ReadOffset(void *pv, ULONG cb, ULONG *pcbRead, ULARGE_INTEGER *plibOffset);
  29. HRESULT WriteOffset(void const* pv, ULONG cb, ULONG *pcbWritten, ULARGE_INTEGER *plibOffset);
  30. HRESULT GetSize(ULARGE_INTEGER *plibSize);
  31. HRESULT CopyToOffset(IStream *pstm, ULARGE_INTEGER libOffset, ULARGE_INTEGER *plibRead, ULARGE_INTEGER *plibWritten, ULARGE_INTEGER *plibOffset);
  32. HRESULT CloneOffset(IStream **pstm, ULARGE_INTEGER libOffset);
  33. static HRESULT CreateInstance(HANDLE hFile, LPCSTR pszFile, ULARGE_INTEGER libOffset, CSEOStream *pSubStream, IStream **ppStream);
  34. static HRESULT CreateInstance(HANDLE hFile, LPCWSTR pszFile, ULARGE_INTEGER libOffset, CSEOStream *pSubStream, IStream **ppStream);
  35. DECLARE_PROTECT_FINAL_CONSTRUCT();
  36. DECLARE_NOT_AGGREGATABLE(CSEOStream);
  37. // DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  38. // L"SMTP IStream Class",
  39. // L"SMTP.IStream.1",
  40. // L"SMTP.IStream");
  41. DECLARE_GET_CONTROLLING_UNKNOWN();
  42. BEGIN_COM_MAP(CSEOStream)
  43. COM_INTERFACE_ENTRY(IStream)
  44. COM_INTERFACE_ENTRY_IID(__uuidof(CSEOStream),CSEOStream)
  45. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  46. END_COM_MAP()
  47. // IStream
  48. public:
  49. HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
  50. HRESULT STDMETHODCALLTYPE Write(void const* pv, ULONG cb, ULONG *pcbWritten);
  51. HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *pdlibNewPosition);
  52. HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize);
  53. HRESULT STDMETHODCALLTYPE CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
  54. HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags);
  55. HRESULT STDMETHODCALLTYPE Revert(void);
  56. HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  57. HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  58. HRESULT STDMETHODCALLTYPE Stat(STATSTG * pstatstg, DWORD grfStatFlag);
  59. HRESULT STDMETHODCALLTYPE Clone(IStream **pstm);
  60. private:
  61. HANDLE m_hFile;
  62. LPSTR m_pszFile;
  63. ULARGE_INTEGER m_libOffset;
  64. HANDLE m_hEvent;
  65. CSEOStream *m_pSubStream;
  66. CComPtr<IUnknown> m_pUnkMarshaler;
  67. };