ReactOS 0.4.16-dev-1273-g5b94656
CFileDefExt Class Reference

#include <filedefext.h>

Inheritance diagram for CFileDefExt:
Collaboration diagram for CFileDefExt:

Public Member Functions

 CFileDefExt ()
 
 ~CFileDefExt ()
 
BOOL OnFolderCustApply (HWND hwndDlg)
 
void OnFolderCustChangeIcon (HWND hwndDlg)
 
void OnFolderCustDestroy (HWND hwndDlg)
 
void UpdateFolderIcon (HWND hwndDlg)
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override
 
STDMETHOD() QueryContextMenu (HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
 
STDMETHOD() InvokeCommand (LPCMINVOKECOMMANDINFO lpici) override
 
STDMETHOD() GetCommandString (UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
 
STDMETHOD() AddPages (LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override
 
STDMETHOD() ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidlFolder, [in] IDataObject *pdtobj, [in] HKEY hkeyProgID)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
- Public Member Functions inherited from IShellPropSheetExt
HRESULT AddPages ([in] LPFNSVADDPROPSHEETPAGE pfnAddPage, [in] LPARAM lParam)
 
HRESULT ReplacePage ([in] EXPPS uPageID, [in] LPFNSVADDPROPSHEETPAGE pfnReplaceWith, [in] LPARAM lParam)
 

Private Types

enum  { WM_UPDATEDIRSTATS = WM_APP }
 

Private Member Functions

VOID InitOpensWithField (HWND hwndDlg)
 
BOOL InitFileType (HWND hwndDlg)
 
BOOL InitFilePath (HWND hwndDlg)
 
BOOL InitFileAttr (HWND hwndDlg)
 
BOOL InitGeneralPage (HWND hwndDlg)
 
BOOL SetVersionLabel (HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName)
 
BOOL AddVersionString (HWND hwndDlg, LPCWSTR pwszName)
 
BOOL InitVersionPage (HWND hwndDlg)
 
BOOL InitFolderCustomizePage (HWND hwndDlg)
 
void InitMultifilePage (HWND hwndDlg)
 
void InitMultifilePageThread ()
 
void CountFolderAndFiles ()
 
void InitDirStats (struct DIRTREESTATS *pStats)
 
BOOL WalkDirTree (PCWSTR pszPath, struct DIRTREESTATS *pStats, WIN32_FIND_DATAW *pWFD)
 
void UpdateDirStatsResults ()
 
BOOL IsDestroyed () const
 

Static Private Member Functions

static BOOL GetFileTimeString (LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
 
static INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK VersionPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK FolderCustomizePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK MultifilePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static DWORD WINAPI _CountFolderAndFilesThreadProc (LPVOID lpParameter)
 
static DWORD WINAPI _InitializeMultifileThreadProc (LPVOID lpParameter)
 

Private Attributes

WCHAR m_wszPath [MAX_PATH]
 
CFileVersionInfo m_VerInfo
 
BOOL m_bDir
 
BOOL m_bMultifile
 
LPITEMIDLIST m_pidlFolder = NULL
 
LPITEMIDLISTm_pidls = NULL
 
UINT m_cidl = 0
 
DWORD m_cFiles
 
DWORD m_cFolders
 
ULARGE_INTEGER m_DirSize
 
ULARGE_INTEGER m_DirSizeOnDisc
 
HWND m_hWndDirStatsDlg
 
LONG volatile m_Destroyed = 0
 
WCHAR m_szFolderIconPath [MAX_PATH]
 
INT m_nFolderIconIndex
 
HICON m_hFolderIcon
 
BOOL m_bFolderIconIsSet
 

Additional Inherited Members

- Public Types inherited from IShellExtInit
typedef IShellExtInitLPSHELLEXTINIT
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IContextMenu
typedef IContextMenuLPCONTEXTMENU
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- Public Types inherited from IShellPropSheetExt
enum  tagSHELLPROPSHEETEXTPAGEID { EXPPS_FILETYPES = 0x1 }
 
typedef UINT EXPPS
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Static Public Attributes inherited from IContextMenu
static const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 56 of file filedefext.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
WM_UPDATEDIRSTATS 

Definition at line 95 of file filedefext.h.

@ WM_UPDATEDIRSTATS
Definition: filedefext.h:95
#define WM_APP
Definition: eventvwr.h:73

Constructor & Destructor Documentation

◆ CFileDefExt()

CFileDefExt::CFileDefExt ( )

Definition at line 1490 of file filedefext.cpp.

1490 :
1492{
1493 m_wszPath[0] = L'\0';
1494 m_DirSize.QuadPart = 0ull;
1496
1497 m_szFolderIconPath[0] = 0;
1501}
WCHAR m_szFolderIconPath[MAX_PATH]
Definition: filedefext.h:108
ULARGE_INTEGER m_DirSize
Definition: filedefext.h:93
BOOL m_bMultifile
Definition: filedefext.h:86
DWORD m_cFiles
Definition: filedefext.h:91
ULARGE_INTEGER m_DirSizeOnDisc
Definition: filedefext.h:94
BOOL m_bFolderIconIsSet
Definition: filedefext.h:111
WCHAR m_wszPath[MAX_PATH]
Definition: filedefext.h:83
INT m_nFolderIconIndex
Definition: filedefext.h:109
DWORD m_cFolders
Definition: filedefext.h:92
BOOL m_bDir
Definition: filedefext.h:85
HICON m_hFolderIcon
Definition: filedefext.h:110
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define L(x)
Definition: ntvdm.h:50
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185

◆ ~CFileDefExt()

CFileDefExt::~CFileDefExt ( )

Definition at line 1503 of file filedefext.cpp.

1504{
1507}
UINT m_cidl
Definition: filedefext.h:90
LPITEMIDLIST * m_pidls
Definition: filedefext.h:89
LPITEMIDLIST m_pidlFolder
Definition: filedefext.h:88
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1045
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2608

Member Function Documentation

◆ _CountFolderAndFilesThreadProc()

DWORD CALLBACK CFileDefExt::_CountFolderAndFilesThreadProc ( LPVOID  lpParameter)
staticprivate

Definition at line 1638 of file filedefext.cpp.

1639{
1640 CFileDefExt *pThis = static_cast<CFileDefExt*>(lpParameter);
1641 pThis->CountFolderAndFiles();
1642 return pThis->Release();
1643}
void CountFolderAndFiles()
ULONG Release()

Referenced by InitFileAttr().

◆ _InitializeMultifileThreadProc()

DWORD CALLBACK CFileDefExt::_InitializeMultifileThreadProc ( LPVOID  lpParameter)
staticprivate

Definition at line 1002 of file filedefext.cpp.

1003{
1004 CFileDefExt *pThis = static_cast<CFileDefExt*>(lpParameter);
1005 pThis->InitMultifilePageThread();
1006 return pThis->Release();
1007}
void InitMultifilePageThread()
Definition: filedefext.cpp:946

Referenced by InitMultifilePage().

◆ AddPages()

HRESULT WINAPI CFileDefExt::AddPages ( LPFNADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
override

Definition at line 1583 of file filedefext.cpp.

1584{
1585 HPROPSHEETPAGE hPage;
1588
1589 hPage = SH_CreatePropertySheetPageEx(wResId, pfnFirstPage, (LPARAM)this, NULL,
1590 &PropSheetPageLifetimeCallback<CFileDefExt>);
1591 HRESULT hr = AddPropSheetPage(hPage, pfnAddPage, lParam);
1593 return hr;
1594 else
1595 AddRef(); // For PropSheetPageLifetimeCallback
1596
1597 if (m_bMultifile)
1598 return S_OK;
1599
1601 {
1604 (LPARAM)this,
1605 NULL);
1606 AddPropSheetPage(hPage, pfnAddPage, lParam);
1607 }
1608
1609 if (m_bDir)
1610 {
1613 (LPARAM)this,
1614 NULL);
1615 AddPropSheetPage(hPage, pfnAddPage, lParam);
1616 }
1617
1618 return S_OK;
1619}
static INT_PTR CALLBACK VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedefext.cpp:709
static INT_PTR CALLBACK FolderCustomizePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK MultifilePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPARAM lParam
Definition: combotst.c:139
#define DLGPROC
Definition: maze.c:62
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:738
static HRESULT AddPropSheetPage(HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: precomp.h:151
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
unsigned short WORD
Definition: ntddk_ex.h:93
ULONG AddRef()
#define S_OK
Definition: intsafe.h:52
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HRESULT hr
Definition: shlfolder.c:183
#define IDD_FILE_VERSION
Definition: shresdef.h:434
#define IDD_FILE_PROPERTIES
Definition: shresdef.h:425
#define IDD_FOLDER_CUSTOMIZE
Definition: shresdef.h:555
#define IDD_FOLDER_PROPERTIES
Definition: shresdef.h:426
HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle)
Definition: propsheet.cpp:243
HPROPSHEETPAGE SH_CreatePropertySheetPageEx(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle, LPFNPSPCALLBACK Callback)
Definition: propsheet.cpp:223
LONG_PTR LPARAM
Definition: windef.h:208

◆ AddVersionString()

BOOL CFileDefExt::AddVersionString ( HWND  hwndDlg,
LPCWSTR  pwszName 
)
private

Definition at line 1171 of file filedefext.cpp.

1172{
1173 TRACE("pwszName %s, hwndDlg %p\n", debugstr_w(pwszName), hwndDlg);
1174
1175 if (hwndDlg == NULL || pwszName == NULL)
1176 return FALSE;
1177
1178 LPCWSTR pwszValue = m_VerInfo.GetString(pwszName);
1179 if (pwszValue)
1180 {
1181 /* listbox name property */
1182 HWND hDlgCtrl = GetDlgItem(hwndDlg, 14009);
1183 TRACE("%s :: %s\n", debugstr_w(pwszName), debugstr_w(pwszValue));
1184 UINT Index = SendMessageW(hDlgCtrl, LB_ADDSTRING, (WPARAM) -1, (LPARAM)pwszName);
1185 SendMessageW(hDlgCtrl, LB_SETITEMDATA, (WPARAM)Index, (LPARAM)(WCHAR *)pwszValue);
1186 return TRUE;
1187 }
1188
1189 return FALSE;
1190}
CFileVersionInfo m_VerInfo
Definition: filedefext.h:84
LPCWSTR GetString(LPCWSTR pwszName)
Definition: filedefext.cpp:161
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
unsigned int UINT
Definition: ndis.h:50
#define TRACE(s)
Definition: solgame.cpp:4
_In_ WDFCOLLECTION _In_ ULONG Index
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_ADDSTRING
Definition: winuser.h:2050
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LB_SETITEMDATA
Definition: winuser.h:2084
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by InitVersionPage().

◆ CountFolderAndFiles()

void CFileDefExt::CountFolderAndFiles ( )
private

Definition at line 1629 of file filedefext.cpp.

1630{
1631 DIRTREESTATS Stats;
1632 InitDirStats(&Stats);
1633 WalkDirTree(m_wszPath, &Stats, NULL);
1635}
void UpdateDirStatsResults()
Definition: filedefext.cpp:824
void InitDirStats(struct DIRTREESTATS *pStats)
Definition: filedefext.cpp:838
BOOL WalkDirTree(PCWSTR pszPath, struct DIRTREESTATS *pStats, WIN32_FIND_DATAW *pWFD)
Definition: filedefext.cpp:896

Referenced by _CountFolderAndFilesThreadProc().

◆ FolderCustomizePageProc()

INT_PTR CALLBACK CFileDefExt::FolderCustomizePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 1253 of file filedefext.cpp.

1254{
1255 CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
1256 switch (uMsg)
1257 {
1258 case WM_INITDIALOG:
1259 {
1261
1262 if (ppsp == NULL || !ppsp->lParam)
1263 break;
1264
1265 TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %x\n", hwndDlg, lParam, ppsp->lParam);
1266
1267 pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
1268 return pFileDefExt->InitFolderCustomizePage(hwndDlg);
1269 }
1270
1271 case WM_COMMAND:
1272 switch (LOWORD(wParam))
1273 {
1275 pFileDefExt->OnFolderCustChangeIcon(hwndDlg);
1276 break;
1277
1279 // TODO:
1280 break;
1281
1283 // TODO:
1284 break;
1285 }
1286 break;
1287
1288 case WM_NOTIFY:
1289 {
1291 if (lppsn->hdr.code == PSN_APPLY)
1292 {
1293 // apply or not
1294 if (pFileDefExt->OnFolderCustApply(hwndDlg))
1295 {
1297 }
1298 else
1299 {
1301 }
1302 return TRUE;
1303 }
1304 break;
1305 }
1306
1307 case PSM_QUERYSIBLINGS:
1308 return FALSE; // continue
1309
1310 case WM_DESTROY:
1311 pFileDefExt->OnFolderCustDestroy(hwndDlg);
1312 break;
1313
1314 default:
1315 break;
1316 }
1317
1318 return FALSE;
1319}
void OnFolderCustDestroy(HWND hwndDlg)
BOOL OnFolderCustApply(HWND hwndDlg)
BOOL InitFolderCustomizePage(HWND hwndDlg)
void OnFolderCustChangeIcon(HWND hwndDlg)
WPARAM wParam
Definition: combotst.c:138
#define LOWORD(l)
Definition: pedump.c:82
#define PSNRET_INVALID_NOCHANGEPAGE
Definition: prsht.h:131
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
#define PSM_QUERYSIBLINGS
Definition: prsht.h:160
#define WM_NOTIFY
Definition: richedit.h:61
#define IDC_FOLDERCUST_CHANGE_ICON
Definition: shresdef.h:565
#define IDC_FOLDERCUST_RESTORE_DEFAULTS
Definition: shresdef.h:562
#define IDC_FOLDERCUST_CHOOSE_PIC
Definition: shresdef.h:561
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3235
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_USER
Definition: winuser.h:883
#define WM_COMMAND
Definition: winuser.h:1759
#define WM_INITDIALOG
Definition: winuser.h:1758
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define WM_DESTROY
Definition: winuser.h:1628

Referenced by AddPages().

◆ GeneralPageProc()

INT_PTR CALLBACK CFileDefExt::GeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 709 of file filedefext.cpp.

710{
711 CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
712 switch (uMsg)
713 {
714 case WM_INITDIALOG:
715 {
717
718 if (ppsp == NULL || !ppsp->lParam)
719 break;
720
721 TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
722
723 pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
724 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
725 pFileDefExt->InitGeneralPage(hwndDlg);
726 break;
727 }
728 case WM_COMMAND:
729 if (LOWORD(wParam) == 14024) /* Opens With - Change */
730 {
731 OPENASINFO oainfo;
732 oainfo.pcszFile = pFileDefExt->m_wszPath;
733 oainfo.pcszClass = NULL;
735 if (SHOpenWithDialog(hwndDlg, &oainfo) == S_OK)
736 {
737 pFileDefExt->InitGeneralPage(hwndDlg);
738 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
739 }
740 break;
741 }
742 else if (LOWORD(wParam) == 14021 || LOWORD(wParam) == 14022 || LOWORD(wParam) == 14023) /* checkboxes */
743 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
744 else if (LOWORD(wParam) == 14001) /* Name */
745 {
746 if (HIWORD(wParam) == EN_CHANGE)
747 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
748 }
749 break;
750 case WM_NOTIFY:
751 {
753 if (lppsn->hdr.code == PSN_APPLY)
754 {
755 /* Update attributes first */
756 DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
757 if (dwAttr)
758 {
760
761 if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14021, BM_GETCHECK, 0, 0))
762 dwAttr |= FILE_ATTRIBUTE_READONLY;
763 if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14022, BM_GETCHECK, 0, 0))
764 dwAttr |= FILE_ATTRIBUTE_HIDDEN;
765 if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14023, BM_GETCHECK, 0, 0))
766 dwAttr |= FILE_ATTRIBUTE_ARCHIVE;
767
768 if (!SetFileAttributesW(pFileDefExt->m_wszPath, dwAttr))
769 ERR("SetFileAttributesW failed\n");
770 }
771
772 /* Update filename now */
773 WCHAR wszBuf[MAX_PATH];
774 StringCchCopyW(wszBuf, _countof(wszBuf), pFileDefExt->m_wszPath);
775 LPWSTR pwszFilename = PathFindFileNameW(wszBuf);
776 UINT cchFilenameMax = _countof(wszBuf) - (pwszFilename - wszBuf);
777 if (GetDlgItemTextW(hwndDlg, 14001, pwszFilename, cchFilenameMax))
778 {
779 if (!MoveFileW(pFileDefExt->m_wszPath, wszBuf))
780 ERR("MoveFileW failed\n");
781 }
782
784 return TRUE;
785 }
786 break;
787 }
789 {
790 // reset icon
791 HWND hIconCtrl = GetDlgItem(hwndDlg, 14025);
792 HICON hIcon = (HICON)SendMessageW(hIconCtrl, STM_GETICON, 0, 0);
794 hIcon = NULL;
795 SendMessageW(hIconCtrl, STM_SETICON, (WPARAM)hIcon, 0);
796
797 // refresh the page
798 pFileDefExt->InitGeneralPage(hwndDlg);
799 return FALSE; // continue
800 }
801 case WM_DESTROY:
802 InterlockedIncrement(&pFileDefExt->m_Destroyed);
803 break;
805 pFileDefExt->UpdateDirStatsResults();
806 break;
807 }
808
809 return FALSE;
810}
HRESULT WINAPI SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
#define InterlockedIncrement
Definition: armddk.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
LONG volatile m_Destroyed
Definition: filedefext.h:101
BOOL InitGeneralPage(HWND hwndDlg)
Definition: filedefext.cpp:653
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1104
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1644
unsigned long DWORD
Definition: ntddk_ex.h:95
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
@ OAIF_REGISTER_EXT
Definition: shlobj.h:2689
@ OAIF_FORCE_REGISTRATION
Definition: shlobj.h:2691
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pcszFile
Definition: shlobj.h:2701
LPCWSTR pcszClass
Definition: shlobj.h:2702
OPEN_AS_INFO_FLAGS oaifInFlags
Definition: shlobj.h:2703
#define HIWORD(l)
Definition: typedefs.h:247
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define STM_SETICON
Definition: winuser.h:2111
#define STM_GETICON
Definition: winuser.h:2109
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetParent(_In_ HWND)
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1937
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390
#define EN_CHANGE
Definition: winuser.h:2041
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by AddPages().

