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.

55 lines
1.7 KiB

  1. class CSniffStream :
  2. public IStream,
  3. public ISniffStream,
  4. public CComObjectRoot,
  5. public CComCoClass< CSniffStream, &CLSID_CoSniffStream >
  6. {
  7. public:
  8. CSniffStream(); // Default constructor
  9. ~CSniffStream(); // Destructor
  10. BEGIN_COM_MAP( CSniffStream )
  11. COM_INTERFACE_ENTRY( IStream )
  12. COM_INTERFACE_ENTRY( ISniffStream )
  13. END_COM_MAP()
  14. DECLARE_REGISTRY( CSniffStream, _T( "ImgUtil.CoSniffStream.1" ),
  15. _T( "ImgUtil.CoSniffStream" ), IDS_COSNIFFSTREAM_DESC,
  16. THREADFLAGS_BOTH );
  17. // DECLARE_NO_REGISTRY()
  18. // IStream
  19. public:
  20. STDMETHOD( Clone )( IStream** ppStream );
  21. STDMETHOD( Commit )( DWORD dwFlags );
  22. STDMETHOD( CopyTo )( IStream* pStream, ULARGE_INTEGER nBytes,
  23. ULARGE_INTEGER* pnBytesRead, ULARGE_INTEGER* pnBytesWritten );
  24. STDMETHOD( LockRegion )( ULARGE_INTEGER iOffset, ULARGE_INTEGER nBytes,
  25. DWORD dwLockType );
  26. STDMETHOD( Read )( void* pBuffer, ULONG nBytes, ULONG* pnBytesRead );
  27. STDMETHOD( Revert )();
  28. STDMETHOD( Seek )( LARGE_INTEGER nDisplacement, DWORD dwOrigin,
  29. ULARGE_INTEGER* piNewPosition );
  30. STDMETHOD( SetSize )( ULARGE_INTEGER nNewSize );
  31. STDMETHOD( Stat )( STATSTG* pStatStg, DWORD dwFlags );
  32. STDMETHOD( UnlockRegion )( ULARGE_INTEGER iOffset, ULARGE_INTEGER nBytes,
  33. DWORD dwLockType );
  34. STDMETHOD( Write )( const void* pBuffer, ULONG nBytes,
  35. ULONG* pnBytesWritten );
  36. // ISniffStream
  37. public:
  38. STDMETHOD( Init )( IStream* pStream );
  39. STDMETHOD( Peek )( void* pBuffer, ULONG nBytes, ULONG* pnBytesRead );
  40. protected:
  41. CComPtr< IStream > m_pStream;
  42. BYTE* m_pbBuffer;
  43. ULONG m_nBufferSize;
  44. ULONG m_nValidBytes;
  45. ULONG m_iNextFreeByte;
  46. ULONG m_iOffset;
  47. };