ReactOS  0.4.15-dev-1177-g6cb3b62
recycler_prop.cpp File Reference
#include <precomp.h>
Include dependency graph for recycler_prop.cpp:

Go to the source code of this file.

Classes

struct  DRIVE_ITEM_CONTEXT
 

Typedefs

typedef struct DRIVE_ITEM_CONTEXTPDRIVE_ITEM_CONTEXT
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (CRecycleBin)
 
static void toggleNukeOnDeleteOption (HWND hwndDlg, BOOL bEnable)
 
static VOID InitializeRecycleBinDlg (HWND hwndDlg, WCHAR DefaultDrive)
 
static BOOL StoreDriveSettings (HWND hwndDlg)
 
static VOID FreeDriveItemContext (HWND hwndDlg)
 
static INT GetDefaultItem (HWND hwndDlg, LVITEMW *li)
 
static INT_PTR CALLBACK RecycleBinDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL SH_ShowRecycleBinProperties (WCHAR sDrive)
 

Typedef Documentation

◆ PDRIVE_ITEM_CONTEXT

Function Documentation

◆ FreeDriveItemContext()

static VOID FreeDriveItemContext ( HWND  hwndDlg)
static

Definition at line 221 of file recycler_prop.cpp.

222 {
223  int iCount, iIndex;
224  HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000);
225  LVITEMW li;
226 
227  iCount = ListView_GetItemCount(hDlgCtrl);
228 
229  ZeroMemory(&li, sizeof(li));
230  li.mask = LVIF_PARAM;
231 
232  for (iIndex = 0; iIndex < iCount; iIndex++)
233  {
234  li.iItem = iIndex;
235  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
236  {
237  HeapFree(GetProcessHeap(), 0, (PVOID)li.lParam);
238  }
239  }
240 }
#define ZeroMemory
Definition: winbase.h:1648
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
#define GetProcessHeap()
Definition: compat.h:484
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by RecycleBinDlg().

◆ GetDefaultItem()

static INT GetDefaultItem ( HWND  hwndDlg,
LVITEMW li 
)
static

Definition at line 243 of file recycler_prop.cpp.

244 {
245  HWND hDlgCtrl;
246  UINT iItemCount, iIndex;
247 
248  hDlgCtrl = GetDlgItem(hwndDlg, 14000);
249  if (!hDlgCtrl)
250  return -1;
251 
252  iItemCount = ListView_GetItemCount(hDlgCtrl);
253  if (!iItemCount)
254  return -1;
255 
256  ZeroMemory(li, sizeof(LVITEMW));
257  li->mask = LVIF_PARAM | LVIF_STATE;
258  li->stateMask = (UINT)-1;
259  for (iIndex = 0; iIndex < iItemCount; iIndex++)
260  {
261  li->iItem = iIndex;
262  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)li))
263  {
264  if (li->state & LVIS_SELECTED)
265  return iIndex;
266  }
267  }
268  return -1;
269 }
#define ZeroMemory
Definition: winbase.h:1648
UINT stateMask
Definition: commctrl.h:2360
#define LVIS_SELECTED
Definition: commctrl.h:2315
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307
#define LVIF_STATE
Definition: commctrl.h:2308

Referenced by RecycleBinDlg().

◆ InitializeRecycleBinDlg()

static VOID InitializeRecycleBinDlg ( HWND  hwndDlg,
WCHAR  DefaultDrive 
)
static

Definition at line 51 of file recycler_prop.cpp.

