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