ReactOS  0.4.14-dev-323-g6fe6a88
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 563 of file drvdefext.cpp.

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

◆ ~CDrvDefExt()

CDrvDefExt::~CDrvDefExt ( )

Definition at line 568 of file drvdefext.cpp.

569 {
570 
571 }

Member Function Documentation

◆ AddPages()

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

Definition at line 630 of file drvdefext.cpp.

631 {
632  HPROPSHEETPAGE hPage;
633 
636  (LPARAM)this,
637  NULL);
638  if (hPage)
639  pfnAddPage(hPage, lParam);
640 
642  {
645  (LPARAM)this,
646  NULL);
647  if (hPage)
648  pfnAddPage(hPage, lParam);
649  }
650 
652  {
655  (LPARAM)this,
656  NULL);
657  if (hPage)
658  pfnAddPage(hPage, lParam);
659  }
660 
661  return S_OK;
662 }
static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:477
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drvdefext.cpp:388
#define IDD_DRIVE_PROPERTIES
Definition: shresdef.h:326
#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:328
#define IDD_DRIVE_TOOLS
Definition: shresdef.h:327
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:539

◆ ExtraPageProc()

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

Definition at line 477 of file drvdefext.cpp.

482 {
483  switch (uMsg)
484  {
485  case WM_INITDIALOG:
486  {
488  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam);
489  return TRUE;
490  }
491  case WM_COMMAND:
492  {
493  WCHAR wszBuf[MAX_PATH];
494  DWORD cbBuf = sizeof(wszBuf);
495  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
496 
497  switch(LOWORD(wParam))
498  {
499  case 14000:
501  break;
502  case 14001:
504  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\DefragPath",
505  NULL,
507  NULL,
508  (PVOID)wszBuf,
509  &cbBuf) == ERROR_SUCCESS)
510  {
511  WCHAR wszCmd[MAX_PATH];
512 
513  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
514 
515  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
516  ERR("Failed to create defrag process %ls\n", wszCmd);
517  }
518  break;
519  case 14002:
521  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\BackupPath",
522  NULL,
524  NULL,
525  (PVOID)wszBuf,
526  &cbBuf) == ERROR_SUCCESS)
527  {
528  if (ShellExecuteW(hwndDlg, NULL, wszBuf, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
529  ERR("Failed to create backup process %ls\n", wszBuf);
530  }
531  }
532  break;
533  }
534  }
535  return FALSE;
536 }
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:156
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:218
#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:109
#define IDD_CHECK_DISK
Definition: shresdef.h:442
__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:2246
#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 388 of file drvdefext.cpp.

393 {
394  switch(uMsg)
395  {
396  case WM_INITDIALOG:
397  {
399  if (ppsp == NULL)
400  break;
401 
402  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
403  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
404  pDrvDefExt->InitGeneralPage(hwndDlg);
405  return TRUE;
406  }
407  case WM_DRAWITEM:
408  {
410 
411  if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
412  {
413  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
414  pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
415  return TRUE;
416  }
417  break;
418  }
419  case WM_PAINT:
420  break;
421  case WM_COMMAND:
422  if (LOWORD(wParam) == 14010) /* Disk Cleanup */
423  {
424  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
425  WCHAR wszBuf[256];
426  DWORD cbBuf = sizeof(wszBuf);
427 
429  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\CleanupPath",
430  NULL,
432  NULL,
433  (PVOID)wszBuf,
434  &cbBuf) == ERROR_SUCCESS)
435  {
436  WCHAR wszCmd[MAX_PATH];
437 
438  StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]);
439 
440  if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32)
441  ERR("Failed to create cleanup process %ls\n", wszCmd);
442  }
443  }
444  else if (LOWORD(wParam) == 14000) /* Label */
445  {
446  if (HIWORD(wParam) == EN_CHANGE)
447  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
448  }
449  break;
450  case WM_NOTIFY:
451  if (((LPNMHDR)lParam)->hwndFrom == GetParent(hwndDlg))
452  {
453  /* Property Sheet */
454  LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
455 
456  if (lppsn->hdr.code == PSN_APPLY)
457  {
458  CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
459  WCHAR wszBuf[256];
460 
461  if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf)))
462  SetVolumeLabelW(pDrvDefExt->m_wszDrive, wszBuf);
464  return TRUE;
465  }
466  }
467  break;
468 
469  default:
470  break;
471  }
472 
473  return FALSE;
474 }
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:2208
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
struct _PSHNOTIFY * LPPSHNOTIFY
#define _countof(array)
Definition: fontsub.cpp:30
#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:3133
NMHDR hdr
Definition: prsht.h:312
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:282
VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
Definition: drvdefext.cpp:188
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
#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:218
#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:109
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:2246
#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 623 of file drvdefext.cpp.

