Reactos
at master 78 lines 2.9 kB view raw
1/* 2 * Provides default drive shell extension 3 * 4 * Copyright 2012 Rafal Harabien 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21#ifndef _DRV_DEF_EXT_H_ 22#define _DRV_DEF_EXT_H_ 23 24class CDrvDefExt : 25 public CComCoClass<CDrvDefExt, &CLSID_ShellDrvDefExt>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IShellExtInit, 28 public IContextMenu, 29 public IShellPropSheetExt, 30 public IObjectWithSite 31{ 32private: 33 VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem); 34 VOID InitGeneralPage(HWND hwndDlg); 35 static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 36 static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 37 static INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 38 39 WCHAR m_wszDrive[MAX_PATH]; 40 UINT m_FreeSpacePerc; 41 CComPtr<IDataObject> m_Multiple; 42 43 HRESULT AddMainPage(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); 44 45public: 46 CDrvDefExt(); 47 ~CDrvDefExt(); 48 49 // IShellExtInit 50 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pDataObj, HKEY hkeyProgID) override; 51 52 // IContextMenu 53 STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; 54 STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici) override; 55 STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override; 56 57 // IShellPropSheetExt 58 STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override; 59 STDMETHOD(ReplacePage)(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override; 60 61 // IObjectWithSite 62 STDMETHOD(SetSite)(IUnknown *punk) override; 63 STDMETHOD(GetSite)(REFIID iid, void **ppvSite) override; 64 65DECLARE_REGISTRY_RESOURCEID(IDR_DRVDEFEXT) 66DECLARE_NOT_AGGREGATABLE(CDrvDefExt) 67 68DECLARE_PROTECT_FINAL_CONSTRUCT() 69 70BEGIN_COM_MAP(CDrvDefExt) 71 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) 72 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) 73 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) 74 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) 75END_COM_MAP() 76}; 77 78#endif /* _DRV_DEF_EXT_H_ */