◆ GetCommandString()

HRESULT WINAPI CFileDefExt::GetCommandString ( UINT_PTR  idCmd,
UINT  uType,
UINT pwReserved,
LPSTR  pszName,
UINT  cchMax 
)
override

Implements IContextMenu.

Definition at line 1576 of file filedefext.cpp.

1577{
1579 return E_NOTIMPL;
1580}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetFileTimeString()

BOOL CFileDefExt::GetFileTimeString ( LPFILETIME  lpFileTime,
LPWSTR  pwszResult,
UINT  cchResult 
)
staticprivate

Definition at line 514 of file filedefext.cpp.

515{
516 FILETIME ft;
517 SYSTEMTIME st;
518
519 if (!FileTimeToLocalFileTime(lpFileTime, &ft) || !FileTimeToSystemTime(&ft, &st))
520 return FALSE;
521
522 size_t cchRemaining = cchResult;
523 LPWSTR pwszEnd = pwszResult;
524 int cchWritten = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, pwszEnd, cchRemaining);
525 if (cchWritten)
526 --cchWritten; // GetDateFormatW returns count with terminating zero
527 else
528 ERR("GetDateFormatW failed\n");
529 cchRemaining -= cchWritten;
530 pwszEnd += cchWritten;
531
532 StringCchCopyExW(pwszEnd, cchRemaining, L", ", &pwszEnd, &cchRemaining, 0);
533
534 cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining);
535 if (cchWritten)
536 --cchWritten; // GetTimeFormatW returns count with terminating zero
537 else
538 ERR("GetTimeFormatW failed\n");
539 TRACE("result %s\n", debugstr_w(pwszResult));
540 return TRUE;
541}
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1089
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:989
#define LOCALE_USER_DEFAULT
STRSAFEAPI StringCchCopyExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:184
#define DATE_LONGDATE
Definition: winnls.h:210

