ReactOS  0.4.15-dev-985-gd905dd5
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:
38  inline CFileVersionInfo():
39  m_pInfo(NULL), m_wLang(0), m_wCode(0)
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 
56 class CFileDefExt :
57  public CComCoClass<CFileDefExt, &CLSID_ShellFileDefExt>,
58  public CComObjectRootEx<CComMultiThreadModelNoCS>,
59  public IShellExtInit,
60  public IContextMenu,
61  public IShellPropSheetExt,
62  public IObjectWithSite
63 {
64 private:
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);
78  BOOL CountFolderAndFiles(HWND hwndDlg, LPCWSTR pwszBuf, LPDWORD ticks);
79 
83 
88 
90 
91  // FolderCustomize
96 
97 public:
98  CFileDefExt();
99  ~CFileDefExt();
100 
101  // FolderCustomize
102  BOOL OnFolderCustApply(HWND hwndDlg);
103  void OnFolderCustChangeIcon(HWND hwndDlg);
104  void OnFolderCustDestroy(HWND hwndDlg);
105  void UpdateFolderIcon(HWND hwndDlg);
106 
107  // IShellExtInit
108  virtual HRESULT STDMETHODCALLTYPE Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
109 
110  // IContextMenu
111  virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
113  virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax);
114 
115  // IShellPropSheetExt
117  virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam);
118 
119  // IObjectWithSite
120  virtual HRESULT WINAPI SetSite(IUnknown *punk);
121  virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite);
122 
125 
127 
129  COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
130  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
131  COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt)
133 END_COM_MAP()
134 };
135 
140 };
141 
142 #endif /* _FILE_DEF_EXT_H_ */
virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
static HICON
Definition: imagelist.c:84
CFileVersionInfo m_VerInfo
Definition: filedefext.h:81
BOOL Load(LPCWSTR pwszPath)
Definition: filedefext.cpp:82
#define REFIID
Definition: guiddef.h:118
VOID InitOpensWithField(HWND hwndDlg)
Definition: filedefext.cpp:322
static HMENU hmenu
Definition: win.c:66
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
void UpdateFolderIcon(HWND hwndDlg)
BOOL AddVersionString(HWND hwndDlg, LPCWSTR pwszName)
Definition: filedefext.cpp:902
#define IDR_FILEDEFEXT
Definition: shresdef.h:840
#define CALLBACK
Definition: compat.h:35
virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite)
struct CFileVersionInfo::_LANGANDCODEPAGE_ LANGANDCODEPAGE
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
BOOL InitGeneralPage(HWND hwndDlg)
Definition: filedefext.cpp:664
static INT_PTR CALLBACK VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedefext.cpp:931
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:59
int32_t INT_PTR
Definition: typedefs.h:64
BOOL InitVersionPage(HWND hwndDlg)
Definition: filedefext.cpp:822
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
void OnFolderCustChangeIcon(HWND hwndDlg)
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL InitFileAttr(HWND hwndDlg)
Definition: filedefext.cpp:536
BOOL InitFolderCustomizePage(HWND hwndDlg)
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax)
void OnFolderCustDestroy(HWND hwndDlg)
BOOL OnFolderCustApply(HWND hwndDlg)
smooth NULL
Definition: ftsmooth.c:416
INT m_nFolderIconIndex
Definition: filedefext.h:93
LONG_PTR LPARAM
Definition: windef.h:208
struct CFileVersionInfo::_LANGANDCODEPAGE_ * LPLANGANDCODEPAGE
virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
virtual HRESULT WINAPI SetSite(IUnknown *punk)
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
DWORD m_cFolders
Definition: filedefext.h:85
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedefext.cpp:720
static INT_PTR CALLBACK FolderCustomizePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedefext.cpp:987
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
BOOL InitFileType(HWND hwndDlg)
Definition: filedefext.cpp:410
DWORD m_cFiles
Definition: filedefext.h:84
BOOL SetVersionLabel(HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName)
Definition: filedefext.cpp:877
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
ULARGE_INTEGER m_DirSize
Definition: filedefext.h:86
BOOL m_bFolderIconIsSet
Definition: filedefext.h:95
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
const IID IID_IObjectWithSite
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
UINT cchMax
virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
ULARGE_INTEGER m_DirSizeOnDisc
Definition: filedefext.h:87
WCHAR m_wszLang[64]
Definition: filedefext.h:29
static const WCHAR L[]
Definition: oid.c:1250
LPVOID lpParameter
Definition: kernel32.h:241
BOOL InitFilePath(HWND hwndDlg)
Definition: filedefext.cpp:469
LPCWSTR GetString(LPCWSTR pwszName)
Definition: filedefext.cpp:123
WCHAR m_szFolderIconPath[MAX_PATH]
Definition: filedefext.h:92
VS_FIXEDFILEINFO * GetFixedInfo()
Definition: filedefext.cpp:153
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
unsigned int UINT
Definition: ndis.h:50
WCHAR m_wszPath[MAX_PATH]
Definition: filedefext.h:80
HICON m_hFolderIcon
Definition: filedefext.h:94
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
static DWORD WINAPI _CountFolderAndFilesThreadProc(LPVOID lpParameter)
uint32_t * LPDWORD
Definition: typedefs.h:59
virtual HRESULT STDMETHODCALLTYPE Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
Definition: filedefext.cpp:498
LPCWSTR GetLangName()
Definition: filedefext.cpp:165
#define END_COM_MAP()
Definition: atlcom.h:552
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL m_bDir
Definition: filedefext.h:82
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL CountFolderAndFiles(HWND hwndDlg, LPCWSTR pwszBuf, LPDWORD ticks)
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:483