ReactOS  0.4.15-dev-344-g6808e40
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 667 of file drvdefext.cpp.

668 {
669  m_wszDrive[0] = L'\0';
670 }
static const WCHAR L[]
Definition: oid.c:1250
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39

◆ ~CDrvDefExt()

CDrvDefExt::~CDrvDefExt ( )

Definition at line 672 of file drvdefext.cpp.

673 {
674 
675 }

Member Function Documentation

◆ AddPages()

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

Definition at line 734 of file drvdefext.cpp.

735 {
736  HPROPSHEETPAGE hPage;
737 
740  (LPARAM)this,
741  NULL);
742  if (hPage)
743  pfnAddPage(hPage, lParam);
744 
746  {
749  (LPARAM)this,
750  NULL);
751  if (hPage)
752  pfnAddPage(hPage, lParam);
753  }
754 
756  {
759  (LPARAM)this,
760  NULL);
761  if (hPage)
762  pfnAddPage(hPage, lParam);
763  }
764 
765  return S_OK;
766 }
static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:581
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:492
#define IDD_DRIVE_PROPERTIES
Definition: shresdef.h:337
#define DRIVE_REMOTE
Definition: winbase.h:250
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_DRIVE_HARDWARE
Definition: shresdef.h:339
#define IDD_DRIVE_TOOLS
Definition: shresdef.h:338
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:59
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:643

◆ ExtraPageProc()

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

Definition at line 581 of file drvdefext.cpp.

586 {
587  switch (uMsg)
588  {
589  case WM_INITDIALOG:
590  {
592  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam);
593  return TRUE;
594  }
595  case WM_COMMAND:
596  {
597  WCHAR wszBuf[MAX_PATH];
598  DWORD cbBuf = sizeof(wszBuf);
599  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
600 
601  switch(LOWORD(wParam))
602  {
603  case 14000:
605  break;
606  case 14001:
608  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\DefragPath",
609  NULL,
611  NULL,
612  (PVOID)wszBuf,
613  &cbBuf) == ERROR_SUCCESS)
614  {
615  WCHAR wszCmd[MAX_PATH];
616 
617  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
618 
619  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
620  ERR("Failed to create defrag process %ls\n", wszCmd);
621  }
622  break;
623  case 14002:
625  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\BackupPath",
626  NULL,
628  NULL,
629  (PVOID)wszBuf,
630  &cbBuf) == ERROR_SUCCESS)
631  {
632  if (ShellExecuteW(hwndDlg, NULL, wszBuf, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
633  ERR("Failed to create backup process %ls\n", wszBuf);
634  }
635  }
636  break;
637  }
638  }
639  return FALSE;
640 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define TRUE
Definition: types.h:120
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 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:161
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
smooth NULL
Definition: ftsmooth.c:416
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:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
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:1722
#define ERR(fmt,...)
Definition: debug.h:110
#define IDD_CHECK_DISK
Definition: shresdef.h:453
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2274
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
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 492 of file drvdefext.cpp.

497 {
498  switch(uMsg)
499  {
500  case WM_INITDIALOG:
501  {
503  if (ppsp == NULL)
504  break;
505 
506  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
507  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
508  pDrvDefExt->InitGeneralPage(hwndDlg);
509  return TRUE;
510  }
511  case WM_DRAWITEM:
512  {
514 
515  if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
516  {
517  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
518  pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
519  return TRUE;
520  }
521  break;
522  }
523  case WM_PAINT:
524  break;
525  case WM_COMMAND:
526  if (LOWORD(wParam) == 14010) /* Disk Cleanup */
527  {
528  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
529  WCHAR wszBuf[256];
530  DWORD cbBuf = sizeof(wszBuf);
531 
533  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\CleanupPath",
534  NULL,
536  NULL,
537  (PVOID)wszBuf,
538  &cbBuf) == ERROR_SUCCESS)
539  {
540  WCHAR wszCmd[MAX_PATH];
541 
542  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
543 
544  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
545  ERR("Failed to create cleanup process %ls\n", wszCmd);
546  }
547  }
548  else if (LOWORD(wParam) == 14000) /* Label */
549  {
550  if (HIWORD(wParam) == EN_CHANGE)
551  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
552  }
553  break;
554  case WM_NOTIFY:
555  if (((LPNMHDR)lParam)->hwndFrom == GetParent(hwndDlg))
556  {
557  /* Property Sheet */
558  LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
559 
560  if (lppsn->hdr.code == PSN_APPLY)
561  {
562  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
563  WCHAR wszBuf[256];
564 
565  if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf)))
566  SetVolumeLabelW(pDrvDefExt->m_wszDrive, wszBuf);
568  return TRUE;
569  }
570  }
571  break;
572 
573  default:
574  break;
575  }
576 
577  return FALSE;
578 }
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:2271
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
struct _PSHNOTIFY * LPPSHNOTIFY
#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:3134
NMHDR hdr
Definition: prsht.h:330
smooth NULL
Definition: ftsmooth.c:416
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:381
VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
Definition: drvdefext.cpp:193
__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:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_PAINT
Definition: winuser.h:1602
#define PSNRET_NOERROR
Definition: prsht.h:129
static const WCHAR L[]
Definition: oid.c:1250
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:1722
#define ERR(fmt,...)
Definition: debug.h:110
HWND WINAPI GetParent(_In_ HWND)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_DRAWITEM
Definition: winuser.h:1627
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2274
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
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:2004

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 727 of file drvdefext.cpp.

