1 /* 2 * PROJECT: shell32 3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) 4 * PURPOSE: file system folder 5 * COPYRIGHT: Copyright 1997 Marcus Meissner 6 * Copyright 1998, 1999, 2002 Juergen Schmied 7 * Copyright 2009 Andrew Hill 8 * Copyright 2020 Mark Jansen (mark.jansen@reactos.org) 9 */ 10 11 #ifndef _CFSFOLDER_H_ 12 #define _CFSFOLDER_H_ 13 14 class CFSFolder : 15 public CComCoClass<CFSFolder, &CLSID_ShellFSFolder>, 16 public CComObjectRootEx<CComMultiThreadModelNoCS>, 17 public IShellFolder2, 18 public IPersistFolder3, 19 public IContextMenuCB, 20 public IShellFolderViewCB, 21 public IItemNameLimits 22 { 23 private: 24 const CLSID *m_pclsid; 25 26 /* both paths are parsible from the desktop */ 27 LPWSTR m_sPathTarget; /* complete path to target used for enumeration and ChangeNotify */ 28 29 LPITEMIDLIST m_pidlRoot; /* absolute pidl */ 30 31 DWORD m_bGroupPolicyActive; 32 HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut); 33 HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut); 34 HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut); 35 HRESULT _GetIconHandler(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut); 36 public: 37 CFSFolder(); 38 ~CFSFolder(); 39 40 // IShellFolder 41 virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes); 42 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList); 43 virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut); 44 virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut); 45 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2); 46 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut); 47 virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut); 48 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut); 49 virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet); 50 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut); 51 52 /* ShellFolder2 */ 53 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid); 54 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum); 55 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay); 56 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags); 57 virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv); 58 virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd); 59 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid); 60 61 // IPersist 62 virtual HRESULT WINAPI GetClassID(CLSID *lpClassId); 63 64 // IPersistFolder 65 virtual HRESULT WINAPI Initialize(PCIDLIST_ABSOLUTE pidl); 66 67 // IPersistFolder2 68 virtual HRESULT WINAPI GetCurFolder(PIDLIST_ABSOLUTE * pidl); 69 70 // IPersistFolder3 71 virtual HRESULT WINAPI InitializeEx(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti); 72 virtual HRESULT WINAPI GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO *ppfti); 73 74 // IContextMenuCB 75 virtual HRESULT WINAPI CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam); 76 77 // IShellFolderViewCB 78 virtual HRESULT WINAPI MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam); 79 80 /*** IItemNameLimits methods ***/ 81 82 STDMETHODIMP 83 GetMaxLength(LPCWSTR pszName, int *piMaxNameLen) 84 { 85 return E_NOTIMPL; 86 } 87 88 STDMETHODIMP 89 GetValidCharacters(LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) 90 { 91 if (ppwszValidChars) 92 { 93 *ppwszValidChars = NULL; 94 } 95 if (ppwszInvalidChars) 96 { 97 SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars); 98 } 99 return S_OK; 100 } 101 102 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLFSFOLDER) 103 DECLARE_NOT_AGGREGATABLE(CFSFolder) 104 105 DECLARE_PROTECT_FINAL_CONSTRUCT() 106 107 BEGIN_COM_MAP(CFSFolder) 108 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2) 109 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder) 110 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder) 111 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2) 112 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder3, IPersistFolder3) 113 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) 114 COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB) 115 COM_INTERFACE_ENTRY_IID(IID_IItemNameLimits, IItemNameLimits) 116 END_COM_MAP() 117 118 protected: 119 HRESULT WINAPI GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data); 120 }; 121 122 #endif /* _CFSFOLDER_H_ */ 123