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.

71 lines
3.1 KiB

  1. /*****************************************************************************
  2. * ftpstm.h
  3. *****************************************************************************/
  4. #ifndef _FTPSTREAM_H
  5. #define _FTPSTREAM_H
  6. typedef HRESULT (*STMIO)(HINTERNET hinst, BOOL fAssertOnFailure, LPVOID pvBuffer, DWORD dwNumberOfBytesToWrite, LPDWORD pdwNumberOfBytesWritten);
  7. /*****************************************************************************
  8. *
  9. * CFtpStm
  10. *
  11. *
  12. *****************************************************************************/
  13. class CFtpStm : public IStream
  14. {
  15. public:
  16. //////////////////////////////////////////////////////
  17. // Public Interfaces
  18. //////////////////////////////////////////////////////
  19. // *** IUnknown ***
  20. virtual STDMETHODIMP_(ULONG) AddRef(void);
  21. virtual STDMETHODIMP_(ULONG) Release(void);
  22. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  23. // *** IStream ***
  24. virtual STDMETHODIMP Read(void *pv, ULONG cb, ULONG *pcbRead);
  25. virtual STDMETHODIMP Write(const void *pv, ULONG cb, ULONG *pcbWritten);
  26. virtual STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { return(E_NOTIMPL); };
  27. virtual STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) { return(E_NOTIMPL); };
  28. virtual STDMETHODIMP CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
  29. virtual STDMETHODIMP Commit(DWORD grfCommitFlags);
  30. virtual STDMETHODIMP Revert(void) { return(E_NOTIMPL); };
  31. virtual STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  32. virtual STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  33. virtual STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag);
  34. virtual STDMETHODIMP Clone(IStream **ppstm) { return(E_NOTIMPL); };
  35. public:
  36. CFtpStm();
  37. ~CFtpStm(void);
  38. // Public Member Functions
  39. HRESULT ReadOrWrite(LPVOID pv, ULONG cb, ULONG * pcb, DWORD dwAccess, STMIO io, HRESULT hresFail);
  40. // Friend Functions
  41. friend HRESULT CFtpStm_Create(CFtpDir * pfd, LPCITEMIDLIST pidl, DWORD dwAccess, IStream ** ppstream, ULARGE_INTEGER uliComplete, ULARGE_INTEGER uliTotal, IProgressDialog * ppd, BOOL fClosePrgDlg);
  42. protected:
  43. // Private Member Variables
  44. int m_cRef;
  45. HINTERNET m_hint; //
  46. DWORD m_dwAccessType; //
  47. CFtpDir * m_pfd; //
  48. HINTERNET m_hintSession; //
  49. LPITEMIDLIST m_pidl; //
  50. IProgressDialog * m_ppd; //
  51. ULARGE_INTEGER m_uliComplete; //
  52. ULARGE_INTEGER m_uliTotal; //
  53. BOOL m_fClosePrgDlg; // Do we want to close the progress dialog after we finish copying this stream?
  54. ULONG m_ulBytesSinceProgressUpdate; // When was the last time I displayed progress?
  55. LPITEMIDLIST m_pidlOriginalFtpPath; // We need to return the current directory for this handle to this location when we are done.
  56. };
  57. #endif // _FTPSTREAM_H