Referenced by InitFileAttr().

◆ InitDirStats()

void CFileDefExt::InitDirStats ( struct DIRTREESTATS pStats)
private

Definition at line 838 of file filedefext.cpp.

839{
840 pStats->pDirCount = &m_cFolders;
841 pStats->pFileCount = &m_cFiles;
842 pStats->pTotVirtSize = &m_DirSize;
843 pStats->pTotPhysSize = &m_DirSizeOnDisc;
844 pStats->nTick = GetTickCount();
845 pStats->fAttribSet = ~0ul;
846 pStats->fAttribAll = 0;
847 pStats->bDeepRecurse = FALSE;
848 pStats->bMultipleTypes = !m_bMultifile; // Only the Multifile page wants to know
849 pStats->szType[0] = UNICODE_NULL;
850}
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
#define UNICODE_NULL
PULARGE_INTEGER pTotPhysSize
Definition: filedefext.cpp:815
WCHAR szType[max(100, RTL_FIELD_SIZE(SHFILEINFOA, szTypeName))]
Definition: filedefext.cpp:820
PDWORD pFileCount
Definition: filedefext.cpp:814
BOOL bMultipleTypes
Definition: filedefext.cpp:818
PDWORD pDirCount
Definition: filedefext.cpp:814
PULARGE_INTEGER pTotVirtSize
Definition: filedefext.cpp:815

Referenced by CountFolderAndFiles(), and InitMultifilePageThread().

◆ InitFileAttr()

BOOL CFileDefExt::InitFileAttr ( HWND  hwndDlg)
private

Definition at line 552 of file filedefext.cpp.

