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.

163 lines
8.3 KiB

  1. /*****************************************************************************\
  2. FILE: ftpfoldr.h
  3. DESCRIPTION:
  4. This class inherits from CBaseFolder for a base ShellFolder implementation
  5. of IShellFolder and overrides methods to give Ftp Specific features.
  6. \*****************************************************************************/
  7. #ifndef _FTPFOLDER_H
  8. #define _FTPFOLDER_H
  9. #include "isf.h"
  10. #include "ftpdir.h"
  11. #include "ftpsite.h"
  12. #include "ftplist.h"
  13. #include "ftpglob.h"
  14. #include "ftppidl.h"
  15. #include "cowsite.h"
  16. #include "util.h"
  17. class CFtpDir;
  18. class CFtpSite;
  19. /*****************************************************************************\
  20. CFtpFolder
  21. The stuff that tracks the state of a folder.
  22. The cBusy field tracks how many sub-objects have been created
  23. (e.g., IEnumIDList) which still contain references to this
  24. folder's identity. You cannot change the folder's identity
  25. (via IPersistFolder::Initialize) while there are outstanding
  26. subobjects.
  27. The number of cBusy's never exceeds the number of cRef's, because
  28. each subobject that requires the folder identity must retain a
  29. reference to the folder itself. That way, the folder won't be
  30. Release()d while the identity is still needed.
  31. \*****************************************************************************/
  32. class CFtpFolder : public CBaseFolder
  33. , public IShellIcon
  34. , public IShellIconOverlay
  35. , public IDelegateFolder
  36. , public IShellPropSheetExt
  37. , public IBrowserFrameOptions
  38. {
  39. public:
  40. //////////////////////////////////////////////////////
  41. // Public Interfaces
  42. //////////////////////////////////////////////////////
  43. // *** IUnknown ***
  44. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  45. virtual STDMETHODIMP_(ULONG) AddRef(void) {return CBaseFolder::AddRef();};
  46. virtual STDMETHODIMP_(ULONG) Release(void) {return CBaseFolder::Release();};
  47. // *** IShellFolder ***
  48. virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
  49. ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes);
  50. virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD grfFlags, LPENUMIDLIST * ppenumIDList);
  51. virtual STDMETHODIMP BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut);
  52. virtual STDMETHODIMP BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvObj);
  53. virtual STDMETHODIMP CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  54. virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID * ppvOut);
  55. virtual STDMETHODIMP GetAttributesOf(UINT cidl, LPCITEMIDLIST * apidl, ULONG * rgfInOut);
  56. virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
  57. virtual STDMETHODIMP GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName);
  58. virtual STDMETHODIMP SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpszName, DWORD uFlags, LPITEMIDLIST * ppidlOut);
  59. // *** IShellFolder2 ***
  60. virtual STDMETHODIMP GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv);
  61. // *** IPersistFolder ***
  62. virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl); // Override default behavior
  63. // *** IShellIcon ***
  64. virtual STDMETHODIMP GetIconOf(LPCITEMIDLIST pidl, UINT flags, LPINT lpIconIndex);
  65. // *** IShellIconOverlay ***
  66. virtual STDMETHODIMP GetOverlayIndex(LPCITEMIDLIST pidl, int * pIndex) {return GetOverlayIndexHelper(pidl, pIndex, SIOM_OVERLAYINDEX);};
  67. virtual STDMETHODIMP GetOverlayIconIndex(LPCITEMIDLIST pidl, int * pIconIndex) {return GetOverlayIndexHelper(pidl, pIconIndex, SIOM_ICONINDEX);};
  68. // *** IDelegateFolder ***
  69. virtual STDMETHODIMP SetItemAlloc(IMalloc *pm);
  70. // *** IShellPropSheetExt ***
  71. virtual STDMETHODIMP AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) {return AddFTPPropertyPages(pfnAddPage, lParam, &m_hinstInetCpl, _punkSite);};
  72. virtual STDMETHODIMP ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam) {return E_NOTIMPL;};
  73. // *** IBrowserFrameOptions ***
  74. virtual STDMETHODIMP GetFrameOptions(IN BROWSERFRAMEOPTIONS dwMask, OUT BROWSERFRAMEOPTIONS * pdwOptions);
  75. public:
  76. CFtpFolder();
  77. ~CFtpFolder(void);
  78. // Public Member Functions
  79. void InvalidateCache(void);
  80. CFtpDir * GetFtpDir(void);
  81. CFtpDir * GetFtpDirFromPidl(LPCITEMIDLIST pidl);
  82. BOOL IsRoot(void) { return ILIsEmpty(GetPrivatePidlReference()); };
  83. BOOL IsUTF8Supported(void);
  84. BOOL _IsValidPidlParameter(LPCITEMIDLIST pidl);
  85. HRESULT GetItemAllocator(IMalloc **ppm);
  86. IMalloc * GetItemAllocatorDirect(void) {ASSERT(m_pm); return m_pm;};
  87. HRESULT GetUIObjectOfHfpl(HWND hwndOwner, CFtpPidlList * pflHfpl, REFIID riid, LPVOID * ppvObj, BOOL fFromCreateViewObject);
  88. HRESULT CreateSubViewObject(HWND hwndOwner, CFtpPidlList * pflHfpl, REFIID riid, LPVOID * ppvObj);
  89. HRESULT _PidlToMoniker(LPCITEMIDLIST pidl, IMoniker ** ppmk);
  90. HRESULT _CreateShellView(HWND hwndOwner, void ** ppvObj);
  91. CFtpGlob * GetSiteMotd(void);
  92. CWireEncoding * GetCWireEncoding(void);
  93. HRESULT _InitFtpSite(void);
  94. IMalloc * GetIMalloc(void);
  95. HRESULT _Initialize(LPCITEMIDLIST pidlTarget, LPCITEMIDLIST pidlRoot, int nBytesToPrivate);
  96. HRESULT _BindToObject_OriginalFtpSupport(LPCITEMIDLIST pidl, REFIID riid, LPVOID * ppvObj);
  97. HRESULT _FilterBadInput(LPCTSTR pszUrl, LPITEMIDLIST * ppidl);
  98. HRESULT _BindToObject(LPCITEMIDLIST pidl, LPCITEMIDLIST pidlFull, IBindCtx * pbc, REFIID riid, LPVOID * ppvObj);
  99. // HRESULT AddToUrlHistory(LPCTSTR pszUrl);
  100. HRESULT AddToUrlHistory(LPCITEMIDLIST pidl);
  101. HRESULT AddToUrlHistory(void) {return AddToUrlHistory(this->GetPrivatePidlReference());};
  102. HRESULT GetOverlayIndexHelper(LPCITEMIDLIST pidl, int * pIndex, DWORD dwFlags);
  103. HRESULT _GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut, BOOL fFromCreateViewObject);
  104. static HRESULT FolderCompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
  105. {
  106. return FtpItemID_CompareIDs(lParam, pidl1, pidl2, FCMP_GROUPDIRS);
  107. };
  108. // Public Member Variables
  109. CFtpSite * m_pfs;
  110. IMalloc * m_pm; // today's itemid allocator
  111. IUrlHistoryStg * m_puhs; // Used to add to the history list.
  112. HINSTANCE m_hinstInetCpl; // HANDLE to Internet Control panel for View.Options.
  113. IShellIconOverlayManager * m_psiom; // Used to get default icon overlays like shortcut cue.
  114. // Friend Functions
  115. friend HRESULT CFtpFolder_Create(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, int ib, REFIID riid, LPVOID * ppvObj);
  116. friend HRESULT CFtpFolder_Create(REFIID riid, LPVOID * ppvObj);
  117. protected:
  118. HRESULT _FixQuestionablePidl(LPCITEMIDLIST pidl);
  119. BOOL _IsProxyBlockingSite(LPCITEMIDLIST pidl);
  120. BOOL _IsServerVMS(LPCITEMIDLIST pidl);
  121. BOOL _NeedToFallBack(LPCITEMIDLIST pidl, BOOL * pfDisplayProxyFallBackDlg);
  122. BOOL _NeedToFallBackRelative(LPCITEMIDLIST pidl, BOOL * pfDisplayProxyFallBackDlg);
  123. HRESULT _CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID * ppvObj);
  124. HRESULT _AddToUrlHistory(LPCWSTR pwzUrl);
  125. HRESULT _GetCachedPidlFromDisplayName(LPCTSTR pszDisplayName, LPITEMIDLIST * ppidl);
  126. HRESULT _ForPopulateAndEnum(CFtpDir * pfd, LPCITEMIDLIST pidlBaseDir, LPCTSTR pszUrl, LPCWIRESTR pwLastDir, LPITEMIDLIST * ppidl);
  127. HRESULT _GetLegacyURL(LPCITEMIDLIST pidl, IBindCtx * pbc, LPTSTR pszUrl, DWORD cchSize);
  128. HRESULT _GetLegacyPidl(LPCITEMIDLIST pidl, LPITEMIDLIST * ppidlLegacy);
  129. HRESULT _INetBindToObject(LPCITEMIDLIST pidl, IBindCtx * pbc, REFIID riid, LPVOID * ppvObj);
  130. HRESULT _InitLegacyShellFolder(IShellFolder * psfLegacy, LPCITEMIDLIST pidlInit);
  131. HRESULT _ConvertPidlForRootedFix(LPCITEMIDLIST pidlBefore, LPITEMIDLIST * ppidlWithVRoot);
  132. HRESULT _GetBindCtx(IBindCtx ** ppbc);
  133. IShellFolder * _GetLegacyShellFolder(void);
  134. };
  135. #endif // _FTPFOLDER_H