ReactOS  0.4.13-dev-563-g0561610
propsheet.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 "propsheet.h"
40 #include "resource.h"
41 
42 #define SUBVOL_ROOT_INODE 0x100
43 
44 #ifndef __REACTOS__
45 #ifndef __MINGW32__ // in winternl.h in mingw
46 
47 typedef struct _FILE_ACCESS_INFORMATION {
50 
51 #define FileAccessInformation (FILE_INFORMATION_CLASS)8
52 
60 
61 #define FileStandardInformation (FILE_INFORMATION_CLASS)5
62 
63 #endif
64 #endif
65 
67  if (riid == IID_IUnknown || riid == IID_IShellPropSheetExt) {
68  *ppObj = static_cast<IShellPropSheetExt*>(this);
69  AddRef();
70  return S_OK;
71  } else if (riid == IID_IShellExtInit) {
72  *ppObj = static_cast<IShellExtInit*>(this);
73  AddRef();
74  return S_OK;
75  }
76 
77  *ppObj = nullptr;
78  return E_NOINTERFACE;
79 }
80 
81 void BtrfsPropSheet::do_search(const wstring& fn) {
82  wstring ss;
83  WIN32_FIND_DATAW ffd;
84 
85 #ifndef __REACTOS__
86  ss = fn + L"\\*"s;
87 #else
88  ss = fn + wstring(L"\\*");
89 #endif
90 
91  fff_handle h = FindFirstFileW(ss.c_str(), &ffd);
92  if (h == INVALID_HANDLE_VALUE)
93  return;
94 
95  do {
96  if (ffd.cFileName[0] != '.' || ((ffd.cFileName[1] != 0) && (ffd.cFileName[1] != '.' || ffd.cFileName[2] != 0))) {
97  wstring fn2;
98 
99 #ifndef __REACTOS__
100  fn2 = fn + L"\\"s + ffd.cFileName;
101 #else
102  fn2 = fn + wstring(L"\\") + ffd.cFileName;
103 #endif
104 
105  if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
106  search_list.push_back(fn2);
107  else {
110 
111  if (fh != INVALID_HANDLE_VALUE) {
114  btrfs_inode_info2 bii2;
115 
116  memset(&bii2, 0, sizeof(bii2));
117 
118  Status = NtFsControlFile(fh, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info2));
119 
120  if (NT_SUCCESS(Status)) {
121  sizes[0] += bii2.inline_length;
122  sizes[1] += bii2.disk_size_uncompressed;
123  sizes[2] += bii2.disk_size_zlib;
124  sizes[3] += bii2.disk_size_lzo;
125  sizes[4] += bii2.disk_size_zstd;
127  sparsesize += bii2.sparse_size;
128  }
129 
131 
132  Status = NtQueryInformationFile(fh, &iosb, &fsi, sizeof(fsi), FileStandardInformation);
133 
134  if (NT_SUCCESS(Status)) {
135  if (bii2.inline_length > 0)
137  else
139  }
140  }
141  }
142  }
143  } while (FindNextFileW(h, &ffd));
144 }
145 
147  while (!search_list.empty()) {
149 
151  }
152 
153  thread = nullptr;
154 
155  return 0;
156 }
157 
160 
161  return bps->search_list_thread();
162 }
163 
164 HRESULT BtrfsPropSheet::check_file(const wstring& fn, UINT i, UINT num_files, UINT* sv) {
165  win_handle h;
170  btrfs_inode_info2 bii2;
171 
174 
175  if (h == INVALID_HANDLE_VALUE)
176  return E_FAIL;
177 
179  if (!NT_SUCCESS(Status))
180  return E_FAIL;
181 
184 
186 
187  if (!readonly && num_files == 1 && !can_change_perms)
188  show_admin_button = true;
189 
192 
193  memset(&bii2, 0, sizeof(bii2));
194 
195  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info2));
196 
197  if (NT_SUCCESS(Status) && !bii2.top) {
198  LARGE_INTEGER filesize;
199 
200  if (i == 0) {
201  subvol = bii2.subvol;
202  inode = bii2.inode;
203  type = bii2.type;
204  uid = bii2.st_uid;
205  gid = bii2.st_gid;
206  rdev = bii2.st_rdev;
207  } else {
208  if (subvol != bii2.subvol)
209  various_subvols = true;
210 
211  if (inode != bii2.inode)
212  various_inodes = true;
213 
214  if (type != bii2.type)
215  various_types = true;
216 
217  if (uid != bii2.st_uid)
218  various_uids = true;
219 
220  if (gid != bii2.st_gid)
221  various_gids = true;
222  }
223 
224  if (bii2.inline_length > 0) {
225  totalsize += bii2.inline_length;
226  sizes[0] += bii2.inline_length;
227  }
228 
229  if (bii2.disk_size_uncompressed > 0) {
231  sizes[1] += bii2.disk_size_uncompressed;
232  }
233 
234  if (bii2.disk_size_zlib > 0) {
235  totalsize += bii2.disk_size_zlib;
236  sizes[2] += bii2.disk_size_zlib;
237  }
238 
239  if (bii2.disk_size_lzo > 0) {
240  totalsize += bii2.disk_size_lzo;
241  sizes[3] += bii2.disk_size_lzo;
242  }
243 
244  if (bii2.disk_size_zstd > 0) {
245  totalsize += bii2.disk_size_zstd;
246  sizes[4] += bii2.disk_size_zstd;
247  }
248 
249  sparsesize += bii2.sparse_size;
250 
252 
254 
255  if (!NT_SUCCESS(Status))
256  throw ntstatus_error(Status);
257 
258  if (bii2.inline_length > 0)
260  else
262 
263  min_mode |= ~bii2.st_mode;
264  max_mode |= bii2.st_mode;
265  min_flags |= ~bii2.flags;
266  max_flags |= bii2.flags;
269 
270  if (bii2.inode == SUBVOL_ROOT_INODE) {
271  bool ro = bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY;
272 
273  has_subvols = true;
274 
275  if (*sv == 0)
276  ro_subvol = ro;
277  else {
278  if (ro_subvol != ro)
279  various_ro = true;
280  }
281 
282  (*sv)++;
283  }
284 
285  ignore = false;
286 
287  if (bii2.type != BTRFS_TYPE_DIRECTORY && GetFileSizeEx(h, &filesize)) {
288  if (filesize.QuadPart != 0)
289  can_change_nocow = false;
290  }
291  } else
292  return E_FAIL;
293 
294  return S_OK;
295 }
296 
298  UINT num_files, i, sv = 0;
299  WCHAR fn[MAX_PATH];
300 
301  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, nullptr, 0);
302 
303  min_mode = 0;
304  max_mode = 0;
305  min_flags = 0;
306  max_flags = 0;
307  min_compression_type = 0xff;
310 
311  can_change_perms = true;
312  can_change_nocow = true;
313 
314  sizes[0] = sizes[1] = sizes[2] = sizes[3] = sizes[4] = 0;
316 
317  for (i = 0; i < num_files; i++) {
318  if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) {
319  HRESULT hr;
320 
321  hr = check_file(fn, i, num_files, &sv);
322  if (FAILED(hr))
323  return hr;
324  } else
325  return E_FAIL;
326  }
327 
328  min_mode = ~min_mode;
329  min_flags = ~min_flags;
330 
331  mode = min_mode;
332  mode_set = ~(min_mode ^ max_mode);
333 
334  flags = min_flags;
336 
337  return S_OK;
338 }
339 
341  try {
342  FORMATETC format = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
343  HDROP hdrop;
344  HRESULT hr;
345 
346  if (pidlFolder)
347  return E_FAIL;
348 
349  if (!pdtobj)
350  return E_FAIL;
351 
352  stgm.tymed = TYMED_HGLOBAL;
353 
354  if (FAILED(pdtobj->GetData(&format, &stgm)))
355  return E_INVALIDARG;
356 
357  stgm_set = true;
358 
359  hdrop = (HDROP)GlobalLock(stgm.hGlobal);
360 
361  if (!hdrop) {
363  stgm_set = false;
364  return E_INVALIDARG;
365  }
366 
367  try {
368  hr = load_file_list();
369  if (FAILED(hr))
370  return hr;
371 
372  if (search_list.size() > 0) {
373  thread = CreateThread(nullptr, 0, global_search_list_thread, this, 0, nullptr);
374 
375  if (!thread)
376  throw last_error(GetLastError());
377  }
378  } catch (...) {
379  GlobalUnlock(hdrop);
380  throw;
381  }
382 
383  GlobalUnlock(hdrop);
384  } catch (const exception& e) {
385  error_message(nullptr, e.what());
386 
387  return E_FAIL;
388  }
389 
390  return S_OK;
391 }
392 
393 void BtrfsPropSheet::set_cmdline(const wstring& cmdline) {
394  win_handle h;
397  UINT sv = 0;
399  btrfs_inode_info2 bii2;
401 
402  min_mode = 0;
403  max_mode = 0;
404  min_flags = 0;
405  max_flags = 0;
406  min_compression_type = 0xff;
409 
410  can_change_perms = true;
411  can_change_nocow = true;
412 
415 
416  if (h == INVALID_HANDLE_VALUE)
417  return;
418 
420  if (!NT_SUCCESS(Status))
421  return;
422 
425 
427 
430 
431  memset(&bii2, 0, sizeof(bii2));
432 
433  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info2));
434 
435  if (NT_SUCCESS(Status) && !bii2.top) {
436  LARGE_INTEGER filesize;
437 
438  subvol = bii2.subvol;
439  inode = bii2.inode;
440  type = bii2.type;
441  uid = bii2.st_uid;
442  gid = bii2.st_gid;
443  rdev = bii2.st_rdev;
444 
445  if (bii2.inline_length > 0) {
446  totalsize += bii2.inline_length;
447  sizes[0] += bii2.inline_length;
448  }
449 
450  if (bii2.disk_size_uncompressed > 0) {
452  sizes[1] += bii2.disk_size_uncompressed;
453  }
454 
455  if (bii2.disk_size_zlib > 0) {
456  totalsize += bii2.disk_size_zlib;
457  sizes[2] += bii2.disk_size_zlib;
458  }
459 
460  if (bii2.disk_size_lzo > 0) {
461  totalsize += bii2.disk_size_lzo;
462  sizes[3] += bii2.disk_size_lzo;
463  }
464 
465  if (bii2.disk_size_zstd > 0) {
466  totalsize += bii2.disk_size_zstd;
467  sizes[4] += bii2.disk_size_zstd;
468  }
469 
470  sparsesize += bii2.sparse_size;
471 
473 
475 
476  if (!NT_SUCCESS(Status))
477  throw ntstatus_error(Status);
478 
479  if (bii2.inline_length > 0)
481  else
483 
484  min_mode |= ~bii2.st_mode;
485  max_mode |= bii2.st_mode;
486  min_flags |= ~bii2.flags;
487  max_flags |= bii2.flags;
490 
491  if (bii2.inode == SUBVOL_ROOT_INODE) {
492  bool ro = bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY;
493 
494  has_subvols = true;
495 
496  if (sv == 0)
497  ro_subvol = ro;
498  else {
499  if (ro_subvol != ro)
500  various_ro = true;
501  }
502 
503  sv++;
504  }
505 
506  ignore = false;
507 
508  if (bii2.type != BTRFS_TYPE_DIRECTORY && GetFileSizeEx(h, &filesize)) {
509  if (filesize.QuadPart != 0)
510  can_change_nocow = false;
511  }
512  } else
513  return;
514 
515  min_mode = ~min_mode;
516  min_flags = ~min_flags;
517 
518  mode = min_mode;
519  mode_set = ~(min_mode ^ max_mode);
520 
521  flags = min_flags;
523 
524  if (search_list.size() > 0) {
525  thread = CreateThread(nullptr, 0, global_search_list_thread, this, 0, nullptr);
526 
527  if (!thread)
528  throw last_error(GetLastError());
529  }
530 
531  this->filename = cmdline;
532 }
533 
535  switch (type) {
536  case BTRFS_TYPE_FILE:
537  return IDS_INODE_FILE;
538 
540  return IDS_INODE_DIR;
541 
542  case BTRFS_TYPE_CHARDEV:
543  return IDS_INODE_CHAR;
544 
545  case BTRFS_TYPE_BLOCKDEV:
546  return IDS_INODE_BLOCK;
547 
548  case BTRFS_TYPE_FIFO:
549  return IDS_INODE_FIFO;
550 
551  case BTRFS_TYPE_SOCKET:
552  return IDS_INODE_SOCKET;
553 
554  case BTRFS_TYPE_SYMLINK:
555  return IDS_INODE_SYMLINK;
556 
557  default:
558  return IDS_INODE_UNKNOWN;
559  }
560 }
561 
565 
566  if (state == BST_CHECKED) {
567  flags |= flag;
568  flags_set |= flag;
569  } else if (state == BST_UNCHECKED) {
570  flags &= ~flag;
571  flags_set |= flag;
572  } else if (state == BST_INDETERMINATE) {
573  flags_set = ~flag;
574  }
575 
576  flags_changed = true;
577 
578  SendMessageW(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
579 }
580 
581 void BtrfsPropSheet::apply_changes_file(HWND hDlg, const wstring& fn) {
582  win_handle h;
586  btrfs_inode_info2 bii2;
588 
589  if (flags_changed || ro_changed)
590  perms |= FILE_WRITE_ATTRIBUTES;
591 
593  perms |= WRITE_DAC;
594 
595  if (mode_set & S_ISUID && (((min_mode & S_ISUID) != (max_mode & S_ISUID)) || ((min_mode & S_ISUID) != (mode & S_ISUID))))
596  perms |= WRITE_OWNER;
597 
598  h = CreateFileW(fn.c_str(), perms, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr,
600 
601  if (h == INVALID_HANDLE_VALUE)
602  throw last_error(GetLastError());
603 
604  ZeroMemory(&bsii, sizeof(btrfs_set_inode_info));
605 
606  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info2));
607 
608  if (!NT_SUCCESS(Status))
609  throw ntstatus_error(Status);
610 
611  if (bii2.inode == SUBVOL_ROOT_INODE && ro_changed) {
613  FILE_BASIC_INFO fbi;
614 
615  if (!GetFileInformationByHandle(h, &bhfi))
616  throw last_error(GetLastError());
617 
618  memset(&fbi, 0, sizeof(fbi));
619  fbi.FileAttributes = bhfi.dwFileAttributes;
620 
621  if (ro_subvol)
622  fbi.FileAttributes |= FILE_ATTRIBUTE_READONLY;
623  else
624  fbi.FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
625 
626  if (!SetFileInformationByHandle(h, FileBasicInfo, &fbi, sizeof(fbi)))
627  throw last_error(GetLastError());
628  }
629 
631  if (flags_changed) {
632  bsii.flags_changed = true;
633  bsii.flags = (bii2.flags & ~flags_set) | (flags & flags_set);
634  }
635 
636  if (perms_changed) {
637  bsii.mode_changed = true;
638  bsii.st_mode = (bii2.st_mode & ~mode_set) | (mode & mode_set);
639  }
640 
641  if (uid_changed) {
642  bsii.uid_changed = true;
643  bsii.st_uid = uid;
644  }
645 
646  if (gid_changed) {
647  bsii.gid_changed = true;
648  bsii.st_gid = gid;
649  }
650 
651  if (compress_type_changed) {
652  bsii.compression_type_changed = true;
654  }
655 
656  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_SET_INODE_INFO, &bsii, sizeof(btrfs_set_inode_info), nullptr, 0);
657 
658  if (!NT_SUCCESS(Status))
659  throw ntstatus_error(Status);
660  }
661 }
662 
664  UINT num_files, i;
665  WCHAR fn[MAX_PATH]; // FIXME - is this long enough?
666 
667  if (various_uids)
668  uid_changed = false;
669 
670  if (various_gids)
671  gid_changed = false;
672 
674  return;
675 
676  if (filename[0] != 0)
678  else {
679  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, nullptr, 0);
680 
681  for (i = 0; i < num_files; i++) {
682  if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) {
683  apply_changes_file(hDlg, fn);
684  }
685  }
686  }
687 
688  flags_changed = false;
689  perms_changed = false;
690  uid_changed = false;
691  gid_changed = false;
692  ro_changed = false;
693 }
694 
696  wstring s, size_on_disk, cr;
697  WCHAR old_text[1024];
698  float ratio;
699 
700  format_size(totalsize, size_on_disk, true);
701 
702  wstring_sprintf(s, size_format, size_on_disk.c_str());
703 
704  if (allocsize == sparsesize || totalsize == 0)
705  ratio = 0.0f;
706  else
707  ratio = 100.0f * (1.0f - ((float)totalsize / (float)(allocsize - sparsesize)));
708 
709  wstring_sprintf(cr, cr_format, ratio);
710 
711  GetDlgItemTextW(hwndDlg, IDC_SIZE_ON_DISK, old_text, sizeof(old_text) / sizeof(WCHAR));
712 
713  if (s != old_text)
714  SetDlgItemTextW(hwndDlg, IDC_SIZE_ON_DISK, s.c_str());
715 
716  GetDlgItemTextW(hwndDlg, IDC_COMPRESSION_RATIO, old_text, sizeof(old_text) / sizeof(WCHAR));
717 
718  if (cr != old_text)
719  SetDlgItemTextW(hwndDlg, IDC_COMPRESSION_RATIO, cr.c_str());
720 }
721 
723  if (state == BST_CHECKED) {
724  mode |= flag;
725  mode_set |= flag;
726  } else if (state == BST_UNCHECKED) {
727  mode &= ~flag;
728  mode_set |= flag;
729  } else if (state == BST_INDETERMINATE) {
730  mode_set = ~flag;
731  }
732 
733  perms_changed = true;
734 
735  SendMessageW(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
736 }
737 
739  if (this->uid != uid) {
740  this->uid = uid;
741  uid_changed = true;
742 
743  SendMessageW(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
744  }
745 }
746 
748  if (this->gid != gid) {
749  this->gid = gid;
750  gid_changed = true;
751 
752  SendMessageW(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
753  }
754 }
755 
757  wstring size;
758  WCHAR old_text[1024];
759  int i;
761 
762  for (i = 0; i < 5; i++) {
763  format_size(sizes[i], size, true);
764 
765  GetDlgItemTextW(hDlg, items[i], old_text, sizeof(old_text) / sizeof(WCHAR));
766 
767  if (size != old_text)
768  SetDlgItemTextW(hDlg, items[i], size.c_str());
769  }
770 }
771 
773  try {
774  switch (uMsg) {
775  case WM_INITDIALOG:
776  {
778 
779  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
780 
781  bps->update_size_details_dialog(hwndDlg);
782 
783  if (bps->thread)
784  SetTimer(hwndDlg, 1, 250, nullptr);
785 
786  return true;
787  }
788 
789  case WM_COMMAND:
790  if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) {
791  EndDialog(hwndDlg, 0);
792  return true;
793  }
794  break;
795 
796  case WM_TIMER:
797  {
799 
800  if (bps) {
801  bps->update_size_details_dialog(hwndDlg);
802 
803  if (!bps->thread)
804  KillTimer(hwndDlg, 1);
805  }
806 
807  break;
808  }
809  }
810  } catch (const exception& e) {
811  error_message(hwndDlg, e.what());
812  }
813 
814  return false;
815 }
816 
817 static void set_check_box(HWND hwndDlg, ULONG id, uint64_t min, uint64_t max) {
818  if (min && max) {
819  SendDlgItemMessage(hwndDlg, id, BM_SETCHECK, BST_CHECKED, 0);
820  } else if (!min && !max) {
821  SendDlgItemMessage(hwndDlg, id, BM_SETCHECK, BST_UNCHECKED, 0);
822  } else {
823  LONG_PTR style;
824 
825  style = GetWindowLongPtr(GetDlgItem(hwndDlg, id), GWL_STYLE);
827  style |= BS_AUTO3STATE;
828  SetWindowLongPtr(GetDlgItem(hwndDlg, id), GWL_STYLE, style);
829 
831  }
832 }
833 
835  ULONG num_files, i;
836  WCHAR fn[MAX_PATH], modfn[MAX_PATH];
837 
838  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, nullptr, 0);
839 
840  if (num_files == 0)
841  return;
842 
843  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
844 
845  for (i = 0; i < num_files; i++) {
846  if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) {
847  wstring t;
848  SHELLEXECUTEINFOW sei;
849 
850 #ifndef __REACTOS__
851  t = L"\""s + modfn + L"\",ShowPropSheet "s + fn;
852 #else
853  t = wstring(L"\"") + modfn + wstring(L"\",ShowPropSheet ") + fn;
854 #endif
855 
856  RtlZeroMemory(&sei, sizeof(sei));
857 
858  sei.cbSize = sizeof(sei);
859  sei.hwnd = hwndDlg;
860  sei.lpVerb = L"runas";
861  sei.lpFile = L"rundll32.exe";
862  sei.lpParameters = t.c_str();
863  sei.nShow = SW_SHOW;
865 
866  if (!ShellExecuteExW(&sei))
867  throw last_error(GetLastError());
868 
870  CloseHandle(sei.hProcess);
871 
872  load_file_list();
873  init_propsheet(hwndDlg);
874  }
875  }
876 }
877 
878 // based on functions in sys/sysmacros.h
879 #define major(rdev) ((((rdev) >> 8) & 0xFFF) | ((uint32_t)((rdev) >> 32) & ~0xFFF))
880 #define minor(rdev) (((rdev) & 0xFF) | ((uint32_t)((rdev) >> 12) & ~0xFF))
881 
883  wstring s;
884  ULONG sr;
885  int i;
886  HWND comptype;
887 
892 
893  if (various_subvols) {
895  throw last_error(GetLastError());
896  } else
897  wstring_sprintf(s, L"%llx", subvol);
898 
899  SetDlgItemTextW(hwndDlg, IDC_SUBVOL, s.c_str());
900 
901  if (various_inodes) {
903  throw last_error(GetLastError());
904  } else
905  wstring_sprintf(s, L"%llx", inode);
906 
907  SetDlgItemTextW(hwndDlg, IDC_INODE, s.c_str());
908 
909  if (various_types)
910  sr = IDS_VARIOUS;
911  else
913 
914  if (various_inodes) {
915  if (sr == IDS_INODE_CHAR)
917  else if (sr == IDS_INODE_BLOCK)
919  }
920 
921  if (sr == IDS_INODE_UNKNOWN) {
922  wstring t;
923 
924  if (!load_string(module, sr, t))
925  throw last_error(GetLastError());
926 
927  wstring_sprintf(s, t, type);
928  } else if (sr == IDS_INODE_CHAR || sr == IDS_INODE_BLOCK) {
929  wstring t;
930 
931  if (!load_string(module, sr, t))
932  throw last_error(GetLastError());
933 
935  } else {
936  if (!load_string(module, sr, s))
937  throw last_error(GetLastError());
938  }
939 
940  SetDlgItemTextW(hwndDlg, IDC_TYPE, s.c_str());
941 
942  if (size_format[0] == 0)
943  GetDlgItemTextW(hwndDlg, IDC_SIZE_ON_DISK, size_format, sizeof(size_format) / sizeof(WCHAR));
944 
945  if (cr_format[0] == 0)
946  GetDlgItemTextW(hwndDlg, IDC_COMPRESSION_RATIO, cr_format, sizeof(cr_format) / sizeof(WCHAR));
947 
948  set_size_on_disk(hwndDlg);
949 
950  if (thread)
951  SetTimer(hwndDlg, 1, 250, nullptr);
952 
955 
956  comptype = GetDlgItem(hwndDlg, IDC_COMPRESS_TYPE);
957 
958  while (SendMessage(comptype, CB_GETCOUNT, 0, 0) > 0) {
959  SendMessage(comptype, CB_DELETESTRING, 0, 0);
960  }
961 
963  SendMessage(comptype, CB_ADDSTRING, 0, (LPARAM)L"");
964  SendMessage(comptype, CB_SETCURSEL, 0, 0);
965  }
966 
967  i = 0;
968  while (comp_types[i] != 0) {
969  wstring t;
970 
971  if (!load_string(module, comp_types[i], t))
972  throw last_error(GetLastError());
973 
974  SendMessage(comptype, CB_ADDSTRING, 0, (LPARAM)t.c_str());
975 
976  i++;
977  }
978 
982  }
983 
985 
986  i = 0;
987  while (perm_controls[i] != 0) {
988  set_check_box(hwndDlg, perm_controls[i], min_mode & perms[i], max_mode & perms[i]);
989  i++;
990  }
991 
992  if (various_uids) {
994  throw last_error(GetLastError());
995 
996  EnableWindow(GetDlgItem(hwndDlg, IDC_UID), 0);
997  } else
998  s = to_wstring(uid);
999 
1000  SetDlgItemTextW(hwndDlg, IDC_UID, s.c_str());
1001 
1002  if (various_gids) {
1003  if (!load_string(module, IDS_VARIOUS, s))
1004  throw last_error(GetLastError());
1005 
1006  EnableWindow(GetDlgItem(hwndDlg, IDC_GID), 0);
1007  } else
1008  s = to_wstring(gid);
1009 
1010  SetDlgItemTextW(hwndDlg, IDC_GID, s.c_str());
1011 
1013 
1014  if (has_subvols)
1016 
1017  if (!can_change_nocow)
1018  EnableWindow(GetDlgItem(hwndDlg, IDC_NODATACOW), 0);
1019 
1020  if (!can_change_perms) {
1021  i = 0;
1022  while (perm_controls[i] != 0) {
1023  EnableWindow(GetDlgItem(hwndDlg, perm_controls[i]), 0);
1024  i++;
1025  }
1026 
1027  EnableWindow(GetDlgItem(hwndDlg, IDC_UID), 0);
1028  EnableWindow(GetDlgItem(hwndDlg, IDC_GID), 0);
1029  EnableWindow(GetDlgItem(hwndDlg, IDC_SETUID), 0);
1030  }
1031 
1032  if (readonly) {
1033  EnableWindow(GetDlgItem(hwndDlg, IDC_NODATACOW), 0);
1034  EnableWindow(GetDlgItem(hwndDlg, IDC_COMPRESS), 0);
1036  }
1037 
1038  if (show_admin_button) {
1039  SendMessageW(GetDlgItem(hwndDlg, IDC_OPEN_ADMIN), BCM_SETSHIELD, 0, true);
1041  } else
1043 }
1044 
1046  try {
1047  switch (uMsg) {
1048  case WM_INITDIALOG:
1049  {
1051  BtrfsPropSheet* bps = (BtrfsPropSheet*)psp->lParam;
1052 
1054 
1055  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
1056 
1057  bps->init_propsheet(hwndDlg);
1058 
1059  return false;
1060  }
1061 
1062  case WM_COMMAND:
1063  {
1065 
1066  if (bps && !bps->readonly) {
1067  switch (HIWORD(wParam)) {
1068  case BN_CLICKED: {
1069  switch (LOWORD(wParam)) {
1070  case IDC_NODATACOW:
1072  break;
1073 
1074  case IDC_COMPRESS:
1076 
1078  break;
1079 
1080  case IDC_USERR:
1081  bps->change_perm_flag(hwndDlg, S_IRUSR, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1082  break;
1083 
1084  case IDC_USERW:
1085  bps->change_perm_flag(hwndDlg, S_IWUSR, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1086  break;
1087 
1088  case IDC_USERX:
1089  bps->change_perm_flag(hwndDlg, S_IXUSR, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1090  break;
1091 
1092  case IDC_GROUPR:
1093  bps->change_perm_flag(hwndDlg, S_IRGRP, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1094  break;
1095 
1096  case IDC_GROUPW:
1097  bps->change_perm_flag(hwndDlg, S_IWGRP, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1098  break;
1099 
1100  case IDC_GROUPX:
1101  bps->change_perm_flag(hwndDlg, S_IXGRP, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1102  break;
1103 
1104  case IDC_OTHERR:
1105  bps->change_perm_flag(hwndDlg, S_IROTH, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1106  break;
1107 
1108  case IDC_OTHERW:
1109  bps->change_perm_flag(hwndDlg, S_IWOTH, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1110  break;
1111 
1112  case IDC_OTHERX:
1113  bps->change_perm_flag(hwndDlg, S_IXOTH, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1114  break;
1115 
1116  case IDC_SETUID:
1117  bps->change_perm_flag(hwndDlg, S_ISUID, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1118  break;
1119 
1120  case IDC_SETGID:
1121  bps->change_perm_flag(hwndDlg, S_ISGID, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1122  break;
1123 
1124  case IDC_STICKY:
1125  bps->change_perm_flag(hwndDlg, S_ISVTX, IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
1126  break;
1127 
1128  case IDC_SUBVOL_RO:
1129  switch (IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) {
1130  case BST_CHECKED:
1131  bps->ro_subvol = true;
1132  bps->ro_changed = true;
1133  break;
1134 
1135  case BST_UNCHECKED:
1136  bps->ro_subvol = false;
1137  bps->ro_changed = true;
1138  break;
1139 
1140  case BST_INDETERMINATE:
1141  bps->ro_changed = false;
1142  break;
1143  }
1144 
1145  SendMessageW(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
1146  break;
1147 
1148  case IDC_OPEN_ADMIN:
1149  bps->open_as_admin(hwndDlg);
1150  break;
1151  }
1152 
1153  break;
1154  }
1155 
1156  case EN_CHANGE: {
1157  switch (LOWORD(wParam)) {
1158  case IDC_UID: {
1159  WCHAR s[255];
1160 
1161  GetDlgItemTextW(hwndDlg, LOWORD(wParam), s, sizeof(s) / sizeof(WCHAR));
1162 
1163  bps->change_uid(hwndDlg, _wtoi(s));
1164  break;
1165  }
1166 
1167  case IDC_GID: {
1168  WCHAR s[255];
1169 
1170  GetDlgItemTextW(hwndDlg, LOWORD(wParam), s, sizeof(s) / sizeof(WCHAR));
1171 
1172  bps->change_gid(hwndDlg, _wtoi(s));
1173  break;
1174  }
1175  }
1176 
1177  break;
1178  }
1179 
1180  case CBN_SELCHANGE: {
1181  switch (LOWORD(wParam)) {
1182  case IDC_COMPRESS_TYPE: {
1183  int sel = SendMessageW(GetDlgItem(hwndDlg, LOWORD(wParam)), CB_GETCURSEL, 0, 0);
1184 
1185  if (bps->min_compression_type != bps->max_compression_type) {
1186  if (sel == 0)
1187  bps->compress_type_changed = false;
1188  else {
1189  bps->compress_type = (uint8_t)(sel - 1);
1190  bps->compress_type_changed = true;
1191  }
1192  } else {
1193  bps->compress_type = (uint8_t)sel;
1194  bps->compress_type_changed = true;
1195  }
1196 
1197  SendMessageW(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
1198 
1199  break;
1200  }
1201  }
1202 
1203  break;
1204  }
1205  }
1206  }
1207 
1208  break;
1209  }
1210 
1211  case WM_NOTIFY:
1212  {
1213  switch (((LPNMHDR)lParam)->code) {
1214  case PSN_KILLACTIVE:
1215  SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, false);
1216  break;
1217 
1218  case PSN_APPLY: {
1220 
1221  bps->apply_changes(hwndDlg);
1223  break;
1224  }
1225 
1226  case NM_CLICK:
1227  case NM_RETURN: {
1228  if (((LPNMHDR)lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_SIZE_ON_DISK)) {
1229  PNMLINK pNMLink = (PNMLINK)lParam;
1230 
1231  if (pNMLink->item.iLink == 0)
1233  }
1234  break;
1235  }
1236  }
1237  }
1238 
1239  case WM_TIMER:
1240  {
1242 
1243  if (bps) {
1244  bps->set_size_on_disk(hwndDlg);
1245 
1246  if (!bps->thread)
1247  KillTimer(hwndDlg, 1);
1248  }
1249 
1250  break;
1251  }
1252  }
1253  } catch (const exception& e) {
1254  error_message(hwndDlg, e.what());
1255  }
1256 
1257  return false;
1258 }
1259 
1261  try {
1262  PROPSHEETPAGE psp;
1263  HPROPSHEETPAGE hPage;
1264  INITCOMMONCONTROLSEX icex;
1265 
1266  if (ignore)
1267  return S_OK;
1268 
1269  icex.dwSize = sizeof(icex);
1270  icex.dwICC = ICC_LINK_CLASS;
1271 
1272  if (!InitCommonControlsEx(&icex))
1274 
1275  psp.dwSize = sizeof(psp);
1276  psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
1277  psp.hInstance = module;
1278  psp.pszTemplate = MAKEINTRESOURCE(IDD_PROP_SHEET);
1279  psp.hIcon = 0;
1280  psp.pszTitle = MAKEINTRESOURCE(IDS_PROP_SHEET_TITLE);
1281  psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
1282  psp.pcRefParent = (UINT*)&objs_loaded;
1283  psp.pfnCallback = nullptr;
1284  psp.lParam = (LPARAM)this;
1285 
1286  hPage = CreatePropertySheetPage(&psp);
1287 
1288  if (hPage) {
1289  if (pfnAddPage(hPage, lParam)) {
1290  this->AddRef();
1291  return S_OK;
1292  } else
1293  DestroyPropertySheetPage(hPage);
1294  } else
1295  return E_OUTOFMEMORY;
1296  } catch (const exception& e) {
1297  error_message(nullptr, e.what());
1298  }
1299 
1300  return E_FAIL;
1301 }
1302 
1304  return S_OK;
1305 }
1306 
1307 #ifdef __cplusplus
1308 extern "C" {
1309 #endif
1310 
1311 void CALLBACK ShowPropSheetW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow) {
1312  try {
1313  BtrfsPropSheet bps;
1314  PROPSHEETPAGEW psp;
1315  PROPSHEETHEADERW psh;
1316  wstring title;
1317 
1318  set_dpi_aware();
1319 
1321 
1322  bps.set_cmdline(lpszCmdLine);
1323 
1324  psp.dwSize = sizeof(psp);
1325  psp.dwFlags = PSP_USETITLE;
1326  psp.hInstance = module;
1328  psp.hIcon = 0;
1331  psp.pfnCallback = nullptr;
1332  psp.lParam = (LPARAM)&bps;
1333 
1334  memset(&psh, 0, sizeof(PROPSHEETHEADERW));
1335 
1336  psh.dwSize = sizeof(PROPSHEETHEADERW);
1337  psh.dwFlags = PSH_PROPSHEETPAGE;
1338  psh.hwndParent = hwnd;
1339  psh.hInstance = psp.hInstance;
1340  psh.pszCaption = title.c_str();
1341  psh.nPages = 1;
1342  psh.ppsp = &psp;
1343 
1344  PropertySheetW(&psh);
1345  } catch (const exception& e) {
1346  error_message(hwnd, e.what());
1347  }
1348 }
1349 
1350 #ifdef __cplusplus
1351 }
1352 #endif
#define IDS_INODE_UNKNOWN
Definition: resource.h:27
static INT_PTR CALLBACK SizeDetailsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.cpp:772
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define IDC_USERW
Definition: resource.h:215
uint64_t subvol
Definition: propsheet.h:175
HWND hwndParent
Definition: prsht.h:277
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
#define IDC_SIZE_ZSTD
Definition: resource.h:240
void change_uid(HWND hDlg, uint32_t uid)
Definition: propsheet.cpp:738
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
bool uid_changed
Definition: propsheet.h:186
#define max(a, b)
Definition: svc.c:63
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
#define FileAccessInformation
Definition: propsheet.cpp:51
#define REFIID
Definition: guiddef.h:113
void pop_front()
Definition: _deque.h:722
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:398
HMODULE module
Definition: main.cpp:47
#define E_NOINTERFACE
Definition: winerror.h:2364
reference front()
Definition: _deque.h:458
struct _FILE_STANDARD_INFORMATION FILE_STANDARD_INFORMATION
void set_cmdline(const wstring &cmdline)
Definition: propsheet.cpp:393
LPCPROPSHEETPAGEW ppsp
Definition: prsht.h:290
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
void update_size_details_dialog(HWND hDlg)
Definition: propsheet.cpp:756
LPCWSTR pszTemplate
Definition: prsht.h:209
#define IDC_GROUPR
Definition: resource.h:213
#define BTRFS_TYPE_SOCKET
Definition: shellext.h:85
HRESULT hr
Definition: shlfolder.c:183
#define BTRFS_INODE_NODATACOW
Definition: propsheet.h:77
#define S_ISGID
Definition: propsheet.h:69
UINT8 compression_type
Definition: btrfsioctl.h:97
void change_gid(HWND hDlg, uint32_t gid)
Definition: propsheet.cpp:747
#define IDD_PROP_SHEET
Definition: resource.h:15
#define IDC_UID
Definition: resource.h:210
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2036
bool various_inodes
Definition: propsheet.h:178
void push_back(const value_type &__t=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _deque.h:668
bool various_gids
Definition: propsheet.h:178
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
uint8_t max_compression_type
Definition: propsheet.h:176
#define SW_HIDE
Definition: winuser.h:762
#define BTRFS_TYPE_BLOCKDEV
Definition: shellext.h:83
REFIID riid
Definition: precomp.h:44
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3135
#define IDC_USERR
Definition: resource.h:212
#define SUBVOL_ROOT_INODE
Definition: propsheet.cpp:42
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define IDS_INODE_FIFO
Definition: resource.h:24
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: propsheet.cpp:66
LONG NTSTATUS
Definition: precomp.h:26
#define BTRFS_TYPE_FIFO
Definition: shellext.h:84
#define CALLBACK
Definition: compat.h:27
uint64_t max_flags
Definition: propsheet.h:174
int iLink
Definition: commctrl.h:4724
HRESULT load_file_list()
Definition: propsheet.cpp:297
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:309
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)
UINT_PTR WPARAM
Definition: windef.h:207
#define IDS_INITCOMMONCONTROLSEX_FAILED
Definition: resource.h:206
#define IDC_TYPE
Definition: resource.h:224
struct _FILE_ACCESS_INFORMATION FILE_ACCESS_INFORMATION
#define SendDlgItemMessage
Definition: winuser.h:5708
UINT64 disk_size_zstd
Definition: btrfsioctl.h:98
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define BCM_SETSHIELD
Definition: commctrl.h:4625
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSN_APPLY
Definition: prsht.h:117
#define WRITE_OWNER
Definition: nt_native.h:60
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define BTRFS_TYPE_CHARDEV
Definition: shellext.h:82
int32_t INT_PTR
Definition: typedefs.h:62
#define IDC_SUBVOL_RO
Definition: resource.h:318
const char * filename
Definition: ioapi.h:135
virtual HRESULT __stdcall ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
Definition: propsheet.cpp:1303
#define IDC_USERX
Definition: resource.h:218
#define E_FAIL
Definition: ddrawi.h:102
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1904
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define BST_INDETERMINATE
Definition: winuser.h:198
WCHAR size_format[255]
Definition: propsheet.h:171
#define IDS_INODE_BLOCK_SIMPLE
Definition: resource.h:40
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define FILE_SHARE_READ
Definition: compat.h:125
uint64_t totalsize
Definition: propsheet.h:187
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define IDD_SIZE_DETAILS
Definition: resource.h:8
uint64_t allocsize
Definition: propsheet.h:187
#define IDC_COMPRESS
Definition: resource.h:225
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
void change_inode_flag(HWND hDlg, uint64_t flag, UINT state)
Definition: propsheet.cpp:562
Definition: fs.h:78
#define IDC_GID
Definition: resource.h:211
void apply_changes_file(HWND hDlg, const wstring &fn)
Definition: propsheet.cpp:581
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define IDS_INODE_CHAR_SIMPLE
Definition: resource.h:39
#define IDS_INODE_SOCKET
Definition: resource.h:25
#define FILE_TRAVERSE
Definition: nt_native.h:643
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
void do_search(const wstring &fn)
Definition: propsheet.cpp:81
#define IDC_SIZE_ZLIB
Definition: resource.h:233
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:738
#define PSN_KILLACTIVE
Definition: prsht.h:116
uint8_t min_compression_type
Definition: propsheet.h:176
DWORD dwSize
Definition: prsht.h:205
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
bool has_subvols
Definition: propsheet.h:178
bool empty() const
Definition: _deque.h:473
LPCWSTR pszCaption
Definition: prsht.h:283
DLGPROC pfnDlgProc
Definition: prsht.h:217
#define BTRFS_INODE_COMPRESS
Definition: propsheet.h:87
#define e
Definition: ke_i.h:82
#define S_IRGRP
Definition: propsheet.h:41
#define S_IXOTH
Definition: propsheet.h:61
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDC_NODATACOW
Definition: resource.h:221
#define IDS_INODE_SYMLINK
Definition: resource.h:26
#define GWLP_USERDATA
Definition: treelist.c:63
uint64_t min_flags
Definition: propsheet.h:174
#define CB_ADDSTRING
Definition: winuser.h:1897
#define E_INVALIDARG
Definition: ddrawi.h:101
#define BTRFS_TYPE_DIRECTORY
Definition: shellext.h:81
#define IDC_SIZE_UNCOMPRESSED
Definition: resource.h:230
unsigned char BOOLEAN
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define CF_HDROP
Definition: constants.h:410
struct tagNMLINK * PNMLINK
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
#define BS_AUTO3STATE
Definition: pedump.c:657
DWORD search_list_thread()
Definition: propsheet.cpp:146
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_INODE_BLOCK
Definition: resource.h:23
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2225
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2896
#define IDS_VARIOUS
Definition: resource.h:38
LPCWSTR pszTitle
Definition: prsht.h:216
#define SW_SHOW
Definition: winuser.h:769
bool various_subvols
Definition: propsheet.h:178
uint32_t uid
Definition: propsheet.h:177
bool various_uids
Definition: propsheet.h:178
#define IDC_COMPRESS_TYPE
Definition: resource.h:316
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define OPEN_EXISTING
Definition: compat.h:426
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define CreatePropertySheetPage
Definition: prsht.h:381
uint32_t mode_set
Definition: propsheet.h:173
#define IDC_GROUPX
Definition: resource.h:219
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
#define S_IWGRP
Definition: propsheet.h:45
#define S_IXGRP
Definition: propsheet.h:49
#define BM_SETCHECK
Definition: winuser.h:1882
#define IDC_OTHERW
Definition: resource.h:217
GLsizeiptr size
Definition: glext.h:5919
#define S_IWUSR
Definition: propsheet.h:33
void set_size_on_disk(HWND hwndDlg)
Definition: propsheet.cpp:695
bool compress_type_changed
Definition: propsheet.h:178
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
uint32_t min_mode
Definition: propsheet.h:173
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
bool perms_changed
Definition: propsheet.h:186
virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
Definition: propsheet.cpp:340
LONG HRESULT
Definition: typedefs.h:77
HINSTANCE hInstance
Definition: prsht.h:278
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define BTRFS_INODE_NODATASUM
Definition: propsheet.h:76
const GUID IID_IUnknown
#define WM_TIMER
Definition: winuser.h:1718
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
static void set_check_box(HWND hwndDlg, ULONG id, uint64_t min, uint64_t max)
Definition: propsheet.cpp:817
bool gid_changed
Definition: propsheet.h:186
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WRITE_DAC
Definition: nt_native.h:59
#define __stdcall
Definition: typedefs.h:25
#define IDS_COMPRESS_ZSTD
Definition: resource.h:199
deque< wstring > search_list
Definition: propsheet.h:188
DWORD dwSize
Definition: prsht.h:275
LARGE_INTEGER AllocationSize
Definition: propsheet.cpp:54
#define IDC_SIZE_INLINE
Definition: resource.h:228
DWORD dwFlags
Definition: prsht.h:276
GLbitfield flags
Definition: glext.h:7161
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define PSNRET_NOERROR
Definition: prsht.h:129
HANDLE thread
Definition: propsheet.h:172
uint64_t sparsesize
Definition: propsheet.h:187
#define GetFileSizeEx
Definition: compat.h:414
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define IDC_GROUPW
Definition: resource.h:216
#define PSP_USEREFPARENT
Definition: prsht.h:29
WCHAR cr_format[255]
Definition: propsheet.h:171
bool can_change_perms
Definition: propsheet.h:169
#define S_IXUSR
Definition: propsheet.h:37
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static DWORD WINAPI global_search_list_thread(LPVOID lpParameter)
Definition: propsheet.cpp:158
#define IDC_STICKY
Definition: resource.h:235
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
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 flag
Definition: glfuncs.h:52
#define S_IROTH
Definition: propsheet.h:53
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
LPARAM lParam
Definition: prsht.h:218
LPVOID lpParameter
Definition: kernel32.h:234
#define IDC_OPEN_ADMIN
Definition: resource.h:276
static int state
Definition: maze.c:121
#define IDS_INODE_DIR
Definition: resource.h:20
HINSTANCE hInstance
Definition: prsht.h:207
#define IDC_COMPRESSION_RATIO
Definition: resource.h:241
GLdouble s
Definition: gl.h:2039
#define IDS_INODE_FILE
Definition: resource.h:18
#define CB_SETCURSEL
Definition: winuser.h:1922
#define WM_COMMAND
Definition: winuser.h:1716
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define FSCTL_BTRFS_SET_INODE_INFO
Definition: btrfsioctl.h:12
#define PSP_USETITLE
Definition: prsht.h:26
GLenum mode
Definition: glext.h:6217
#define IDS_STANDALONE_PROPSHEET_TITLE
Definition: resource.h:126
#define BST_UNCHECKED
Definition: winuser.h:199
#define NM_CLICK
Definition: commctrl.h:130
struct _FILE_STANDARD_INFORMATION * PFILE_STANDARD_INFORMATION
BYTE uint8_t
Definition: msvideo1.c:66
STGMEDIUM stgm
Definition: propsheet.h:184
UINT64 disk_size_zlib
Definition: btrfsioctl.h:95
void change_perm_flag(HWND hDlg, ULONG perm, UINT state)
Definition: propsheet.cpp:722
uint8_t compress_type
Definition: propsheet.h:176
#define S_IWOTH
Definition: propsheet.h:57
Status
Definition: gdiplustypes.h:24
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2849
HICON hIcon
Definition: prsht.h:213
uint32_t gid
Definition: propsheet.h:177
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_SETUID
Definition: resource.h:229
#define GWL_STYLE
Definition: winuser.h:846
#define NM_RETURN
Definition: commctrl.h:132
HWND WINAPI GetParent(_In_ HWND)
bool flags_changed
Definition: propsheet.h:186
#define S_OK
Definition: intsafe.h:59
UINT64 uint64_t
Definition: types.h:77
#define IDC_SIZE_ON_DISK
Definition: resource.h:226
ULONG __stdcall AddRef()
Definition: propsheet.h:133
#define uint8_t
Definition: nsiface.idl:59
#define IDC_SETGID
Definition: resource.h:232
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
LPCWSTR lpParameters
Definition: shellapi.h:331
#define S_ISUID
Definition: propsheet.h:65
#define FSCTL_BTRFS_GET_INODE_INFO
Definition: btrfsioctl.h:11
#define major(rdev)
Definition: propsheet.cpp:879
#define IDC_SUBVOL
Definition: resource.h:222
virtual HRESULT __stdcall AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: propsheet.cpp:1260
uint64_t sizes[5]
Definition: propsheet.h:187
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_COMPRESS_ANY
Definition: resource.h:123
#define S_IRUSR
Definition: propsheet.h:29
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
UINT64 sparse_size
Definition: btrfsioctl.h:99
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define PSM_CHANGED
Definition: prsht.h:164
bool various_types
Definition: propsheet.h:178
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define CBN_SELCHANGE
Definition: winuser.h:1940
UINT64 disk_size_lzo
Definition: btrfsioctl.h:96
UINT32 uint32_t
Definition: types.h:75
void apply_changes(HWND hDlg)
Definition: propsheet.cpp:663
#define IDC_OTHERR
Definition: resource.h:214
#define BST_CHECKED
Definition: winuser.h:197
#define FileStandardInformation
Definition: propsheet.cpp:61
#define CreateFileW
Definition: compat.h:400
#define BTRFS_TYPE_FILE
Definition: shellext.h:80
size_type size() const
Definition: _deque.h:471
static ULONG inode_type_to_string_ref(uint8_t type)
Definition: propsheet.cpp:534
BOOL WINAPI SetFileInformationByHandle(HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize)
Definition: reactos.cpp:177
#define SendMessage
Definition: winuser.h:5709
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define IDC_INODE
Definition: resource.h:223
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
bool show_admin_button
Definition: propsheet.h:178
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define minor(rdev)
Definition: propsheet.cpp:880
static HINSTANCE hinst
Definition: edit.c:551
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
UINT64 disk_size_uncompressed
Definition: btrfsioctl.h:94
#define IDS_INODE_CHAR
Definition: resource.h:22
void init_propsheet(HWND hwndDlg)
Definition: propsheet.cpp:882
#define CB_GETCOUNT
Definition: winuser.h:1903
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define IDS_COMPRESS_ZLIB
Definition: resource.h:124
void CALLBACK ShowPropSheetW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
Definition: propsheet.cpp:1311
uint32_t max_mode
Definition: propsheet.h:173
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
uint64_t flags_set
Definition: propsheet.h:174
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDC_SIZE_LZO
Definition: resource.h:237
uint64_t rdev
Definition: propsheet.h:175
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CB_DELETESTRING
Definition: winuser.h:1898
#define IDCANCEL
Definition: winuser.h:825
#define ss
Definition: i386-dis.c:432
#define INFINITE
Definition: serial.h:102
LONG objs_loaded
Definition: main.cpp:48
static TCHAR * items[]
Definition: page1.c:45
Arabic default style
Definition: afstyles.h:93
struct _FILE_ACCESS_INFORMATION * PFILE_ACCESS_INFORMATION
HRESULT check_file(const wstring &fn, UINT i, UINT num_files, UINT *sv)
Definition: propsheet.cpp:164
#define memset(x, y, z)
Definition: compat.h:39
void open_as_admin(HWND hwndDlg)
Definition: propsheet.cpp:834
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:1715
LPARAM lParam
Definition: combotst.c:139
static char title[]
Definition: ps.c:92
#define IDC_OTHERX
Definition: resource.h:220
bool can_change_nocow
Definition: propsheet.h:170
#define LOWORD(l)
Definition: pedump.c:82
DWORD dwFlags
Definition: prsht.h:206
ULONG ACCESS_MASK
Definition: nt_native.h:40
static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.cpp:1045
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define PROPSHEETPAGE
Definition: prsht.h:371
#define WM_NOTIFY
Definition: richedit.h:61
#define IDS_COMPRESS_LZO
Definition: resource.h:125
#define S_ISVTX
Definition: propsheet.h:73
LONGLONG QuadPart
Definition: typedefs.h:112
#define BTRFS_TYPE_SYMLINK
Definition: shellext.h:86
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
UINT32 inline_length
Definition: btrfsioctl.h:93
#define IDS_PROP_SHEET_TITLE
Definition: resource.h:16
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65
#define EN_CHANGE
Definition: winuser.h:1983