728 {
730  return E_NOTIMPL;
731 }
#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 783 of file drvdefext.cpp.

784 {
786  return E_NOTIMPL;
787 }
#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 643 of file drvdefext.cpp.

648 {
651 
652  switch(uMsg)
653  {
654  case WM_INITDIALOG:
655  {
657 
658  /* create the hardware page */
660  break;
661  }
662  }
663 
664  return FALSE;
665 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
WPARAM wParam
Definition: combotst.c:138
static GUID * Guid
Definition: apphelp.c:93
EXTERN_C HWND WINAPI DeviceCreateHardwarePageEx(HWND hWndParent, LPGUID lpGuids, UINT uNumberOfGuids, HWPAGE_DISPLAYMODE DisplayMode)
static const GUID GUID_DEVCLASS_DISKDRIVE
Definition: drvdefext.cpp:34
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by AddPages().

◆ InitGeneralPage()

VOID CDrvDefExt::InitGeneralPage ( HWND  hwndDlg)
private

Definition at line 381 of file drvdefext.cpp.

382 {
383  WCHAR wszVolumeName[MAX_PATH+1] = {0};
384  WCHAR wszFileSystem[MAX_PATH+1] = {0};
385  WCHAR wszBuf[128];
386  BOOL bRet;
387 
388  bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem));
389  if (bRet)
390  {
391  /* Set volume label and filesystem */
392  SetDlgItemTextW(hwndDlg, 14000, wszVolumeName);
393  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
394  }
395  else
396  {
397  LoadStringW(shell32_hInstance, IDS_FS_UNKNOWN, wszFileSystem, _countof(wszFileSystem));
398  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
399  }
400 
401  /* Set drive type and icon */
403  UINT IconId, TypeStrId = 0;
404  switch (DriveType)
405  {
406  case DRIVE_REMOVABLE:
408  IconId = IDI_SHELL_3_14_FLOPPY;
409  else
410  IconId = IDI_SHELL_REMOVEABLE;
411  break;
412  case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break;
413  case DRIVE_REMOTE: IconId = IDI_SHELL_NETDRIVE; TypeStrId = IDS_DRIVE_NETWORK; break;
414  case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
415  default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED;
416  }
417 
419  {
420  /* volume label textbox */
421  SendMessage(GetDlgItem(hwndDlg, 14000), EM_SETREADONLY, TRUE, 0);
422 
423  /* disk compression */
424  ShowWindow(GetDlgItem(hwndDlg, 14011), FALSE);
425 
426  /* index */
427  ShowWindow(GetDlgItem(hwndDlg, 14012), FALSE);
428  }
429 
431  if (hIcon)
432  SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
433  if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf)))
434  SetDlgItemTextW(hwndDlg, 14001, wszBuf);
435 
436  ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes;
437  if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL))
438  {
439  /* Init free space percentage used for drawing piechart */
440  m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart);
441 
442  /* Used space */
443  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
444  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
445 
446  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
447  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
448 
449  /* Free space */
450  if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
451  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
452 
453  if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
454  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
455 
456  /* Total space */
457  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
458  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
459 
460  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
461  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
462  }
463  else
464  {
465  m_FreeSpacePerc = 0;
466 
467  if (SH_FormatByteSize(0, wszBuf, _countof(wszBuf)))
468  {
469  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
470  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
471  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
472  }
473  if (StrFormatByteSizeW(0, wszBuf, _countof(wszBuf)))
474  {
475  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
476  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
477  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
478  }
479  }
480 
481  /* Set drive description */
482  WCHAR wszFormat[50];
483  GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat));
484  swprintf(wszBuf, wszFormat, m_wszDrive[0]);
485  SetDlgItemTextW(hwndDlg, 14009, wszBuf);
486 
487  /* show disk cleanup button only for fixed drives */
488  ShowWindow(GetDlgItem(hwndDlg, 14010), DriveType == DRIVE_FIXED);
489 }
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
#define STM_SETICON
Definition: winuser.h:2074
#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:2271
#define IDI_SHELL_DRIVE
Definition: shresdef.h:487
#define TRUE
Definition: types.h:120
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
UINT SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
Definition: filedefext.cpp:182
#define EM_SETREADONLY
Definition: winuser.h:1997
#define DRIVE_RAMDISK
Definition: winbase.h:252
#define IDI_SHELL_REMOVEABLE
Definition: shresdef.h:486
UINT DriveType
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_DRIVE_CDROM
Definition: shresdef.h:106
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
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
UINT m_FreeSpacePerc
Definition: drvdefext.h:40
#define IDI_SHELL_3_14_FLOPPY
Definition: shresdef.h:485
#define IDS_DRIVE_FIXED
Definition: shresdef.h:105
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:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
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
#define DRIVE_FIXED
Definition: winbase.h:249
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:107
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
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define IDI_SHELL_CDROM
Definition: shresdef.h:490
BOOL IsDriveFloppyW(LPCWSTR pszDriveRoot)
Definition: drvdefext.cpp:307
#define SendMessage
Definition: winuser.h:5818
#define IDI_SHELL_RAMDISK
Definition: shresdef.h:491
#define LoadImage
Definition: winuser.h:5790
#define IDI_SHELL_NETDRIVE
Definition: shresdef.h:488
#define IDS_FS_UNKNOWN
Definition: shresdef.h:110
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 678 of file drvdefext.cpp.

