2 * Provides default file shell extension
4 * Copyright 2012 Rafal Harabien
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.
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.
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
21 #ifndef _FILE_DEF_EXT_H_
22 #define _FILE_DEF_EXT_H_
24 class CFileVersionInfo
28 WORD m_wLang
, m_wCode
;
31 typedef struct _LANGANDCODEPAGE_
35 } LANGANDCODEPAGE
, *LPLANGANDCODEPAGE
;
38 inline CFileVersionInfo():
39 m_pInfo(NULL
), m_wLang(0), m_wCode(0)
44 inline ~CFileVersionInfo()
47 HeapFree(GetProcessHeap(), 0, m_pInfo
);
50 BOOL
Load(LPCWSTR pwszPath
);
51 LPCWSTR
GetString(LPCWSTR pwszName
);
52 VS_FIXEDFILEINFO
*GetFixedInfo();
53 LPCWSTR
GetLangName();
57 public CComCoClass
<CFileDefExt
, &CLSID_ShellFileDefExt
>,
58 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
61 public IShellPropSheetExt
,
62 public IObjectWithSite
65 VOID
InitOpensWithField(HWND hwndDlg
);
66 BOOL
InitFileType(HWND hwndDlg
);
67 BOOL
InitFilePath(HWND hwndDlg
);
68 static BOOL
GetFileTimeString(LPFILETIME lpFileTime
, LPWSTR pwszResult
, UINT cchResult
);
69 BOOL
InitFileAttr(HWND hwndDlg
);
70 BOOL
InitGeneralPage(HWND hwndDlg
);
71 BOOL
SetVersionLabel(HWND hwndDlg
, DWORD idCtrl
, LPCWSTR pwszName
);
72 BOOL
AddVersionString(HWND hwndDlg
, LPCWSTR pwszName
);
73 BOOL
InitVersionPage(HWND hwndDlg
);
74 static INT_PTR CALLBACK
GeneralPageProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
75 static INT_PTR CALLBACK
VersionPageProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
76 BOOL
CountFolderAndFiles(HWND hwndDlg
, LPWSTR pwszBuf
, UINT cchBufMax
, LPDWORD ticks
);
78 WCHAR m_wszPath
[MAX_PATH
];
79 CFileVersionInfo m_VerInfo
;
84 ULARGE_INTEGER m_DirSize
;
86 static DWORD WINAPI
_CountFolderAndFilesThreadProc(LPVOID lpParameter
);
93 virtual HRESULT STDMETHODCALLTYPE
Initialize(LPCITEMIDLIST pidlFolder
, IDataObject
*pdtobj
, HKEY hkeyProgID
);
96 virtual HRESULT WINAPI
QueryContextMenu(HMENU hmenu
, UINT indexMenu
, UINT idCmdFirst
, UINT idCmdLast
, UINT uFlags
);
97 virtual HRESULT WINAPI
InvokeCommand(LPCMINVOKECOMMANDINFO lpici
);
98 virtual HRESULT WINAPI
GetCommandString(UINT_PTR idCmd
, UINT uType
, UINT
*pwReserved
, LPSTR pszName
, UINT cchMax
);
100 // IShellPropSheetExt
101 virtual HRESULT WINAPI
AddPages(LPFNADDPROPSHEETPAGE pfnAddPage
, LPARAM lParam
);
102 virtual HRESULT WINAPI
ReplacePage(UINT uPageID
, LPFNADDPROPSHEETPAGE pfnReplacePage
, LPARAM lParam
);
105 virtual HRESULT WINAPI
SetSite(IUnknown
*punk
);
106 virtual HRESULT WINAPI
GetSite(REFIID iid
, void **ppvSite
);
108 DECLARE_REGISTRY_RESOURCEID(IDR_FILEDEFEXT
)
109 DECLARE_NOT_AGGREGATABLE(CFileDefExt
)
111 DECLARE_PROTECT_FINAL_CONSTRUCT()
113 BEGIN_COM_MAP(CFileDefExt
)
114 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit
, IShellExtInit
)
115 COM_INTERFACE_ENTRY_IID(IID_IContextMenu
, IContextMenu
)
116 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt
, IShellPropSheetExt
)
117 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite
, IObjectWithSite
)
121 struct _CountFolderAndFilesData
{
128 #endif /* _FILE_DEF_EXT_H_ */