ReactOS 0.4.16-dev-1515-g853b446
CDrvDefExt Class Reference

#include <drvdefext.h>

Inheritance diagram for CDrvDefExt:
Collaboration diagram for CDrvDefExt:

Public Member Functions

 CDrvDefExt ()
 
 ~CDrvDefExt ()
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pDataObj, 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
 
STDMETHOD() SetSite (IUnknown *punk) override
 
STDMETHOD() GetSite (REFIID iid, void **ppvSite) 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)
 
- Public Member Functions inherited from IObjectWithSite
HRESULT SetSite ([in] IUnknown *pUnkSite)
 
HRESULT GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 

Private Member Functions

VOID PaintStaticControls (HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
 
VOID InitGeneralPage (HWND hwndDlg)
 
HRESULT AddMainPage (LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
 

Static Private Member Functions

static INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK ExtraPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK HardwarePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Private Attributes

WCHAR m_wszDrive [MAX_PATH]
 
UINT m_FreeSpacePerc
 
CComPtr< IDataObjectm_Multiple
 

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
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- 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 24 of file drvdefext.h.

Constructor & Destructor Documentation

◆ CDrvDefExt()

CDrvDefExt::CDrvDefExt ( )

Definition at line 694 of file drvdefext.cpp.

695{
696 m_wszDrive[0] = L'\0';
697}
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
#define L(x)
Definition: resources.c:13

◆ ~CDrvDefExt()

CDrvDefExt::~CDrvDefExt ( )

Definition at line 699 of file drvdefext.cpp.

700{
701
702}

Member Function Documentation

◆ AddMainPage()

HRESULT CDrvDefExt::AddMainPage ( LPFNADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
private

Definition at line 785 of file drvdefext.cpp.

786{
787 WCHAR szTitle[MAX_PATH], *pszTitle = NULL;
788 if (m_Multiple)
789 {
790 CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidl(SHSimpleIDListFromPathW(m_wszDrive));
791 if (SUCCEEDED(SHGetNameAndFlagsW(pidl, SHGDN_INFOLDER, szTitle, _countof(szTitle), NULL)))
792 pszTitle = szTitle;
793 }
794
795 HPROPSHEETPAGE hPage;
797 pszTitle, &PropSheetPageLifetimeCallback<CDrvDefExt>);
798 HRESULT hr = AddPropSheetPage(hPage, pfnAddPage, lParam);
800 return hr;
801 else
802 AddRef(); // For PropSheetPageLifetimeCallback
803 return hr;
804}
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:508
CComPtr< IDataObject > m_Multiple
Definition: drvdefext.h:41
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
HRESULT SHGetNameAndFlagsW(_In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_opt_ LPWSTR pszText, _In_ UINT cchBuf, _Inout_opt_ DWORD *pdwAttributes)
Definition: utils.cpp:503
static HRESULT AddPropSheetPage(HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: precomp.h:151
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
ULONG AddRef()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1239
HRESULT hr
Definition: shlfolder.c:183
#define IDD_DRIVE_PROPERTIES
Definition: shresdef.h:430
#define _countof(array)
Definition: sndvol32.h:70
HPROPSHEETPAGE SH_CreatePropertySheetPageEx(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle, LPFNPSPCALLBACK Callback)
Definition: propsheet.cpp:223
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AddPages().

◆ AddPages()

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

Definition at line 807 of file drvdefext.cpp.

808{
809 HRESULT hr = AddMainPage(pfnAddPage, lParam);
811 return hr;
812
813 if (m_Multiple)
814 {
815 CDrop drop(m_Multiple);
816 UINT count = SUCCEEDED(drop.hr) ? drop.GetCount() : 0;
817 for (UINT i = 0; ++i < count;) // Skipping the first drive since it already has a page
818 {
819 CComPtr<CDrvDefExt> SheetExt;
820 if (FAILED_UNEXPECTEDLY(hr = ShellObjectCreator(SheetExt)))
821 continue;
822 if (!DragQueryFileW(drop.hDrop, i, SheetExt->m_wszDrive, _countof(SheetExt->m_wszDrive)))
823 continue;
824 if (!IsValidDrivePath(SheetExt->m_wszDrive))
825 continue;
826
827 SheetExt->m_Multiple = m_Multiple;
828 SheetExt->AddMainPage(pfnAddPage, lParam);
829 }
830 }
831 else
832 {
833 HPROPSHEETPAGE hPage;
835 {
838 (LPARAM)this,
839 NULL);
840 if (hPage)
841 pfnAddPage(hPage, lParam);
842 }
843
845 {
848 (LPARAM)this,
849 NULL);
850 if (hPage)
851 pfnAddPage(hPage, lParam);
852 }
853 }
854
855 return S_OK;
856}
static INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:668
static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:606
HRESULT AddMainPage(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: drvdefext.cpp:785
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:666
static bool IsValidDrivePath(PCWSTR Path)
Definition: drvdefext.cpp:729
GLuint GLuint GLsizei count
Definition: gl.h:1545
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 S_OK
Definition: intsafe.h:52
unsigned int UINT
Definition: ndis.h:50
#define IDD_DRIVE_TOOLS
Definition: shresdef.h:431
#define IDD_DRIVE_HARDWARE
Definition: shresdef.h:432
HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle)
Definition: propsheet.cpp:243
#define DRIVE_REMOTE
Definition: winbase.h:286
#define DRIVE_FIXED
Definition: winbase.h:285

◆ ExtraPageProc()

INT_PTR CALLBACK CDrvDefExt::ExtraPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 606 of file drvdefext.cpp.

611{
612 switch (uMsg)
613 {
614 case WM_INITDIALOG:
615 {
617 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam);
618 return TRUE;
619 }
620 case WM_COMMAND:
621 {
622 WCHAR wszBuf[MAX_PATH];
623 DWORD cbBuf = sizeof(wszBuf);
624 CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
625
626 switch(LOWORD(wParam))
627 {
628 case 14000:
630 break;
631 case 14001:
633 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\DefragPath",
634 NULL,
636 NULL,
637 (PVOID)wszBuf,
638 &cbBuf) == ERROR_SUCCESS)
639 {
640 WCHAR wszCmd[MAX_PATH];
641
642 StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
643
644 if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
645 ERR("Failed to create defrag process %ls\n", wszCmd);
646 }
647 break;
648 case 14002:
650 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\BackupPath",
651 NULL,
653 NULL,
654 (PVOID)wszBuf,
655 &cbBuf) == ERROR_SUCCESS)
656 {
657 if (ShellExecuteW(hwndDlg, NULL, wszBuf, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
658 ERR("Failed to create backup process %ls\n", wszBuf);
659 }
660 }
661 break;
662 }
663 }
664 return FALSE;
665}
#define shell32_hInstance
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define RRF_RT_REG_SZ
Definition: driver.c:575
static INT_PTR CALLBACK ChkDskDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:160
unsigned long DWORD
Definition: ntddk_ex.h:95
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2607
#define IDD_CHECK_DISK
Definition: shresdef.h:553
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LPARAM lParam
Definition: prsht.h:227
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define DWLP_USER
Definition: winuser.h:883
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define SW_SHOW
Definition: winuser.h:786
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by AddPages().

