1c2c66affSColin Finck /*
2ba03ffd6SStanislav Motylkov  * PROJECT:     NT Object Namespace shell extension
3ba03ffd6SStanislav Motylkov  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4ba03ffd6SStanislav Motylkov  * PURPOSE:     NT Object Namespace folder class header
5ba03ffd6SStanislav Motylkov  * COPYRIGHT:   Copyright 2015-2017 David Quintana <gigaherz@gmail.com>
6c2c66affSColin Finck  */
7ba03ffd6SStanislav Motylkov 
8c2c66affSColin Finck #pragma once
9c2c66affSColin Finck 
10c2c66affSColin Finck extern const GUID CLSID_NtObjectFolder;
11c2c66affSColin Finck 
12c2c66affSColin Finck class CNtObjectFolderExtractIcon :
13c2c66affSColin Finck     public CComObjectRootEx<CComMultiThreadModelNoCS>,
14c2c66affSColin Finck     public IExtractIconW
15c2c66affSColin Finck {
16c2c66affSColin Finck     PCWSTR m_NtPath;
17c2c66affSColin Finck     PCITEMID_CHILD    m_pcidlChild;
18c2c66affSColin Finck 
19c2c66affSColin Finck public:
20c2c66affSColin Finck     CNtObjectFolderExtractIcon();
21c2c66affSColin Finck 
22c2c66affSColin Finck     virtual ~CNtObjectFolderExtractIcon();
23c2c66affSColin Finck 
24c2c66affSColin Finck     HRESULT Initialize(LPCWSTR ntPath, PCIDLIST_ABSOLUTE parent, UINT cidl, PCUITEMID_CHILD_ARRAY apidl);
25c2c66affSColin Finck 
26*de8e1553SKatayama Hirofumi MZ     STDMETHOD(GetIconLocation)(
27c2c66affSColin Finck         UINT uFlags,
28c2c66affSColin Finck         LPWSTR szIconFile,
29c2c66affSColin Finck         UINT cchMax,
30c2c66affSColin Finck         INT *piIndex,
31*de8e1553SKatayama Hirofumi MZ         UINT *pwFlags) override;
32c2c66affSColin Finck 
33*de8e1553SKatayama Hirofumi MZ     STDMETHOD(Extract)(
34c2c66affSColin Finck         LPCWSTR pszFile,
35c2c66affSColin Finck         UINT nIconIndex,
36c2c66affSColin Finck         HICON *phiconLarge,
37c2c66affSColin Finck         HICON *phiconSmall,
38*de8e1553SKatayama Hirofumi MZ         UINT nIconSize) override;
39c2c66affSColin Finck 
40c2c66affSColin Finck     DECLARE_NOT_AGGREGATABLE(CNtObjectFolderExtractIcon)
41c2c66affSColin Finck     DECLARE_PROTECT_FINAL_CONSTRUCT()
42c2c66affSColin Finck 
43c2c66affSColin Finck     BEGIN_COM_MAP(CNtObjectFolderExtractIcon)
44c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW)
45c2c66affSColin Finck     END_COM_MAP()
46c2c66affSColin Finck 
47c2c66affSColin Finck };
48c2c66affSColin Finck 
49c2c66affSColin Finck class CNtObjectFolder :
50c2c66affSColin Finck     public CComCoClass<CNtObjectFolder, &CLSID_NtObjectFolder>,
51c2c66affSColin Finck     public CCommonFolder<CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon>
52c2c66affSColin Finck {
53c2c66affSColin Finck public:
54c2c66affSColin Finck     DECLARE_REGISTRY_RESOURCEID(IDR_NTOBJECTFOLDER)
55c2c66affSColin Finck 
56c2c66affSColin Finck     CNtObjectFolder();
57c2c66affSColin Finck     virtual ~CNtObjectFolder();
58c2c66affSColin Finck 
59c2c66affSColin Finck     // IShellFolder
60c2c66affSColin Finck 
61*de8e1553SKatayama Hirofumi MZ     STDMETHOD(EnumObjects)(
62c2c66affSColin Finck         HWND hwndOwner,
63c2c66affSColin Finck         SHCONTF grfFlags,
64*de8e1553SKatayama Hirofumi MZ         IEnumIDList **ppenumIDList) override;
65c2c66affSColin Finck 
66c2c66affSColin Finck protected:
67*de8e1553SKatayama Hirofumi MZ     STDMETHOD(InternalBindToObject)(
68c2c66affSColin Finck         PWSTR path,
69c2c66affSColin Finck         const NtPidlEntry * info,
70c2c66affSColin Finck         LPITEMIDLIST first,
71c2c66affSColin Finck         LPCITEMIDLIST rest,
72c2c66affSColin Finck         LPITEMIDLIST fullPidl,
73c2c66affSColin Finck         LPBC pbcReserved,
74*de8e1553SKatayama Hirofumi MZ         IShellFolder** ppsfChild) override;
75c2c66affSColin Finck 
76*de8e1553SKatayama Hirofumi MZ     STDMETHOD(ResolveSymLink)(
77c2c66affSColin Finck         const NtPidlEntry * info,
78*de8e1553SKatayama Hirofumi MZ         LPITEMIDLIST * fullPidl) override;
79c2c66affSColin Finck 
80c2c66affSColin Finck public:
81*de8e1553SKatayama Hirofumi MZ     STDMETHOD(GetDefaultColumnState)(
82c2c66affSColin Finck         UINT iColumn,
83*de8e1553SKatayama Hirofumi MZ         SHCOLSTATEF *pcsFlags) override;
84c2c66affSColin Finck 
85*de8e1553SKatayama Hirofumi MZ     STDMETHOD(GetDetailsEx)(
86c2c66affSColin Finck         LPCITEMIDLIST pidl,
87c2c66affSColin Finck         const SHCOLUMNID *pscid,
88*de8e1553SKatayama Hirofumi MZ         VARIANT *pv) override;
89c2c66affSColin Finck 
90*de8e1553SKatayama Hirofumi MZ     STDMETHOD(GetDetailsOf)(
91c2c66affSColin Finck         LPCITEMIDLIST pidl,
92c2c66affSColin Finck         UINT iColumn,
93*de8e1553SKatayama Hirofumi MZ         SHELLDETAILS *psd) override;
94c2c66affSColin Finck 
95*de8e1553SKatayama Hirofumi MZ     STDMETHOD(MapColumnToSCID)(
96c2c66affSColin Finck         UINT iColumn,
97*de8e1553SKatayama Hirofumi MZ         SHCOLUMNID *pscid) override;
98c2c66affSColin Finck 
99c2c66affSColin Finck     // IPersistFolder
100*de8e1553SKatayama Hirofumi MZ     STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidl) override;
101c2c66affSColin Finck 
102c2c66affSColin Finck     // Internal
103c2b476bdSThomas Faber     HRESULT STDMETHODCALLTYPE Initialize(PCIDLIST_ABSOLUTE pidl, PCWSTR ntPath);
104c2c66affSColin Finck 
105c2c66affSColin Finck protected:
106*de8e1553SKatayama Hirofumi MZ     STDMETHOD(CompareIDs)(LPARAM lParam, const NtPidlEntry * first, const NtPidlEntry * second) override;
107*de8e1553SKatayama Hirofumi MZ     STDMETHOD_(ULONG, ConvertAttributes)(const NtPidlEntry * entry, PULONG inMask) override;
108*de8e1553SKatayama Hirofumi MZ     STDMETHOD_(BOOL, IsFolder)(const NtPidlEntry * info) override;
109*de8e1553SKatayama Hirofumi MZ     STDMETHOD_(BOOL, IsSymLink)(const NtPidlEntry * info) override;
110c2c66affSColin Finck 
111c2c66affSColin Finck     virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry ** pentry);
112c2c66affSColin Finck 
113c2c66affSColin Finck     HRESULT FormatValueData(DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR * strContents);
114c2c66affSColin Finck 
115c2c66affSColin Finck     HRESULT FormatContentsForDisplay(const NtPidlEntry * info, HKEY rootKey, LPCWSTR ntPath, PCWSTR * strContents);
116c2c66affSColin Finck };
117