553{
555 WIN32_FIND_DATAW FileInfo; // WIN32_FILE_ATTRIBUTE_DATA
556 WCHAR wszBuf[MAX_PATH];
557
558 TRACE("InitFileAttr %ls\n", m_wszPath);
559
560 /*
561 * There are situations where GetFileAttributes(Ex) can fail even if the
562 * specified path represents a file. This happens when e.g. the file is a
563 * locked system file, such as C:\pagefile.sys . In this case, the function
564 * returns INVALID_FILE_ATTRIBUTES and GetLastError returns ERROR_SHARING_VIOLATION.
565 * (this would allow us to distinguish between this failure and a failure
566 * due to the fact that the path actually refers to a directory).
567 *
568 * Because we really want to retrieve the file attributes/size/date&time,
569 * we do the following trick:
570 * - First we call GetFileAttributesEx. If it succeeds we know we have
571 * a file or a directory, and we have retrieved its attributes.
572 * - If GetFileAttributesEx fails, we call FindFirstFile on the full path.
573 * While we could have called FindFirstFile at first and skip GetFileAttributesEx
574 * altogether, we do it after GetFileAttributesEx because it performs more
575 * work to retrieve the file attributes. However it actually works even
576 * for locked system files.
577 * - If FindFirstFile succeeds we have retrieved its attributes.
578 * - Otherwise (FindFirstFile has failed), we do not retrieve anything.
579 *
580 * The following code also relies on the fact that the first 6 members
581 * of WIN32_FIND_DATA are *exactly* the same as the WIN32_FILE_ATTRIBUTE_DATA
582 * structure. Therefore it is safe to use a single WIN32_FIND_DATA
583 * structure for both the GetFileAttributesEx and FindFirstFile calls.
584 */
585
589 {
590 /* Update attribute checkboxes */
591 if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
592 SendDlgItemMessage(hwndDlg, 14021, BM_SETCHECK, BST_CHECKED, 0);
593 if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
594 SendDlgItemMessage(hwndDlg, 14022, BM_SETCHECK, BST_CHECKED, 0);
595 if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)
596 SendDlgItemMessage(hwndDlg, 14023, BM_SETCHECK, BST_CHECKED, 0);
597
598 /* Update creation time */
599 if (GetFileTimeString(&FileInfo.ftCreationTime, wszBuf, _countof(wszBuf)))
600 SetDlgItemTextW(hwndDlg, 14015, wszBuf);
601
602 /* For files display last access and last write time */
603 if (!m_bDir)
604 {
605 if (GetFileTimeString(&FileInfo.ftLastAccessTime, wszBuf, _countof(wszBuf)))
606 SetDlgItemTextW(hwndDlg, 14019, wszBuf);
607
608 if (GetFileTimeString(&FileInfo.ftLastWriteTime, wszBuf, _countof(wszBuf)))
609 SetDlgItemTextW(hwndDlg, 14017, wszBuf);
610
611 /* Update size of file */
613 FileSize.u.LowPart = FileInfo.nFileSizeLow;
614 FileSize.u.HighPart = FileInfo.nFileSizeHigh;
615 if (SH_FormatFileSizeWithBytes(&FileSize, wszBuf, _countof(wszBuf)))
616 {
617 SetDlgItemTextW(hwndDlg, 14011, wszBuf);
618
619 // Compute file on disk. If fails, use logical size
622 else
623 ERR("Unreliable size on disk\n");
624
625 SetDlgItemTextW(hwndDlg, 14012, wszBuf);
626 }
627 }
628 }
629
630 if (m_bDir)
631 {
632 // For directories, files have to be counted
633 m_hWndDirStatsDlg = hwndDlg;
634 AddRef();
636 Release();
637 }
638
639 /* Hide Advanced button. TODO: Implement advanced dialog and enable this button if filesystem supports compression or encryption */
640 ShowWindow(GetDlgItem(hwndDlg, 14028), SW_HIDE);
641
642 return TRUE;
643}
static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
Definition: filedefext.cpp:514
static DWORD WINAPI _CountFolderAndFilesThreadProc(LPVOID lpParameter)
HWND m_hWndDirStatsDlg
Definition: filedefext.h:96
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:552
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
@ Success
Definition: eventcreate.c:712
BOOL GetPhysicalFileSize(LPCWSTR pszPath, PULARGE_INTEGER Size)
Definition: filedefext.cpp:38
static BOOL SH32_GetFileFindData(PCWSTR pszPath, WIN32_FIND_DATAW *pWFD)
Definition: filedefext.cpp:32
LPWSTR SH_FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT cchResultMax)
Definition: filedefext.cpp:304
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
struct _LARGE_INTEGER::@2416 u
@ GetFileExInfoStandard
Definition: winbase.h:1202
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define BM_SETCHECK
Definition: winuser.h:1940
#define SendDlgItemMessage
Definition: winuser.h:5927

Referenced by InitGeneralPage().

◆ InitFilePath()

BOOL CFileDefExt::InitFilePath ( HWND  hwndDlg)
private

Definition at line 485 of file filedefext.cpp.

486{
487 /* Find the filename */
488 WCHAR *pwszFilename = PathFindFileNameW(m_wszPath);
489
490 if (pwszFilename > m_wszPath)
491 {
492 /* Location field */
493 WCHAR wszLocation[MAX_PATH];
494 StringCchCopyNW(wszLocation, _countof(wszLocation), m_wszPath, pwszFilename - m_wszPath);
495 PathRemoveBackslashW(wszLocation);
496
497 SetDlgItemTextW(hwndDlg, 14009, wszLocation);
498 }
499
500 /* Filename field */
501 SetDlgItemTextW(hwndDlg, 14001, pwszFilename);
502
503 return TRUE;
504}
WCHAR *WINAPI PathRemoveBackslashW(WCHAR *path)
Definition: path.c:1983
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236

Referenced by InitGeneralPage().

◆ InitFileType()

BOOL CFileDefExt::InitFileType ( HWND  hwndDlg)
private

Definition at line 426 of file filedefext.cpp.

427{
428 TRACE("path %s\n", debugstr_w(m_wszPath));
429
430 HWND hDlgCtrl = GetDlgItem(hwndDlg, 14005);
431 if (hDlgCtrl == NULL)
432 return FALSE;
433
434 /* Get file information */
435 SHFILEINFOW fi;
436 if (!SHGetFileInfoW(m_wszPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME|SHGFI_ICON))
437 {
438 ERR("SHGetFileInfoW failed for %ls (%lu)\n", m_wszPath, GetLastError());
439 fi.szTypeName[0] = L'\0';
440 fi.hIcon = NULL;
441 }
442
444 if (pwszExt[0])
445 {
446 WCHAR wszBuf[256];
447
448 if (!fi.szTypeName[0])
449 {
450 /* The file type is unknown, so default to string "FileExtension File" */
451 size_t cchRemaining = 0;
452 LPWSTR pwszEnd = NULL;
453
454 StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining, 0, L"%s ", pwszExt + 1);
455 SendMessageW(hDlgCtrl, WM_GETTEXT, (WPARAM)cchRemaining, (LPARAM)pwszEnd);
456
457 SendMessageW(hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)wszBuf);
458 }
459 else
460 {
461 /* Update file type */
462 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName, pwszExt);
463 SendMessageW(hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)wszBuf);
464 }
465 }
466
467 /* Update file icon */
468 if (fi.hIcon)
469 SendDlgItemMessageW(hwndDlg, 14000, STM_SETICON, (WPARAM)fi.hIcon, 0);
470 else
471 ERR("No icon %ls\n", m_wszPath);
472
473 return TRUE;
474}
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1217
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SHGFI_ICON
Definition: shellapi.h:164
#define SHGFI_TYPENAME
Definition: shellapi.h:167
STRSAFEAPI StringCchPrintfExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:585
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
WCHAR szTypeName[80]
Definition: shellapi.h:388
HICON hIcon
Definition: shellapi.h:384
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WM_GETTEXT
Definition: winuser.h:1637
#define WM_SETTEXT
Definition: winuser.h:1636

Referenced by InitGeneralPage().

◆ InitFolderCustomizePage()

BOOL CFileDefExt::InitFolderCustomizePage ( HWND  hwndDlg)
private

Definition at line 1356 of file filedefext.cpp.

1357{
1358 /* Attach the object to dialog window */
1359 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)this);
1360
1365
1366 // build the desktop.ini file path
1369 PathAppendW(szIniFile, L"desktop.ini");
1370
1371 // desktop.ini --> m_szFolderIconPath, m_nFolderIconIndex
1372 m_szFolderIconPath[0] = 0;
1376 {
1378 }
1381 {
1383 }
1384
1385 // update icon
1386 UpdateFolderIcon(hwndDlg);
1387
1388 return TRUE;
1389}
void UpdateFolderIcon(HWND hwndDlg)
UINT WINAPI GetPrivateProfileIntW(LPCWSTR section, LPCWSTR entry, INT def_val, LPCWSTR filename)
Definition: profile.c:1297
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
int WINAPI PathParseIconLocationW(WCHAR *path)
Definition: path.c:2587
static const WCHAR s_szShellClassInfo[]
static const WCHAR s_szIconFile[]
static const WCHAR s_szIconResource[]
static const WCHAR s_szIconIndex[]
#define PathAppendW
Definition: pathcch.h:309
TCHAR szIniFile[]
Definition: scrnsave.c:29
#define IDC_FOLDERCUST_CHECKBOX
Definition: shresdef.h:560
#define IDC_FOLDERCUST_COMBOBOX
Definition: shresdef.h:559
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by FolderCustomizePageProc().

◆ InitGeneralPage()

BOOL CFileDefExt::InitGeneralPage ( HWND  hwndDlg)
private

Definition at line 653 of file filedefext.cpp.