◆ GeneralPageProc()

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

Definition at line 508 of file drvdefext.cpp.

513{
514 switch(uMsg)
515 {
516 case WM_INITDIALOG:
517 {
519 if (ppsp == NULL)
520 break;
521
522 CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
523 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
524 pDrvDefExt->InitGeneralPage(hwndDlg);
525 return TRUE;
526 }
527 case WM_DRAWITEM:
528 {
530
531 if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
532 {
533 CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
534 pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
535 return TRUE;
536 }
537 break;
538 }
539 case WM_PAINT:
540 break;
541 case WM_COMMAND:
542 if (LOWORD(wParam) == 14010) /* Disk Cleanup */
543 {
544 CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
545 WCHAR wszBuf[256];
546 DWORD cbBuf = sizeof(wszBuf);
547
549 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\CleanupPath",
550 NULL,
552 NULL,
553 (PVOID)wszBuf,
554 &cbBuf) == ERROR_SUCCESS)
555 {
556 WCHAR wszCmd[MAX_PATH];
557
558 StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
559 WCHAR* wszArgs = PathGetArgsW(wszCmd);
560 if (wszArgs && *wszArgs && wszArgs != wszCmd)
561 wszArgs[-1] = UNICODE_NULL;
562 else
563 wszArgs = NULL;
564
565 if (ShellExecuteW(hwndDlg, NULL, wszCmd, wszArgs, NULL, SW_SHOW) <= (HINSTANCE)32)
566 ERR("Failed to create cleanup process %ls\n", wszCmd);
567 }
568 }
569 else if (LOWORD(wParam) == 14000) /* Label */
570 {
571 if (HIWORD(wParam) == EN_CHANGE)
572 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
573 }
574 break;
575 case WM_NOTIFY:
576 if (((LPNMHDR)lParam)->hwndFrom == GetParent(hwndDlg))
577 {
578 /* Property Sheet */
580
581 if (lppsn->hdr.code == PSN_APPLY)
582 {
583 CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
584
585 HRESULT hr = E_FAIL;
586 HWND hLabel = GetDlgItem(hwndDlg, 14000);
587 WCHAR wszBuf[256];
588 *wszBuf = UNICODE_NULL;
589 if (GetWindowTextW(hLabel, wszBuf, _countof(wszBuf)) || GetWindowTextLengthW(hLabel) == 0)
590 hr = CDrivesFolder::SetDriveLabel(hwndDlg, pDrvDefExt->m_wszDrive, wszBuf);
591
593 return TRUE;
594 }
595 }
596 break;
597
598 default:
599 break;
600 }
601
602 return FALSE;
603}
static HRESULT SetDriveLabel(HWND hwndOwner, PCWSTR DrivePath, PCWSTR Label)
VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
Definition: drvdefext.cpp:192
VOID InitGeneralPage(HWND hwndDlg)
Definition: drvdefext.cpp:394
#define E_FAIL
Definition: ddrawi.h:102
WCHAR *WINAPI PathGetArgsW(const WCHAR *path)
Definition: path.c:1740
#define FAILED(hr)
Definition: intsafe.h:51
#define UNICODE_NULL
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
struct _PSHNOTIFY * LPPSHNOTIFY
#define WM_NOTIFY
Definition: richedit.h:61
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3261
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define WM_PAINT
Definition: winuser.h:1648
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1673
int WINAPI GetWindowTextLengthW(_In_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define EN_CHANGE
Definition: winuser.h:2051

Referenced by AddMainPage().

◆ GetCommandString()

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

Implements IContextMenu.

Definition at line 778 of file drvdefext.cpp.

779{
781 return E_NOTIMPL;
782}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetSite()

HRESULT WINAPI CDrvDefExt::GetSite ( REFIID  iid,
void **  ppvSite 
)
override

Definition at line 873 of file drvdefext.cpp.

874{
876 return E_NOTIMPL;
877}

◆ HardwarePageProc()

INT_PTR CALLBACK CDrvDefExt::HardwarePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 668 of file drvdefext.cpp.

673{
676
677 switch(uMsg)
678 {
679 case WM_INITDIALOG:
680 {
681 GUID Guids[2];
682 Guids[0] = GUID_DEVCLASS_DISKDRIVE;
683 Guids[1] = GUID_DEVCLASS_CDROM;
684
685 /* create the hardware page */
687 break;
688 }
689 }
690
691 return FALSE;
692}
@ HWPD_STANDARDLIST
Definition: main.h:24
HWND WINAPI DeviceCreateHardwarePageEx(HWND hWndParent, LPGUID lpGuids, UINT uNumberOfGuids, HWPAGE_DISPLAYMODE DisplayMode)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329

Referenced by AddPages().

◆ InitGeneralPage()

VOID CDrvDefExt::InitGeneralPage ( HWND  hwndDlg)
private

Definition at line 394 of file drvdefext.cpp.

395{
396 WCHAR wszVolumeName[MAX_PATH+1] = {0};
397 WCHAR wszFileSystem[MAX_PATH+1] = {0};
398 WCHAR wszBuf[128];
399 BOOL bRet, bFloppy = FALSE, bHasFS = FALSE;
400
401 bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem));
402 if (bRet)
403 {
404 /* Set volume label and filesystem */
405 SetDlgItemTextW(hwndDlg, 14000, wszVolumeName);
406 SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
407 bHasFS = *wszFileSystem != UNICODE_NULL;
408 }
409 else
410 {
411 LoadStringW(shell32_hInstance, IDS_FS_UNKNOWN, wszFileSystem, _countof(wszFileSystem));
412 SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
413 }
414
415 /* Set drive type and icon */
416 // TODO: Call SHGetFileInfo to get this info
418 UINT IconId, TypeStrId;
419 switch (DriveType)
420 {
421 case DRIVE_REMOVABLE:
422 bFloppy = IsDriveFloppyW(m_wszDrive);
423 IconId = bFloppy ? IDI_SHELL_3_14_FLOPPY : IDI_SHELL_REMOVEABLE;
424 TypeStrId = bFloppy ? IDS_DRIVE_FLOPPY : IDS_DRIVE_REMOVABLE;
425 break;
426 case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break;
427 case DRIVE_REMOTE: IconId = IDI_SHELL_NETDRIVE; TypeStrId = IDS_DRIVE_NETWORK; break;
428 case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
429 default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED;
430 }
431
432 BOOL bCanSetLabel = bHasFS;
433 if (DriveType == DRIVE_CDROM || DriveType == DRIVE_REMOTE || bFloppy)
434 {
435 bCanSetLabel = bFloppy && bHasFS;
436
437 /* disk compression */
438 ShowWindow(GetDlgItem(hwndDlg, 14011), FALSE);
439
440 /* index */
441 ShowWindow(GetDlgItem(hwndDlg, 14012), FALSE);
442 }
443 /* volume label textbox */
444 SendMessage(GetDlgItem(hwndDlg, 14000), EM_SETREADONLY, !bCanSetLabel, 0);
445
447 if (hIcon)
448 SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
449 if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf)))
450 SetDlgItemTextW(hwndDlg, 14001, wszBuf);
451
452 ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes;
453 if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL))
454 {
455 /* Init free space percentage used for drawing piechart */
456 m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart);
457
458 /* Used space */
459 if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
460 SetDlgItemTextW(hwndDlg, 14003, wszBuf);
461
462 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
463 SetDlgItemTextW(hwndDlg, 14004, wszBuf);
464
465 /* Free space */
466 if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
467 SetDlgItemTextW(hwndDlg, 14005, wszBuf);
468
469 if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
470 SetDlgItemTextW(hwndDlg, 14006, wszBuf);
471
472 /* Total space */
473 if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
474 SetDlgItemTextW(hwndDlg, 14007, wszBuf);
475
476 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
477 SetDlgItemTextW(hwndDlg, 14008, wszBuf);
478 }
479 else
480 {
481 m_FreeSpacePerc = 0;
482
483 if (SH_FormatByteSize(0, wszBuf, _countof(wszBuf)))
484 {
485 SetDlgItemTextW(hwndDlg, 14003, wszBuf);
486 SetDlgItemTextW(hwndDlg, 14005, wszBuf);
487 SetDlgItemTextW(hwndDlg, 14007, wszBuf);
488 }
489 if (StrFormatByteSizeW(0, wszBuf, _countof(wszBuf)))
490 {
491 SetDlgItemTextW(hwndDlg, 14004, wszBuf);
492 SetDlgItemTextW(hwndDlg, 14006, wszBuf);
493 SetDlgItemTextW(hwndDlg, 14008, wszBuf);
494 }
495 }
496
497 /* Set drive description */
498 WCHAR wszFormat[50];
499 GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat));
500 swprintf(wszBuf, wszFormat, m_wszDrive[0]);
501 SetDlgItemTextW(hwndDlg, 14009, wszBuf);
502
503 /* show disk cleanup button only for fixed drives */
504 ShowWindow(GetDlgItem(hwndDlg, 14010), DriveType == DRIVE_FIXED);
505}
UINT DriveType
UINT m_FreeSpacePerc
Definition: drvdefext.h:40
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
BOOL IsDriveFloppyW(LPCWSTR pszDriveRoot)
Definition: drvdefext.cpp:320
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2394
#define swprintf
Definition: precomp.h:40
UINT SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
Definition: filedefext.cpp:274
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DRIVE_CDROM
Definition: machpc98.h:119
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define IDS_DRIVE_CDROM
Definition: shresdef.h:112
#define IDS_DRIVE_FIXED
Definition: shresdef.h:111
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:113
#define IDS_FS_UNKNOWN
Definition: shresdef.h:116
#define IDS_DRIVE_REMOVABLE
Definition: shresdef.h:115
#define IDI_SHELL_3_14_FLOPPY
Definition: shresdef.h:592
#define IDI_SHELL_NETDRIVE
Definition: shresdef.h:595
#define IDS_DRIVE_FLOPPY
Definition: shresdef.h:114
#define IDI_SHELL_CDROM
Definition: shresdef.h:597
#define IDI_SHELL_DRIVE
Definition: shresdef.h:594
#define IDI_SHELL_RAMDISK
Definition: shresdef.h:598
#define IDI_SHELL_REMOVEABLE
Definition: shresdef.h:593
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define DRIVE_RAMDISK
Definition: winbase.h:288
#define DRIVE_REMOVABLE
Definition: winbase.h:284
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_SETREADONLY
Definition: winuser.h:2044
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2128
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5954
#define LR_SHARED
Definition: winuser.h:1111
#define LoadImage
Definition: winuser.h:5926

