ReactOS 0.4.15-dev-8339-g4028de8
CFSFolder.h
Go to the documentation of this file.
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
14class 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:
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
36
38 _In_ LPOLESTR lpszDisplayName,
40 _Out_ LPITEMIDLIST *ppidl);
42 HRESULT _CreateIDListFromName(LPCWSTR pszName, DWORD attrs, IBindCtx *pbc, LPITEMIDLIST *ppidl);
43
44 public:
45 CFSFolder();
46 ~CFSFolder();
47
48 // IShellFolder
49 STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override;
50 STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override;
51 STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override;
52 STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override;
54 STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override;
55 STDMETHOD(GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override;
56 STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) override;
58 STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override;
59
60 /* ShellFolder2 */
61 STDMETHOD(GetDefaultSearchGUID)(GUID *pguid) override;
62 STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum) override;
63 STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override;
64 STDMETHOD(GetDefaultColumnState)(UINT iColumn, DWORD *pcsFlags) override;
65 STDMETHOD(GetDetailsEx)(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override;
66 STDMETHOD(GetDetailsOf)(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override;
68
69 // IPersist
70 STDMETHOD(GetClassID)(CLSID *lpClassId) override;
71
72 // IPersistFolder
74
75 // IPersistFolder2
76 STDMETHOD(GetCurFolder)(PIDLIST_ABSOLUTE * pidl) override;
77
78 // IPersistFolder3
79 STDMETHOD(InitializeEx)(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti) override;
81
82 // IContextMenuCB
83 STDMETHOD(CallBack)(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
84
85 // IShellFolderViewCB
87
88 /*** IItemNameLimits methods ***/
89
91 GetMaxLength(LPCWSTR pszName, int *piMaxNameLen) override
92 {
93 return E_NOTIMPL;
94 }
95
97 GetValidCharacters(LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) override
98 {
99 if (ppwszValidChars)
100 {
101 *ppwszValidChars = NULL;
102 }
103 if (ppwszInvalidChars)
104 {
105 SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
106 }
107 return S_OK;
108 }
109
112
114
116 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
117 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
118 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
119 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
120 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder3, IPersistFolder3)
122 COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
123 COM_INTERFACE_ENTRY_IID(IID_IItemNameLimits, IItemNameLimits)
125
126 protected:
128
129 public:
130 // Helper functions shared with CDesktopFolder
132 static HRESULT GetDefaultFSColumnState(UINT iColumn, SHCOLSTATEF &csFlags);
133};
134
135#endif /* _CFSFOLDER_H_ */
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHOD(m)
Definition: basetyps.h:62
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CFSFolder.cpp:1412
STDMETHOD() CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override
Definition: CFSFolder.cpp:1874
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
Definition: CFSFolder.cpp:902
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1843
static HRESULT GetDefaultFSColumnState(UINT iColumn, SHCOLSTATEF &csFlags)
Definition: CFSFolder.cpp:551
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
Definition: CFSFolder.cpp:1470
DWORD m_bGroupPolicyActive
Definition: CFSFolder.h:31
HRESULT _GetIconHandler(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1827
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
Definition: CFSFolder.cpp:1184
HRESULT _ParseSimple(_In_ LPOLESTR lpszDisplayName, _Inout_ WIN32_FIND_DATAW *pFind, _Out_ LPITEMIDLIST *ppidl)
Definition: CFSFolder.cpp:687
static HRESULT GetFSColumnDetails(UINT iColumn, SHELLDETAILS &sd)
Definition: CFSFolder.cpp:541
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
Definition: CFSFolder.cpp:1023
STDMETHOD() GetCurFolder(PIDLIST_ABSOLUTE *pidl) override
Definition: CFSFolder.cpp:1683
BOOL _GetFindDataFromName(_In_ LPCWSTR pszName, _Out_ WIN32_FIND_DATAW *pFind)
Definition: CFSFolder.cpp:728
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
Definition: CFSFolder.cpp:1264
HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1799
HRESULT _CreateIDListFromName(LPCWSTR pszName, DWORD attrs, IBindCtx *pbc, LPITEMIDLIST *ppidl)
Definition: CFSFolder.cpp:742
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
Definition: CFSFolder.cpp:1626
const CLSID * m_pclsid
Definition: CFSFolder.h:24
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CFSFolder.cpp:1006
STDMETHOD() InitializeEx(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti) override
Definition: CFSFolder.cpp:1699
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
Definition: CFSFolder.cpp:1554
HRESULT WINAPI GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data)
Definition: CFSFolder.cpp:1942
STDMETHOD() MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam) override
Definition: CFSFolder.cpp:2030
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
STDMETHOD() GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO *ppfti) override
Definition: CFSFolder.cpp:1769
STDMETHODIMP GetMaxLength(LPCWSTR pszName, int *piMaxNameLen) override
Definition: CFSFolder.h:91
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
Definition: CFSFolder.cpp:1565
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
Definition: CFSFolder.cpp:1535
STDMETHODIMP GetValidCharacters(LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) override
Definition: CFSFolder.h:97
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
Definition: CFSFolder.cpp:1529
STDMETHOD() GetClassID(CLSID *lpClassId) override
Definition: CFSFolder.cpp:1636
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
Definition: CFSFolder.cpp:1089
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
Definition: CFSFolder.cpp:1541
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CFSFolder.cpp:918
HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1776
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
Definition: CFSFolder.cpp:1573
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2012
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
static BOOL protected
Definition: protectdata.c:37
static const WCHAR sd[]
Definition: suminfo.c:286
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
static LPOLESTR
Definition: stg_prop.c:27
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
const GUID IID_IPersist
Definition: proxy.cpp:14
#define REFIID
Definition: guiddef.h:118
#define IDR_SHELLFSFOLDER
Definition: shresdef.h:900
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
uint32_t ULONG
Definition: typedefs.h:59
#define INVALID_FILETITLE_CHARACTERSW
Definition: undocshell.h:911
_In_ LPCSTR lpName
Definition: winbase.h:2789
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
static void Initialize()
Definition: xlate.c:212
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185