654{
655 /* Set general text properties filename filelocation and icon */
656 InitFilePath(hwndDlg);
657
658 /* Set file type and icon */
659 InitFileType(hwndDlg);
660
661 /* Set open with application */
662 if (!m_bDir)
663 {
664 if (!PathIsExeW(m_wszPath))
665 InitOpensWithField(hwndDlg);
666 else
667 {
668 WCHAR wszBuf[MAX_PATH];
670 SetDlgItemTextW(hwndDlg, 14006, wszBuf);
671 ShowWindow(GetDlgItem(hwndDlg, 14024), SW_HIDE);
672
673 /* hidden button 14024 allows to draw edit 14007 larger than defined in resources , we use edit 14009 as idol */
674 RECT rectIdol, rectToAdjust;
675 GetClientRect(GetDlgItem(hwndDlg, 14009), &rectIdol);
676 GetClientRect(GetDlgItem(hwndDlg, 14007), &rectToAdjust);
677 SetWindowPos(GetDlgItem(hwndDlg, 14007), HWND_TOP, 0, 0,
678 rectIdol.right-rectIdol.left /* make it as wide as its idol */,
679 rectToAdjust.bottom-rectToAdjust.top /* but keep its current height */,
681
682 LPCWSTR pwszDescr = m_VerInfo.GetString(L"FileDescription");
683 if (pwszDescr)
684 SetDlgItemTextW(hwndDlg, 14007, pwszDescr);
685 else
686 {
687 StringCbCopyW(wszBuf, sizeof(wszBuf), PathFindFileNameW(m_wszPath));
688 PathRemoveExtension(wszBuf);
689 SetDlgItemTextW(hwndDlg, 14007, wszBuf);
690 }
691 }
692 }
693
694 /* Set file created/modfied/accessed time, size and attributes */
695 InitFileAttr(hwndDlg);
696
697 return TRUE;
698}
EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:539
#define shell32_hInstance
BOOL InitFileAttr(HWND hwndDlg)
Definition: filedefext.cpp:552
BOOL InitFileType(HWND hwndDlg)
Definition: filedefext.cpp:426
VOID InitOpensWithField(HWND hwndDlg)
Definition: filedefext.cpp:332
BOOL InitFilePath(HWND hwndDlg)
Definition: filedefext.cpp:485
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
#define PathRemoveExtension
Definition: shlwapi.h:1074
#define IDS_EXE_DESCRIPTION
Definition: shresdef.h:210
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1255
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_TOP
Definition: winuser.h:1218
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by GeneralPageProc().

◆ Initialize()

HRESULT WINAPI CFileDefExt::Initialize ( PCIDLIST_ABSOLUTE  pidlFolder,
IDataObject pdtobj,
HKEY  hkeyProgID 
)
override

Implements IShellExtInit.

Definition at line 1510 of file filedefext.cpp.

1511{
1512 FORMATETC format;
1513 STGMEDIUM stgm;
1514 HRESULT hr;
1515
1516 TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID);
1517
1518 if (!pDataObj)
1519 return E_FAIL;
1520
1521 int count = DataObject_GetHIDACount(pDataObj);
1522 m_bMultifile = count > 1;
1523 if (m_bMultifile)
1524 {
1525 CDataObjectHIDA cida(pDataObj);
1526 if (SUCCEEDED(cida.hr()))
1527 {
1529 if (m_pidls)
1530 m_cidl = cida->cidl;
1531 }
1532 }
1533
1534 format.cfFormat = CF_HDROP;
1535 format.ptd = NULL;
1536 format.dwAspect = DVASPECT_CONTENT;
1537 format.lindex = -1;
1538 format.tymed = TYMED_HGLOBAL;
1539
1540 hr = pDataObj->GetData(&format, &stgm);
1542 return hr;
1543
1544 if (!DragQueryFileW((HDROP)stgm.hGlobal, 0, m_wszPath, _countof(m_wszPath)))
1545 {
1546 ERR("DragQueryFileW failed\n");
1547 ReleaseStgMedium(&stgm);
1548 return E_FAIL;
1549 }
1550
1551 ReleaseStgMedium(&stgm);
1552
1553 TRACE("File properties %ls\n", m_wszPath);
1555 if (!m_bDir && !m_bMultifile)
1557
1558 return S_OK;
1559}
#define CF_HDROP
Definition: constants.h:410
BOOL Load(LPCWSTR pwszPath)
Definition: filedefext.cpp:120
#define E_FAIL
Definition: ddrawi.h:102
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
HRESULT DataObject_GetHIDACount(IDataObject *pdo)
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:622
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1729
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SUCCEEDED(hr)
Definition: intsafe.h:50
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST *pidl, const CIDA *cida)
Definition: pidl.c:2648
Definition: format.c:58

◆ InitMultifilePage()

void CFileDefExt::InitMultifilePage ( HWND  hwndDlg)
private

Definition at line 1010 of file filedefext.cpp.

1011{
1012 m_hWndDirStatsDlg = hwndDlg;
1014 SendDlgItemMessageW(hwndDlg, 14000, STM_SETICON, (WPARAM)hIco, 0);
1015
1016 // We are lazy and just reuse the directory page so we must tweak some controls
1017 HWND hCtrl = GetDlgItem(hwndDlg, 14001);
1019 SetWindowLongPtrW(hCtrl, GWL_EXSTYLE, 0);
1020 SendMessageW(hCtrl, EM_SETREADONLY, TRUE, 0);
1021 SetDlgItemTextW(hwndDlg, 14005, NULL);
1022
1023 static const WORD idAttr[] = { 14021, 14022, 14023 };
1024 for (SIZE_T i = 0; i < _countof(idAttr); ++i)
1025 {
1026 hCtrl = GetDlgItem(hwndDlg, idAttr[i]);
1028 EnableWindow(hCtrl, FALSE);
1029 }
1030
1031 static const WORD idUnused[] = { 14026, 14027, 14028, 14014, 14015 };
1032 for (SIZE_T i = 0; i < _countof(idUnused); ++i)
1033 DestroyWindow(GetDlgItem(hwndDlg, idUnused[i]));
1034
1035 if (!m_cidl)
1036 return;
1037
1038 AddRef();
1040 Release();
1041}
static DWORD WINAPI _InitializeMultifileThreadProc(LPVOID lpParameter)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BS_AUTO3STATE
Definition: pedump.c:657
#define CTF_COINIT
Definition: shlwapi.h:1992
#define IDI_SHELL_MULTIPLE_FILES
Definition: shresdef.h:637
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define EM_SETREADONLY
Definition: winuser.h:2034
#define GetWindowLongPtrW
Definition: winuser.h:4905
#define BM_SETSTYLE
Definition: winuser.h:1943
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SetWindowLongPtrW
Definition: winuser.h:5431
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2412
#define GWL_EXSTYLE
Definition: winuser.h:862

◆ InitMultifilePageThread()

void CFileDefExt::InitMultifilePageThread ( )
private

Definition at line 946 of file filedefext.cpp.

947{
948 DIRTREESTATS Stats;
949 InitDirStats(&Stats);
950
951 // MSDN says CFSTR_SHELLIDLIST and SHGDN_FORPARSING must be supported so that is what we use
952 for (SIZE_T i = 0; i < m_cidl; ++i)
953 {
955 if (!pidl)
956 return;
957 PWSTR pszAbsPath;
958 HRESULT hr = SHELL_DisplayNameOf(NULL, pidl, SHGDN_FORPARSING, &pszAbsPath);
959 ILFree(pidl);
960 if (FAILED(hr))
961 return;
962 BOOL bSuccess = WalkDirTree(pszAbsPath, &Stats, NULL);
963 SHFree(pszAbsPath);
964 if (!bSuccess)
965 return;
966 }
967
969 if (Stats.bMultipleTypes)
972
973 PWSTR pszDir = NULL;
974 HRESULT hr = E_FAIL;
975 if (!Stats.bDeepRecurse)
976 hr = SHELL_DisplayNameOf(NULL, m_pidlFolder, SHGDN_FORPARSING | SHGDN_FORADDRESSBAR, &pszDir);
977 if (SUCCEEDED(hr))
978 {
980 }
981 else
982 {
985 }
986 SHFree(pszDir);
987
988 #define SetMultifileDlgFileAttr(attr, id) do \
989 { \
990 if (Stats.fAttribSet & (attr)) \
991 CheckDlgButton(m_hWndDirStatsDlg, (id), BST_CHECKED); \
992 else if (Stats.fAttribAll & (attr)) \
993 CheckDlgButton(m_hWndDirStatsDlg, (id), BST_INDETERMINATE); \
994 } while (0)
998 #undef SetMultifileDlgFileAttr
999}
HRESULT SHELL_DisplayNameOf(_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_opt_ UINT Flags, _Out_ PWSTR *ppStr)
Definition: utils.cpp:406
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define SetMultifileDlgFileAttr(attr, id)
#define FAILED(hr)
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
_In_ LPCSTR pszDir
Definition: shellapi.h:601
#define IDS_MULTIPLETYPES
Definition: shresdef.h:266
#define IDS_VARIOUSFOLDERS
Definition: shresdef.h:267
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by _InitializeMultifileThreadProc().