624 {
626  return E_NOTIMPL;
627 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ GetSite()

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

Definition at line 679 of file drvdefext.cpp.

680 {
682  return E_NOTIMPL;
683 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HardwarePageProc()

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

Definition at line 539 of file drvdefext.cpp.

544 {
547 
548  switch(uMsg)
549  {
550  case WM_INITDIALOG:
551  {
553 
554  /* create the hardware page */
556  break;
557  }
558  }
559 
560  return FALSE;
561 }
#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:29
#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 282 of file drvdefext.cpp.

283 {
284  WCHAR wszVolumeName[MAX_PATH+1] = {0};
285  WCHAR wszFileSystem[MAX_PATH+1] = {0};
286  WCHAR wszBuf[128];
287  BOOL bRet;
288 
289  bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem));
290  if (bRet)
291  {
292  /* Set volume label and filesystem */
293  SetDlgItemTextW(hwndDlg, 14000, wszVolumeName);
294  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
295  }
296  else
297  {
298  LoadStringW(shell32_hInstance, IDS_FS_UNKNOWN, wszFileSystem, _countof(wszFileSystem));
299  SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
300  }
301 
302  /* Set drive type and icon */
304  UINT IconId, TypeStrId = 0;
305  switch (DriveType)
306  {
307  case DRIVE_REMOVABLE: IconId = IDI_SHELL_3_14_FLOPPY; break;
308  case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break;
309  case DRIVE_REMOTE: IconId = IDI_SHELL_NETDRIVE; TypeStrId = IDS_DRIVE_NETWORK; break;
310  case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
311  default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED;
312  }
313 
315  {
316  /* volume label textbox */
317  SendMessage(GetDlgItem(hwndDlg, 14000), EM_SETREADONLY, TRUE, 0);
318 
319  /* disk compression */
320  ShowWindow(GetDlgItem(hwndDlg, 14011), FALSE);
321 
322  /* index */
323  ShowWindow(GetDlgItem(hwndDlg, 14012), FALSE);
324  }
325 
327  if (hIcon)
328  SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
329  if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf)))
330  SetDlgItemTextW(hwndDlg, 14001, wszBuf);
331 
332  ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes;
333  if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL))
334  {
335  /* Init free space percentage used for drawing piechart */
336  m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart);
337 
338  /* Used space */
339  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
340  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
341 
342  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
343  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
344 
345  /* Free space */
346  if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
347  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
348 
349  if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
350  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
351 
352  /* Total space */
353  if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
354  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
355 
356  if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
357  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
358  }
359  else
360  {
361  m_FreeSpacePerc = 0;
362 
363  if (SH_FormatByteSize(0, wszBuf, _countof(wszBuf)))
364  {
365  SetDlgItemTextW(hwndDlg, 14003, wszBuf);
366  SetDlgItemTextW(hwndDlg, 14005, wszBuf);
367  SetDlgItemTextW(hwndDlg, 14007, wszBuf);
368  }
369  if (StrFormatByteSizeW(0, wszBuf, _countof(wszBuf)))
370  {
371  SetDlgItemTextW(hwndDlg, 14004, wszBuf);
372  SetDlgItemTextW(hwndDlg, 14006, wszBuf);
373  SetDlgItemTextW(hwndDlg, 14008, wszBuf);
374  }
375  }
376 
377  /* Set drive description */
378  WCHAR wszFormat[50];
379  GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat));
380  swprintf(wszBuf, wszFormat, m_wszDrive[0]);
381  SetDlgItemTextW(hwndDlg, 14009, wszBuf);
382 
383  /* show disk cleanup button only for fixed drives */
384  ShowWindow(GetDlgItem(hwndDlg, 14010), DriveType == DRIVE_FIXED);
385 }
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:2208
#define IDI_SHELL_DRIVE
Definition: shresdef.h:476
#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 _countof(array)
Definition: fontsub.cpp:30
#define DRIVE_RAMDISK
Definition: winbase.h:252
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
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:474
#define IDS_DRIVE_FIXED
Definition: shresdef.h:105
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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
#define DRIVE_CDROM
Definition: winbase.h:251
unsigned int UINT
Definition: ndis.h:50
#define IDI_SHELL_CDROM
Definition: shresdef.h:479
#define SendMessage
Definition: winuser.h:5744
#define IDI_SHELL_RAMDISK
Definition: shresdef.h:480
#define LoadImage
Definition: winuser.h:5716
#define IDI_SHELL_NETDRIVE
Definition: shresdef.h:477
#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 574 of file drvdefext.cpp.

575 {
576  FORMATETC format;
577  STGMEDIUM stgm;
578  HRESULT hr;
579 
580  TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID);
581 
582  if (!pDataObj)
583  return E_FAIL;
584 
585  format.cfFormat = CF_HDROP;
586  format.ptd = NULL;
587  format.dwAspect = DVASPECT_CONTENT;
588  format.lindex = -1;
589  format.tymed = TYMED_HGLOBAL;
590 
591  hr = pDataObj->GetData(&format, &stgm);
592  if (FAILED(hr))
593  return hr;
594 
595  if (!DragQueryFileW((HDROP)stgm.hGlobal, 0, m_wszDrive, _countof(m_wszDrive)))
596  {
597  ERR("DragQueryFileW failed\n");
598  ReleaseStgMedium(&stgm);
599  return E_FAIL;
600  }
601 
602  ReleaseStgMedium(&stgm);
603  TRACE("Drive properties %ls\n", m_wszDrive);
604 
605  return S_OK;
606 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define _countof(array)
Definition: fontsub.cpp:30
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:77
WCHAR m_wszDrive[MAX_PATH]
Definition: drvdefext.h:39
#define ERR(fmt,...)
Definition: debug.h:109
#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 616 of file drvdefext.cpp.

