ReactOS  0.4.15-dev-1148-g8a4273b
volpropsheet.cpp
Go to the documentation of this file.
1 /* Copyright (c) Mark Harmstone 2016-17
2  *
3  * This file is part of WinBtrfs.
4  *
5  * WinBtrfs is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public Licence as published by
7  * the Free Software Foundation, either version 3 of the Licence, or
8  * (at your option) any later version.
9  *
10  * WinBtrfs is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public Licence for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public Licence
16  * along with WinBtrfs. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #define ISOLATION_AWARE_ENABLED 1
19 #define STRSAFE_NO_DEPRECATE
20 
21 #include "shellext.h"
22 #ifndef __REACTOS__
23 #include <windows.h>
24 #include <strsafe.h>
25 #include <winternl.h>
26 #else
27 #define WIN32_NO_STATUS
28 #include <windef.h>
29 #include <winbase.h>
30 #include <strsafe.h>
31 #include <ndk/iofuncs.h>
32 #include <ndk/iotypes.h>
33 #endif
34 
35 #define NO_SHLWAPI_STRFCNS
36 #include <shlwapi.h>
37 #include <uxtheme.h>
38 
39 #include "volpropsheet.h"
40 #include "resource.h"
41 #ifndef __REACTOS__
42 #include "mountmgr.h"
43 #else
44 #include "mountmgr_local.h"
45 #endif
46 
47 #ifndef __REACTOS__
48 static const NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034;
49 #endif
50 
52  if (riid == IID_IUnknown || riid == IID_IShellPropSheetExt) {
53  *ppObj = static_cast<IShellPropSheetExt*>(this);
54  AddRef();
55  return S_OK;
56  } else if (riid == IID_IShellExtInit) {
57  *ppObj = static_cast<IShellExtInit*>(this);
58  AddRef();
59  return S_OK;
60  }
61 
62  *ppObj = nullptr;
63  return E_NOINTERFACE;
64 }
65 
67  ULONG num_files;
68  FORMATETC format = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
69  HDROP hdrop;
70  WCHAR fnbuf[MAX_PATH];
71 
72  if (pidlFolder)
73  return E_FAIL;
74 
75  if (!pdtobj)
76  return E_FAIL;
77 
78  stgm.tymed = TYMED_HGLOBAL;
79 
80  if (FAILED(pdtobj->GetData(&format, &stgm)))
81  return E_INVALIDARG;
82 
83  stgm_set = true;
84 
85  hdrop = (HDROP)GlobalLock(stgm.hGlobal);
86 
87  if (!hdrop) {
89  stgm_set = false;
90  return E_INVALIDARG;
91  }
92 
93  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, nullptr, 0);
94 
95  if (num_files > 1) {
96  GlobalUnlock(hdrop);
97  return E_FAIL;
98  }
99 
100  if (DragQueryFileW((HDROP)stgm.hGlobal, 0, fnbuf, sizeof(fnbuf) / sizeof(MAX_PATH))) {
101  fn = fnbuf;
102 
105 
106  if (h != INVALID_HANDLE_VALUE) {
109  ULONG devsize, i;
110 
111  i = 0;
112  devsize = 1024;
113 
114  devices = (btrfs_device*)malloc(devsize);
115 
116  while (true) {
117  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
119  if (i < 8) {
120  devsize += 1024;
121 
122  free(devices);
123  devices = (btrfs_device*)malloc(devsize);
124 
125  i++;
126  } else {
127  GlobalUnlock(hdrop);
128  return E_FAIL;
129  }
130  } else
131  break;
132  }
133 
134  if (!NT_SUCCESS(Status)) {
135  GlobalUnlock(hdrop);
136  return E_FAIL;
137  }
138 
139  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_UUID, nullptr, 0, &uuid, sizeof(BTRFS_UUID));
141 
142  ignore = false;
143  balance = new BtrfsBalance(fn);
144  } else {
145  GlobalUnlock(hdrop);
146  return E_FAIL;
147  }
148  } else {
149  GlobalUnlock(hdrop);
150  return E_FAIL;
151  }
152 
153  GlobalUnlock(hdrop);
154 
155  return S_OK;
156 }
157 
158 typedef struct {
160  wstring name;
163 } dev;
164 
166  uint8_t i, j;
167  uint64_t num_devs, dev_size, dev_alloc, data_size, data_alloc, metadata_size, metadata_alloc;
168  btrfs_device* bd;
169  vector<dev> devs;
170  btrfs_usage* bue;
171  wstring t, u, v;
172 
174  static const ULONG typestrings[] = { IDS_USAGE_DATA, IDS_USAGE_MIXED, IDS_USAGE_METADATA, IDS_USAGE_SYSTEM };
178 
181 
182  s = L"";
183 
184  num_devs = 0;
185  bd = devices;
186 
187  while (true) {
188  num_devs++;
189 
190  if (bd->next_entry > 0)
191  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
192  else
193  break;
194  }
195 
196  bd = devices;
197 
198  dev_size = 0;
199 
200  while (true) {
201  dev d;
202 
203  if (bd->missing) {
205  throw last_error(GetLastError());
206  } else if (bd->device_number == 0xffffffff)
207  d.name = wstring(bd->name, bd->namelen / sizeof(WCHAR));
208  else if (bd->partition_number == 0) {
210  throw last_error(GetLastError());
211 
213  } else {
215  throw last_error(GetLastError());
216 
218  }
219 
220  d.dev_id = bd->dev_id;
221  d.alloc = 0;
222  d.size = bd->size;
223 
224  devs.push_back(d);
225 
226  dev_size += bd->size;
227 
228  if (bd->next_entry > 0)
229  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
230  else
231  break;
232  }
233 
234  dev_alloc = 0;
235  data_size = data_alloc = 0;
236  metadata_size = metadata_alloc = 0;
237 
238  bue = usage;
239  while (true) {
240  for (uint64_t k = 0; k < bue->num_devices; k++) {
241  dev_alloc += bue->devices[k].alloc;
242 
243  if (bue->type & BLOCK_FLAG_DATA) {
244  data_alloc += bue->devices[k].alloc;
245  }
246 
247  if (bue->type & BLOCK_FLAG_METADATA) {
248  metadata_alloc += bue->devices[k].alloc;
249  }
250  }
251 
252  if (bue->type & BLOCK_FLAG_DATA)
253  data_size += bue->size;
254 
255  if (bue->type & BLOCK_FLAG_METADATA)
256  metadata_size += bue->size;
257 
258  if (bue->next_entry > 0)
259  bue = (btrfs_usage*)((uint8_t*)bue + bue->next_entry);
260  else
261  break;
262  }
263 
264  // device size
265 
267  throw last_error(GetLastError());
268 
269  format_size(dev_size, v, false);
270 
271  wstring_sprintf(t, u, v.c_str());
272 
273  s += t + L"\r\n";
274 
275  // device allocated
276 
278  throw last_error(GetLastError());
279 
280  format_size(dev_alloc, v, false);
281 
282  wstring_sprintf(t, u, v.c_str());
283 
284 #ifndef __REACTOS__
285  s += t + L"\r\n"s;
286 #else
287  s += t + L"\r\n";
288 #endif
289 
290  // device unallocated
291 
293  throw last_error(GetLastError());
294 
295  format_size(dev_size - dev_alloc, v, false);
296 
297  wstring_sprintf(t, u, v.c_str());
298 
299 #ifndef __REACTOS__
300  s += t + L"\r\n"s;
301 #else
302  s += t + L"\r\n";
303 #endif
304 
305  // data ratio
306 
307  if (data_alloc > 0) {
309  throw last_error(GetLastError());
310 
311  wstring_sprintf(t, u, (float)data_alloc / (float)data_size);
312 
313 #ifndef __REACTOS__
314  s += t + L"\r\n"s;
315 #else
316  s += t + L"\r\n";
317 #endif
318  }
319 
320  // metadata ratio
321 
323  throw last_error(GetLastError());
324 
325  wstring_sprintf(t, u, (float)metadata_alloc / (float)metadata_size);
326 
327  s += t + L"\r\n\r\n";
328 
329  for (i = 0; i < sizeof(types) / sizeof(types[0]); i++) {
330  for (j = 0; j < sizeof(duptypes) / sizeof(duptypes[0]); j++) {
331  bue = usage;
332 
333  while (true) {
334  if ((bue->type & types[i]) == types[i] && ((duptypes[j] == 0 && (bue->type & raid_types) == 0) || bue->type & duptypes[j])) {
335  wstring sizestring, usedstring, typestring, dupstring;
336 
338  break;
339 
340  if (!load_string(module, typestrings[i], typestring))
341  throw last_error(GetLastError());
342 
343  if (!load_string(module, dupstrings[j], dupstring))
344  throw last_error(GetLastError());
345 
346  format_size(bue->size, sizestring, false);
347  format_size(bue->used, usedstring, false);
348 
349  wstring_sprintf(t, typestring, dupstring.c_str(), sizestring.c_str(), usedstring.c_str());
350 
351  s += t + L"\r\n";
352 
353  for (uint64_t k = 0; k < bue->num_devices; k++) {
354  bool found = false;
355 
356  format_size(bue->devices[k].alloc, sizestring, false);
357 
358  for (size_t l = 0; l < min((uint64_t)SIZE_MAX, num_devs); l++) {
359  if (devs[l].dev_id == bue->devices[k].dev_id) {
360  s += devs[l].name + L"\t" + sizestring + L"\r\n";
361 
362  devs[l].alloc += bue->devices[k].alloc;
363 
364  found = true;
365  break;
366  }
367  }
368 
369  if (!found) {
370  if (!load_string(module, IDS_UNKNOWN_DEVICE, typestring))
371  throw last_error(GetLastError());
372 
373  wstring_sprintf(t, typestring, bue->devices[k].dev_id);
374 
375 #ifndef __REACTOS__
376  s += t + L"\t"s + sizestring + L"\r\n"s;
377 #else
378  s += t + L"\t" + sizestring + L"\r\n";
379 #endif
380  }
381  }
382 
383  s += L"\r\n";
384 
385  break;
386  }
387 
388  if (bue->next_entry > 0)
389  bue = (btrfs_usage*)((uint8_t*)bue + bue->next_entry);
390  else
391  break;
392  }
393  }
394  }
395 
397  throw last_error(GetLastError());
398 
399 #ifndef __REACTOS__
400  s += t + L"\r\n"s;
401 #else
402  s += t + L"\r\n";
403 #endif
404 
405  for (size_t k = 0; k < min((uint64_t)SIZE_MAX, num_devs); k++) {
406  wstring sizestring;
407 
408  format_size(devs[k].size - devs[k].alloc, sizestring, false);
409 
410  s += devs[k].name + L"\t" + sizestring + L"\r\n";
411  }
412 }
413 
415  wstring s;
417 
420 
421  if (h != INVALID_HANDLE_VALUE) {
424  ULONG devsize, usagesize, i;
425 
426  i = 0;
427  devsize = 1024;
428 
429  devices = (btrfs_device*)malloc(devsize);
430 
431  while (true) {
432  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
434  if (i < 8) {
435  devsize += 1024;
436 
437  free(devices);
438  devices = (btrfs_device*)malloc(devsize);
439 
440  i++;
441  } else
442  return;
443  } else
444  break;
445  }
446 
447  if (!NT_SUCCESS(Status))
448  return;
449 
450  i = 0;
451  usagesize = 1024;
452 
453  usage = (btrfs_usage*)malloc(usagesize);
454 
455  while (true) {
456  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
458  if (i < 8) {
459  usagesize += 1024;
460 
461  free(usage);
462  usage = (btrfs_usage*)malloc(usagesize);
463 
464  i++;
465  } else
466  return;
467  } else
468  break;
469  }
470 
471  if (!NT_SUCCESS(Status)) {
472  free(usage);
473  return;
474  }
475 
476  ignore = false;
477  } else
478  return;
479 
480  FormatUsage(hwndDlg, s, usage);
481 
482  SetDlgItemTextW(hwndDlg, IDC_USAGE_BOX, s.c_str());
483 
484  free(usage);
485 }
486 
488  try {
489  switch (uMsg) {
490  case WM_INITDIALOG:
491  {
492  wstring s;
493  int i;
494  ULONG usagesize;
497 
499 
502 
503  if (h != INVALID_HANDLE_VALUE) {
505 
506  i = 0;
507  usagesize = 1024;
508 
509  usage = (btrfs_usage*)malloc(usagesize);
510 
511  while (true) {
512  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
514  if (i < 8) {
515  usagesize += 1024;
516 
517  free(usage);
518  usage = (btrfs_usage*)malloc(usagesize);
519 
520  i++;
521  } else
522  break;
523  } else
524  break;
525  }
526 
527  if (!NT_SUCCESS(Status)) {
528  free(usage);
529  break;
530  }
531 
532  FormatUsage(hwndDlg, s, usage);
533 
534  SetDlgItemTextW(hwndDlg, IDC_USAGE_BOX, s.c_str());
535 
536  free(usage);
537  }
538 
539  break;
540  }
541 
542  case WM_COMMAND:
543  switch (HIWORD(wParam)) {
544  case BN_CLICKED:
545  switch (LOWORD(wParam)) {
546  case IDOK:
547  case IDCANCEL:
548  EndDialog(hwndDlg, 0);
549  return true;
550 
551  case IDC_USAGE_REFRESH:
552  RefreshUsage(hwndDlg);
553  return true;
554  }
555  break;
556  }
557  break;
558  }
559  } catch (const exception& e) {
560  error_message(hwndDlg, e.what());
561  }
562 
563  return false;
564 }
565 
567  BtrfsVolPropSheet* bvps;
568 
569  if (uMsg == WM_INITDIALOG) {
571  bvps = (BtrfsVolPropSheet*)lParam;
572  } else {
574  }
575 
576  if (bvps)
577  return bvps->UsageDlgProc(hwndDlg, uMsg, wParam, lParam);
578  else
579  return false;
580 }
581 
584 }
585 
586 static void add_lv_column(HWND list, int string, int cx) {
587  LVCOLUMNW lvc;
588  wstring s;
589 
590  if (!load_string(module, string, s))
591  throw last_error(GetLastError());
592 
593  lvc.mask = LVCF_TEXT|LVCF_WIDTH;
594  lvc.pszText = (WCHAR*)s.c_str();
595  lvc.cx = cx;
597 }
598 
599 static int CALLBACK lv_sort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
600  if (lParam1 < lParam2)
601  return -1;
602  else if (lParam1 > lParam2)
603  return 1;
604  else
605  return 0;
606 }
607 
609  btrfs_usage* bue;
610  uint64_t alloc;
611 
612  alloc = 0;
613 
614  bue = usage;
615  while (true) {
616  uint64_t k;
617 
618  for (k = 0; k < bue->num_devices; k++) {
619  if (bue->devices[k].dev_id == dev_id)
620  alloc += bue->devices[k].alloc;
621  }
622 
623  if (bue->next_entry > 0)
624  bue = (btrfs_usage*)((uint8_t*)bue + bue->next_entry);
625  else
626  break;
627  }
628 
629  return alloc;
630 }
631 
635  ULONG usagesize, devsize;
637  btrfs_device* bd;
638  int i;
639  uint64_t num_rw_devices;
640  {
643 
644  if (h == INVALID_HANDLE_VALUE)
645  throw last_error(GetLastError());
646 
647  i = 0;
648  devsize = 1024;
649 
650  if (devices)
651  free(devices);
652 
653  devices = (btrfs_device*)malloc(devsize);
654 
655  while (true) {
656  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
658  if (i < 8) {
659  devsize += 1024;
660 
661  free(devices);
662  devices = (btrfs_device*)malloc(devsize);
663 
664  i++;
665  } else
666  return;
667  } else
668  break;
669  }
670 
671  if (!NT_SUCCESS(Status))
672  return;
673 
674  bd = devices;
675 
676  i = 0;
677  usagesize = 1024;
678 
679  usage = (btrfs_usage*)malloc(usagesize);
680 
681  while (true) {
682  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
684  if (i < 8) {
685  usagesize += 1024;
686 
687  free(usage);
688  usage = (btrfs_usage*)malloc(usagesize);
689 
690  i++;
691  } else {
692  free(usage);
693  return;
694  }
695  } else
696  break;
697  }
698 
699  if (!NT_SUCCESS(Status)) {
700  free(usage);
701  return;
702  }
703  }
704 
705  SendMessageW(devlist, LVM_DELETEALLITEMS, 0, 0);
706 
707  num_rw_devices = 0;
708 
709  i = 0;
710  while (true) {
711  LVITEMW lvi;
712  wstring s, u;
713  uint64_t alloc;
714 
715  // ID
716 
717  RtlZeroMemory(&lvi, sizeof(LVITEMW));
718  lvi.mask = LVIF_TEXT | LVIF_PARAM;
719  lvi.iItem = (int)SendMessageW(devlist, LVM_GETITEMCOUNT, 0, 0);
720  lvi.lParam = (LPARAM)bd->dev_id;
721 
722  s = to_wstring(bd->dev_id);
723  lvi.pszText = (LPWSTR)s.c_str();
724 
725  SendMessageW(devlist, LVM_INSERTITEMW, 0, (LPARAM)&lvi);
726 
727  // description
728 
729  lvi.mask = LVIF_TEXT;
730  lvi.iSubItem = 1;
731 
732  if (bd->missing) {
734  throw last_error(GetLastError());
735  } else if (bd->device_number == 0xffffffff)
736  s = wstring(bd->name, bd->namelen / sizeof(WCHAR));
737  else if (bd->partition_number == 0) {
739  throw last_error(GetLastError());
740 
742  } else {
744  throw last_error(GetLastError());
745 
747  }
748 
749  lvi.pszText = (LPWSTR)s.c_str();
750 
751  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
752 
753  // readonly
754 
755  lvi.iSubItem = 2;
757  lvi.pszText = (LPWSTR)s.c_str();
758  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
759 
760  if (!bd->readonly)
761  num_rw_devices++;
762 
763  // size
764 
765  lvi.iSubItem = 3;
766  format_size(bd->size, s, false);
767  lvi.pszText = (LPWSTR)s.c_str();
768  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
769 
770  // alloc
771 
773 
774  lvi.iSubItem = 4;
775  format_size(alloc, s, false);
776  lvi.pszText = (LPWSTR)s.c_str();
777  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
778 
779  // alloc %
780 
781  wstring_sprintf(s, L"%1.1f%%", (float)alloc * 100.0f / (float)bd->size);
782  lvi.iSubItem = 5;
783  lvi.pszText = (LPWSTR)s.c_str();
784  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
785 
786  i++;
787 
788  if (bd->next_entry > 0)
789  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
790  else
791  break;
792  }
793 
794  free(usage);
795 
796  SendMessageW(devlist, LVM_SORTITEMS, 0, (LPARAM)lv_sort);
797 
798  EnableWindow(GetDlgItem(GetParent(devlist), IDC_DEVICE_ADD), num_rw_devices > 0);
799  EnableWindow(GetDlgItem(GetParent(devlist), IDC_DEVICE_REMOVE), num_rw_devices > 1);
800 }
801 
803  wstring t, sel;
804  WCHAR modfn[MAX_PATH];
805  SHELLEXECUTEINFOW sei;
806 
807  sel = to_wstring(stats_dev);
808 
809  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
810 
811 #ifndef __REACTOS__
812  t = L"\""s + modfn + L"\",ResetStats " + fn + L"|" + sel;
813 #else
814  t = wstring(L"\"") + modfn + wstring(L"\",ResetStats ") + fn + wstring(L"|") + sel;
815 #endif
816 
817  RtlZeroMemory(&sei, sizeof(sei));
818 
819  sei.cbSize = sizeof(sei);
820  sei.hwnd = hwndDlg;
821  sei.lpVerb = L"runas";
822  sei.lpFile = L"rundll32.exe";
823  sei.lpParameters = t.c_str();
824  sei.nShow = SW_SHOW;
826 
827  if (!ShellExecuteExW(&sei))
828  throw last_error(GetLastError());
829 
831  CloseHandle(sei.hProcess);
832 
835 
836  if (h != INVALID_HANDLE_VALUE) {
839  ULONG devsize, i;
840 
841  i = 0;
842  devsize = 1024;
843 
844  free(devices);
845  devices = (btrfs_device*)malloc(devsize);
846 
847  while (true) {
848  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
850  if (i < 8) {
851  devsize += 1024;
852 
853  free(devices);
854  devices = (btrfs_device*)malloc(devsize);
855 
856  i++;
857  } else
858  break;
859  } else
860  break;
861  }
862  }
863 
864  EndDialog(hwndDlg, 0);
865 }
866 
868  try {
869  switch (uMsg) {
870  case WM_INITDIALOG:
871  {
872  WCHAR s[255];
873  wstring t;
874  btrfs_device *bd, *dev = nullptr;
875  int i;
876 
878 
879  bd = devices;
880 
881  while (true) {
882  if (bd->dev_id == stats_dev) {
883  dev = bd;
884  break;
885  }
886 
887  if (bd->next_entry > 0)
888  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
889  else
890  break;
891  }
892 
893  if (!dev) {
894  EndDialog(hwndDlg, 0);
896  }
897 
898  GetDlgItemTextW(hwndDlg, IDC_DEVICE_ID, s, sizeof(s) / sizeof(WCHAR));
899 
901 
902  SetDlgItemTextW(hwndDlg, IDC_DEVICE_ID, t.c_str());
903 
904  for (i = 0; i < 5; i++) {
905  GetDlgItemTextW(hwndDlg, stat_ids[i], s, sizeof(s) / sizeof(WCHAR));
906 
907  wstring_sprintf(t, s, dev->stats[i]);
908 
909  SetDlgItemTextW(hwndDlg, stat_ids[i], t.c_str());
910  }
911 
914 
915  break;
916  }
917 
918  case WM_COMMAND:
919  switch (HIWORD(wParam)) {
920  case BN_CLICKED:
921  switch (LOWORD(wParam)) {
922  case IDOK:
923  case IDCANCEL:
924  EndDialog(hwndDlg, 0);
925  return true;
926 
927  case IDC_RESET_STATS:
928  ResetStats(hwndDlg);
929  return true;
930  }
931  break;
932  }
933  break;
934  }
935  } catch (const exception& e) {
936  error_message(hwndDlg, e.what());
937  }
938 
939  return false;
940 }
941 
943  BtrfsVolPropSheet* bvps;
944 
945  if (uMsg == WM_INITDIALOG) {
947  bvps = (BtrfsVolPropSheet*)lParam;
948  } else {
950  }
951 
952  if (bvps)
953  return bvps->StatsDlgProc(hwndDlg, uMsg, wParam, lParam);
954  else
955  return false;
956 }
957 
959  stats_dev = devid;
960 
962 }
963 
965  try {
966  switch (uMsg) {
967  case WM_INITDIALOG:
968  {
969  HWND devlist;
970  RECT rect;
971  ULONG w;
972 
974 
975  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
976 
977  GetClientRect(devlist, &rect);
978  w = rect.right - rect.left;
979 
980  add_lv_column(devlist, IDS_DEVLIST_ALLOC_PC, w * 5 / 44);
981  add_lv_column(devlist, IDS_DEVLIST_ALLOC, w * 6 / 44);
982  add_lv_column(devlist, IDS_DEVLIST_SIZE, w * 6 / 44);
983  add_lv_column(devlist, IDS_DEVLIST_READONLY, w * 7 / 44);
984  add_lv_column(devlist, IDS_DEVLIST_DESC, w * 16 / 44);
985  add_lv_column(devlist, IDS_DEVLIST_ID, w * 4 / 44);
986 
990 
991  RefreshDevList(devlist);
992 
993  break;
994  }
995 
996  case WM_COMMAND:
997  switch (HIWORD(wParam)) {
998  case BN_CLICKED:
999  switch (LOWORD(wParam)) {
1000  case IDOK:
1001  case IDCANCEL:
1002  KillTimer(hwndDlg, 1);
1003  EndDialog(hwndDlg, 0);
1004  return true;
1005 
1006  case IDC_DEVICE_ADD:
1007  {
1008  wstring t;
1009  WCHAR modfn[MAX_PATH];
1010  SHELLEXECUTEINFOW sei;
1011 
1012  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1013 
1014 #ifndef __REACTOS__
1015  t = L"\""s + modfn + L"\",AddDevice "s + fn;
1016 #else
1017  t = wstring(L"\"") + modfn + wstring(L"\",AddDevice ") + fn;
1018 #endif
1019 
1020  RtlZeroMemory(&sei, sizeof(sei));
1021 
1022  sei.cbSize = sizeof(sei);
1023  sei.hwnd = hwndDlg;
1024  sei.lpVerb = L"runas";
1025  sei.lpFile = L"rundll32.exe";
1026  sei.lpParameters = t.c_str();
1027  sei.nShow = SW_SHOW;
1029 
1030  if (!ShellExecuteExW(&sei))
1031  throw last_error(GetLastError());
1032 
1034  CloseHandle(sei.hProcess);
1035 
1037 
1038  return true;
1039  }
1040 
1041  case IDC_DEVICE_REFRESH:
1043  return true;
1044 
1045  case IDC_DEVICE_SHOW_STATS:
1046  {
1047  WCHAR sel[MAX_PATH];
1048  HWND devlist;
1049  LVITEMW lvi;
1050 
1051  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1052 
1053  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1054 
1055  if (index == -1)
1056  return true;
1057 
1058  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1059  lvi.mask = LVIF_TEXT;
1060  lvi.iItem = (int)index;
1061  lvi.iSubItem = 0;
1062  lvi.pszText = sel;
1063  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1064  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1065 
1066  ShowStats(hwndDlg, _wtoi(sel));
1067  return true;
1068  }
1069 
1070  case IDC_DEVICE_REMOVE:
1071  {
1072  wstring t, mess, mess2, title;
1073  WCHAR modfn[MAX_PATH], sel[MAX_PATH], sel2[MAX_PATH];
1074  HWND devlist;
1075  SHELLEXECUTEINFOW sei;
1076  LVITEMW lvi;
1077 
1078  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1079 
1080  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1081 
1082  if (index == -1)
1083  return true;
1084 
1085  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1086  lvi.mask = LVIF_TEXT;
1087  lvi.iItem = (int)index;
1088  lvi.iSubItem = 0;
1089  lvi.pszText = sel;
1090  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1091  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1092 
1093  lvi.iSubItem = 1;
1094  lvi.pszText = sel2;
1095  lvi.cchTextMax = sizeof(sel2) / sizeof(WCHAR);
1096  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1097 
1099  throw last_error(GetLastError());
1100 
1101  wstring_sprintf(mess2, mess, sel, sel2);
1102 
1104  throw last_error(GetLastError());
1105 
1106  if (MessageBoxW(hwndDlg, mess2.c_str(), title.c_str(), MB_YESNO) != IDYES)
1107  return true;
1108 
1109  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1110 
1111 #ifndef __REACTOS__
1112  t = L"\""s + modfn + L"\",RemoveDevice "s + fn + L"|"s + sel;
1113 #else
1114  t = wstring(L"\"") + modfn + wstring(L"\",RemoveDevice ") + fn + wstring(L"|") + sel;
1115 #endif
1116 
1117  RtlZeroMemory(&sei, sizeof(sei));
1118 
1119  sei.cbSize = sizeof(sei);
1120  sei.hwnd = hwndDlg;
1121  sei.lpVerb = L"runas";
1122  sei.lpFile = L"rundll32.exe";
1123  sei.lpParameters = t.c_str();
1124  sei.nShow = SW_SHOW;
1126 
1127  if (!ShellExecuteExW(&sei))
1128  throw last_error(GetLastError());
1129 
1131  CloseHandle(sei.hProcess);
1132 
1134 
1135  return true;
1136  }
1137 
1138  case IDC_DEVICE_RESIZE:
1139  {
1140  HWND devlist;
1141  LVITEMW lvi;
1142  wstring t;
1143  WCHAR modfn[MAX_PATH], sel[100];
1144  SHELLEXECUTEINFOW sei;
1145 
1146  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1147 
1148  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1149 
1150  if (index == -1)
1151  return true;
1152 
1153  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1154  lvi.mask = LVIF_TEXT;
1155  lvi.iItem = (int)index;
1156  lvi.iSubItem = 0;
1157  lvi.pszText = sel;
1158  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1159  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1160 
1161  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1162 
1163 #ifndef __REACTOS__
1164  t = L"\""s + modfn + L"\",ResizeDevice "s + fn + L"|"s + sel;
1165 #else
1166  t = wstring(L"\"") + modfn + wstring(L"\",ResizeDevice ") + fn + wstring(L"|") + sel;
1167 #endif
1168 
1169  RtlZeroMemory(&sei, sizeof(sei));
1170 
1171  sei.cbSize = sizeof(sei);
1172  sei.hwnd = hwndDlg;
1173  sei.lpVerb = L"runas";
1174  sei.lpFile = L"rundll32.exe";
1175  sei.lpParameters = t.c_str();
1176  sei.nShow = SW_SHOW;
1178 
1179  if (!ShellExecuteExW(&sei))
1180  throw last_error(GetLastError());
1181 
1183  CloseHandle(sei.hProcess);
1184 
1186  }
1187  }
1188  break;
1189  }
1190  break;
1191 
1192  case WM_NOTIFY:
1193  switch (((LPNMHDR)lParam)->code) {
1194  case LVN_ITEMCHANGED:
1195  {
1196  NMLISTVIEW* nmv = (NMLISTVIEW*)lParam;
1197 
1199 
1200  if (nmv->uNewState & LVIS_SELECTED && !readonly) {
1201  HWND devlist;
1202  btrfs_device* bd;
1203  bool device_readonly = false;
1204  LVITEMW lvi;
1205  WCHAR sel[MAX_PATH];
1206  uint64_t devid;
1207 
1208  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1209 
1210  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1211  lvi.mask = LVIF_TEXT;
1212  lvi.iItem = nmv->iItem;
1213  lvi.iSubItem = 0;
1214  lvi.pszText = sel;
1215  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1216  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1217  devid = _wtoi(sel);
1218 
1219  bd = devices;
1220 
1221  while (true) {
1222  if (bd->dev_id == devid) {
1223  device_readonly = bd->readonly;
1224  break;
1225  }
1226 
1227  if (bd->next_entry > 0)
1228  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
1229  else
1230  break;
1231  }
1232 
1233  EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_RESIZE), !device_readonly);
1234  } else
1235  EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_RESIZE), false);
1236 
1237  break;
1238  }
1239  }
1240  break;
1241  }
1242  } catch (const exception& e) {
1243  error_message(hwndDlg, e.what());
1244  }
1245 
1246  return false;
1247 }
1248 
1250  BtrfsVolPropSheet* bvps;
1251 
1252  if (uMsg == WM_INITDIALOG) {
1254  bvps = (BtrfsVolPropSheet*)lParam;
1255  } else {
1257  }
1258 
1259  if (bvps)
1260  return bvps->DeviceDlgProc(hwndDlg, uMsg, wParam, lParam);
1261  else
1262  return false;
1263 }
1264 
1267 }
1268 
1270  wstring t;
1271  WCHAR modfn[MAX_PATH];
1272  SHELLEXECUTEINFOW sei;
1273 
1274  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1275 
1276 #ifndef __REACTOS__
1277  t = L"\""s + modfn + L"\",ShowScrub "s + fn;
1278 #else
1279  t = wstring(L"\"") + modfn + wstring(L"\",ShowScrub ") + fn;
1280 #endif
1281 
1282  RtlZeroMemory(&sei, sizeof(sei));
1283 
1284  sei.cbSize = sizeof(sei);
1285  sei.hwnd = hwndDlg;
1286  sei.lpVerb = L"runas";
1287  sei.lpFile = L"rundll32.exe";
1288  sei.lpParameters = t.c_str();
1289  sei.nShow = SW_SHOW;
1291 
1292  if (!ShellExecuteExW(&sei))
1293  throw last_error(GetLastError());
1294 
1296  CloseHandle(sei.hProcess);
1297 }
1298 
1300  wstring t;
1301  WCHAR modfn[MAX_PATH];
1302  SHELLEXECUTEINFOW sei;
1303 
1304  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1305 
1306 #ifndef __REACTOS__
1307  t = L"\""s + modfn + L"\",ShowChangeDriveLetter "s + fn;
1308 #else
1309  t = wstring(L"\"") + modfn + wstring(L"\",ShowChangeDriveLetter ") + fn;
1310 #endif
1311 
1312  RtlZeroMemory(&sei, sizeof(sei));
1313 
1314  sei.cbSize = sizeof(sei);
1315  sei.hwnd = hwndDlg;
1316  sei.lpVerb = L"runas";
1317  sei.lpFile = L"rundll32.exe";
1318  sei.lpParameters = t.c_str();
1319  sei.nShow = SW_SHOW;
1321 
1322  if (!ShellExecuteExW(&sei))
1323  throw last_error(GetLastError());
1324 
1326  CloseHandle(sei.hProcess);
1327 }
1328 
1330  try {
1331  switch (uMsg) {
1332  case WM_INITDIALOG:
1333  {
1335  BtrfsVolPropSheet* bps = (BtrfsVolPropSheet*)psp->lParam;
1336  btrfs_device* bd;
1337 
1339 
1340  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
1341 
1342  bps->readonly = true;
1343  bd = bps->devices;
1344 
1345  while (true) {
1346  if (!bd->readonly) {
1347  bps->readonly = false;
1348  break;
1349  }
1350 
1351  if (bd->next_entry > 0)
1352  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
1353  else
1354  break;
1355  }
1356 
1357  if (bps->uuid_set) {
1358  WCHAR s[255];
1359  wstring t;
1360 
1361  GetDlgItemTextW(hwndDlg, IDC_UUID, s, sizeof(s) / sizeof(WCHAR));
1362 
1363  wstring_sprintf(t, s, bps->uuid.uuid[0], bps->uuid.uuid[1], bps->uuid.uuid[2], bps->uuid.uuid[3], bps->uuid.uuid[4], bps->uuid.uuid[5],
1364  bps->uuid.uuid[6], bps->uuid.uuid[7], bps->uuid.uuid[8], bps->uuid.uuid[9], bps->uuid.uuid[10], bps->uuid.uuid[11],
1365  bps->uuid.uuid[12], bps->uuid.uuid[13], bps->uuid.uuid[14], bps->uuid.uuid[15]);
1366 
1367  SetDlgItemTextW(hwndDlg, IDC_UUID, t.c_str());
1368  } else
1369  SetDlgItemTextW(hwndDlg, IDC_UUID, L"");
1370 
1371  SendMessageW(GetDlgItem(hwndDlg, IDC_VOL_SCRUB), BCM_SETSHIELD, 0, true);
1373 
1374  return false;
1375  }
1376 
1377  case WM_NOTIFY:
1378  {
1379  switch (((LPNMHDR)lParam)->code) {
1380  case PSN_KILLACTIVE:
1381  SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, false);
1382  break;
1383  }
1384  break;
1385  }
1386 
1387  case WM_COMMAND:
1388  {
1390 
1391  if (bps) {
1392  switch (HIWORD(wParam)) {
1393  case BN_CLICKED: {
1394  switch (LOWORD(wParam)) {
1395  case IDC_VOL_SHOW_USAGE:
1396  bps->ShowUsage(hwndDlg);
1397  break;
1398 
1399  case IDC_VOL_BALANCE:
1400  bps->balance->ShowBalance(hwndDlg);
1401  break;
1402 
1403  case IDC_VOL_DEVICES:
1404  bps->ShowDevices(hwndDlg);
1405  break;
1406 
1407  case IDC_VOL_SCRUB:
1408  bps->ShowScrub(hwndDlg);
1409  break;
1410 
1412  bps->ShowChangeDriveLetter(hwndDlg);
1413  break;
1414  }
1415  }
1416  }
1417  }
1418 
1419  break;
1420  }
1421  }
1422  } catch (const exception& e) {
1423  error_message(hwndDlg, e.what());
1424  }
1425 
1426  return false;
1427 }
1428 
1430  try {
1431  PROPSHEETPAGE psp;
1432  HPROPSHEETPAGE hPage;
1433  INITCOMMONCONTROLSEX icex;
1434 
1435  if (ignore)
1436  return S_OK;
1437 
1438  icex.dwSize = sizeof(icex);
1439  icex.dwICC = ICC_LINK_CLASS;
1440 
1441  if (!InitCommonControlsEx(&icex))
1443 
1444  psp.dwSize = sizeof(psp);
1445  psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
1446  psp.hInstance = module;
1447  psp.pszTemplate = MAKEINTRESOURCE(IDD_VOL_PROP_SHEET);
1448  psp.hIcon = 0;
1449  psp.pszTitle = MAKEINTRESOURCE(IDS_VOL_PROP_SHEET_TITLE);
1450  psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
1451  psp.pcRefParent = (UINT*)&objs_loaded;
1452  psp.pfnCallback = nullptr;
1453  psp.lParam = (LPARAM)this;
1454 
1455  hPage = CreatePropertySheetPage(&psp);
1456 
1457  if (hPage) {
1458  if (pfnAddPage(hPage, lParam)) {
1459  this->AddRef();
1460  return S_OK;
1461  } else
1462  DestroyPropertySheetPage(hPage);
1463  } else
1464  return E_OUTOFMEMORY;
1465  } catch (const exception& e) {
1466  error_message(nullptr, e.what());
1467  }
1468 
1469  return E_FAIL;
1470 }
1471 
1473  return S_OK;
1474 }
1475 
1477  unsigned int sel = (unsigned int)SendDlgItemMessageW(hwndDlg, IDC_DRIVE_LETTER_COMBO, CB_GETCURSEL, 0, 0);
1478 
1479  if (sel >= 0 && sel < letters.size()) {
1480  wstring dd;
1481 
1482  if (fn.length() == 3 && fn[1] == L':' && fn[2] == L'\\') {
1483  dd = L"\\DosDevices\\?:";
1484 
1485  dd[12] = fn[0];
1486  } else
1487 #ifndef __REACTOS__
1488  throw runtime_error("Volume path was not root of drive.");
1489 #else
1490  error_message(nullptr, "Volume path was not root of drive.");
1491 #endif
1492 
1493  mountmgr mm;
1494  wstring dev_name;
1495 
1496  {
1497  auto v = mm.query_points(dd);
1498 
1499  if (v.empty())
1500 #ifndef __REACTOS__
1501  throw runtime_error("Error finding device name.");
1502 #else
1503  error_message(nullptr, "Error finding device name.");
1504 #endif
1505 
1506  dev_name = v[0].device_name;
1507  }
1508 
1509  wstring new_dd = L"\\DosDevices\\?:";
1510  new_dd[12] = letters[sel];
1511 
1512  mm.delete_points(dd);
1513 
1514  try {
1515  mm.create_point(new_dd, dev_name);
1516  } catch (...) {
1517  // if fails, try to recreate old symlink, so we're not left with no drive letter at all
1518  mm.create_point(dd, dev_name);
1519  throw;
1520  }
1521  }
1522 
1523  EndDialog(hwndDlg, 1);
1524 }
1525 
1527  try {
1528  switch (uMsg) {
1529  case WM_INITDIALOG:
1530  {
1532 
1534 
1535  mountmgr mm;
1536  wstring drv;
1537 
1538  drv = L"\\DosDevices\\?:";
1539 
1540  for (wchar_t l = 'A'; l <= 'Z'; l++) {
1541  bool found = true;
1542 
1543  drv[12] = l;
1544 
1545  try {
1546  auto v = mm.query_points(drv);
1547 
1548  if (v.empty())
1549  found = false;
1550  } catch (const ntstatus_error& ntstatus) {
1551  if (ntstatus.Status == STATUS_OBJECT_NAME_NOT_FOUND)
1552  found = false;
1553  else
1554  throw;
1555  }
1556 
1557  if (!found) {
1558  wstring str = L"?:";
1559 
1560  str[0] = l;
1561  letters.push_back(l);
1562 
1563  SendMessageW(cb, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str.c_str()));
1564  }
1565  }
1566 
1567  break;
1568  }
1569 
1570  case WM_COMMAND:
1571  switch (HIWORD(wParam)) {
1572  case BN_CLICKED:
1573  switch (LOWORD(wParam)) {
1574  case IDOK:
1575  do_change(hwndDlg);
1576  return true;
1577 
1578  case IDCANCEL:
1579  EndDialog(hwndDlg, 0);
1580  return true;
1581  }
1582  break;
1583  }
1584  break;
1585  }
1586  } catch (const exception& e) {
1587  error_message(hwndDlg, e.what());
1588  }
1589 
1590  return false;
1591 }
1592 
1593 #ifdef __REACTOS__
1594 INT_PTR CALLBACK VolPropSheetDlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
1595 {
1596  BtrfsChangeDriveLetter* bcdl;
1597 
1598  if (uMsg == WM_INITDIALOG) {
1600  bcdl = (BtrfsChangeDriveLetter*)lParam;
1601  } else
1603 
1604  return bcdl->DlgProc(hwndDlg, uMsg, wParam, lParam);
1605 }
1606 #endif
1607 
1609 #ifndef __REACTOS__
1611  BtrfsChangeDriveLetter* bcdl;
1612 
1613  if (uMsg == WM_INITDIALOG) {
1615  bcdl = (BtrfsChangeDriveLetter*)lParam;
1616  } else
1618 
1619  return bcdl->DlgProc(hwndDlg, uMsg, wParam, lParam);
1620  }, (LPARAM)this);
1621 #else
1622  DialogBoxParamW(module, MAKEINTRESOURCEW(IDD_DRIVE_LETTER), hwnd, VolPropSheetDlgproc, (LPARAM)this);
1623 #endif
1624 }
1625 
1626 #ifdef __cplusplus
1627 extern "C" {
1628 #endif
1629 
1630 void CALLBACK ResetStatsW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow) {
1631  try {
1632  win_handle token;
1633  NTSTATUS Status;
1635  LUID luid;
1636  uint64_t devid;
1637  wstring cmdline, vol, dev;
1638  size_t pipe;
1640 
1641  set_dpi_aware();
1642 
1643  cmdline = lpszCmdLine;
1644 
1646  throw last_error(GetLastError());
1647 
1648  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1649  throw last_error(GetLastError());
1650 
1651  tp.PrivilegeCount = 1;
1652  tp.Privileges[0].Luid = luid;
1653  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1654 
1655  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1656  throw last_error(GetLastError());
1657 
1658  pipe = cmdline.find(L"|");
1659 
1660  if (pipe == string::npos)
1661  return;
1662 
1663  vol = cmdline.substr(0, pipe);
1664  dev = cmdline.substr(pipe + 1);
1665 
1666  devid = _wtoi(dev.c_str());
1667  if (devid == 0)
1668  return;
1669 
1672 
1673  if (h == INVALID_HANDLE_VALUE)
1674  throw last_error(GetLastError());
1675 
1676  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_RESET_STATS, &devid, sizeof(uint64_t), nullptr, 0);
1677  if (!NT_SUCCESS(Status))
1678  throw ntstatus_error(Status);
1679  } catch (const exception& e) {
1680  error_message(hwnd, e.what());
1681  }
1682 }
1683 
1684 void CALLBACK ShowChangeDriveLetterW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow) {
1685  BtrfsChangeDriveLetter bcdl(hwnd, lpszCmdLine);
1686 
1687  bcdl.show();
1688 }
1689 
1690 #ifdef __cplusplus
1691 }
1692 #endif
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
WCHAR name[1]
Definition: btrfsioctl.h:112
#define IDC_GENERATION_ERRS
Definition: resource.h:330
#define IDS_DEVLIST_READONLY_YES
Definition: resource.h:78
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDS_RAID10
Definition: resource.h:47
#define MAKEINTRESOURCE
Definition: winuser.h:591
uint64_t type
Definition: btrfsioctl.h:122
#define IDC_DEVICE_REFRESH
Definition: resource.h:281
void ShowChangeDriveLetter(HWND hwndDlg)
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
USHORT namelen
Definition: btrfsioctl.h:111
#define REFIID
Definition: guiddef.h:118
#define IDS_USAGE_DATA
Definition: resource.h:50
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:487
HMODULE module
Definition: main.cpp:47
#define E_NOINTERFACE
Definition: winerror.h:2364
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
#define IDS_REMOVE_DEVICE_CONFIRMATION
Definition: resource.h:96
#define LVCF_WIDTH
Definition: commctrl.h:2583
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
INT_PTR CALLBACK StatsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
uint64_t used
Definition: btrfsioctl.h:124
UINT uNewState
Definition: commctrl.h:3032
#define IDD_VOL_USAGE
Definition: resource.h:13
void do_change(HWND hwndDlg)
#define IDYES
Definition: winuser.h:829
#define IDC_VOL_CHANGE_DRIVE_LETTER
Definition: resource.h:337
uint64_t num_devices
Definition: btrfsioctl.h:125
#define LVCF_TEXT
Definition: commctrl.h:2584
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define IDS_UNKNOWN_DEVICE
Definition: resource.h:55
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
#define IDC_FLUSH_ERRS
Definition: resource.h:326
#define IDC_VOL_BALANCE
Definition: resource.h:238
REFIID riid
Definition: precomp.h:44
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
uint32_t next_entry
Definition: btrfsioctl.h:102
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define free
Definition: debug_ros.c:5
virtual HRESULT __stdcall ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
#define FSCTL_BTRFS_GET_USAGE
Definition: btrfsioctl.h:13
static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
btrfs_device * devices
Definition: volpropsheet.h:100
LONG NTSTATUS
Definition: precomp.h:26
#define IDS_RAID1C3
Definition: resource.h:137
GLsizei GLenum GLenum * types
Definition: glext.h:7753
#define CALLBACK
Definition: compat.h:35
static const size_t npos
Definition: _string_npos.h:26
INT_PTR CALLBACK DeviceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
GLdouble GLdouble t
Definition: gl.h:2047
uint32_t next_entry
Definition: btrfsioctl.h:121
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
const char * dev_name(int device)
Definition: wave.c:211
#define LVM_SORTITEMS
Definition: commctrl.h:2698
BtrfsBalance * balance
Definition: volpropsheet.h:102
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
#define IDS_INITCOMMONCONTROLSEX_FAILED
Definition: resource.h:205
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define IDS_CONFIRMATION_TITLE
Definition: resource.h:97
#define BCM_SETSHIELD
Definition: commctrl.h:4649
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:64
#define IDC_USAGE_BOX
Definition: resource.h:230
#define IDS_CANNOT_FIND_DEVICE
Definition: resource.h:29
#define E_FAIL
Definition: ddrawi.h:102
#define IDD_DEVICE_STATS
Definition: resource.h:84
void ShowScrub(HWND hwndDlg)
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define DWLP_MSGRESULT
Definition: winuser.h:864
static int dev
Definition: mkdosfs.c:536
#define FILE_SHARE_READ
Definition: compat.h:136
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
void FormatUsage(HWND hwndDlg, wstring &s, btrfs_usage *usage)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FILE_TRAVERSE
Definition: nt_native.h:643
#define FSCTL_BTRFS_RESET_STATS
Definition: btrfsioctl.h:29
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG device_number
Definition: btrfsioctl.h:108
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define IDS_RAID5
Definition: resource.h:48
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define MB_YESNO
Definition: winuser.h:811
#define IDS_SINGLE
Definition: resource.h:43
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
#define e
Definition: ke_i.h:82
#define IDS_DEVLIST_READONLY
Definition: resource.h:76
std::vector< mountmgr_point > query_points(const std::wstring_view &symlink=L"", const std::wstring_view &unique_id=L"", const std::wstring_view &device_name=L"") const
void create_point(const std::wstring_view &symlink, const std::wstring_view &device) const
static INT_PTR CALLBACK stub_UsageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual HRESULT __stdcall AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define IDC_DEVICE_ID
Definition: resource.h:322
int iSubItem
Definition: commctrl.h:2358
#define IDS_DEVLIST_ALLOC_PC
Definition: resource.h:83
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
LPARAM lParam
Definition: commctrl.h:2364
#define IDS_RAID0
Definition: resource.h:45
#define IDC_RESET_STATS
Definition: resource.h:275
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2302
#define GWLP_USERDATA
Definition: treelist.c:63
#define BLOCK_FLAG_RAID1C3
Definition: btrfs.h:83
#define CB_ADDSTRING
Definition: winuser.h:1918
#define BLOCK_FLAG_SYSTEM
Definition: shellext.h:76
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
#define IDS_DISK_PART_NUM
Definition: resource.h:103
uint64_t size
Definition: btrfsioctl.h:123
#define IDS_DEVLIST_SIZE
Definition: resource.h:77
#define IDD_DEVICES
Definition: resource.h:21
#define LVIS_SELECTED
Definition: commctrl.h:2315
#define IDS_DISK_NUM
Definition: resource.h:102
#define IDS_MISSING
Definition: resource.h:193
#define CF_HDROP
Definition: constants.h:410
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
#define BLOCK_FLAG_RAID10
Definition: shellext.h:81
LONG_PTR LPARAM
Definition: windef.h:208
void delete_points(const std::wstring_view &symlink, const std::wstring_view &unique_id=L"", const std::wstring_view &device_name=L"") const
#define SIZE_MAX
Definition: asmshader.yy.c:347
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
GLuint index
Definition: glext.h:6031
ULONG partition_number
Definition: btrfsioctl.h:109
ULONG __stdcall AddRef()
Definition: volpropsheet.h:65
#define SW_SHOW
Definition: winuser.h:769
void ShowUsage(HWND hwndDlg)
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define IDS_USAGE_MIXED
Definition: resource.h:51
#define OPEN_EXISTING
Definition: compat.h:523
#define CreatePropertySheetPage
Definition: prsht.h:399
#define IDS_USAGE_UNALLOC
Definition: resource.h:54
#define IDC_VOL_SHOW_USAGE
Definition: resource.h:237
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2930
r l[0]
Definition: byte_order.h:167
#define IDS_USAGE_SYSTEM
Definition: resource.h:53
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
#define BLOCK_FLAG_RAID0
Definition: shellext.h:78
GLfloat f
Definition: glext.h:7540
static INT_PTR CALLBACK stub_StatsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
GLsizeiptr size
Definition: glext.h:5919
void ShowBalance(HWND hwndDlg)
Definition: balance.cpp:979
#define d
Definition: ke_i.h:81
#define TOKEN_QUERY
Definition: setypes.h:874
#define IDD_VOL_PROP_SHEET
Definition: resource.h:11
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDC_UUID
Definition: resource.h:306
Definition: cmds.c:130
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void add_lv_column(HWND list, int string, int cx)
#define IDS_USAGE_DEV_SIZE
Definition: resource.h:56
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IDS_VOL_PROP_SHEET_TITLE
Definition: resource.h:41
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define IDS_DUP
Definition: resource.h:44
const GUID IID_IUnknown
#define IDC_DEVLIST
Definition: resource.h:302
LPWSTR pszText
Definition: commctrl.h:2361
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:379
#define MAX_PATH
Definition: compat.h:34
static const NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND
LPWSTR pszText
Definition: commctrl.h:2563
INT_PTR CALLBACK UsageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
char * name
Definition: compiler.c:66
#define BN_CLICKED
Definition: winuser.h:1907
void CALLBACK ShowChangeDriveLetterW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
#define IDS_DEVLIST_ID
Definition: resource.h:74
void ShowDevices(HWND hwndDlg)
#define __stdcall
Definition: typedefs.h:25
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_RAID6
Definition: resource.h:49
#define BLOCK_FLAG_RAID6
Definition: shellext.h:83
#define IDS_USAGE_METADATA
Definition: resource.h:52
#define IDS_USAGE_DATA_RATIO
Definition: resource.h:59
UINT mask
Definition: commctrl.h:2356
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define BLOCK_FLAG_RAID1C4
Definition: btrfs.h:84
#define IDC_DRIVE_LETTER_COMBO
Definition: resource.h:338
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define PSP_USEREFPARENT
Definition: prsht.h:29
#define IDC_DEVICE_SHOW_STATS
Definition: resource.h:290
Status
Definition: gdiplustypes.h:24
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
void ResetStats(HWND hwndDlg)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define BLOCK_FLAG_METADATA
Definition: shellext.h:77
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
#define GetCurrentProcess()
Definition: compat.h:507
vector< wchar_t > letters
Definition: volpropsheet.h:128
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
#define PSP_USETITLE
Definition: prsht.h:26
BYTE uint8_t
Definition: msvideo1.c:66
#define IDC_USAGE_REFRESH
Definition: resource.h:233
#define IDS_USAGE_DEV_ALLOC
Definition: resource.h:57
#define IDC_VOL_DEVICES
Definition: resource.h:245
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2871
void ShowStats(HWND hwndDlg, uint64_t devid)
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2409
#define IDC_WRITE_ERRS
Definition: resource.h:323
#define IDC_DEVICE_RESIZE
Definition: resource.h:294
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
#define S_OK
Definition: intsafe.h:51
UINT64 uint64_t
Definition: types.h:77
void RefreshUsage(HWND hwndDlg)
const GLdouble * v
Definition: gl.h:2040
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
uint64_t alloc
LPCWSTR lpParameters
Definition: shellapi.h:331
#define IDD_DRIVE_LETTER
Definition: resource.h:95
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define list
Definition: rosglue.h:35
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define min(a, b)
Definition: monoChain.cc:55
#define alloc
Definition: rosglue.h:13
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
#define IDC_VOL_SCRUB
Definition: resource.h:248
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
uint64_t dev_id
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define IDC_DEVICE_REMOVE
Definition: resource.h:286
#define BLOCK_FLAG_DATA
Definition: shellext.h:75
uint64_t dev_id
Definition: btrfsioctl.h:103
#define CreateFileW
Definition: compat.h:489
btrfs_usage_device devices[1]
Definition: btrfsioctl.h:126
#define IDC_CORRUPTION_ERRS
Definition: resource.h:328
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
void CALLBACK ResetStatsW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
#define IDS_RAID1C4
Definition: resource.h:149
#define IDS_DEVLIST_DESC
Definition: resource.h:75
_Out_opt_ int * cx
Definition: commctrl.h:581
#define LVM_SETITEMW
Definition: commctrl.h:2393
#define IDC_DEVICE_ADD
Definition: resource.h:274
static uint64_t find_dev_alloc(uint64_t dev_id, btrfs_usage *usage)
INT_PTR DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define LVIF_PARAM
Definition: commctrl.h:2307
static INT_PTR CALLBACK stub_DeviceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define IDS_DEVLIST_ALLOC
Definition: resource.h:81
size_type size() const
Definition: _vector.h:192
#define HIWORD(l)
Definition: typedefs.h:247
Definition: msctf.idl:510
unsigned int ULONG
Definition: retypes.h:1
static HINSTANCE hinst
Definition: edit.c:551
static int CALLBACK lv_sort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IDS_DEVLIST_READONLY_NO
Definition: resource.h:79
NTSTATUS Status
Definition: shellext.h:385
#define malloc
Definition: debug_ros.c:4
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define IDS_USAGE_METADATA_RATIO
Definition: resource.h:60
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define BLOCK_FLAG_DUPLICATE
Definition: shellext.h:80
#define GetWindowLongPtr
Definition: treelist.c:73
uint64_t size
#define IDS_RAID1
Definition: resource.h:46
#define BLOCK_FLAG_RAID5
Definition: shellext.h:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDC_READ_ERRS
Definition: resource.h:324
#define INFINITE
Definition: serial.h:102
LONG objs_loaded
Definition: main.cpp:48
#define LVM_GETNEXTITEM
Definition: commctrl.h:2429
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
wstring name
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
void set_dpi_aware()
Definition: main.cpp:50
#define WM_INITDIALOG
Definition: winuser.h:1721
void RefreshDevList(HWND devlist)
LPARAM lParam
Definition: combotst.c:139
static char title[]
Definition: ps.c:92
int k
Definition: mpi.c:3369
#define LOWORD(l)
Definition: pedump.c:82
#define FSCTL_BTRFS_GET_UUID
Definition: btrfsioctl.h:22
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define PROPSHEETPAGE
Definition: prsht.h:389
#define WM_NOTIFY
Definition: richedit.h:61
uint64_t size
Definition: btrfsioctl.h:104
#define BLOCK_FLAG_RAID1
Definition: shellext.h:79
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define IDS_USAGE_DEV_UNALLOC
Definition: resource.h:58
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65