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 24 class CDrvDefExt : 25 public CComCoClass<CDrvDefExt, &CLSID_ShellDrvDefExt>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IShellExtInit, 28 public IContextMenu, 29 public IShellPropSheetExt, 30 public IObjectWithSite 31 { 32 private: 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 42 public: 43 CDrvDefExt(); 44 ~CDrvDefExt(); 45 46 // IShellExtInit 47 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pDataObj, HKEY hkeyProgID) override; 48 49 // IContextMenu 50 STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; 51 STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici) override; 52 STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override; 53 54 // IShellPropSheetExt 55 STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override; 56 STDMETHOD(ReplacePage)(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override; 57 58 // IObjectWithSite 59 STDMETHOD(SetSite)(IUnknown *punk) override; 60 STDMETHOD(GetSite)(REFIID iid, void **ppvSite) override; 61 62 DECLARE_REGISTRY_RESOURCEID(IDR_DRVDEFEXT) 63 DECLARE_NOT_AGGREGATABLE(CDrvDefExt) 64 65 DECLARE_PROTECT_FINAL_CONSTRUCT() 66 67 BEGIN_COM_MAP(CDrvDefExt) 68 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) 69 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) 70 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) 71 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) 72 END_COM_MAP() 73 }; 74 75 #endif /* _DRV_DEF_EXT_H_ */ 76