◆ InitOpensWithField()

VOID CFileDefExt::InitOpensWithField ( HWND  hwndDlg)
private

Definition at line 332 of file filedefext.cpp.

333{
334 WCHAR wszBuf[MAX_PATH] = L"";
335 WCHAR wszPath[MAX_PATH] = L"";
336 DWORD dwSize = sizeof(wszBuf);
337 BOOL bUnknownApp = TRUE;
339
340 // TODO: Use ASSOCSTR_EXECUTABLE with ASSOCF_REMAPRUNDLL | ASSOCF_IGNOREBASECLASS
341 if (RegGetValueW(HKEY_CLASSES_ROOT, pwszExt, L"", RRF_RT_REG_SZ, NULL, wszBuf, &dwSize) == ERROR_SUCCESS)
342 {
343 bUnknownApp = FALSE;
344 StringCbCatW(wszBuf, sizeof(wszBuf), L"\\shell\\open\\command");
345 dwSize = sizeof(wszPath);
346 // FIXME: Missing FileExt check, see COpenWithList::SetDefaultHandler for details
347 // FIXME: Use HCR_GetDefaultVerbW to find the default verb
348 if (RegGetValueW(HKEY_CLASSES_ROOT, wszBuf, L"", RRF_RT_REG_SZ, NULL, wszPath, &dwSize) == ERROR_SUCCESS)
349 {
350 /* Get path from command line */
351 ExpandEnvironmentStringsW(wszPath, wszBuf, _countof(wszBuf));
352 if (SHELL32_GetDllFromRundll32CommandLine(wszBuf, wszBuf, _countof(wszBuf)) != S_OK)
353 {
354 PathRemoveArgs(wszBuf);
355 PathUnquoteSpacesW(wszBuf);
356 }
357 PathSearchAndQualify(wszBuf, wszPath, _countof(wszPath));
358
359 HICON hIcon;
360 if (ExtractIconExW(wszPath, 0, NULL, &hIcon, 1))
361 {
362 HWND hIconCtrl = GetDlgItem(hwndDlg, 14025);
363 HWND hDescrCtrl = GetDlgItem(hwndDlg, 14007);
364 ShowWindow(hIconCtrl, SW_SHOW);
365 RECT rcIcon, rcDescr;
366 GetWindowRect(hIconCtrl, &rcIcon);
367
368 rcIcon.right = rcIcon.left + GetSystemMetrics(SM_CXSMICON);
369 rcIcon.bottom = rcIcon.top + GetSystemMetrics(SM_CYSMICON);
370
371 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcIcon, 2);
372 GetWindowRect(hDescrCtrl, &rcDescr);
373 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcDescr, 2);
374 INT cxOffset = rcIcon.right + 2 - rcDescr.left;
375 SetWindowPos(hDescrCtrl, NULL,
376 rcDescr.left + cxOffset, rcDescr.top,
377 rcDescr.right - rcDescr.left - cxOffset, rcDescr.bottom - rcDescr.top,
379 SendMessageW(hIconCtrl, STM_SETICON, (WPARAM)hIcon, 0);
380 } else
381 ERR("Failed to extract icon\n");
382
383 if (PathFileExistsW(wszPath))
384 {
385 /* Get file description */
386 CFileVersionInfo VerInfo;
387 VerInfo.Load(wszPath);
388 LPCWSTR pwszDescr = VerInfo.GetString(L"FileDescription");
389 if (pwszDescr)
390 SetDlgItemTextW(hwndDlg, 14007, pwszDescr);
391 else
392 {
393 /* File has no description - display filename */
394 LPWSTR pwszFilename = PathFindFileNameW(wszPath);
395 PathRemoveExtension(pwszFilename);
396 pwszFilename[0] = towupper(pwszFilename[0]);
397 SetDlgItemTextW(hwndDlg, 14007, pwszFilename);
398 }
399 }
400 else
401 bUnknownApp = TRUE;
402 } else
403 WARN("RegGetValueW %ls failed\n", wszBuf);
404 } else
405 WARN("RegGetValueW %ls failed\n", pwszExt);
406
407 if (bUnknownApp)
408 {
409 /* Unknown application */
411 SetDlgItemTextW(hwndDlg, 14007, wszBuf);
412 }
413}
HRESULT SHELL32_GetDllFromRundll32CommandLine(LPCWSTR pszCmd, LPWSTR pszOut, SIZE_T cchMax)
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERROR_SUCCESS
Definition: deptool.c:10
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:1949
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2550
#define RRF_RT_REG_SZ
Definition: driver.c:575
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define PathSearchAndQualify
Definition: shlwapi.h:1108
#define PathRemoveArgs
Definition: shlwapi.h:1062
#define IDS_UNKNOWN_APP
Definition: shresdef.h:209
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define towupper(c)
Definition: wctype.h:99
int32_t INT
Definition: typedefs.h:58
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SM_CYSMICON
Definition: winuser.h:1024
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define SM_CXSMICON
Definition: winuser.h:1023
#define SW_SHOW
Definition: winuser.h:786
int WINAPI GetSystemMetrics(_In_ int)

Referenced by InitGeneralPage().

◆ InitVersionPage()

BOOL CFileDefExt::InitVersionPage ( HWND  hwndDlg)
private

Definition at line 1083 of file filedefext.cpp.