617 {
619  return E_NOTIMPL;
620 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ PaintStaticControls()

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

Definition at line 188 of file drvdefext.cpp.

189 {
190  HBRUSH hBrush;
191 
192  if (pDrawItem->CtlID == 14013)
193  {
194  hBrush = CreateSolidBrush(RGB(0, 0, 255));
195  if (hBrush)
196  {
197  FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
198  DeleteObject((HGDIOBJ)hBrush);
199  }
200  }
201  else if (pDrawItem->CtlID == 14014)
202  {
203  hBrush = CreateSolidBrush(RGB(255, 0, 255));
204  if (hBrush)
205  {
206  FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush);
207  DeleteObject((HGDIOBJ)hBrush);
208  }
209  }
210  else if (pDrawItem->CtlID == 14015)
211  {
212  HBRUSH hBlueBrush = CreateSolidBrush(RGB(0, 0, 255));
213  HBRUSH hMagBrush = CreateSolidBrush(RGB(255, 0, 255));
214  HBRUSH hbrOld;
215  HPEN hDarkBluePen = CreatePen(PS_SOLID, 1, RGB(0, 0, 128));
216  HPEN hDarkMagPen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128));
217  HPEN hOldPen = (HPEN)SelectObject(pDrawItem->hDC, hDarkMagPen);
218  INT xCenter = (pDrawItem->rcItem.left + pDrawItem->rcItem.right) / 2;
219  INT yCenter = (pDrawItem->rcItem.top + pDrawItem->rcItem.bottom - 10) / 2;
220  INT cx = pDrawItem->rcItem.right - pDrawItem->rcItem.left;
221  INT cy = pDrawItem->rcItem.bottom - pDrawItem->rcItem.top - 10;
222  INT xRadial = xCenter + (INT)(cos(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cx / 2);
223  INT yRadial = yCenter - (INT)(sin(M_PI + m_FreeSpacePerc / 100.0f * M_PI * 2.0f) * cy / 2);
224 
225  TRACE("FreeSpace %u a %f cx %d\n", m_FreeSpacePerc, M_PI+m_FreeSpacePerc / 100.0f * M_PI * 2.0f, cx);
226 
227  for (INT x = pDrawItem->rcItem.left; x < pDrawItem->rcItem.right; ++x)
228  {
229  double cos_val = (x - xCenter) * 2.0f / cx;
230  INT y = yCenter + (INT)(sin(acos(cos_val)) * cy / 2) - 1;
231 
232  if (m_FreeSpacePerc < 50 && x == xRadial)
233  SelectObject(pDrawItem->hDC, hDarkBluePen);
234 
235  MoveToEx(pDrawItem->hDC, x, y, NULL);
236  LineTo(pDrawItem->hDC, x, y + 10);
237  }
238 
239  SelectObject(pDrawItem->hDC, hOldPen);
240 
241  if (m_FreeSpacePerc > 50)
242  {
243  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush);
244 
245  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
246  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
247 
248  SelectObject(pDrawItem->hDC, hBlueBrush);
249 
250  if (m_FreeSpacePerc < 100)
251  {
252  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
253  pDrawItem->rcItem.bottom - 10, xRadial, yRadial, pDrawItem->rcItem.left, yCenter);
254  }
255  }
256  else
257  {
258  hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hBlueBrush);
259 
260  Ellipse(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top,
261  pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10);
262 
263  SelectObject(pDrawItem->hDC, hMagBrush);
264 
265  if (m_FreeSpacePerc > 0)
266  {
267  Pie(pDrawItem->hDC, pDrawItem->rcItem.left, pDrawItem->rcItem.top, pDrawItem->rcItem.right,
268  pDrawItem->rcItem.bottom - 10, pDrawItem->rcItem.left, yCenter, xRadial, yRadial);
269  }
270  }
271 
272  SelectObject(pDrawItem->hDC, hbrOld);
273 
274  DeleteObject(hBlueBrush);
275  DeleteObject(hMagBrush);
276  DeleteObject(hDarkBluePen);
277  DeleteObject(hDarkMagPen);
278  }
279 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define INT
Definition: polytest.cpp:20
LONG top
Definition: windef.h:292
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:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
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)
#define RGB(r, g, b)
Definition: wingdi.h:2935
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:294
_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 609 of file drvdefext.cpp.

610 {
612  return E_NOTIMPL;
613 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ ReplacePage()

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

Definition at line 665 of file drvdefext.cpp.

666 {
668  return E_NOTIMPL;
669 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ SetSite()

HRESULT WINAPI CDrvDefExt::SetSite ( IUnknown punk)
virtual

Implements IObjectWithSite.

Definition at line 672 of file drvdefext.cpp.

673 {
675  return E_NOTIMPL;
676 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

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: