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.

143 lines
6.8 KiB

  1. /*****************************************************************************
  2. * ftpsite.h
  3. *****************************************************************************/
  4. #ifndef _FTPSITE_H
  5. #define _FTPSITE_H
  6. #include "ftpfoldr.h"
  7. #include "ftplist.h"
  8. #include "ftpinet.h"
  9. #include "ftpurl.h"
  10. #include "account.h"
  11. #include "util.h"
  12. HRESULT SiteCache_PidlLookup(LPCITEMIDLIST pidl, BOOL fPasswordRedir, IMalloc * pm, CFtpSite ** ppfs);
  13. int CALLBACK _CompareSites(LPVOID pvStrSite, LPVOID pvFtpSite, LPARAM lParam);
  14. HRESULT CFtpPunkList_Purge(CFtpList ** pfl);
  15. /*****************************************************************************
  16. * CFtpSite
  17. *****************************************************************************/
  18. class CFtpSite : public IUnknown
  19. {
  20. public:
  21. //////////////////////////////////////////////////////
  22. // Public Interfaces
  23. //////////////////////////////////////////////////////
  24. // *** IUnknown ***
  25. virtual STDMETHODIMP_(ULONG) AddRef(void);
  26. virtual STDMETHODIMP_(ULONG) Release(void);
  27. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  28. public:
  29. CFtpSite();
  30. ~CFtpSite();
  31. // Public Member Functions
  32. void CollectMotd(HINTERNET hint);
  33. void ReleaseHint(LPCITEMIDLIST pidlFtpPath, HINTERNET hint);
  34. HRESULT GetHint(HWND hwnd, LPCITEMIDLIST pidlFtpPath, CStatusBar * psb, HINTERNET * phint, IUnknown * punkSite, CFtpFolder * pff);
  35. BOOL QueryMotd(void);
  36. BOOL IsServerVMS(void) {return m_fIsServerVMS;};
  37. BOOL HasVirtualRoot(void);
  38. CFtpGlob * GetMotd(void);
  39. CFtpList * GetCFtpList(void);
  40. CWireEncoding * GetCWireEncoding(void) {return &m_cwe;};
  41. HRESULT GetFtpDir(LPCITEMIDLIST pidl, CFtpDir ** ppfd);
  42. HRESULT GetFtpDir(LPCTSTR pszUrlPath, CFtpDir ** ppfd) {return GetFtpDir(m_pszServer, pszUrlPath, ppfd);};
  43. HRESULT GetFtpDir(LPCTSTR pszServer, LPCTSTR pszUrlPath, CFtpDir ** ppfd);
  44. HRESULT GetVirtualRoot(LPITEMIDLIST * ppidl);
  45. HRESULT PidlInsertVirtualRoot(LPCITEMIDLIST pidlFtpPath, LPITEMIDLIST * ppidl);
  46. LPCITEMIDLIST GetVirtualRootReference(void) {return (LPCITEMIDLIST) m_pidlVirtualDir;};
  47. HRESULT GetServer(LPTSTR pszServer, DWORD cchSize) { StrCpyN(pszServer, HANDLE_NULLSTR(m_pszServer), cchSize); return S_OK; };
  48. HRESULT GetUser(LPTSTR pszUser, DWORD cchSize) { StrCpyN(pszUser, HANDLE_NULLSTR(m_pszUser), cchSize); return S_OK; };
  49. HRESULT GetPassword(LPTSTR pszPassword, DWORD cchSize) { StrCpyN(pszPassword, HANDLE_NULLSTR(m_pszPassword), cchSize); return S_OK; };
  50. HRESULT UpdateHiddenPassword(LPITEMIDLIST pidl);
  51. HRESULT SetRedirPassword(LPCTSTR pszPassword) {Str_SetPtr(&m_pszRedirPassword, pszPassword); return S_OK;};
  52. HRESULT FlushSubDirs(LPCITEMIDLIST pidl);
  53. LPITEMIDLIST GetPidl(void);
  54. BOOL IsCHMODSupported(void) {return m_fIsCHMODSupported;};
  55. BOOL IsUTF8Supported(void) {return m_fInUTF8Mode;};
  56. BOOL IsSiteBlockedByRatings(HWND hwndDialogOwner);
  57. void FlushRatingsInfo(void) {m_fRatingsChecked = m_fRatingsAllow = FALSE;};
  58. static void FlushHintCB(LPVOID pvFtpSite);
  59. // Friend Functions
  60. friend HRESULT CFtpSite_Create(LPCITEMIDLIST pidl, LPCTSTR pszLookupStr, IMalloc * pm, CFtpSite ** ppfs);
  61. friend HRESULT SiteCache_PidlLookup(LPCITEMIDLIST pidl, BOOL fPasswordRedir, IMalloc * pm, CFtpSite ** ppfs);
  62. friend int CALLBACK _CompareSites(LPVOID pvStrSite, LPVOID pvFtpSite, LPARAM lParam);
  63. friend class CFtpView;
  64. protected:
  65. // Private Member Variables
  66. int m_cRef;
  67. BOOL m_fMotd; // There is a Motd at all
  68. BOOL m_fNewMotd; // Motd has changed
  69. HINTERNET m_hint; // Session for this site
  70. LPGLOBALTIMEOUTINFO m_hgti; // Timeout for the session handle
  71. CFtpList * m_FtpDirList; // List of FtpDir's attached to me. (No Ref Held)
  72. CFtpGlob * m_pfgMotd; //
  73. IMalloc * m_pm; // Used for creating full pidls if needed.
  74. LPTSTR m_pszServer; // Server name
  75. LPITEMIDLIST m_pidl; // What ftp dir is hint in? (Not including the virtual root) (Does begin with ServerID)
  76. LPTSTR m_pszUser; // 0 or "" means "anonymous"
  77. LPTSTR m_pszPassword; // User's Password
  78. LPTSTR m_pszFragment; // URL fragment
  79. LPITEMIDLIST m_pidlVirtualDir; // Our rooted directory on the server.
  80. LPTSTR m_pszRedirPassword; // What was the password if it was changed?
  81. LPTSTR m_pszLookupStr; // Str to lookup.
  82. INTERNET_PORT m_ipPortNum; // The port number
  83. BOOL m_fDLTypeSpecified; // Did the user specify a Download Type to use? (ASCII vs. Binary)
  84. BOOL m_fASCIIDownload; // If specified, was it ASCII? (Else, Binary)
  85. CAccounts m_cAccount;
  86. BOOL m_fRatingsChecked; // Did I check ratings yet?
  87. BOOL m_fRatingsAllow; // Does ratings allow access to this site?
  88. BOOL m_fFeaturesQueried; //
  89. BOOL m_fInUTF8Mode; // Did a success value come back from the 'UTF8' command?
  90. BOOL m_fIsCHMODSupported;// Is the CHMOD UNIX command supported via the 'SITE CHMOD' FTP Command?
  91. BOOL m_fIsServerVMS; // Is this a VMS server?
  92. CWireEncoding m_cwe; // What codepage and confidence in that codepage of the MOTD and filenames?
  93. // Protected Member Functions
  94. HRESULT _RedirectAndUpdate(LPCTSTR pszServer, INTERNET_PORT ipPortNum, LPCTSTR pszUser, LPCTSTR pszPassword, LPCITEMIDLIST pidlFtpPath, LPCTSTR pszFragment, IUnknown * punkSite, CFtpFolder * pff);
  95. HRESULT _Redirect(LPITEMIDLIST pidl, IUnknown * punkSite, CFtpFolder * pff);
  96. HRESULT _SetDirectory(HINTERNET hint, HWND hwnd, LPCITEMIDLIST pidlNewDir, CStatusBar * psb, int * pnTriesLeft);
  97. private:
  98. // Private Member Functions
  99. HRESULT _SetPidl(LPCITEMIDLIST pidlFtpPath);
  100. HRESULT _QueryServerFeatures(HINTERNET hint);
  101. HRESULT _CheckToEnableCHMOD(LPCWIRESTR pwResponse);
  102. HRESULT _LoginToTheServer(HWND hwnd, HINTERNET hintDll, HINTERNET * phint, LPCITEMIDLIST pidlFtpPath, CStatusBar * psb, IUnknown * punkSite, CFtpFolder * pff);
  103. HRESULT _SetRedirPassword(LPCTSTR pszServer, INTERNET_PORT ipPortNum, LPCTSTR pszUser, LPCTSTR pszPassword, LPCITEMIDLIST pidlFtpPath, LPCTSTR pszFragment);
  104. void FlushHint(void);
  105. void FlushHintCritial(void);
  106. // Private Friend Functions
  107. friend HRESULT SiteCache_PrivSearch(LPCTSTR pszLookup, LPCITEMIDLIST pidl, IMalloc * pm, CFtpSite ** ppfs);
  108. };
  109. HRESULT CFtpSite_Init(void);
  110. HRESULT CFtpSite_Create(LPCITEMIDLIST pidl, LPCTSTR pszLookupStr, IMalloc * pm, CFtpSite ** ppfs);
  111. #endif // _FTPSITE_H