52 {
53  WCHAR szDrive[] = L"A:\\";
54  DWORD dwDrives;
55  WCHAR szName[100];
56  WCHAR szVolume[100];
57  DWORD MaxComponent, Flags;
58  DWORD dwSerial;
59  LVCOLUMNW lc;
60  HWND hDlgCtrl;
61  LVITEMW li;
62  INT itemCount;
63  ULARGE_INTEGER TotalNumberOfFreeBytes, TotalNumberOfBytes, FreeBytesAvailable;
64  RECT rect;
65  int columnSize;
66  int defIndex = 0;
67  DWORD dwSize;
68  PDRIVE_ITEM_CONTEXT pItem = NULL, pDefault = NULL, pFirst = NULL;
69 
70  hDlgCtrl = GetDlgItem(hwndDlg, 14000);
71 
73  szVolume[0] = 0;
74 
75  GetClientRect(hDlgCtrl, &rect);
76 
77  ZeroMemory(&lc, sizeof(lc));
79 
80  columnSize = 140; //FIXME
81  lc.iSubItem = 0;
82  lc.fmt = LVCFMT_FIXED_WIDTH;
83  lc.cx = columnSize;
84  lc.cchTextMax = wcslen(szVolume);
85  lc.pszText = szVolume;
86  (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, 0, (LPARAM)&lc);
87 
89  szVolume[0] = 0;
90 
91  lc.iSubItem = 1;
92  lc.cx = rect.right - rect.left - columnSize;
93  lc.cchTextMax = wcslen(szVolume);
94  lc.pszText = szVolume;
95  (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, 1, (LPARAM)&lc);
96 
97  dwDrives = GetLogicalDrives();
98  itemCount = 0;
99  do
100  {
101  if (dwDrives & 0x1)
102  {
103  UINT Type = GetDriveTypeW(szDrive);
104  if (Type == DRIVE_FIXED) //FIXME
105  {
106  if (!GetVolumeInformationW(szDrive, szName, _countof(szName), &dwSerial, &MaxComponent, &Flags, NULL, 0))
107  {
108  szName[0] = 0;
109  dwSerial = -1;
110  }
111 
112  swprintf(szVolume, L"%s (%c:)", szName, szDrive[0]);
113  ZeroMemory(&li, sizeof(li));
114  li.mask = LVIF_TEXT | LVIF_PARAM;
115  li.iSubItem = 0;
116  li.pszText = szVolume;
117  li.iItem = itemCount;
118  SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
119  if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
120  {
121  if (StrFormatByteSizeW(TotalNumberOfFreeBytes.QuadPart, szVolume, _countof(szVolume)))
122  {
124  if (pItem)
125  {
126  pItem->FreeBytesAvailable = FreeBytesAvailable;
127  pItem->dwSerial = dwSerial;
128 
129  swprintf(szName, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket\\Volume\\%04X-%04X", LOWORD(dwSerial), HIWORD(dwSerial));
130 
131  dwSize = sizeof(DWORD);
133 
134  /* Check if the maximum capacity doesn't exceed the available disk space (in megabytes), and truncate it if needed */
135  FreeBytesAvailable.QuadPart = (FreeBytesAvailable.QuadPart / (1024 * 1024));
136  pItem->dwMaxCapacity = min(pItem->dwMaxCapacity, FreeBytesAvailable.LowPart);
137 
138  dwSize = sizeof(DWORD);
140 
141  li.mask = LVIF_PARAM;
142  li.lParam = (LPARAM)pItem;
143  (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
144  if (szDrive[0] == DefaultDrive)
145  {
146  defIndex = itemCount;
147  pDefault = pItem;
148  }
149  }
150  if (!pFirst)
151  pFirst = pItem;
152 
153  li.mask = LVIF_TEXT;
154  li.iSubItem = 1;
155  li.pszText = szVolume;
156  li.iItem = itemCount;
157  (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
158  }
159  }
160  itemCount++;
161  }
162  }
163  szDrive[0]++;
164  dwDrives = (dwDrives >> 1);
165  } while (dwDrives);
166 
167  if (!pDefault)
168  pDefault = pFirst;
169  if (pDefault)
170  {
171  toggleNukeOnDeleteOption(hwndDlg, pDefault->dwNukeOnDelete);
172  SetDlgItemInt(hwndDlg, 14002, pDefault->dwMaxCapacity, FALSE);
173  }
174  ZeroMemory(&li, sizeof(li));
175  li.mask = LVIF_STATE;
176  li.stateMask = (UINT)-1;
178  li.iItem = defIndex;
179  (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
180 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
Type
Definition: Type.h:6
#define LVCF_TEXT
Definition: commctrl.h:2584
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define ZeroMemory
Definition: winbase.h:1648
$ULONG LowPart
Definition: ntbasedef.h:570
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
UINT stateMask
Definition: commctrl.h:2360
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
int iSubItem
Definition: commctrl.h:2358
LPARAM lParam
Definition: commctrl.h:2364
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2315
LONG_PTR LPARAM
Definition: windef.h:208
#define RRF_RT_DWORD
Definition: driver.c:581
#define IDS_RECYCLEBIN_LOCATION
Definition: shresdef.h:135
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
LPWSTR pszText
Definition: commctrl.h:2361
#define swprintf(buf, format,...)
Definition: sprintf.c:56
LPWSTR pszText
Definition: commctrl.h:2563
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2356
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static const WCHAR L[]
Definition: oid.c:1250
static void toggleNukeOnDeleteOption(HWND hwndDlg, BOOL bEnable)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
UINT state
Definition: commctrl.h:2359
#define DRIVE_FIXED
Definition: winbase.h:249
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
int cchTextMax
Definition: commctrl.h:2564
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
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
#define LVCF_FMT
Definition: commctrl.h:2582
#define shell32_hInstance
ULARGE_INTEGER FreeBytesAvailable
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define IDS_RECYCLEBIN_DISKSPACE
Definition: shresdef.h:136
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define LVM_SETITEMW
Definition: commctrl.h:2393
static const WCHAR szName[]
Definition: msipriv.h:1194
#define LVIF_PARAM
Definition: commctrl.h:2307
#define HIWORD(l)
Definition: typedefs.h:247
#define LVIF_STATE
Definition: commctrl.h:2308
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define LVIS_FOCUSED
Definition: commctrl.h:2314
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342

Referenced by RecycleBinDlg().

◆ RecycleBinDlg()

static INT_PTR CALLBACK RecycleBinDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 272 of file recycler_prop.cpp.

277 {
278  LPPSHNOTIFY lppsn;
279  LPNMLISTVIEW lppl;
280  LVITEMW li;
281  PDRIVE_ITEM_CONTEXT pItem;
282  BOOL bSuccess;
283  UINT uResult;
285  DWORD dwStyle;
286  ULARGE_INTEGER FreeBytesAvailable;
287 
288  switch(uMsg)
289  {
290  case WM_INITDIALOG:
292  InitializeRecycleBinDlg(hwndDlg, (WCHAR)page->lParam);
293  dwStyle = (DWORD) SendDlgItemMessage(hwndDlg, 14000, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
294  dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
295  SendDlgItemMessage(hwndDlg, 14000, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
296  if (GetDlgCtrlID((HWND)wParam) != 14000)
297  {
298  SetFocus(GetDlgItem(hwndDlg, 14000));
299  return FALSE;
300  }
301  return TRUE;
302  case WM_COMMAND:
303  switch(LOWORD(wParam))
304  {
305  case 14001:
307  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
308  break;
309  case 14002:
310  if (HIWORD(wParam) == EN_CHANGE)
311  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
312  break;
313  case 14003:
314  toggleNukeOnDeleteOption(hwndDlg, TRUE);
315  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
316  break;
317  case 14004:
318  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
319  break;
320  }
321  break;
322  case WM_NOTIFY:
323  lppsn = (LPPSHNOTIFY) lParam;
324  lppl = (LPNMLISTVIEW) lParam;
325  if (lppsn->hdr.code == PSN_APPLY)
326  {
327  if (GetDefaultItem(hwndDlg, &li) > -1)
328  {
329  pItem = (PDRIVE_ITEM_CONTEXT)li.lParam;
330  if (pItem)
331  {
332  uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE);
333  if (bSuccess)
334  {
335  /* Check if the maximum capacity doesn't exceed the available disk space (in megabytes), and truncate it if needed */
336  FreeBytesAvailable = pItem->FreeBytesAvailable;
337  FreeBytesAvailable.QuadPart = (FreeBytesAvailable.QuadPart / (1024 * 1024));
338  pItem->dwMaxCapacity = min(uResult, FreeBytesAvailable.LowPart);
339  SetDlgItemInt(hwndDlg, 14002, pItem->dwMaxCapacity, FALSE);
340  }
341  if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED)
342  pItem->dwNukeOnDelete = TRUE;
343  else
344  pItem->dwNukeOnDelete = FALSE;
345  }
346  }
347  if (StoreDriveSettings(hwndDlg))
348  {
350  return TRUE;
351  }
352  }
353  else if (lppl->hdr.code == LVN_ITEMCHANGING)
354  {
355  ZeroMemory(&li, sizeof(li));
356  li.mask = LVIF_PARAM;
357  li.iItem = lppl->iItem;
358  if (!SendMessageW(lppl->hdr.hwndFrom, LVM_GETITEMW, 0, (LPARAM)&li))
359  return TRUE;
360 
361  pItem = (PDRIVE_ITEM_CONTEXT)li.lParam;
362  if (!pItem)
363  return TRUE;
364 
365  if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED))
366  {
367  /* new focused item */
369  SetDlgItemInt(hwndDlg, 14002, pItem->dwMaxCapacity, FALSE);
370  }
371  else if ((lppl->uOldState & LVIS_FOCUSED) && !(lppl->uNewState & LVIS_FOCUSED))
372  {
373  /* kill focus */
374  uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE);
375  if (bSuccess)
376  {
377  /* Check if the maximum capacity doesn't exceed the available disk space (in megabytes), and truncate it if needed */
378  FreeBytesAvailable = pItem->FreeBytesAvailable;
379  FreeBytesAvailable.QuadPart = (FreeBytesAvailable.QuadPart / (1024 * 1024));
380  pItem->dwMaxCapacity = min(uResult, FreeBytesAvailable.LowPart);
381  SetDlgItemInt(hwndDlg, 14002, pItem->dwMaxCapacity, FALSE);
382  }
383  if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED)
384  pItem->dwNukeOnDelete = TRUE;
385  else
386  pItem->dwNukeOnDelete = FALSE;
387  }
388  return TRUE;
389 
390  }
391  break;
392  case WM_DESTROY:
393  FreeDriveItemContext(hwndDlg);
394  break;
395  }
396  return FALSE;
397 }
UINT uNewState
Definition: commctrl.h:3032
struct _PSHNOTIFY * LPPSHNOTIFY
#define TRUE
Definition: types.h:120
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2730
#define ZeroMemory
Definition: winbase.h:1648
$ULONG LowPart
Definition: ntbasedef.h:570
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendDlgItemMessage
Definition: winuser.h:5817
#define PSN_APPLY
Definition: prsht.h:117
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define SetWindowLongPtr
Definition: treelist.c:70
static BOOL StoreDriveSettings(HWND hwndDlg)
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define LVN_ITEMCHANGING
Definition: commctrl.h:3126
UINT code
Definition: winuser.h:3134
int WINAPI GetDlgCtrlID(_In_ HWND)
NMHDR hdr
Definition: prsht.h:330
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static INT GetDefaultItem(HWND hwndDlg, LVITEMW *li)
LPARAM lParam
Definition: commctrl.h:2364
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
UINT uOldState
Definition: commctrl.h:3033
LONG_PTR LPARAM
Definition: windef.h:208
Definition: module.h:566
#define BM_GETCHECK
Definition: winuser.h:1900
#define WM_DESTROY
Definition: winuser.h:1591
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
struct DRIVE_ITEM_CONTEXT * PDRIVE_ITEM_CONTEXT
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2720
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2356
#define PSNRET_NOERROR
Definition: prsht.h:129
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static void toggleNukeOnDeleteOption(HWND hwndDlg, BOOL bEnable)
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3132
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2723
HWND WINAPI GetParent(_In_ HWND)
static VOID FreeDriveItemContext(HWND hwndDlg)
ULARGE_INTEGER FreeBytesAvailable
struct tagNMLISTVIEW * LPNMLISTVIEW
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define min(a, b)
Definition: monoChain.cc:55
static VOID InitializeRecycleBinDlg(HWND hwndDlg, WCHAR DefaultDrive)
unsigned int UINT
Definition: ndis.h:50
#define BST_CHECKED
Definition: winuser.h:197
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define LVIS_FOCUSED
Definition: commctrl.h:2314
#define PROPSHEETPAGE
Definition: prsht.h:389
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by SH_ShowRecycleBinProperties().

◆ SH_ShowRecycleBinProperties()

BOOL SH_ShowRecycleBinProperties ( WCHAR  sDrive)

Definition at line 399 of file recycler_prop.cpp.

400 {
401  HPROPSHEETPAGE hpsp[1];
402  PROPSHEETHEADERW psh;
403  HPROPSHEETPAGE hprop;
404  INT_PTR ret;
405 
406  ZeroMemory(&psh, sizeof(psh));
407  psh.dwSize = sizeof(psh);
410  psh.hwndParent = NULL;
411  psh.phpage = hpsp;
413 
415  if (!hprop)
416  {
417  ERR("Failed to create property sheet\n");
418  return FALSE;
419  }
420  hpsp[psh.nPages] = hprop;
421  psh.nPages++;
422 
423  ret = PropertySheetW(&psh);
424  return (ret >= 0);
425 }
HWND hwndParent
Definition: prsht.h:295
#define IDS_RECYCLEBIN_FOLDER_NAME
Definition: shresdef.h:245
#define ZeroMemory
Definition: winbase.h:1648
int32_t INT_PTR
Definition: typedefs.h:64
#define FALSE
Definition: types.h:117
LPCWSTR pszCaption
Definition: prsht.h:301
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
#define IDD_RECYCLE_BIN_PROPERTIES
Definition: shresdef.h:351
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSH_PROPTITLE
Definition: prsht.h:40
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
int ret
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
#define ERR(fmt,...)
Definition: debug.h:110
#define shell32_hInstance
static INT_PTR CALLBACK RecycleBinDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HPROPSHEETPAGE SH_CreatePropertySheetPage(LPCSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)

Referenced by RegFolderContextMenuCallback().

◆ StoreDriveSettings()

static BOOL StoreDriveSettings ( HWND  hwndDlg)
static

Definition at line 182 of file recycler_prop.cpp.

183 {
184  int iCount, iIndex;
185  HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000);
186  LVITEMW li;
187  PDRIVE_ITEM_CONTEXT pItem;
188  HKEY hKey, hSubKey;
189  WCHAR szSerial[20];
190  DWORD dwSize;
191 
192  if (RegCreateKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket\\Volume", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
193  return FALSE;
194 
195  iCount = ListView_GetItemCount(hDlgCtrl);
196 
197  ZeroMemory(&li, sizeof(li));
198  li.mask = LVIF_PARAM;
199 
200  for (iIndex = 0; iIndex < iCount; iIndex++)
201  {
202  li.iItem = iIndex;
203  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
204  {
205  pItem = (PDRIVE_ITEM_CONTEXT)li.lParam;
206  swprintf(szSerial, L"%04X-%04X", LOWORD(pItem->dwSerial), HIWORD(pItem->dwSerial));
207  if (RegCreateKeyExW(hKey, szSerial, 0, NULL, 0, KEY_WRITE, NULL, &hSubKey, NULL) == ERROR_SUCCESS)
208  {
209  dwSize = sizeof(DWORD);
210  RegSetValueExW(hSubKey, L"MaxCapacity", 0, REG_DWORD, (LPBYTE)&pItem->dwMaxCapacity, dwSize);
211  dwSize = sizeof(DWORD);
212  RegSetValueExW(hSubKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&pItem->dwNukeOnDelete, dwSize);
213  RegCloseKey(hSubKey);
214  }
215  }
216  }
217  RegCloseKey(hKey);
218  return TRUE;
219 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define ZeroMemory
Definition: winbase.h:1648
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
struct DRIVE_ITEM_CONTEXT * PDRIVE_ITEM_CONTEXT
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2356
static const WCHAR L[]
Definition: oid.c:1250
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307
#define HIWORD(l)
Definition: typedefs.h:247
#define REG_DWORD
Definition: sdbapi.c:596
#define LOWORD(l)
Definition: pedump.c:82
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by RecycleBinDlg().

◆ toggleNukeOnDeleteOption()

static void toggleNukeOnDeleteOption ( HWND  hwndDlg,
BOOL  bEnable 
)
static

Definition at line 34 of file recycler_prop.cpp.

35 {
36  if (bEnable)
37  {
38  SendDlgItemMessage(hwndDlg, 14001, BM_SETCHECK, BST_UNCHECKED, 0);
39  EnableWindow(GetDlgItem(hwndDlg, 14002), FALSE);
40  SendDlgItemMessage(hwndDlg, 14003, BM_SETCHECK, BST_CHECKED, 0);
41  }
42  else
43  {
44  SendDlgItemMessage(hwndDlg, 14001, BM_SETCHECK, BST_CHECKED, 0);
45  EnableWindow(GetDlgItem(hwndDlg, 14002), TRUE);
46  SendDlgItemMessage(hwndDlg, 14003, BM_SETCHECK, BST_UNCHECKED, 0);
47  }
48 }
#define TRUE
Definition: types.h:120
#define SendDlgItemMessage
Definition: winuser.h:5817
#define FALSE
Definition: types.h:117
#define BM_SETCHECK
Definition: winuser.h:1903
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
_In_ BOOL bEnable
Definition: winddi.h:3426
#define BST_CHECKED
Definition: winuser.h:197

Referenced by InitializeRecycleBinDlg(), and RecycleBinDlg().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( CRecycleBin  )