1084{
1085 /* Get fixed info */
1087 if (pInfo)
1088 {
1089 WCHAR wszVersion[256];
1090 swprintf(wszVersion, L"%u.%u.%u.%u", HIWORD(pInfo->dwFileVersionMS),
1091 LOWORD(pInfo->dwFileVersionMS),
1092 HIWORD(pInfo->dwFileVersionLS),
1093 LOWORD(pInfo->dwFileVersionLS));
1094 TRACE("MS %x LS %x ver %s \n", pInfo->dwFileVersionMS, pInfo->dwFileVersionLS, debugstr_w(wszVersion));
1095 SetDlgItemTextW(hwndDlg, 14001, wszVersion);
1096 }
1097
1098 /* Update labels */
1099 SetVersionLabel(hwndDlg, 14003, L"FileDescription");
1100 SetVersionLabel(hwndDlg, 14005, L"LegalCopyright");
1101
1102 /* Add items to listbox */
1103 AddVersionString(hwndDlg, L"CompanyName");
1104 LPCWSTR pwszLang = m_VerInfo.GetLangName();
1105 if (pwszLang)
1106 {
1107 HWND hDlgCtrl = GetDlgItem(hwndDlg, 14009);
1108 UINT Index = SendMessageW(hDlgCtrl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)L"Language");
1109 SendMessageW(hDlgCtrl, LB_SETITEMDATA, (WPARAM)Index, (LPARAM)(WCHAR *)pwszLang);
1110 }
1111 AddVersionString(hwndDlg, L"ProductName");
1112 AddVersionString(hwndDlg, L"InternalName");
1113 AddVersionString(hwndDlg, L"OriginalFilename");
1114 AddVersionString(hwndDlg, L"FileVersion");
1115 AddVersionString(hwndDlg, L"ProductVersion");
1116 AddVersionString(hwndDlg, L"Comments");
1117 AddVersionString(hwndDlg, L"LegalTrademarks");
1118
1119 if (pInfo && (pInfo->dwFileFlags & VS_FF_PRIVATEBUILD))
1120 AddVersionString(hwndDlg, L"PrivateBuild");
1121
1122 if (pInfo && (pInfo->dwFileFlags & VS_FF_SPECIALBUILD))
1123 AddVersionString(hwndDlg, L"SpecialBuild");
1124
1125 /* Attach file version to dialog window */
1126 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)this);
1127
1128 /* Select first item */
1129 HWND hDlgCtrl = GetDlgItem(hwndDlg, 14009);
1130 SendMessageW(hDlgCtrl, LB_SETCURSEL, 0, 0);
1131 LPCWSTR pwszText = (LPCWSTR)SendMessageW(hDlgCtrl, LB_GETITEMDATA, (WPARAM)0, (LPARAM)NULL);
1132 if (pwszText && pwszText != (LPCWSTR)LB_ERR)
1133 SetDlgItemTextW(hwndDlg, 14010, pwszText);
1134
1135 return TRUE;
1136}
BOOL AddVersionString(HWND hwndDlg, LPCWSTR pwszName)
BOOL SetVersionLabel(HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName)
VS_FIXEDFILEINFO * GetFixedInfo()
Definition: filedefext.cpp:191
LPCWSTR GetLangName()
Definition: filedefext.cpp:203
#define swprintf
Definition: precomp.h:40
DWORD dwFileVersionLS
Definition: compat.h:903
DWORD dwFileVersionMS
Definition: compat.h:902
#define VS_FF_SPECIALBUILD
Definition: verrsrc.h:47
#define VS_FF_PRIVATEBUILD
Definition: verrsrc.h:45
#define LB_ERR
Definition: winuser.h:2451
#define LB_GETITEMDATA
Definition: winuser.h:2060
#define LB_SETCURSEL
Definition: winuser.h:2082

Referenced by VersionPageProc().

◆ InvokeCommand()

HRESULT WINAPI CFileDefExt::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
override

Implements IContextMenu.

Definition at line 1569 of file filedefext.cpp.

1570{
1572 return E_NOTIMPL;
1573}

◆ IsDestroyed()

BOOL CFileDefExt::IsDestroyed ( ) const
inlineprivate

Definition at line 102 of file filedefext.h.

102{ return m_Destroyed; }

Referenced by WalkDirTree().

◆ MultifilePageProc()

INT_PTR CALLBACK CFileDefExt::MultifilePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 1050 of file filedefext.cpp.

1051{
1052 CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
1053 switch (uMsg)
1054 {
1055 case WM_INITDIALOG:
1056 {
1058 if (ppsp == NULL || !ppsp->lParam)
1059 break;
1060 pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
1061 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
1062 pFileDefExt->InitMultifilePage(hwndDlg);
1063 break;
1064 }
1065 case WM_DESTROY:
1066 InterlockedIncrement(&pFileDefExt->m_Destroyed);
1067 break;
1068 case WM_UPDATEDIRSTATS:
1069 pFileDefExt->UpdateDirStatsResults();
1070 break;
1071 }
1072 return FALSE;
1073}
void InitMultifilePage(HWND hwndDlg)

Referenced by AddPages().

◆ OnFolderCustApply()

BOOL CFileDefExt::OnFolderCustApply ( HWND  hwndDlg)

Definition at line 1424 of file filedefext.cpp.

1425{
1426 // build the desktop.ini file path
1429 PathAppendW(szIniFile, L"desktop.ini");
1430
1431 if (m_bFolderIconIsSet) // it is set!
1432 {
1433 DWORD attrs;
1434
1435 // change folder attributes (-S -R)
1439
1440 // change desktop.ini attributes (-S -H -R)
1444
1445 if (m_szFolderIconPath[0])
1446 {
1447 // write IconFile and IconIndex
1449
1450 WCHAR szInt[32];
1451 StringCchPrintfW(szInt, _countof(szInt), L"%d", m_nFolderIconIndex);
1453
1454 // flush!
1456 }
1457 else
1458 {
1459 // erase three values
1463
1464 // flush!
1466 }
1467
1468 // change desktop.ini attributes (+S +H)
1472
1473 // change folder attributes (+R)
1475 attrs |= FILE_ATTRIBUTE_READONLY;
1477
1478 // notify to the siblings
1479 PropSheet_QuerySiblings(GetParent(hwndDlg), 0, 0);
1480
1481 // done!
1483 }
1484
1485 return TRUE;
1486}
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define PropSheet_QuerySiblings(d, w, l)
Definition: prsht.h:349
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by FolderCustomizePageProc().

◆ OnFolderCustChangeIcon()

void CFileDefExt::OnFolderCustChangeIcon ( HWND  hwndDlg)

Definition at line 1392 of file filedefext.cpp.

1393{
1395 INT nIconIndex;
1396
1397 // m_szFolderIconPath, m_nFolderIconIndex --> szPath, nIconIndex
1398 if (m_szFolderIconPath[0])
1399 {
1401 nIconIndex = m_nFolderIconIndex;
1402 }
1403 else
1404 {
1405 szPath[0] = 0;
1406 nIconIndex = 0;
1407 }
1408
1409 // let the user choose the icon
1410 if (PickIconDlg(hwndDlg, szPath, _countof(szPath), &nIconIndex))
1411 {
1412 // changed
1414 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1415
1416 // update
1418 m_nFolderIconIndex = nIconIndex;
1419 UpdateFolderIcon(hwndDlg);
1420 }
1421}
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
LPCWSTR szPath
Definition: env.c:37

Referenced by FolderCustomizePageProc().

◆ OnFolderCustDestroy()

void CFileDefExt::OnFolderCustDestroy ( HWND  hwndDlg)

Definition at line 1322 of file filedefext.cpp.

1323{
1326
1327 /* Detach the object from dialog window */
1328 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)0);
1329}

Referenced by FolderCustomizePageProc().

◆ QueryContextMenu()