Referenced by GeneralPageProc().

◆ Initialize()

HRESULT WINAPI CDrvDefExt::Initialize ( PCIDLIST_ABSOLUTE  pidlFolder,
IDataObject pDataObj,
HKEY  hkeyProgID 
)
override

Implements IShellExtInit.

Definition at line 735 of file drvdefext.cpp.

736{
737 HRESULT hr;
738
739 TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID);
740
741 if (!pDataObj)
742 return E_FAIL;
743
744
745 CDrop drop(pDataObj);
746 if (FAILED_UNEXPECTEDLY(hr = drop.hr))
747 return hr;
748
749 if (!DragQueryFileW(drop.hDrop, 0, m_wszDrive, _countof(m_wszDrive)))
750 {
751 ERR("DragQueryFileW failed\n");
752 return E_FAIL;
753 }
754
755 if (drop.GetCount() > 1)
756 m_Multiple = pDataObj;
757
758 TRACE("Drive properties %ls\n", m_wszDrive);
759
760 return S_OK;
761}
#define TRACE(s)
Definition: solgame.cpp:4

◆ InvokeCommand()

HRESULT WINAPI CDrvDefExt::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
override

Implements IContextMenu.

Definition at line 771 of file drvdefext.cpp.

772{
774 return E_NOTIMPL;
775}

