1 /*
2  * PROJECT:     ReactOS shell extensions
3  * LICENSE:     GPL - See COPYING in the top level directory
4  * FILE:        dll/shellext/ntobjshex/ntobjfolder.h
5  * PURPOSE:     NT Object Namespace shell extension
6  * PROGRAMMERS: David Quintana <gigaherz@gmail.com>
7  */
8 #pragma once
9 
10 extern const GUID CLSID_NtObjectFolder;
11 
12 class CNtObjectFolder :
13     public CComCoClass<CNtObjectFolder, &CLSID_NtObjectFolder>,
14     public CComObjectRootEx<CComMultiThreadModelNoCS>,
15     public IShellFolder2,
16     public IPersistFolder2,
17     public IShellFolderViewCB
18 {
19     WCHAR m_NtPath[MAX_PATH];
20 
21     LPITEMIDLIST m_shellPidl;
22 
23 public:
24 
25     CNtObjectFolder();
26     virtual ~CNtObjectFolder();
27 
28     // IShellFolder
29     virtual HRESULT STDMETHODCALLTYPE ParseDisplayName(
30         HWND hwndOwner,
31         LPBC pbcReserved,
32         LPOLESTR lpszDisplayName,
33         ULONG *pchEaten,
34         LPITEMIDLIST *ppidl,
35         ULONG *pdwAttributes);
36 
37     virtual HRESULT STDMETHODCALLTYPE EnumObjects(
38         HWND hwndOwner,
39         SHCONTF grfFlags,
40         IEnumIDList **ppenumIDList);
41 
42     virtual HRESULT STDMETHODCALLTYPE BindToObject(
43         LPCITEMIDLIST pidl,
44         LPBC pbcReserved,
45         REFIID riid,
46         void **ppvOut);
47 
48     virtual HRESULT STDMETHODCALLTYPE BindToStorage(
49         LPCITEMIDLIST pidl,
50         LPBC pbcReserved,
51         REFIID riid,
52         void **ppvObj);
53 
54     virtual HRESULT STDMETHODCALLTYPE CompareIDs(
55         LPARAM lParam,
56         LPCITEMIDLIST pidl1,
57         LPCITEMIDLIST pidl2);
58 
59     virtual HRESULT STDMETHODCALLTYPE CreateViewObject(
60         HWND hwndOwner,
61         REFIID riid,
62         void **ppvOut);
63 
64     virtual HRESULT STDMETHODCALLTYPE GetAttributesOf(
65         UINT cidl,
66         PCUITEMID_CHILD_ARRAY apidl,
67         SFGAOF *rgfInOut);
68 
69     virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf(
70         HWND hwndOwner,
71         UINT cidl,
72         PCUITEMID_CHILD_ARRAY apidl,
73         REFIID riid,
74         UINT *prgfInOut,
75         void **ppvOut);
76 
77     virtual HRESULT STDMETHODCALLTYPE GetDisplayNameOf(
78         LPCITEMIDLIST pidl,
79         SHGDNF uFlags,
80         STRRET *lpName);
81 
82     virtual HRESULT STDMETHODCALLTYPE SetNameOf(
83         HWND hwnd,
84         LPCITEMIDLIST pidl,
85         LPCOLESTR lpszName,
86         SHGDNF uFlags,
87         LPITEMIDLIST *ppidlOut);
88 
89     // IShellFolder2
90     virtual HRESULT STDMETHODCALLTYPE GetDefaultSearchGUID(
91         GUID *lpguid);
92 
93     virtual HRESULT STDMETHODCALLTYPE EnumSearches(
94         IEnumExtraSearch **ppenum);
95 
96     virtual HRESULT STDMETHODCALLTYPE GetDefaultColumn(
97         DWORD dwReserved,
98         ULONG *pSort,
99         ULONG *pDisplay);
100 
101     virtual HRESULT STDMETHODCALLTYPE GetDefaultColumnState(
102         UINT iColumn,
103         SHCOLSTATEF *pcsFlags);
104 
105     virtual HRESULT STDMETHODCALLTYPE GetDetailsEx(
106         LPCITEMIDLIST pidl,
107         const SHCOLUMNID *pscid,
108         VARIANT *pv);
109 
110     virtual HRESULT STDMETHODCALLTYPE GetDetailsOf(
111         LPCITEMIDLIST pidl,
112         UINT iColumn,
113         SHELLDETAILS *psd);
114 
115     virtual HRESULT STDMETHODCALLTYPE MapColumnToSCID(
116         UINT iColumn,
117         SHCOLUMNID *pscid);
118 
119     // IPersist
120     virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *lpClassId);
121 
122     // IPersistFolder
123     virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl);
124 
125     // IPersistFolder2
126     virtual HRESULT STDMETHODCALLTYPE GetCurFolder(LPITEMIDLIST * pidl);
127 
128     // IShellFolderViewCB
129     virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
130 
131     // Internal
132     HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl, PCWSTR ntPath);
133 
134     static HRESULT CALLBACK DefCtxMenuCallback(IShellFolder *, HWND, IDataObject *, UINT, WPARAM, LPARAM);
135 
136     DECLARE_REGISTRY_RESOURCEID(IDR_NTOBJECTFOLDER)
137     DECLARE_NOT_AGGREGATABLE(CNtObjectFolder)
138     DECLARE_PROTECT_FINAL_CONSTRUCT()
139 
140     BEGIN_COM_MAP(CNtObjectFolder)
141         COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
142         COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
143         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
144         COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
145         COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
146         COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
147     END_COM_MAP()
148 
149 };