679 {
680  FORMATETC format;
681  STGMEDIUM stgm;
682  HRESULT hr;
683 
684  TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID);
685 
686  if (!pDataObj)
687  return E_FAIL;
688 
689  format.cfFormat = CF_HDROP;
690  format.ptd = NULL;
691  format.dwAspect = DVASPECT_CONTENT;
692  format.lindex = -1;
693  format.tymed = TYMED_HGLOBAL;
694 
695  hr = pDataObj->GetData(&format, &stgm);
696  if (FAILED(hr))
697  return hr;
698 
699  if (!DragQueryFileW((HDROP)stgm.hGlobal, 0, m_wszDrive, _countof(m_wszDrive)))
700  {
701  ERR("DragQueryFileW failed\n");
702  ReleaseStgMedium(&stgm);
703  return E_FAIL;
704  }
705 
706  ReleaseStgMedium(&stgm);
707  TRACE("Drive properties %ls\n", m_wszDrive);
708 
709  return S_OK;
710 }
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
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#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:59
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627

◆ InvokeCommand()

HRESULT WINAPI CDrvDefExt::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
virtual

Implements IContextMenu.

Definition at line 720 of file drvdefext.cpp.

721 {
723  return E_NOTIMPL;
724 }
#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 193 of file drvdefext.cpp.

194 {
195  HBRUSH hBrush;
196 
197  if (pDrawItem->CtlID == 14013)
198  {
199  hBrush = CreateSolidBrush(RGB(0, 0, 255));
200  if (hBrush)
201  {
202  FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
203  DeleteObject((HGDIOBJ)hBrush);
204  }
205  }
206  else if (pDrawItem->CtlID == 14014)
207  {
208  hBrush = CreateSolidBrush(RGB(255, 0, 255));
209  if (hBrush)
210  {
211  FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
212  DeleteObject((HGDIOBJ)hBrush);
213  }
214  }
215  else if (pDrawItem->CtlID == 14015)
216  {
217  HBRUSH hBlueBrush = CreateSolidBrush(RGB(0, 0, 255));
218  HBRUSH hMagBrush = CreateSolidBrush(RGB(255, 0, 255));
219  HBRUSH hbrOld;
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 
237  if (m_FreeSpacePerc < 50 && x == xRadial)
238  SelectObject(pDrawItem->hDC, hDarkBluePen);
239 
240  MoveToEx(pDrawItem->hDC, x, y, NULL);
241  LineTo(pDrawItem->hDC, x, y + 10);
242  }
243 
244  SelectObject(pDrawItem->hDC, hOldPen);
245 
246  if (m_FreeSpacePerc > 50)
247  {
248  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush);
249 
250  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
251  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
252 
253  SelectObject(pDrawItem->hDC, hBlueBrush);
254 
255  if (m_FreeSpacePerc < 100)
256  {
257  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
258  pDrawItem->rcItem.bottom - 10, xRadial, yRadial, pDrawItem->rcItem.left, yCenter);
259  }
260  }
261  else
262  {
263  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hBlueBrush);
264 
265  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
266  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
267 
268  SelectObject(pDrawItem->hDC, hMagBrush);
269 
270  if (m_FreeSpacePerc > 0)
271  {
272  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
273  pDrawItem->rcItem.bottom - 10, pDrawItem->rcItem.left, yCenter, xRadial, yRadial);
274  }
275  }
276 
277  SelectObject(pDrawItem->hDC, hbrOld);
278 
279  DeleteObject(hBlueBrush);
280  DeleteObject(hMagBrush);
281  DeleteObject(hDarkBluePen);
282  DeleteObject(hDarkMagPen);
283  }
284 }
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:1497
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:57
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:585
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
smooth NULL
Definition: ftsmooth.c:416
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)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define M_PI
Definition: macros.h:263
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581
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 713 of file drvdefext.cpp.

714 {
716  return E_NOTIMPL;
717 }
#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 769 of file drvdefext.cpp.

770 {
772  return E_NOTIMPL;
773 }
#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 776 of file drvdefext.cpp.

777 {
779  return E_NOTIMPL;
780 }
#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: