ReactOS 0.4.16-dev-1369-gd4d04c8
filedefext.h
Go to the documentation of this file.
1/*
2 * Provides default file 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 _FILE_DEF_EXT_H_
22#define _FILE_DEF_EXT_H_
23
25{
26 private:
30
31 typedef struct _LANGANDCODEPAGE_
32 {
36
37 public:
40 {
41 m_wszLang[0] = L'\0';
42 }
43
45 {
46 if (m_pInfo)
48 }
49
50 BOOL Load(LPCWSTR pwszPath);
51 LPCWSTR GetString(LPCWSTR pwszName);
54};
55
57 public CComCoClass<CFileDefExt, &CLSID_ShellFileDefExt>,
58 public CComObjectRootEx<CComMultiThreadModelNoCS>,
59 public IShellExtInit,
60 public IContextMenu,
61 public IShellPropSheetExt,
62 public CObjectWithSiteBase
63{
64private:
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);
75 void InitMultifilePage(HWND hwndDlg);
82
87
97 void InitDirStats(struct DIRTREESTATS *pStats);
98 BOOL WalkDirTree(PCWSTR pszPath, struct DIRTREESTATS *pStats, WIN32_FIND_DATAW *pWFD);
100
101 LONG volatile m_Destroyed = 0;
102 BOOL IsDestroyed() const { return m_Destroyed; }
103
106
107 // FolderCustomize
112
113public:
114 CFileDefExt();
115 ~CFileDefExt();
116
117 // FolderCustomize
118 BOOL OnFolderCustApply(HWND hwndDlg);
119 void OnFolderCustChangeIcon(HWND hwndDlg);
120 void OnFolderCustDestroy(HWND hwndDlg);
121 void UpdateFolderIcon(HWND hwndDlg);
122
123 // IShellExtInit
124 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
125
126 // IContextMenu
127 STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
129 STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override;
130
131 // IShellPropSheetExt
132 STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override;
133 STDMETHOD(ReplacePage)(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override;
134
137
139
141 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
142 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
143 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt)
146};
147
152};
153
154#endif /* _FILE_DEF_EXT_H_ */
UINT cchMax
#define STDMETHOD(m)
Definition: basetyps.h:62
static DWORD WINAPI _InitializeMultifileThreadProc(LPVOID lpParameter)
static INT_PTR CALLBACK VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
STDMETHOD() ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override
static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
Definition: filedefext.cpp:514
BOOL InitFileAttr(HWND hwndDlg)
Definition: filedefext.cpp:552
void OnFolderCustDestroy(HWND hwndDlg)
BOOL InitFileType(HWND hwndDlg)
Definition: filedefext.cpp:426
@ WM_UPDATEDIRSTATS
Definition: filedefext.h:95
WCHAR m_szFolderIconPath[MAX_PATH]
Definition: filedefext.h:108
ULARGE_INTEGER m_DirSize
Definition: filedefext.h:93
UINT m_cidl
Definition: filedefext.h:90
VOID InitOpensWithField(HWND hwndDlg)
Definition: filedefext.cpp:332
BOOL m_bMultifile
Definition: filedefext.h:86
void UpdateDirStatsResults()
Definition: filedefext.cpp:824
BOOL InitVersionPage(HWND hwndDlg)
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpici) override
LONG volatile m_Destroyed
Definition: filedefext.h:101
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedefext.cpp:709
void UpdateFolderIcon(HWND hwndDlg)
BOOL OnFolderCustApply(HWND hwndDlg)
BOOL InitFilePath(HWND hwndDlg)
Definition: filedefext.cpp:485
BOOL InitFolderCustomizePage(HWND hwndDlg)
DWORD m_cFiles
Definition: filedefext.h:91
static DWORD WINAPI _CountFolderAndFilesThreadProc(LPVOID lpParameter)
ULARGE_INTEGER m_DirSizeOnDisc
Definition: filedefext.h:94
LPITEMIDLIST * m_pidls
Definition: filedefext.h:89
BOOL m_bFolderIconIsSet
Definition: filedefext.h:111
STDMETHOD() AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override
WCHAR m_wszPath[MAX_PATH]
Definition: filedefext.h:83
static INT_PTR CALLBACK FolderCustomizePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void OnFolderCustChangeIcon(HWND hwndDlg)
void CountFolderAndFiles()
INT m_nFolderIconIndex
Definition: filedefext.h:109
DWORD m_cFolders
Definition: filedefext.h:92
BOOL m_bDir
Definition: filedefext.h:85
STDMETHOD() GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
BOOL IsDestroyed() const
Definition: filedefext.h:102
BOOL InitGeneralPage(HWND hwndDlg)
Definition: filedefext.cpp:653
HICON m_hFolderIcon
Definition: filedefext.h:110
static INT_PTR CALLBACK MultifilePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void InitMultifilePageThread()
Definition: filedefext.cpp:946
CFileVersionInfo m_VerInfo
Definition: filedefext.h:84
BOOL AddVersionString(HWND hwndDlg, LPCWSTR pwszName)
STDMETHOD() QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
void InitDirStats(struct DIRTREESTATS *pStats)
Definition: filedefext.cpp:838
BOOL SetVersionLabel(HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName)
void InitMultifilePage(HWND hwndDlg)
LPITEMIDLIST m_pidlFolder
Definition: filedefext.h:88
BOOL WalkDirTree(PCWSTR pszPath, struct DIRTREESTATS *pStats, WIN32_FIND_DATAW *pWFD)
Definition: filedefext.cpp:896
HWND m_hWndDirStatsDlg
Definition: filedefext.h:96
struct CFileVersionInfo::_LANGANDCODEPAGE_ * LPLANGANDCODEPAGE
WCHAR m_wszLang[64]
Definition: filedefext.h:29
struct CFileVersionInfo::_LANGANDCODEPAGE_ LANGANDCODEPAGE
BOOL Load(LPCWSTR pwszPath)
Definition: filedefext.cpp:120
LPCWSTR GetString(LPCWSTR pwszName)
Definition: filedefext.cpp:161
VS_FIXEDFILEINFO * GetFixedInfo()
Definition: filedefext.cpp:191
LPCWSTR GetLangName()
Definition: filedefext.cpp:203
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
UINT uFlags
Definition: api.c:59
#define GetProcessHeap()
Definition: compat.h:736
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define L(x)
Definition: resources.c:13
#define WM_APP
Definition: eventvwr.h:73
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
static HICON
Definition: imagelist.c:80
const IID IID_IObjectWithSite
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static HMENU hmenu
Definition: win.c:66
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
#define IDR_FILEDEFEXT
Definition: shresdef.h:938
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
static void Initialize()
Definition: xlate.c:212
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185