◆ PaintStaticControls()

VOID CDrvDefExt::PaintStaticControls ( HWND  hwndDlg,
LPDRAWITEMSTRUCT  pDrawItem 
)
private

Definition at line 192 of file drvdefext.cpp.

193{
194 HBRUSH hBrush;
195
196 if (pDrawItem->CtlID == 14013)
197 {
198 hBrush = CreateSolidBrush(RGB(0, 0, 255));
199 if (hBrush)
200 {
201 FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
202 DeleteObject((HGDIOBJ)hBrush);
203 }
204 }
205 else if (pDrawItem->CtlID == 14014)
206 {
207 hBrush = CreateSolidBrush(RGB(255, 0, 255));
208 if (hBrush)
209 {
210 FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
211 DeleteObject((HGDIOBJ)hBrush);
212 }
213 }
214 else if (pDrawItem->CtlID == 14015)
215 {
216 HBRUSH hBlueBrush = CreateSolidBrush(RGB(0, 0, 255));
217 HBRUSH hMagBrush = CreateSolidBrush(RGB(255, 0, 255));
218 HBRUSH hbrOld;
219 HPEN hBlackPen = (HPEN)GetStockObject(BLACK_PEN);
220 HPEN hDarkBluePen = CreatePen(PS_SOLID, 1, RGB(0, 0, 128));
221 HPEN hDarkMagPen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128));
222 HPEN hOldPen = (HPEN)SelectObject(pDrawItem->hDC, hDarkMagPen);
223 INT xCenter = (pDrawItem->rcItem.left + pDrawItem->rcItem.right) / 2;
224 INT yCenter = (pDrawItem->rcItem.top + pDrawItem->rcItem.bottom - 10) / 2;
225 INT cx = pDrawItem->rcItem.right - pDrawItem->rcItem.left;
226 INT cy = pDrawItem->rcItem.bottom - pDrawItem->rcItem.top - 10;
227 INT xRadial = xCenter + (INT)(cos(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cx / 2);
228 INT yRadial = yCenter - (INT)(sin(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cy / 2);
229
230 TRACE("FreeSpace %u a %f cx %d\n", m_FreeSpacePerc, M_PI+m_FreeSpacePerc / 100.0f * M_PI * 2.0f, cx);
231
232 for (INT x = pDrawItem->rcItem.left; x < pDrawItem->rcItem.right; ++x)
233 {
234 double cos_val = (x - xCenter) * 2.0f / cx;
235 INT y = yCenter + (INT)(sin(acos(cos_val)) * cy / 2) - 1;
236 HPEN hCenterPen;
237
238 if (m_FreeSpacePerc < 50 && x == xRadial)
239 SelectObject(pDrawItem->hDC, hDarkBluePen);
240
241 /* Temporarily change pens to draw edges */
242 if (x == pDrawItem->rcItem.left)
243 hCenterPen = (HPEN)SelectObject(pDrawItem->hDC, hBlackPen);
244 else if (x == pDrawItem->rcItem.right - 1)
245 SelectObject(pDrawItem->hDC, hBlackPen);
246
247 MoveToEx(pDrawItem->hDC, x, y, NULL);
248 LineTo(pDrawItem->hDC, x, y + 10);
249 SetPixel(pDrawItem->hDC, x, y + 10, RGB(0, 0, 0));
250
251 /* Restore fill section pens */
252 if (x == pDrawItem->rcItem.left)
253 SelectObject(pDrawItem->hDC, hCenterPen);
254 }
255
256 SelectObject(pDrawItem->hDC, hBlackPen);
257
258 if (m_FreeSpacePerc > 50)
259 {
260 hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush);
261
262 Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
263 pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
264
265 SelectObject(pDrawItem->hDC, hBlueBrush);
266
267 if (m_FreeSpacePerc < 100)
268 {
269 Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
270 pDrawItem->rcItem.bottom - 10, xRadial, yRadial, pDrawItem->rcItem.left, yCenter);
271 }
272 }
273 else
274 {
275 hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hBlueBrush);
276
277 Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
278 pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
279
280 SelectObject(pDrawItem->hDC, hMagBrush);
281
282 if (m_FreeSpacePerc > 0)
283 {
284 Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
285 pDrawItem->rcItem.bottom - 10, pDrawItem->rcItem.left, yCenter, xRadial, yRadial);
286 }
287 }
288
289 SelectObject(pDrawItem->hDC, hbrOld);
290 SelectObject(pDrawItem->hDC, hOldPen);
291
292 DeleteObject(hBlueBrush);
293 DeleteObject(hMagBrush);
294 DeleteObject(hDarkBluePen);
295 DeleteObject(hDarkMagPen);
296 }
297}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:43
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define M_PI
Definition: macros.h:263
#define INT
Definition: polytest.cpp:20
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define BLACK_PEN
Definition: wingdi.h:903
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by GeneralPageProc().

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 764 of file drvdefext.cpp.

765{
767 return E_NOTIMPL;
768}

◆ ReplacePage()

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

Definition at line 859 of file drvdefext.cpp.

860{
862 return E_NOTIMPL;
863}

◆ SetSite()

HRESULT WINAPI CDrvDefExt::SetSite ( IUnknown punk)
override

Implements IObjectWithSite.

Definition at line 866 of file drvdefext.cpp.

867{
869 return E_NOTIMPL;
870}

Member Data Documentation

◆ m_FreeSpacePerc

UINT CDrvDefExt::m_FreeSpacePerc
private

Definition at line 40 of file drvdefext.h.

Referenced by InitGeneralPage(), and PaintStaticControls().

◆ m_Multiple

CComPtr<IDataObject> CDrvDefExt::m_Multiple
private

Definition at line 41 of file drvdefext.h.

Referenced by AddMainPage(), AddPages(), and Initialize().

◆ m_wszDrive

WCHAR CDrvDefExt::m_wszDrive[MAX_PATH]
private

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