HRESULT WINAPI CFileDefExt::QueryContextMenu ( HMENU  hmenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
override

Implements IContextMenu.

Definition at line 1562 of file filedefext.cpp.

1563{
1565 return E_NOTIMPL;
1566}

◆ ReplacePage()

HRESULT WINAPI CFileDefExt::ReplacePage ( UINT  uPageID,
LPFNADDPROPSHEETPAGE  pfnReplacePage,
LPARAM  lParam 
)
override

Definition at line 1622 of file filedefext.cpp.

1623{
1625 return E_NOTIMPL;
1626}

◆ SetVersionLabel()

BOOL CFileDefExt::SetVersionLabel ( HWND  hwndDlg,
DWORD  idCtrl,
LPCWSTR  pwszName 
)
private

Definition at line 1146 of file filedefext.cpp.

1147{
1148 if (hwndDlg == NULL || pwszName == NULL)
1149 return FALSE;
1150
1151 LPCWSTR pwszValue = m_VerInfo.GetString(pwszName);
1152 if (pwszValue)
1153 {
1154 /* file description property */
1155 TRACE("%s :: %s\n", debugstr_w(pwszName), debugstr_w(pwszValue));
1156 SetDlgItemTextW(hwndDlg, idCtrl, pwszValue);
1157 return TRUE;
1158 }
1159
1160 return FALSE;
1161}

Referenced by InitVersionPage().

◆ UpdateDirStatsResults()

void CFileDefExt::UpdateDirStatsResults ( )
private

Definition at line 824 of file filedefext.cpp.

825{
826 WCHAR fmt[200], buf[200];
830
835}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define IDS_FILE_FOLDER
Definition: shresdef.h:220
Definition: dsound.c:943
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by CountFolderAndFiles(), GeneralPageProc(), InitMultifilePageThread(), and MultifilePageProc().

◆ UpdateFolderIcon()

void CFileDefExt::UpdateFolderIcon ( HWND  hwndDlg)

Definition at line 1331 of file filedefext.cpp.

1332{
1333 // destroy icon if any
1334 if (m_hFolderIcon)
1335 {
1338 }
1339
1340 // create the icon
1341 if (m_szFolderIconPath[0] == 0 && m_nFolderIconIndex == 0)
1342 {
1343 // Windows ignores shell customization here and uses the default icon
1345 }
1346 else
1347 {
1349 }
1350
1351 // set icon
1353}
#define IDI_SHELL_FOLDER
Definition: treeview.c:21
#define IDC_FOLDERCUST_ICON
Definition: shresdef.h:564

Referenced by InitFolderCustomizePage(), and OnFolderCustChangeIcon().

◆ VersionPageProc()

INT_PTR CALLBACK CFileDefExt::VersionPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 1200 of file filedefext.cpp.

1201{
1202 switch (uMsg)
1203 {
1204 case WM_INITDIALOG:
1205 {
1207
1208 if (ppsp == NULL || !ppsp->lParam)
1209 break;
1210
1211 TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %x\n", hwndDlg, lParam, ppsp->lParam);
1212
1213 CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
1214 return pFileDefExt->InitVersionPage(hwndDlg);
1215 }
1216 case WM_COMMAND:
1217 if (LOWORD(wParam) == 14009 && HIWORD(wParam) == LBN_SELCHANGE)
1218 {
1219 HWND hDlgCtrl = (HWND)lParam;
1220
1222 if (Index == LB_ERR)
1223 break;
1224
1225 LPCWSTR pwszData = (LPCWSTR)SendMessageW(hDlgCtrl, LB_GETITEMDATA, (WPARAM)Index, (LPARAM)NULL);
1226 if (pwszData == NULL)
1227 break;
1228
1229 CString str(pwszData);
1230 str.Trim();
1231
1232 TRACE("hDlgCtrl %x string %s\n", hDlgCtrl, debugstr_w(str));
1233 SetDlgItemTextW(hwndDlg, 14010, str);
1234
1235 return TRUE;
1236 }
1237 break;
1238 }
1239
1240 return FALSE;
1241}
BOOL InitVersionPage(HWND hwndDlg)
HANDLE HWND
Definition: compat.h:19
CStringA CString
Definition: atlstr.h:139
const WCHAR * str
LONG_PTR LRESULT
Definition: windef.h:209
#define LBN_SELCHANGE
Definition: winuser.h:2094
#define LB_GETCURSEL
Definition: winuser.h:2058

Referenced by AddPages().

◆ WalkDirTree()

BOOL CFileDefExt::WalkDirTree ( PCWSTR  pszPath,
struct DIRTREESTATS pStats,
WIN32_FIND_DATAW pWFD 
)
private

Definition at line 896 of file filedefext.cpp.

897{
899 wfd.dwFileAttributes = ProcessDirStatsItem(pszBase, *pStats, pWFD);
900 if (wfd.dwFileAttributes == INVALID_FILE_ATTRIBUTES)
901 return FALSE;
902 if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
903 return TRUE;
904
905 BOOL bSuccess = TRUE;
906 SIZE_T cch = lstrlenW(pszBase);
907 PWSTR pszFull = (PWSTR)SHAlloc((cch + MAX_PATH) * sizeof(*pszFull));
908 if (!pszFull)
909 return FALSE;
910 PWSTR pszFile = pszFull + cch;
911 wcscpy(pszFull, pszBase);
912 wcscpy(pszFile++, L"\\*");
913 HANDLE hFind = FindFirstFileW(pszFull, &wfd);
914 if (hFind != INVALID_HANDLE_VALUE)
915 {
916 for (; bSuccess && !IsDestroyed();)
917 {
918 UINT nTickNow = GetTickCount();
919 if (nTickNow - pStats->nTick >= 500)
920 {
921 pStats->nTick = nTickNow;
923 }
924
925 wcscpy(pszFile, wfd.cFileName);
926 if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
927 {
928 bSuccess = ProcessDirStatsItem(pszFull, *pStats, NULL);
929 }
930 else if (!PathIsDotOrDotDotW(wfd.cFileName))
931 {
932 bSuccess = WalkDirTree(pszFull, pStats, &wfd);
933 pStats->bDeepRecurse |= bSuccess;
934 }
935
936 if (!FindNextFileW(hFind, &wfd))
937 break;
938 }
939 FindClose(hFind);
940 }
941 SHFree(pszFull);
942 return bSuccess;
943}
BOOL IsDestroyed() const
Definition: filedefext.h:102
wcscpy
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define lstrlenW
Definition: compat.h:750
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL PathIsDotOrDotDotW(_In_ LPCWSTR pszPath)
Definition: utils.cpp:146
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
static UINT ProcessDirStatsItem(PCWSTR pszPath, DIRTREESTATS &Stats, WIN32_FIND_DATAW *pWFD)
Definition: filedefext.cpp:853
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by CountFolderAndFiles(), InitMultifilePageThread(), and WalkDirTree().

Member Data Documentation

◆ m_bDir

BOOL CFileDefExt::m_bDir
private

Definition at line 85 of file filedefext.h.

Referenced by AddPages(), InitFileAttr(), InitGeneralPage(), and Initialize().

◆ m_bFolderIconIsSet

BOOL CFileDefExt::m_bFolderIconIsSet
private

Definition at line 111 of file filedefext.h.

Referenced by CFileDefExt(), OnFolderCustApply(), and OnFolderCustChangeIcon().

◆ m_bMultifile

BOOL CFileDefExt::m_bMultifile
private

Definition at line 86 of file filedefext.h.

Referenced by AddPages(), InitDirStats(), Initialize(), and UpdateDirStatsResults().

◆ m_cFiles

DWORD CFileDefExt::m_cFiles
private

Definition at line 91 of file filedefext.h.

Referenced by InitDirStats(), and UpdateDirStatsResults().

◆ m_cFolders

DWORD CFileDefExt::m_cFolders
private

Definition at line 92 of file filedefext.h.

Referenced by InitDirStats(), and UpdateDirStatsResults().

◆ m_cidl

UINT CFileDefExt::m_cidl = 0
private

Definition at line 90 of file filedefext.h.

Referenced by Initialize(), InitMultifilePage(), InitMultifilePageThread(), and ~CFileDefExt().

◆ m_Destroyed

LONG volatile CFileDefExt::m_Destroyed = 0
private

Definition at line 101 of file filedefext.h.

Referenced by GeneralPageProc(), IsDestroyed(), and MultifilePageProc().

◆ m_DirSize

ULARGE_INTEGER CFileDefExt::m_DirSize
private

Definition at line 93 of file filedefext.h.

Referenced by CFileDefExt(), InitDirStats(), and UpdateDirStatsResults().

◆ m_DirSizeOnDisc

ULARGE_INTEGER CFileDefExt::m_DirSizeOnDisc
private

Definition at line 94 of file filedefext.h.

Referenced by CFileDefExt(), InitDirStats(), and UpdateDirStatsResults().

◆ m_hFolderIcon

HICON CFileDefExt::m_hFolderIcon
private

Definition at line 110 of file filedefext.h.

Referenced by CFileDefExt(), OnFolderCustDestroy(), and UpdateFolderIcon().

◆ m_hWndDirStatsDlg

HWND CFileDefExt::m_hWndDirStatsDlg
private

◆ m_nFolderIconIndex

INT CFileDefExt::m_nFolderIconIndex
private

◆ m_pidlFolder

LPITEMIDLIST CFileDefExt::m_pidlFolder = NULL
private

Definition at line 88 of file filedefext.h.

Referenced by Initialize(), InitMultifilePageThread(), and ~CFileDefExt().

◆ m_pidls

LPITEMIDLIST* CFileDefExt::m_pidls = NULL
private

Definition at line 89 of file filedefext.h.

Referenced by Initialize(), InitMultifilePageThread(), and ~CFileDefExt().

◆ m_szFolderIconPath

WCHAR CFileDefExt::m_szFolderIconPath[MAX_PATH]
private

◆ m_VerInfo

CFileVersionInfo CFileDefExt::m_VerInfo
private

◆ m_wszPath


The documentation for this class was generated from the following files: