ReactOS  0.4.15-dev-4872-g8a3db97
CDrvDefExt Class Reference

#include <drvdefext.h>

Inheritance diagram for CDrvDefExt:
Collaboration diagram for CDrvDefExt:

Public Member Functions

 CDrvDefExt ()
 
 ~CDrvDefExt ()
 
virtual HRESULT STDMETHODCALLTYPE Initialize (PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pDataObj, HKEY hkeyProgID)
 
virtual HRESULT WINAPI QueryContextMenu (HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
 
virtual HRESULT WINAPI InvokeCommand (LPCMINVOKECOMMANDINFO lpici)
 
virtual HRESULT WINAPI GetCommandString (UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax)
 
virtual HRESULT WINAPI AddPages (LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
 
virtual HRESULT WINAPI ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
 
virtual HRESULT WINAPI SetSite (IUnknown *punk)
 
virtual HRESULT WINAPI GetSite (REFIID iid, void **ppvSite)
 
- 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 ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- 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 GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 

Private Member Functions

VOID PaintStaticControls (HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
 
VOID InitGeneralPage (HWND hwndDlg)
 

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
 

Additional Inherited Members

- Public Types inherited from IShellExtInit
typedef IShellExtInitLPSHELLEXTINIT
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IContextMenu
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
 
- Public Attributes inherited from IContextMenu
CMIC_MASK_NOZONECHECKS typedef IContextMenuLPCONTEXTMENU
 
- Static Public Attributes inherited from IContextMenu
static CMDSTR_VIEWDETAILSW(const WCHAR []) 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 668 of file drvdefext.cpp.

669 {
670  m_wszDrive[0] = L'\0';
671 }
#define L(x)
Definition: ntvdm.h:50
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39

◆ ~CDrvDefExt()

CDrvDefExt::~CDrvDefExt ( )

Definition at line 673 of file drvdefext.cpp.

674 {
675 
676 }

Member Function Documentation

◆ AddPages()

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

Definition at line 735 of file drvdefext.cpp.

736 {
737  HPROPSHEETPAGE hPage;
738 
741  (LPARAM)this,
742  NULL);
743  if (hPage)
744  pfnAddPage(hPage, lParam);
745 
747  {
750  (LPARAM)this,
751  NULL);
752  if (hPage)
753  pfnAddPage(hPage, lParam);
754  }
755 
757  {
760  (LPARAM)this,
761  NULL);
762  if (hPage)
763  pfnAddPage(hPage, lParam);
764  }
765 
766  return S_OK;
767 }
static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:580
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:491
#define IDD_DRIVE_PROPERTIES
Definition: shresdef.h:368
#define DRIVE_REMOTE
Definition: winbase.h:250
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_DRIVE_HARDWARE
Definition: shresdef.h:370
#define IDD_DRIVE_TOOLS
Definition: shresdef.h:369
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_FIXED
Definition: winbase.h:249
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
HPROPSHEETPAGE SH_CreatePropertySheetPage(LPCSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
LPARAM lParam
Definition: combotst.c:139
static INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:642

◆ ExtraPageProc()

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

Definition at line 580 of file drvdefext.cpp.

585 {
586  switch (uMsg)
587  {
588  case WM_INITDIALOG:
589  {
591  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam);
592  return TRUE;
593  }
594  case WM_COMMAND:
595  {
596  WCHAR wszBuf[MAX_PATH];
597  DWORD cbBuf = sizeof(wszBuf);
598  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
599 
600  switch(LOWORD(wParam))
601  {
602  case 14000:
604  break;
605  case 14001:
607  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\DefragPath",
608  NULL,
610  NULL,
611  (PVOID)wszBuf,
612  &cbBuf) == ERROR_SUCCESS)
613  {
614  WCHAR wszCmd[MAX_PATH];
615 
616  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
617 
618  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
619  ERR("Failed to create defrag process %ls\n", wszCmd);
620  }
621  break;
622  case 14002:
624  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\BackupPath",
625  NULL,
627  NULL,
628  (PVOID)wszBuf,
629  &cbBuf) == ERROR_SUCCESS)
630  {
631  if (ShellExecuteW(hwndDlg, NULL, wszBuf, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
632  ERR("Failed to create backup process %ls\n", wszBuf);
633  }
634  }
635  break;
636  }
637  }
638  return FALSE;
639 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
static INT_PTR CALLBACK ChkDskDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:160
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM lParam
Definition: prsht.h:227
#define DWLP_USER
Definition: winuser.h:866
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
#define WM_COMMAND
Definition: winuser.h:1727
#define ERR(fmt,...)
Definition: debug.h:110
#define shell32_hInstance
#define IDD_CHECK_DISK
Definition: shresdef.h:491
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2354
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by AddPages().

◆ GeneralPageProc()

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

Definition at line 491 of file drvdefext.cpp.

496 {
497  switch(uMsg)
498  {
499  case WM_INITDIALOG:
500  {
502  if (ppsp == NULL)
503  break;
504 
505  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
506  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
507  pDrvDefExt->InitGeneralPage(hwndDlg);
508  return TRUE;
509  }
510  case WM_DRAWITEM:
511  {
513 
514  if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
515  {
516  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
517  pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
518  return TRUE;
519  }
520  break;
521  }
522  case WM_PAINT:
523  break;
524  case WM_COMMAND:
525  if (LOWORD(wParam) == 14010) /* Disk Cleanup */
526  {
527  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
528  WCHAR wszBuf[256];
529  DWORD cbBuf = sizeof(wszBuf);
530 
532  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\CleanupPath",
533  NULL,
535  NULL,
536  (PVOID)wszBuf,
537  &cbBuf) == ERROR_SUCCESS)
538  {
539  WCHAR wszCmd[MAX_PATH];
540 
541  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
542 
543  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
544  ERR("Failed to create cleanup process %ls\n", wszCmd);
545  }
546  }
547  else if (LOWORD(wParam) == 14000) /* Label */
548  {
549  if (HIWORD(wParam) == EN_CHANGE)
550  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
551  }
552  break;
553  case WM_NOTIFY:
554  if (((LPNMHDR)lParam)->hwndFrom == GetParent(hwndDlg))
555  {
556  /* Property Sheet */
557  LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
558 
559  if (lppsn->hdr.code == PSN_APPLY)
560  {
561  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
562  WCHAR wszBuf[256];
563 
564  if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf)))
565  SetVolumeLabelW(pDrvDefExt->m_wszDrive, wszBuf);
567  return TRUE;
568  }
569  }
570  break;
571 
572  default:
573  break;
574  }
575 
576  return FALSE;
577 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define ERROR_SUCCESS
Definition: deptool.c:10
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
struct _PSHNOTIFY * LPPSHNOTIFY
#define TRUE
Definition: types.h:120
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define PSN_APPLY
Definition: prsht.h:117
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
UINT code
Definition: winuser.h:3139
NMHDR hdr
Definition: prsht.h:330
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define SW_SHOW
Definition: winuser.h:769
VOID InitGeneralPage(HWND hwndDlg)
Definition: drvdefext.cpp:380
VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
Definition: drvdefext.cpp:192
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_PAINT
Definition: winuser.h:1607
#define PSNRET_NOERROR
Definition: prsht.h:129
LPARAM lParam
Definition: prsht.h:227
#define DWLP_USER
Definition: winuser.h:866
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
#define WM_COMMAND
Definition: winuser.h:1727
#define ERR(fmt,...)
Definition: debug.h:110
HWND WINAPI GetParent(_In_ HWND)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define WM_DRAWITEM
Definition: winuser.h:1632
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2354
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define EN_CHANGE
Definition: winuser.h:2009

Referenced by AddPages().

◆ GetCommandString()

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

Implements IContextMenu.

Definition at line 728 of file drvdefext.cpp.

729 {
731  return E_NOTIMPL;
732 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetSite()

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

Definition at line 784 of file drvdefext.cpp.

785 {
787  return E_NOTIMPL;
788 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ HardwarePageProc()

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

Definition at line 642 of file drvdefext.cpp.

647 {
650 
651  switch(uMsg)
652  {
653  case WM_INITDIALOG:
654  {
655  GUID Guids[2];
656  Guids[0] = GUID_DEVCLASS_DISKDRIVE;
657  Guids[1] = GUID_DEVCLASS_CDROM;
658 
659  /* create the hardware page */
660  DeviceCreateHardwarePageEx(hwndDlg, Guids, _countof(Guids), HWPD_STANDARDLIST);
661  break;
662  }
663  }
664 
665  return FALSE;
666 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
EXTERN_C HWND WINAPI DeviceCreateHardwarePageEx(HWND hWndParent, LPGUID lpGuids, UINT uNumberOfGuids, HWPAGE_DISPLAYMODE DisplayMode)
#define _countof(array)
Definition: sndvol32.h:68
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139

Referenced by AddPages().

◆ InitGeneralPage()

VOID CDrvDefExt::InitGeneralPage ( HWND  hwndDlg)
private

Definition at line 380 of file drvdefext.cpp.

381 {
382  WCHAR wszVolumeName[MAX_PATH+1] = {0};
383  WCHAR wszFileSystem[MAX_PATH+1] = {0};
384  WCHAR wszBuf[128];
385  BOOL bRet;
386 
387  bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem));
388  if (bRet)
389  {
390  /* Set volume label and filesystem */
391  SetDlgItemTextW(hwndDlg, 14000, wszVolumeName);
392  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
393  }
394  else
395  {
396  LoadStringW(shell32_hInstance, IDS_FS_UNKNOWN, wszFileSystem, _countof(wszFileSystem));
397  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
398  }
399 
400  /* Set drive type and icon */
402  UINT IconId, TypeStrId = 0;
403  switch (DriveType)
404  {
405  case DRIVE_REMOVABLE:
407  IconId = IDI_SHELL_3_14_FLOPPY;
408  else
409  IconId = IDI_SHELL_REMOVEABLE;
410  break;
411  case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break;
412  case DRIVE_REMOTE: IconId = IDI_SHELL_NETDRIVE; TypeStrId = IDS_DRIVE_NETWORK; break;
413  case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
414  default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED;
415  }
416 
418  {
419  /* volume label textbox */
420  SendMessage(GetDlgItem(hwndDlg, 14000), EM_SETREADONLY, TRUE, 0);
421 
422  /* disk compression */
423  ShowWindow(GetDlgItem(hwndDlg, 14011), FALSE);
424 
425  /* index */
426  ShowWindow(GetDlgItem(hwndDlg, 14012), FALSE);
427  }
428 
430  if (hIcon)
431  SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
432  if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf)))
433  SetDlgItemTextW(hwndDlg, 14001, wszBuf);
434 
435  ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes;
436  if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL))
437  {
438  /* Init free space percentage used for drawing piechart */
439  m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart);
440 
441  /* Used space */
442  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
443  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
444 
445  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
446  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
447 
448  /* Free space */
449  if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
450  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
451 
452  if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
453  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
454 
455  /* Total space */
456  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
457  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
458 
459  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
460  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
461  }
462  else
463  {
464  m_FreeSpacePerc = 0;
465 
466  if (SH_FormatByteSize(0, wszBuf, _countof(wszBuf)))
467  {
468  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
469  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
470  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
471  }
472  if (StrFormatByteSizeW(0, wszBuf, _countof(wszBuf)))
473  {
474  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
475  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
476  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
477  }
478  }
479 
480  /* Set drive description */
481  WCHAR wszFormat[50];
482  GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat));
483  swprintf(wszBuf, wszFormat, m_wszDrive[0]);
484  SetDlgItemTextW(hwndDlg, 14009, wszBuf);
485 
486  /* show disk cleanup button only for fixed drives */
487  ShowWindow(GetDlgItem(hwndDlg, 14010), DriveType == DRIVE_FIXED);
488 }
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
#define STM_SETICON
Definition: winuser.h:2079
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define IDI_SHELL_DRIVE
Definition: shresdef.h:532
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
UINT SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
Definition: filedefext.cpp:236
#define EM_SETREADONLY
Definition: winuser.h:2002
#define TRUE
Definition: types.h:120
#define DRIVE_RAMDISK
Definition: winbase.h:252
#define IDI_SHELL_REMOVEABLE
Definition: shresdef.h:531
UINT DriveType
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_DRIVE_CDROM
Definition: shresdef.h:114
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DRIVE_REMOVABLE
Definition: winbase.h:248
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define DRIVE_REMOTE
Definition: winbase.h:250
#define DRIVE_CDROM
Definition: machpc98.h:115
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT m_FreeSpacePerc
Definition: drvdefext.h:40
#define IDI_SHELL_3_14_FLOPPY
Definition: shresdef.h:530
#define IDS_DRIVE_FIXED
Definition: shresdef.h:113
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
int _cdecl swprintf(const WCHAR *,...)
#define DRIVE_FIXED
Definition: winbase.h:249
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:115
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
#define shell32_hInstance
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IDI_SHELL_CDROM
Definition: shresdef.h:535
BOOL IsDriveFloppyW(LPCWSTR pszDriveRoot)
Definition: drvdefext.cpp:306
#define SendMessage
Definition: winuser.h:5823
#define IDI_SHELL_RAMDISK
Definition: shresdef.h:536
#define LoadImage
Definition: winuser.h:5795
#define IDI_SHELL_NETDRIVE
Definition: shresdef.h:533
#define IDS_FS_UNKNOWN
Definition: shresdef.h:118
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342

◆ Initialize()

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

Implements IShellExtInit.

Definition at line 679 of file drvdefext.cpp.

680 {
681  FORMATETC format;
682  STGMEDIUM stgm;
683  HRESULT hr;
684 
685  TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID);
686 
687  if (!pDataObj)
688  return E_FAIL;
689 
690  format.cfFormat = CF_HDROP;
691  format.ptd = NULL;
692  format.dwAspect = DVASPECT_CONTENT;
693  format.lindex = -1;
694  format.tymed = TYMED_HGLOBAL;
695 
696  hr = pDataObj->GetData(&format, &stgm);
697  if (FAILED(hr))
698  return hr;
699 
700  if (!DragQueryFileW((HDROP)stgm.hGlobal, 0, m_wszDrive, _countof(m_wszDrive)))
701  {
702  ERR("DragQueryFileW failed\n");
703  ReleaseStgMedium(&stgm);
704  return E_FAIL;
705  }
706 
707  ReleaseStgMedium(&stgm);
708  TRACE("Drive properties %ls\n", m_wszDrive);
709 
710  return S_OK;
711 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
#define E_FAIL
Definition: ddrawi.h:102
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define CF_HDROP
Definition: constants.h:410
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:622

◆ InvokeCommand()

HRESULT WINAPI CDrvDefExt::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
virtual

Implements IContextMenu.

Definition at line 721 of file drvdefext.cpp.

722 {
724  return E_NOTIMPL;
725 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ 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 hDarkBluePen = CreatePen(PS_SOLID, 1, RGB(0, 0, 128));
220  HPEN hDarkMagPen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128));
221  HPEN hOldPen = (HPEN)SelectObject(pDrawItem->hDC, hDarkMagPen);
222  INT xCenter = (pDrawItem->rcItem.left + pDrawItem->rcItem.right) / 2;
223  INT yCenter = (pDrawItem->rcItem.top + pDrawItem->rcItem.bottom - 10) / 2;
224  INT cx = pDrawItem->rcItem.right - pDrawItem->rcItem.left;
225  INT cy = pDrawItem->rcItem.bottom - pDrawItem->rcItem.top - 10;
226  INT xRadial = xCenter + (INT)(cos(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cx / 2);
227  INT yRadial = yCenter - (INT)(sin(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cy / 2);
228 
229  TRACE("FreeSpace %u a %f cx %d\n", m_FreeSpacePerc, M_PI+m_FreeSpacePerc / 100.0f * M_PI * 2.0f, cx);
230 
231  for (INT x = pDrawItem->rcItem.left; x < pDrawItem->rcItem.right; ++x)
232  {
233  double cos_val = (x - xCenter) * 2.0f / cx;
234  INT y = yCenter + (INT)(sin(acos(cos_val)) * cy / 2) - 1;
235 
236  if (m_FreeSpacePerc < 50 && x == xRadial)
237  SelectObject(pDrawItem->hDC, hDarkBluePen);
238 
239  MoveToEx(pDrawItem->hDC, x, y, NULL);
240  LineTo(pDrawItem->hDC, x, y + 10);
241  }
242 
243  SelectObject(pDrawItem->hDC, hOldPen);
244 
245  if (m_FreeSpacePerc > 50)
246  {
247  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush);
248 
249  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
250  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
251 
252  SelectObject(pDrawItem->hDC, hBlueBrush);
253 
254  if (m_FreeSpacePerc < 100)
255  {
256  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
257  pDrawItem->rcItem.bottom - 10, xRadial, yRadial, pDrawItem->rcItem.left, yCenter);
258  }
259  }
260  else
261  {
262  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hBlueBrush);
263 
264  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
265  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
266 
267  SelectObject(pDrawItem->hDC, hMagBrush);
268 
269  if (m_FreeSpacePerc > 0)
270  {
271  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
272  pDrawItem->rcItem.bottom - 10, pDrawItem->rcItem.left, yCenter, xRadial, yRadial);
273  }
274  }
275 
276  SelectObject(pDrawItem->hDC, hbrOld);
277 
278  DeleteObject(hBlueBrush);
279  DeleteObject(hMagBrush);
280  DeleteObject(hDarkBluePen);
281  DeleteObject(hDarkMagPen);
282  }
283 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define RGB(r, g, b)
Definition: precomp.h:62
#define INT
Definition: polytest.cpp:20
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:586
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
UINT m_FreeSpacePerc
Definition: drvdefext.h:40
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
#define M_PI
Definition: dib.cpp:249
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG bottom
Definition: windef.h:309
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by GeneralPageProc().

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 714 of file drvdefext.cpp.

715 {
717  return E_NOTIMPL;
718 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ ReplacePage()

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

Definition at line 770 of file drvdefext.cpp.

771 {
773  return E_NOTIMPL;
774 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ SetSite()

HRESULT WINAPI CDrvDefExt::SetSite ( IUnknown punk)
virtual

Implements IObjectWithSite.

Definition at line 777 of file drvdefext.cpp.

778 {
780  return E_NOTIMPL;
781 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

Member Data Documentation

◆ m_FreeSpacePerc

UINT CDrvDefExt::m_FreeSpacePerc
private

Definition at line 40 of file drvdefext.h.

Referenced by InitGeneralPage(), and PaintStaticControls().

◆ m_wszDrive

WCHAR CDrvDefExt::m_wszDrive[MAX_PATH]
private

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