[NTOBJSHEX]
[reactos.git] / reactos / dll / shellext / ntobjshex / regfolder.h
index 55e4327..6d25163 100644 (file)
@@ -9,17 +9,48 @@
 
 extern const GUID CLSID_RegistryFolder;
 
+class CRegistryFolderExtractIcon :
+    public CComObjectRootEx<CComMultiThreadModelNoCS>,
+    public IExtractIconW
+{
+    PCIDLIST_ABSOLUTE m_pcidlFolder;
+    PCITEMID_CHILD    m_pcidlChild;
+
+public:
+    CRegistryFolderExtractIcon();
+
+    virtual ~CRegistryFolderExtractIcon();
+
+    HRESULT Initialize(LPCWSTR ntPath, PCIDLIST_ABSOLUTE parent, UINT cidl, PCUITEMID_CHILD_ARRAY apidl);
+
+    virtual HRESULT STDMETHODCALLTYPE GetIconLocation(
+        UINT uFlags,
+        LPWSTR szIconFile,
+        UINT cchMax,
+        INT *piIndex,
+        UINT *pwFlags);
+
+    virtual HRESULT STDMETHODCALLTYPE Extract(
+        LPCWSTR pszFile,
+        UINT nIconIndex,
+        HICON *phiconLarge,
+        HICON *phiconSmall,
+        UINT nIconSize);
+
+    DECLARE_NOT_AGGREGATABLE(CRegistryFolderExtractIcon)
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(CRegistryFolderExtractIcon)
+        COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW)
+    END_COM_MAP()
+
+};
+
 class CRegistryFolder :
     public CComCoClass<CRegistryFolder, &CLSID_RegistryFolder>,
-    public CComObjectRootEx<CComMultiThreadModelNoCS>,
-    public IShellFolder2,
-    public IPersistFolder2,
-    public IShellFolderViewCB
+    public CCommonFolder<CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon>
 {
     HKEY m_hRoot;
-    WCHAR m_NtPath[MAX_PATH];
-
-    LPITEMIDLIST m_shellPidl;
 
 public:
 
@@ -27,77 +58,19 @@ public:
     virtual ~CRegistryFolder();
 
     // IShellFolder
-    virtual HRESULT STDMETHODCALLTYPE ParseDisplayName(
-        HWND hwndOwner,
-        LPBC pbcReserved,
-        LPOLESTR lpszDisplayName,
-        ULONG *pchEaten,
-        LPITEMIDLIST *ppidl,
-        ULONG *pdwAttributes);
-
     virtual HRESULT STDMETHODCALLTYPE EnumObjects(
         HWND hwndOwner,
         SHCONTF grfFlags,
         IEnumIDList **ppenumIDList);
 
-    virtual HRESULT STDMETHODCALLTYPE BindToObject(
-        LPCITEMIDLIST pidl,
+    virtual HRESULT STDMETHODCALLTYPE InternalBindToObject(
+        PWSTR path,
+        const RegPidlEntry * info,
+        LPITEMIDLIST first,
+        LPCITEMIDLIST rest,
+        LPITEMIDLIST fullPidl,
         LPBC pbcReserved,
-        REFIID riid,
-        void **ppvOut);
-
-    virtual HRESULT STDMETHODCALLTYPE BindToStorage(
-        LPCITEMIDLIST pidl,
-        LPBC pbcReserved,
-        REFIID riid,
-        void **ppvObj);
-
-    virtual HRESULT STDMETHODCALLTYPE CompareIDs(
-        LPARAM lParam,
-        LPCITEMIDLIST pidl1,
-        LPCITEMIDLIST pidl2);
-
-    virtual HRESULT STDMETHODCALLTYPE CreateViewObject(
-        HWND hwndOwner,
-        REFIID riid,
-        void **ppvOut);
-
-    virtual HRESULT STDMETHODCALLTYPE GetAttributesOf(
-        UINT cidl,
-        PCUITEMID_CHILD_ARRAY apidl,
-        SFGAOF *rgfInOut);
-
-    virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf(
-        HWND hwndOwner,
-        UINT cidl,
-        PCUITEMID_CHILD_ARRAY apidl,
-        REFIID riid,
-        UINT *prgfInOut,
-        void **ppvOut);
-
-    virtual HRESULT STDMETHODCALLTYPE GetDisplayNameOf(
-        LPCITEMIDLIST pidl,
-        SHGDNF uFlags,
-        STRRET *lpName);
-
-    virtual HRESULT STDMETHODCALLTYPE SetNameOf(
-        HWND hwnd,
-        LPCITEMIDLIST pidl,
-        LPCOLESTR lpszName,
-        SHGDNF uFlags,
-        LPITEMIDLIST *ppidlOut);
-
-    // IShellFolder2
-    virtual HRESULT STDMETHODCALLTYPE GetDefaultSearchGUID(
-        GUID *lpguid);
-
-    virtual HRESULT STDMETHODCALLTYPE EnumSearches(
-        IEnumExtraSearch **ppenum);
-
-    virtual HRESULT STDMETHODCALLTYPE GetDefaultColumn(
-        DWORD dwReserved,
-        ULONG *pSort,
-        ULONG *pDisplay);
+        IShellFolder** ppsfChild);
 
     virtual HRESULT STDMETHODCALLTYPE GetDefaultColumnState(
         UINT iColumn,
@@ -117,34 +90,21 @@ public:
         UINT iColumn,
         SHCOLUMNID *pscid);
 
-    // IPersist
-    virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *lpClassId);
-
     // IPersistFolder
     virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl);
 
-    // IPersistFolder2
-    virtual HRESULT STDMETHODCALLTYPE GetCurFolder(LPITEMIDLIST * pidl);
-
-    // IShellFolderViewCB
-    virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
-
     // Internal
-    HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl, PCWSTR ntPath, HKEY hRoot);
+    virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl, PCWSTR ntPath, HKEY hRoot);
 
-    static HRESULT CALLBACK DefCtxMenuCallback(IShellFolder *, HWND, IDataObject *, UINT, WPARAM, LPARAM);
+protected:
+    virtual HRESULT STDMETHODCALLTYPE CompareIDs(LPARAM lParam, const RegPidlEntry * first, const RegPidlEntry * second);
+    virtual ULONG STDMETHODCALLTYPE ConvertAttributes(const RegPidlEntry * entry, PULONG inMask);
+    virtual BOOL STDMETHODCALLTYPE IsFolder(LPCITEMIDLIST pcidl);
+    virtual BOOL STDMETHODCALLTYPE IsFolder(const RegPidlEntry * info);
 
-    DECLARE_REGISTRY_RESOURCEID(IDR_REGISTRYFOLDER)
-    DECLARE_NOT_AGGREGATABLE(CRegistryFolder)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
+    virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry ** pentry);
 
-    BEGIN_COM_MAP(CRegistryFolder)
-        COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
-        COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
-        COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
-        COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
-        COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
-        COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
-    END_COM_MAP()
+    HRESULT FormatValueData(DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR * strContents);
 
-};
\ No newline at end of file
+    HRESULT FormatContentsForDisplay(const RegPidlEntry * info, HKEY rootKey, LPCWSTR ntPath, PCWSTR * strContents);
+};