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.

108 lines
4.7 KiB

  1. /*****************************************************************************
  2. * ftpdir.h
  3. *****************************************************************************/
  4. #ifndef _FTPDIR_H
  5. #define _FTPDIR_H
  6. #include "ftpsite.h"
  7. #include "ftpfoldr.h"
  8. #include "ftplist.h"
  9. #include "ftpglob.h"
  10. #include "ftppl.h"
  11. typedef struct tagSETNAMEOFINFO
  12. {
  13. LPCITEMIDLIST pidlOld;
  14. LPCITEMIDLIST pidlNew;
  15. } SETNAMEOFINFO, * LPSETNAMEOFINFO;
  16. int CALLBACK _CompareDirs(LPVOID pvPidl, LPVOID pvFtpDir, LPARAM lParam);
  17. /*****************************************************************************\
  18. CLASS: CFtpDir
  19. DESCRIPTION:
  20. This class is the cache of a directory on some server. m_pfs identifies
  21. the server.
  22. PERF - PERF - PERF - PERF
  23. This directory contains the folder contents in the form of a list of
  24. pidls (m_pflHfpl). We need to keep them in order based on name so that
  25. way looking up and changing is fast because of all the work we need to do
  26. with change notify. Also, when we go to parse a display name, we look here
  27. first, so that needs to be fast.
  28. \*****************************************************************************/
  29. class CFtpDir : public IUnknown
  30. {
  31. public:
  32. //////////////////////////////////////////////////////
  33. // Public Interfaces
  34. //////////////////////////////////////////////////////
  35. // *** IUnknown ***
  36. virtual STDMETHODIMP_(ULONG) AddRef(void);
  37. virtual STDMETHODIMP_(ULONG) Release(void);
  38. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  39. public:
  40. CFtpDir();
  41. ~CFtpDir(void);
  42. // Public Member Functions
  43. void CollectMotd(HINTERNET hint);
  44. void SetCache(CFtpPidlList * pflHfpl);
  45. CFtpPidlList * GetHfpl(void);
  46. HRESULT GetHint(HWND hwnd, CStatusBar * psb, HINTERNET * phint, IUnknown * punkSite, CFtpFolder * pff);
  47. void ReleaseHint(HINTERNET hint);
  48. STDMETHODIMP WithHint(CStatusBar * psb, HWND hwnd, HINTPROC hp, LPCVOID pv, IUnknown * punkSite, CFtpFolder * pff);
  49. HRESULT SetNameOf(CFtpFolder * pff, HWND hwndOwner, LPCITEMIDLIST pidl, LPCTSTR pszName, DWORD dwReserved, LPITEMIDLIST *ppidlOut);
  50. BOOL IsRoot(void);
  51. BOOL IsCHMODSupported(void) {return m_pfs->IsCHMODSupported();};
  52. BOOL IsUTF8Supported(void) {return m_pfs->IsUTF8Supported();};
  53. HRESULT GetFindDataForDisplayPath(HWND hwnd, LPCWSTR pwzDisplayPath, LPFTP_FIND_DATA pwfd, CFtpFolder * pff);
  54. HRESULT GetFindData(HWND hwnd, LPCWIRESTR pwWireName, LPFTP_FIND_DATA pwfd, CFtpFolder * pff);
  55. HRESULT GetNameOf(LPCITEMIDLIST pidl, DWORD shgno, LPSTRRET pstr);
  56. // HRESULT DisambiguatePidl(LPCITEMIDLIST pidl);
  57. CFtpSite * GetFtpSite(void);
  58. CFtpDir * GetSubFtpDir(CFtpFolder * pff, LPCITEMIDLIST pidl, BOOL fPublic);
  59. HRESULT GetDisplayPath(LPTSTR pszUrlPath, DWORD cchSize);
  60. LPCITEMIDLIST GetPathPidlReference(void) { return m_pidlFtpDir;};
  61. LPCITEMIDLIST GetPidlReference(void) { return m_pidl;};
  62. LPCITEMIDLIST GetPidlFromWireName(LPCWIRESTR pwWireName);
  63. LPCITEMIDLIST GetPidlFromDisplayName(LPCWSTR pwzDisplayName);
  64. LPITEMIDLIST GetSubPidl(CFtpFolder * pff, LPCITEMIDLIST pidlRelative, BOOL fPublic);
  65. HRESULT AddItem(LPCITEMIDLIST pidl);
  66. HRESULT ChangeFolderName(LPCITEMIDLIST pidlFtpPath);
  67. HRESULT ReplacePidl(LPCITEMIDLIST pidlSrc, LPCITEMIDLIST pidlDest) { if (!m_pflHfpl) return S_OK; return m_pflHfpl->ReplacePidl(pidlSrc, pidlDest); };
  68. HRESULT DeletePidl(LPCITEMIDLIST pidl) { if (!m_pflHfpl) return S_OK; return m_pflHfpl->CompareAndDeletePidl(pidl); };
  69. static HRESULT _SetNameOfCB(HINTERNET hint, HINTPROCINFO * phpi, LPVOID pv, BOOL * pfReleaseHint);
  70. static HRESULT _GetFindData(HINTERNET hint0, HINTPROCINFO * phpi, LPVOID pv, BOOL * pfReleaseHint);
  71. // Friend Functions
  72. friend HRESULT CFtpDir_Create(CFtpSite * pfs, LPCITEMIDLIST pidl, CFtpDir ** ppfd);
  73. friend int CALLBACK _CompareDirs(LPVOID pvPidl, LPVOID pvFtpDir, LPARAM lParam);
  74. protected:
  75. int m_cRef;
  76. CFtpSite * m_pfs; // The FTP site I belong to. (WARNING: No Ref Held)
  77. CFtpPidlList * m_pflHfpl; // The items inside this directory
  78. CFtpGlob * m_pfgMotd; // The message of the day
  79. LPITEMIDLIST m_pidlFtpDir; // Name of subdirectory w/o Virtual Root and decoded. Doesn't include Server ID
  80. LPITEMIDLIST m_pidl; // Where we live. May include the virtual root
  81. BOOL _DoesItemExist(HWND hwnd, CFtpFolder * pff, LPCITEMIDLIST pidl);
  82. BOOL _ConfirmReplaceWithRename(HWND hwnd);
  83. HRESULT _SetFtpDir(CFtpSite * pfs, CFtpDir * pfd, LPCITEMIDLIST pidl);
  84. };
  85. #endif // _FTPDIR_H