ReactOS  0.4.14-dev-815-ge410a12
BtrfsVolPropSheet Class Reference

#include <volpropsheet.h>

Inheritance diagram for BtrfsVolPropSheet:
Collaboration diagram for BtrfsVolPropSheet:

Public Member Functions

 BtrfsVolPropSheet ()
 
virtual ~BtrfsVolPropSheet ()
 
HRESULT __stdcall QueryInterface (REFIID riid, void **ppObj)
 
ULONG __stdcall AddRef ()
 
ULONG __stdcall Release ()
 
virtual HRESULT __stdcall Initialize (PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
 
virtual HRESULT __stdcall AddPages (LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
 
virtual HRESULT __stdcall ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
 
void FormatUsage (HWND hwndDlg, wstring &s, btrfs_usage *usage)
 
void RefreshUsage (HWND hwndDlg)
 
void ShowUsage (HWND hwndDlg)
 
INT_PTR CALLBACK UsageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void RefreshDevList (HWND devlist)
 
INT_PTR CALLBACK DeviceDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void ShowDevices (HWND hwndDlg)
 
void ShowScrub (HWND hwndDlg)
 
void ShowChangeDriveLetter (HWND hwndDlg)
 
INT_PTR CALLBACK StatsDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void ShowStats (HWND hwndDlg, uint64_t devid)
 
void ResetStats (HWND hwndDlg)
 

Public Attributes

btrfs_devicedevices
 
bool readonly
 
BtrfsBalancebalance
 
BTRFS_UUID uuid
 
bool uuid_set
 

Private Attributes

LONG refcount
 
bool ignore
 
STGMEDIUM stgm
 
bool stgm_set
 
wstring fn
 
uint64_t stats_dev
 

Additional Inherited Members

- Public Types inherited from IShellExtInit
typedef IShellExtInitLPSHELLEXTINIT
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Private Types inherited from IShellPropSheetExt
enum  tagSHELLPROPSHEETEXTPAGEID { EXPPS_FILETYPES = 0x1 }
 
typedef UINT EXPPS
 
- Private Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Private Member Functions inherited from IShellPropSheetExt
HRESULT AddPages ([in] LPFNSVADDPROPSHEETPAGE pfnAddPage, [in] LPARAM lParam)
 
HRESULT ReplacePage ([in] EXPPS uPageID, [in] LPFNSVADDPROPSHEETPAGE pfnReplaceWith, [in] LPARAM lParam)
 

Detailed Description

Definition at line 33 of file volpropsheet.h.

Constructor & Destructor Documentation

◆ BtrfsVolPropSheet()

BtrfsVolPropSheet::BtrfsVolPropSheet ( )
inline

Definition at line 35 of file volpropsheet.h.

35  {
36  refcount = 0;
37  ignore = true;
38  stgm_set = false;
39  devices = nullptr;
40 
42 
43  balance = nullptr;
44  }
btrfs_device * devices
Definition: volpropsheet.h:100
BtrfsBalance * balance
Definition: volpropsheet.h:102
LONG objs_loaded
Definition: main.cpp:48
#define InterlockedIncrement
Definition: armddk.h:53

◆ ~BtrfsVolPropSheet()

virtual BtrfsVolPropSheet::~BtrfsVolPropSheet ( )
inlinevirtual

Definition at line 46 of file volpropsheet.h.

46  {
47  if (stgm_set) {
48  GlobalUnlock(stgm.hGlobal);
50  }
51 
52  if (devices)
53  free(devices);
54 
56 
57  if (balance)
58  delete balance;
59  }
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define free
Definition: debug_ros.c:5
btrfs_device * devices
Definition: volpropsheet.h:100
BtrfsBalance * balance
Definition: volpropsheet.h:102
LONG objs_loaded
Definition: main.cpp:48
#define InterlockedDecrement
Definition: armddk.h:52
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Member Function Documentation

◆ AddPages()

HRESULT __stdcall BtrfsVolPropSheet::AddPages ( LPFNADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
virtual

Definition at line 1427 of file volpropsheet.cpp.

1427  {
1428  try {
1429  PROPSHEETPAGE psp;
1430  HPROPSHEETPAGE hPage;
1431  INITCOMMONCONTROLSEX icex;
1432 
1433  if (ignore)
1434  return S_OK;
1435 
1436  icex.dwSize = sizeof(icex);
1437  icex.dwICC = ICC_LINK_CLASS;
1438 
1439  if (!InitCommonControlsEx(&icex))
1441 
1442  psp.dwSize = sizeof(psp);
1443  psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
1444  psp.hInstance = module;
1445  psp.pszTemplate = MAKEINTRESOURCE(IDD_VOL_PROP_SHEET);
1446  psp.hIcon = 0;
1447  psp.pszTitle = MAKEINTRESOURCE(IDS_VOL_PROP_SHEET_TITLE);
1448  psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
1449  psp.pcRefParent = (UINT*)&objs_loaded;
1450  psp.pfnCallback = nullptr;
1451  psp.lParam = (LPARAM)this;
1452 
1453  hPage = CreatePropertySheetPage(&psp);
1454 
1455  if (hPage) {
1456  if (pfnAddPage(hPage, lParam)) {
1457  this->AddRef();
1458  return S_OK;
1459  } else
1460  DestroyPropertySheetPage(hPage);
1461  } else
1462  return E_OUTOFMEMORY;
1463  } catch (const exception& e) {
1464  error_message(nullptr, e.what());
1465  }
1466 
1467  return E_FAIL;
1468 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
HMODULE module
Definition: main.cpp:47
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define IDS_INITCOMMONCONTROLSEX_FAILED
Definition: resource.h:203
#define E_FAIL
Definition: ddrawi.h:102
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define e
Definition: ke_i.h:82
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
LONG_PTR LPARAM
Definition: windef.h:208
ULONG __stdcall AddRef()
Definition: volpropsheet.h:65
#define CreatePropertySheetPage
Definition: prsht.h:381
#define IDD_VOL_PROP_SHEET
Definition: resource.h:11
#define IDS_VOL_PROP_SHEET_TITLE
Definition: resource.h:41
#define PSP_USEREFPARENT
Definition: prsht.h:29
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define PSP_USETITLE
Definition: prsht.h:26
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2871
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
LONG objs_loaded
Definition: main.cpp:48
LPARAM lParam
Definition: combotst.c:139
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define PROPSHEETPAGE
Definition: prsht.h:371

◆ AddRef()

ULONG __stdcall BtrfsVolPropSheet::AddRef ( void  )
inline

Implements IUnknown.

Definition at line 65 of file volpropsheet.h.

65  {
67  }
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by AddPages(), and QueryInterface().

◆ DeviceDlgProc()

INT_PTR CALLBACK BtrfsVolPropSheet::DeviceDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 962 of file volpropsheet.cpp.

962  {
963  try {
964  switch (uMsg) {
965  case WM_INITDIALOG:
966  {
967  HWND devlist;
968  RECT rect;
969  ULONG w;
970 
972 
973  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
974 
975  GetClientRect(devlist, &rect);
976  w = rect.right - rect.left;
977 
978  add_lv_column(devlist, IDS_DEVLIST_ALLOC_PC, w * 5 / 44);
979  add_lv_column(devlist, IDS_DEVLIST_ALLOC, w * 6 / 44);
980  add_lv_column(devlist, IDS_DEVLIST_SIZE, w * 6 / 44);
981  add_lv_column(devlist, IDS_DEVLIST_READONLY, w * 7 / 44);
982  add_lv_column(devlist, IDS_DEVLIST_DESC, w * 16 / 44);
983  add_lv_column(devlist, IDS_DEVLIST_ID, w * 4 / 44);
984 
988 
989  RefreshDevList(devlist);
990 
991  break;
992  }
993 
994  case WM_COMMAND:
995  switch (HIWORD(wParam)) {
996  case BN_CLICKED:
997  switch (LOWORD(wParam)) {
998  case IDOK:
999  case IDCANCEL:
1000  KillTimer(hwndDlg, 1);
1001  EndDialog(hwndDlg, 0);
1002  return true;
1003 
1004  case IDC_DEVICE_ADD:
1005  {
1006  wstring t;
1007  WCHAR modfn[MAX_PATH];
1008  SHELLEXECUTEINFOW sei;
1009 
1010  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1011 
1012 #ifndef __REACTOS__
1013  t = L"\""s + modfn + L"\",AddDevice "s + fn;
1014 #else
1015  t = wstring(L"\"") + modfn + wstring(L"\",AddDevice ") + fn;
1016 #endif
1017 
1018  RtlZeroMemory(&sei, sizeof(sei));
1019 
1020  sei.cbSize = sizeof(sei);
1021  sei.hwnd = hwndDlg;
1022  sei.lpVerb = L"runas";
1023  sei.lpFile = L"rundll32.exe";
1024  sei.lpParameters = t.c_str();
1025  sei.nShow = SW_SHOW;
1027 
1028  if (!ShellExecuteExW(&sei))
1029  throw last_error(GetLastError());
1030 
1032  CloseHandle(sei.hProcess);
1033 
1035 
1036  return true;
1037  }
1038 
1039  case IDC_DEVICE_REFRESH:
1041  return true;
1042 
1043  case IDC_DEVICE_SHOW_STATS:
1044  {
1045  WCHAR sel[MAX_PATH];
1046  HWND devlist;
1047  LVITEMW lvi;
1048 
1049  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1050 
1051  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1052 
1053  if (index == -1)
1054  return true;
1055 
1056  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1057  lvi.mask = LVIF_TEXT;
1058  lvi.iItem = (int)index;
1059  lvi.iSubItem = 0;
1060  lvi.pszText = sel;
1061  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1062  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1063 
1064  ShowStats(hwndDlg, _wtoi(sel));
1065  return true;
1066  }
1067 
1068  case IDC_DEVICE_REMOVE:
1069  {
1070  wstring t, mess, mess2, title;
1071  WCHAR modfn[MAX_PATH], sel[MAX_PATH], sel2[MAX_PATH];
1072  HWND devlist;
1073  SHELLEXECUTEINFOW sei;
1074  LVITEMW lvi;
1075 
1076  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1077 
1078  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1079 
1080  if (index == -1)
1081  return true;
1082 
1083  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1084  lvi.mask = LVIF_TEXT;
1085  lvi.iItem = (int)index;
1086  lvi.iSubItem = 0;
1087  lvi.pszText = sel;
1088  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1089  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1090 
1091  lvi.iSubItem = 1;
1092  lvi.pszText = sel2;
1093  lvi.cchTextMax = sizeof(sel2) / sizeof(WCHAR);
1094  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1095 
1097  throw last_error(GetLastError());
1098 
1099  wstring_sprintf(mess2, mess, sel, sel2);
1100 
1102  throw last_error(GetLastError());
1103 
1104  if (MessageBoxW(hwndDlg, mess2.c_str(), title.c_str(), MB_YESNO) != IDYES)
1105  return true;
1106 
1107  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1108 
1109 #ifndef __REACTOS__
1110  t = L"\""s + modfn + L"\",RemoveDevice "s + fn + L"|"s + sel;
1111 #else
1112  t = wstring(L"\"") + modfn + wstring(L"\",RemoveDevice ") + fn + wstring(L"|") + sel;
1113 #endif
1114 
1115  RtlZeroMemory(&sei, sizeof(sei));
1116 
1117  sei.cbSize = sizeof(sei);
1118  sei.hwnd = hwndDlg;
1119  sei.lpVerb = L"runas";
1120  sei.lpFile = L"rundll32.exe";
1121  sei.lpParameters = t.c_str();
1122  sei.nShow = SW_SHOW;
1124 
1125  if (!ShellExecuteExW(&sei))
1126  throw last_error(GetLastError());
1127 
1129  CloseHandle(sei.hProcess);
1130 
1132 
1133  return true;
1134  }
1135 
1136  case IDC_DEVICE_RESIZE:
1137  {
1138  HWND devlist;
1139  LVITEMW lvi;
1140  wstring t;
1141  WCHAR modfn[MAX_PATH], sel[100];
1142  SHELLEXECUTEINFOW sei;
1143 
1144  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1145 
1146  auto index = SendMessageW(devlist, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
1147 
1148  if (index == -1)
1149  return true;
1150 
1151  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1152  lvi.mask = LVIF_TEXT;
1153  lvi.iItem = (int)index;
1154  lvi.iSubItem = 0;
1155  lvi.pszText = sel;
1156  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1157  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1158 
1159  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1160 
1161 #ifndef __REACTOS__
1162  t = L"\""s + modfn + L"\",ResizeDevice "s + fn + L"|"s + sel;
1163 #else
1164  t = wstring(L"\"") + modfn + wstring(L"\",ResizeDevice ") + fn + wstring(L"|") + sel;
1165 #endif
1166 
1167  RtlZeroMemory(&sei, sizeof(sei));
1168 
1169  sei.cbSize = sizeof(sei);
1170  sei.hwnd = hwndDlg;
1171  sei.lpVerb = L"runas";
1172  sei.lpFile = L"rundll32.exe";
1173  sei.lpParameters = t.c_str();
1174  sei.nShow = SW_SHOW;
1176 
1177  if (!ShellExecuteExW(&sei))
1178  throw last_error(GetLastError());
1179 
1181  CloseHandle(sei.hProcess);
1182 
1184  }
1185  }
1186  break;
1187  }
1188  break;
1189 
1190  case WM_NOTIFY:
1191  switch (((LPNMHDR)lParam)->code) {
1192  case LVN_ITEMCHANGED:
1193  {
1194  NMLISTVIEW* nmv = (NMLISTVIEW*)lParam;
1195 
1197 
1198  if (nmv->uNewState & LVIS_SELECTED && !readonly) {
1199  HWND devlist;
1200  btrfs_device* bd;
1201  bool device_readonly = false;
1202  LVITEMW lvi;
1203  WCHAR sel[MAX_PATH];
1204  uint64_t devid;
1205 
1206  devlist = GetDlgItem(hwndDlg, IDC_DEVLIST);
1207 
1208  RtlZeroMemory(&lvi, sizeof(LVITEMW));
1209  lvi.mask = LVIF_TEXT;
1210  lvi.iItem = nmv->iItem;
1211  lvi.iSubItem = 0;
1212  lvi.pszText = sel;
1213  lvi.cchTextMax = sizeof(sel) / sizeof(WCHAR);
1214  SendMessageW(devlist, LVM_GETITEMW, 0, (LPARAM)&lvi);
1215  devid = _wtoi(sel);
1216 
1217  bd = devices;
1218 
1219  while (true) {
1220  if (bd->dev_id == devid) {
1221  device_readonly = bd->readonly;
1222  break;
1223  }
1224 
1225  if (bd->next_entry > 0)
1226  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
1227  else
1228  break;
1229  }
1230 
1231  EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_RESIZE), !device_readonly);
1232  } else
1233  EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_RESIZE), false);
1234 
1235  break;
1236  }
1237  }
1238  break;
1239  }
1240  } catch (const exception& e) {
1241  error_message(hwndDlg, e.what());
1242  }
1243 
1244  return false;
1245 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define IDC_DEVICE_REFRESH
Definition: resource.h:279
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:406
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define IDS_REMOVE_DEVICE_CONFIRMATION
Definition: resource.h:96
UINT uNewState
Definition: commctrl.h:3032
#define IDYES
Definition: winuser.h:829
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
uint32_t next_entry
Definition: btrfsioctl.h:102
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
btrfs_device * devices
Definition: volpropsheet.h:100
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define LVNI_SELECTED
Definition: commctrl.h:2420
#define IDS_CONFIRMATION_TITLE
Definition: resource.h:97
#define BCM_SETSHIELD
Definition: commctrl.h:4649
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define MB_YESNO
Definition: winuser.h:811
#define e
Definition: ke_i.h:82
#define IDS_DEVLIST_READONLY
Definition: resource.h:76
int iSubItem
Definition: commctrl.h:2358
#define IDS_DEVLIST_ALLOC_PC
Definition: resource.h:83
#define IDS_DEVLIST_SIZE
Definition: resource.h:77
#define LVIS_SELECTED
Definition: commctrl.h:2315
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2239
GLuint index
Definition: glext.h:6031
#define SW_SHOW
Definition: winuser.h:769
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
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)
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define IDC_DEVLIST
Definition: resource.h:300
LPWSTR pszText
Definition: commctrl.h:2361
#define MAX_PATH
Definition: compat.h:26
#define BN_CLICKED
Definition: winuser.h:1907
#define IDS_DEVLIST_ID
Definition: resource.h:74
UINT mask
Definition: commctrl.h:2356
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define IDC_DEVICE_SHOW_STATS
Definition: resource.h:288
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
#define WM_COMMAND
Definition: winuser.h:1722
BYTE uint8_t
Definition: msvideo1.c:66
void ShowStats(HWND hwndDlg, uint64_t devid)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_DEVICE_RESIZE
Definition: resource.h:292
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
UINT64 uint64_t
Definition: types.h:77
LPCWSTR lpParameters
Definition: shellapi.h:331
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define IDC_DEVICE_REMOVE
Definition: resource.h:284
uint64_t dev_id
Definition: btrfsioctl.h:103
#define IDS_DEVLIST_DESC
Definition: resource.h:75
#define IDC_DEVICE_ADD
Definition: resource.h:272
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define IDS_DEVLIST_ALLOC
Definition: resource.h:81
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define IDCANCEL
Definition: winuser.h:825
#define INFINITE
Definition: serial.h:102
#define LVM_GETNEXTITEM
Definition: commctrl.h:2429
#define WM_INITDIALOG
Definition: winuser.h:1721
void RefreshDevList(HWND devlist)
LPARAM lParam
Definition: combotst.c:139
static char title[]
Definition: ps.c:92
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by stub_DeviceDlgProc().

◆ FormatUsage()

void BtrfsVolPropSheet::FormatUsage ( HWND  hwndDlg,
wstring &  s,
btrfs_usage usage 
)

Definition at line 165 of file volpropsheet.cpp.

165  {
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 };
176  static const ULONG dupstrings[] = { IDS_SINGLE, IDS_DUP, IDS_RAID0, IDS_RAID1, IDS_RAID10, IDS_RAID5, IDS_RAID6 };
177 
178  s = L"";
179 
180  num_devs = 0;
181  bd = devices;
182 
183  while (true) {
184  num_devs++;
185 
186  if (bd->next_entry > 0)
187  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
188  else
189  break;
190  }
191 
192  bd = devices;
193 
194  dev_size = 0;
195 
196  while (true) {
197  dev d;
198 
199  if (bd->missing) {
201  throw last_error(GetLastError());
202  } else if (bd->device_number == 0xffffffff)
203  d.name = wstring(bd->name, bd->namelen / sizeof(WCHAR));
204  else if (bd->partition_number == 0) {
206  throw last_error(GetLastError());
207 
209  } else {
211  throw last_error(GetLastError());
212 
214  }
215 
216  d.dev_id = bd->dev_id;
217  d.alloc = 0;
218  d.size = bd->size;
219 
220  devs.push_back(d);
221 
222  dev_size += bd->size;
223 
224  if (bd->next_entry > 0)
225  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
226  else
227  break;
228  }
229 
230  dev_alloc = 0;
231  data_size = data_alloc = 0;
232  metadata_size = metadata_alloc = 0;
233 
234  bue = usage;
235  while (true) {
236  for (uint64_t k = 0; k < bue->num_devices; k++) {
237  dev_alloc += bue->devices[k].alloc;
238 
239  if (bue->type & BLOCK_FLAG_DATA) {
240  data_alloc += bue->devices[k].alloc;
241  }
242 
243  if (bue->type & BLOCK_FLAG_METADATA) {
244  metadata_alloc += bue->devices[k].alloc;
245  }
246  }
247 
248  if (bue->type & BLOCK_FLAG_DATA)
249  data_size += bue->size;
250 
251  if (bue->type & BLOCK_FLAG_METADATA)
252  metadata_size += bue->size;
253 
254  if (bue->next_entry > 0)
255  bue = (btrfs_usage*)((uint8_t*)bue + bue->next_entry);
256  else
257  break;
258  }
259 
260  // device size
261 
263  throw last_error(GetLastError());
264 
265  format_size(dev_size, v, false);
266 
267  wstring_sprintf(t, u, v.c_str());
268 
269  s += t + L"\r\n";
270 
271  // device allocated
272 
274  throw last_error(GetLastError());
275 
276  format_size(dev_alloc, v, false);
277 
278  wstring_sprintf(t, u, v.c_str());
279 
280 #ifndef __REACTOS__
281  s += t + L"\r\n"s;
282 #else
283  s += t + L"\r\n";
284 #endif
285 
286  // device unallocated
287 
289  throw last_error(GetLastError());
290 
291  format_size(dev_size - dev_alloc, v, false);
292 
293  wstring_sprintf(t, u, v.c_str());
294 
295 #ifndef __REACTOS__
296  s += t + L"\r\n"s;
297 #else
298  s += t + L"\r\n";
299 #endif
300 
301  // data ratio
302 
303  if (data_alloc > 0) {
305  throw last_error(GetLastError());
306 
307  wstring_sprintf(t, u, (float)data_alloc / (float)data_size);
308 
309 #ifndef __REACTOS__
310  s += t + L"\r\n"s;
311 #else
312  s += t + L"\r\n";
313 #endif
314  }
315 
316  // metadata ratio
317 
319  throw last_error(GetLastError());
320 
321  wstring_sprintf(t, u, (float)metadata_alloc / (float)metadata_size);
322 
323  s += t + L"\r\n\r\n";
324 
325  for (i = 0; i < sizeof(types) / sizeof(types[0]); i++) {
326  for (j = 0; j < sizeof(duptypes) / sizeof(duptypes[0]); j++) {
327  bue = usage;
328 
329  while (true) {
330  if ((bue->type & types[i]) == types[i] &&
332  || bue->type & duptypes[j])) {
333  wstring sizestring, usedstring, typestring, dupstring;
334 
336  break;
337 
338  if (!load_string(module, typestrings[i], typestring))
339  throw last_error(GetLastError());
340 
341  if (!load_string(module, dupstrings[j], dupstring))
342  throw last_error(GetLastError());
343 
344  format_size(bue->size, sizestring, false);
345  format_size(bue->used, usedstring, false);
346 
347  wstring_sprintf(t, typestring, dupstring.c_str(), sizestring.c_str(), usedstring.c_str());
348 
349  s += t + L"\r\n";
350 
351  for (uint64_t k = 0; k < bue->num_devices; k++) {
352  bool found = false;
353 
354  format_size(bue->devices[k].alloc, sizestring, false);
355 
356  for (size_t l = 0; l < min((uint64_t)SIZE_MAX, num_devs); l++) {
357  if (devs[l].dev_id == bue->devices[k].dev_id) {
358  s += devs[l].name + L"\t" + sizestring + L"\r\n";
359 
360  devs[l].alloc += bue->devices[k].alloc;
361 
362  found = true;
363  break;
364  }
365  }
366 
367  if (!found) {
368  if (!load_string(module, IDS_UNKNOWN_DEVICE, typestring))
369  throw last_error(GetLastError());
370 
371  wstring_sprintf(t, typestring, bue->devices[k].dev_id);
372 
373 #ifndef __REACTOS__
374  s += t + L"\t"s + sizestring + L"\r\n"s;
375 #else
376  s += t + L"\t" + sizestring + L"\r\n";
377 #endif
378  }
379  }
380 
381  s += L"\r\n";
382 
383  break;
384  }
385 
386  if (bue->next_entry > 0)
387  bue = (btrfs_usage*)((uint8_t*)bue + bue->next_entry);
388  else
389  break;
390  }
391  }
392  }
393 
395  throw last_error(GetLastError());
396 
397 #ifndef __REACTOS__
398  s += t + L"\r\n"s;
399 #else
400  s += t + L"\r\n";
401 #endif
402 
403  for (size_t k = 0; k < min((uint64_t)SIZE_MAX, num_devs); k++) {
404  wstring sizestring;
405 
406  format_size(devs[k].size - devs[k].alloc, sizestring, false);
407 
408  s += devs[k].name + L"\t" + sizestring + L"\r\n";
409  }
410 }
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 IDS_RAID10
Definition: resource.h:47
uint64_t type
Definition: btrfsioctl.h:122
USHORT namelen
Definition: btrfsioctl.h:111
#define IDS_USAGE_DATA
Definition: resource.h:50
uint64_t used
Definition: btrfsioctl.h:124
uint64_t num_devices
Definition: btrfsioctl.h:125
#define IDS_UNKNOWN_DEVICE
Definition: resource.h:55
uint32_t next_entry
Definition: btrfsioctl.h:102
btrfs_device * devices
Definition: volpropsheet.h:100
GLsizei GLenum GLenum * types
Definition: glext.h:7753
GLdouble GLdouble t
Definition: gl.h:2047
uint32_t next_entry
Definition: btrfsioctl.h:121
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
#define IDS_RAID5
Definition: resource.h:48
#define IDS_SINGLE
Definition: resource.h:43
#define IDS_RAID0
Definition: resource.h:45
#define BLOCK_FLAG_SYSTEM
Definition: shellext.h:76
#define IDS_DISK_PART_NUM
Definition: resource.h:103
uint64_t size
Definition: btrfsioctl.h:123
#define IDS_DISK_NUM
Definition: resource.h:102
#define IDS_MISSING
Definition: resource.h:191
#define BLOCK_FLAG_RAID10
Definition: shellext.h:81
#define SIZE_MAX
Definition: asmshader.yy.c:347
ULONG partition_number
Definition: btrfsioctl.h:109
#define IDS_USAGE_MIXED
Definition: resource.h:51
#define IDS_USAGE_UNALLOC
Definition: resource.h:54
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
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
GLsizeiptr size
Definition: glext.h:5919
#define d
Definition: ke_i.h:81
Definition: cmds.c:130
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_USAGE_DEV_SIZE
Definition: resource.h:56
#define IDS_DUP
Definition: resource.h:44
char * name
Definition: compiler.c:66
#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
static const WCHAR L[]
Definition: oid.c:1250
#define BLOCK_FLAG_METADATA
Definition: shellext.h:77
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
BYTE uint8_t
Definition: msvideo1.c:66
#define IDS_USAGE_DEV_ALLOC
Definition: resource.h:57
UINT64 uint64_t
Definition: types.h:77
const GLdouble * v
Definition: gl.h:2040
#define min(a, b)
Definition: monoChain.cc:55
#define alloc
Definition: rosglue.h:13
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define BLOCK_FLAG_DATA
Definition: shellext.h:75
uint64_t dev_id
Definition: btrfsioctl.h:103
btrfs_usage_device devices[1]
Definition: btrfsioctl.h:126
unsigned int ULONG
Definition: retypes.h:1
#define IDS_USAGE_METADATA_RATIO
Definition: resource.h:60
#define BLOCK_FLAG_DUPLICATE
Definition: shellext.h:80
#define IDS_RAID1
Definition: resource.h:46
#define BLOCK_FLAG_RAID5
Definition: shellext.h:82
int k
Definition: mpi.c:3369
uint64_t size
Definition: btrfsioctl.h:104
#define BLOCK_FLAG_RAID1
Definition: shellext.h:79
#define IDS_USAGE_DEV_UNALLOC
Definition: resource.h:58
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65

Referenced by RefreshUsage(), and UsageDlgProc().

◆ Initialize()

HRESULT __stdcall BtrfsVolPropSheet::Initialize ( PCIDLIST_ABSOLUTE  pidlFolder,
IDataObject pdtobj,
HKEY  hkeyProgID 
)
virtual

Implements IShellExtInit.

Definition at line 66 of file volpropsheet.cpp.

66  {
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 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define free
Definition: debug_ros.c:5
btrfs_device * devices
Definition: volpropsheet.h:100
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
BtrfsBalance * balance
Definition: volpropsheet.h:102
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
#define E_FAIL
Definition: ddrawi.h:102
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#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
#define E_INVALIDARG
Definition: ddrawi.h:101
#define CF_HDROP
Definition: constants.h:410
#define OPEN_EXISTING
Definition: compat.h:434
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define CreateFileW
Definition: compat.h:408
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
Definition: msctf.idl:510
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
#define FSCTL_BTRFS_GET_UUID
Definition: btrfsioctl.h:22

◆ QueryInterface()

HRESULT __stdcall BtrfsVolPropSheet::QueryInterface ( REFIID  riid,
void **  ppObj 
)

Implements IUnknown.

Definition at line 51 of file volpropsheet.cpp.

51  {
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
ULONG __stdcall AddRef()
Definition: volpropsheet.h:65
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59

Referenced by Factory::CreateInstance().

◆ RefreshDevList()

void BtrfsVolPropSheet::RefreshDevList ( HWND  devlist)

Definition at line 630 of file volpropsheet.cpp.

630  {
633  ULONG usagesize, devsize;
635  btrfs_device* bd;
636  int i;
637  uint64_t num_rw_devices;
638  {
641 
642  if (h == INVALID_HANDLE_VALUE)
643  throw last_error(GetLastError());
644 
645  i = 0;
646  devsize = 1024;
647 
648  if (devices)
649  free(devices);
650 
651  devices = (btrfs_device*)malloc(devsize);
652 
653  while (true) {
654  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
656  if (i < 8) {
657  devsize += 1024;
658 
659  free(devices);
660  devices = (btrfs_device*)malloc(devsize);
661 
662  i++;
663  } else
664  return;
665  } else
666  break;
667  }
668 
669  if (!NT_SUCCESS(Status))
670  return;
671 
672  bd = devices;
673 
674  i = 0;
675  usagesize = 1024;
676 
677  usage = (btrfs_usage*)malloc(usagesize);
678 
679  while (true) {
680  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
682  if (i < 8) {
683  usagesize += 1024;
684 
685  free(usage);
686  usage = (btrfs_usage*)malloc(usagesize);
687 
688  i++;
689  } else {
690  free(usage);
691  return;
692  }
693  } else
694  break;
695  }
696 
697  if (!NT_SUCCESS(Status)) {
698  free(usage);
699  return;
700  }
701  }
702 
703  SendMessageW(devlist, LVM_DELETEALLITEMS, 0, 0);
704 
705  num_rw_devices = 0;
706 
707  i = 0;
708  while (true) {
709  LVITEMW lvi;
710  wstring s, u;
711  uint64_t alloc;
712 
713  // ID
714 
715  RtlZeroMemory(&lvi, sizeof(LVITEMW));
716  lvi.mask = LVIF_TEXT | LVIF_PARAM;
717  lvi.iItem = (int)SendMessageW(devlist, LVM_GETITEMCOUNT, 0, 0);
718  lvi.lParam = (LPARAM)bd->dev_id;
719 
720  s = to_wstring(bd->dev_id);
721  lvi.pszText = (LPWSTR)s.c_str();
722 
723  SendMessageW(devlist, LVM_INSERTITEMW, 0, (LPARAM)&lvi);
724 
725  // description
726 
727  lvi.mask = LVIF_TEXT;
728  lvi.iSubItem = 1;
729 
730  if (bd->missing) {
732  throw last_error(GetLastError());
733  } else if (bd->device_number == 0xffffffff)
734  s = wstring(bd->name, bd->namelen / sizeof(WCHAR));
735  else if (bd->partition_number == 0) {
737  throw last_error(GetLastError());
738 
740  } else {
742  throw last_error(GetLastError());
743 
745  }
746 
747  lvi.pszText = (LPWSTR)s.c_str();
748 
749  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
750 
751  // readonly
752 
753  lvi.iSubItem = 2;
755  lvi.pszText = (LPWSTR)s.c_str();
756  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
757 
758  if (!bd->readonly)
759  num_rw_devices++;
760 
761  // size
762 
763  lvi.iSubItem = 3;
764  format_size(bd->size, s, false);
765  lvi.pszText = (LPWSTR)s.c_str();
766  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
767 
768  // alloc
769 
771 
772  lvi.iSubItem = 4;
773  format_size(alloc, s, false);
774  lvi.pszText = (LPWSTR)s.c_str();
775  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
776 
777  // alloc %
778 
779  wstring_sprintf(s, L"%1.1f%%", (float)alloc * 100.0f / (float)bd->size);
780  lvi.iSubItem = 5;
781  lvi.pszText = (LPWSTR)s.c_str();
782  SendMessageW(devlist, LVM_SETITEMW, 0, (LPARAM)&lvi);
783 
784  i++;
785 
786  if (bd->next_entry > 0)
787  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
788  else
789  break;
790  }
791 
792  free(usage);
793 
794  SendMessageW(devlist, LVM_SORTITEMS, 0, (LPARAM)lv_sort);
795 
796  EnableWindow(GetDlgItem(GetParent(devlist), IDC_DEVICE_ADD), num_rw_devices > 0);
797  EnableWindow(GetDlgItem(GetParent(devlist), IDC_DEVICE_REMOVE), num_rw_devices > 1);
798 }
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 IDS_DEVLIST_READONLY_YES
Definition: resource.h:78
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
USHORT namelen
Definition: btrfsioctl.h:111
uint32_t next_entry
Definition: btrfsioctl.h:102
#define free
Definition: debug_ros.c:5
#define FSCTL_BTRFS_GET_USAGE
Definition: btrfsioctl.h:13
btrfs_device * devices
Definition: volpropsheet.h:100
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define LVM_SORTITEMS
Definition: commctrl.h:2698
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define LVIF_TEXT
Definition: commctrl.h:2305
#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
ULONG device_number
Definition: btrfsioctl.h:108
int iSubItem
Definition: commctrl.h:2358
LPARAM lParam
Definition: commctrl.h:2364
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2302
#define IDS_DISK_PART_NUM
Definition: resource.h:103
#define IDS_DISK_NUM
Definition: resource.h:102
#define IDS_MISSING
Definition: resource.h:191
LONG_PTR LPARAM
Definition: windef.h:208
ULONG partition_number
Definition: btrfsioctl.h:109
#define OPEN_EXISTING
Definition: compat.h:434
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
GLfloat f
Definition: glext.h:7540
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LPWSTR pszText
Definition: commctrl.h:2361
UINT mask
Definition: commctrl.h:2356
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
BYTE uint8_t
Definition: msvideo1.c:66
Status
Definition: gdiplustypes.h:24
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2409
HWND WINAPI GetParent(_In_ HWND)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
UINT64 uint64_t
Definition: types.h:77
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define alloc
Definition: rosglue.h:13
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define IDC_DEVICE_REMOVE
Definition: resource.h:284
uint64_t dev_id
Definition: btrfsioctl.h:103
#define CreateFileW
Definition: compat.h:408
#define LVM_SETITEMW
Definition: commctrl.h:2393
#define IDC_DEVICE_ADD
Definition: resource.h:272
static uint64_t find_dev_alloc(uint64_t dev_id, btrfs_usage *usage)
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define LVIF_PARAM
Definition: commctrl.h:2307
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
unsigned int ULONG
Definition: retypes.h:1
static int CALLBACK lv_sort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define IDS_DEVLIST_READONLY_NO
Definition: resource.h:79
#define malloc
Definition: debug_ros.c:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184
uint64_t size
Definition: btrfsioctl.h:104
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65

Referenced by DeviceDlgProc().

◆ RefreshUsage()

void BtrfsVolPropSheet::RefreshUsage ( HWND  hwndDlg)

Definition at line 412 of file volpropsheet.cpp.

412  {
413  wstring s;
415 
418 
419  if (h != INVALID_HANDLE_VALUE) {
422  ULONG devsize, usagesize, i;
423 
424  i = 0;
425  devsize = 1024;
426 
427  devices = (btrfs_device*)malloc(devsize);
428 
429  while (true) {
430  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
432  if (i < 8) {
433  devsize += 1024;
434 
435  free(devices);
436  devices = (btrfs_device*)malloc(devsize);
437 
438  i++;
439  } else
440  return;
441  } else
442  break;
443  }
444 
445  if (!NT_SUCCESS(Status))
446  return;
447 
448  i = 0;
449  usagesize = 1024;
450 
451  usage = (btrfs_usage*)malloc(usagesize);
452 
453  while (true) {
454  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
456  if (i < 8) {
457  usagesize += 1024;
458 
459  free(usage);
460  usage = (btrfs_usage*)malloc(usagesize);
461 
462  i++;
463  } else
464  return;
465  } else
466  break;
467  }
468 
469  if (!NT_SUCCESS(Status)) {
470  free(usage);
471  return;
472  }
473 
474  ignore = false;
475  } else
476  return;
477 
478  FormatUsage(hwndDlg, s, usage);
479 
480  SetDlgItemTextW(hwndDlg, IDC_USAGE_BOX, s.c_str());
481 
482  free(usage);
483 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define free
Definition: debug_ros.c:5
#define FSCTL_BTRFS_GET_USAGE
Definition: btrfsioctl.h:13
btrfs_device * devices
Definition: volpropsheet.h:100
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
#define IDC_USAGE_BOX
Definition: resource.h:228
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
void FormatUsage(HWND hwndDlg, wstring &s, btrfs_usage *usage)
#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
#define OPEN_EXISTING
Definition: compat.h:434
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define CreateFileW
Definition: compat.h:408
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4

Referenced by UsageDlgProc().

◆ Release()

ULONG __stdcall BtrfsVolPropSheet::Release ( void  )
inline

Implements IUnknown.

Definition at line 69 of file volpropsheet.h.

69  {
71 
72  if (rc == 0)
73  delete this;
74 
75  return rc;
76  }
long LONG
Definition: pedump.c:60
#define InterlockedDecrement
Definition: armddk.h:52

◆ ReplacePage()

HRESULT __stdcall BtrfsVolPropSheet::ReplacePage ( UINT  uPageID,
LPFNADDPROPSHEETPAGE  pfnReplacePage,
LPARAM  lParam 
)
virtual

Definition at line 1470 of file volpropsheet.cpp.

1470  {
1471  return S_OK;
1472 }
#define S_OK
Definition: intsafe.h:59

◆ ResetStats()

void BtrfsVolPropSheet::ResetStats ( HWND  hwndDlg)

Definition at line 800 of file volpropsheet.cpp.

800  {
801  wstring t, sel;
802  WCHAR modfn[MAX_PATH];
803  SHELLEXECUTEINFOW sei;
804 
805  sel = to_wstring(stats_dev);
806 
807  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
808 
809 #ifndef __REACTOS__
810  t = L"\""s + modfn + L"\",ResetStats " + fn + L"|" + sel;
811 #else
812  t = wstring(L"\"") + modfn + wstring(L"\",ResetStats ") + fn + wstring(L"|") + sel;
813 #endif
814 
815  RtlZeroMemory(&sei, sizeof(sei));
816 
817  sei.cbSize = sizeof(sei);
818  sei.hwnd = hwndDlg;
819  sei.lpVerb = L"runas";
820  sei.lpFile = L"rundll32.exe";
821  sei.lpParameters = t.c_str();
822  sei.nShow = SW_SHOW;
824 
825  if (!ShellExecuteExW(&sei))
826  throw last_error(GetLastError());
827 
829  CloseHandle(sei.hProcess);
830 
833 
834  if (h != INVALID_HANDLE_VALUE) {
837  ULONG devsize, i;
838 
839  i = 0;
840  devsize = 1024;
841 
842  free(devices);
843  devices = (btrfs_device*)malloc(devsize);
844 
845  while (true) {
846  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
848  if (i < 8) {
849  devsize += 1024;
850 
851  free(devices);
852  devices = (btrfs_device*)malloc(devsize);
853 
854  i++;
855  } else
856  break;
857  } else
858  break;
859  }
860  }
861 
862  EndDialog(hwndDlg, 0);
863 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define CloseHandle
Definition: compat.h:406
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
#define free
Definition: debug_ros.c:5
btrfs_device * devices
Definition: volpropsheet.h:100
LONG NTSTATUS
Definition: precomp.h:26
GLdouble GLdouble t
Definition: gl.h:2047
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#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
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2239
#define SW_SHOW
Definition: winuser.h:769
#define OPEN_EXISTING
Definition: compat.h:434
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
LPCWSTR lpParameters
Definition: shellapi.h:331
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define CreateFileW
Definition: compat.h:408
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define malloc
Definition: debug_ros.c:4
#define INFINITE
Definition: serial.h:102

Referenced by StatsDlgProc().

◆ ShowChangeDriveLetter()

void BtrfsVolPropSheet::ShowChangeDriveLetter ( HWND  hwndDlg)

Definition at line 1297 of file volpropsheet.cpp.

1297  {
1298  wstring t;
1299  WCHAR modfn[MAX_PATH];
1300  SHELLEXECUTEINFOW sei;
1301 
1302  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1303 
1304 #ifndef __REACTOS__
1305  t = L"\""s + modfn + L"\",ShowChangeDriveLetter "s + fn;
1306 #else
1307  t = wstring(L"\"") + modfn + wstring(L"\",ShowChangeDriveLetter ") + fn;
1308 #endif
1309 
1310  RtlZeroMemory(&sei, sizeof(sei));
1311 
1312  sei.cbSize = sizeof(sei);
1313  sei.hwnd = hwndDlg;
1314  sei.lpVerb = L"runas";
1315  sei.lpFile = L"rundll32.exe";
1316  sei.lpParameters = t.c_str();
1317  sei.nShow = SW_SHOW;
1319 
1320  if (!ShellExecuteExW(&sei))
1321  throw last_error(GetLastError());
1322 
1324  CloseHandle(sei.hProcess);
1325 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define CloseHandle
Definition: compat.h:406
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2239
#define SW_SHOW
Definition: winuser.h:769
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
LPCWSTR lpParameters
Definition: shellapi.h:331
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define INFINITE
Definition: serial.h:102

Referenced by PropSheetDlgProc().

◆ ShowDevices()

void BtrfsVolPropSheet::ShowDevices ( HWND  hwndDlg)

Definition at line 1263 of file volpropsheet.cpp.

1263  {
1265 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_DEVICES
Definition: resource.h:21
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK stub_DeviceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by PropSheetDlgProc().

◆ ShowScrub()

void BtrfsVolPropSheet::ShowScrub ( HWND  hwndDlg)

Definition at line 1267 of file volpropsheet.cpp.

1267  {
1268  wstring t;
1269  WCHAR modfn[MAX_PATH];
1270  SHELLEXECUTEINFOW sei;
1271 
1272  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
1273 
1274 #ifndef __REACTOS__
1275  t = L"\""s + modfn + L"\",ShowScrub "s + fn;
1276 #else
1277  t = wstring(L"\"") + modfn + wstring(L"\",ShowScrub ") + fn;
1278 #endif
1279 
1280  RtlZeroMemory(&sei, sizeof(sei));
1281 
1282  sei.cbSize = sizeof(sei);
1283  sei.hwnd = hwndDlg;
1284  sei.lpVerb = L"runas";
1285  sei.lpFile = L"rundll32.exe";
1286  sei.lpParameters = t.c_str();
1287  sei.nShow = SW_SHOW;
1289 
1290  if (!ShellExecuteExW(&sei))
1291  throw last_error(GetLastError());
1292 
1294  CloseHandle(sei.hProcess);
1295 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define CloseHandle
Definition: compat.h:406
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2239
#define SW_SHOW
Definition: winuser.h:769
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
LPCWSTR lpParameters
Definition: shellapi.h:331
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define INFINITE
Definition: serial.h:102

Referenced by PropSheetDlgProc().

◆ ShowStats()

void BtrfsVolPropSheet::ShowStats ( HWND  hwndDlg,
uint64_t  devid 
)

Definition at line 956 of file volpropsheet.cpp.

956  {
957  stats_dev = devid;
958 
960 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_DEVICE_STATS
Definition: resource.h:84
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK stub_StatsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by DeviceDlgProc().

◆ ShowUsage()

void BtrfsVolPropSheet::ShowUsage ( HWND  hwndDlg)

Definition at line 580 of file volpropsheet.cpp.

580  {
582 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_VOL_USAGE
Definition: resource.h:13
static INT_PTR CALLBACK stub_UsageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by PropSheetDlgProc().

◆ StatsDlgProc()

INT_PTR CALLBACK BtrfsVolPropSheet::StatsDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 865 of file volpropsheet.cpp.

865  {
866  try {
867  switch (uMsg) {
868  case WM_INITDIALOG:
869  {
870  WCHAR s[255];
871  wstring t;
872  btrfs_device *bd, *dev = nullptr;
873  int i;
874 
876 
877  bd = devices;
878 
879  while (true) {
880  if (bd->dev_id == stats_dev) {
881  dev = bd;
882  break;
883  }
884 
885  if (bd->next_entry > 0)
886  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
887  else
888  break;
889  }
890 
891  if (!dev) {
892  EndDialog(hwndDlg, 0);
894  }
895 
896  GetDlgItemTextW(hwndDlg, IDC_DEVICE_ID, s, sizeof(s) / sizeof(WCHAR));
897 
899 
900  SetDlgItemTextW(hwndDlg, IDC_DEVICE_ID, t.c_str());
901 
902  for (i = 0; i < 5; i++) {
903  GetDlgItemTextW(hwndDlg, stat_ids[i], s, sizeof(s) / sizeof(WCHAR));
904 
905  wstring_sprintf(t, s, dev->stats[i]);
906 
907  SetDlgItemTextW(hwndDlg, stat_ids[i], t.c_str());
908  }
909 
912 
913  break;
914  }
915 
916  case WM_COMMAND:
917  switch (HIWORD(wParam)) {
918  case BN_CLICKED:
919  switch (LOWORD(wParam)) {
920  case IDOK:
921  case IDCANCEL:
922  EndDialog(hwndDlg, 0);
923  return true;
924 
925  case IDC_RESET_STATS:
926  ResetStats(hwndDlg);
927  return true;
928  }
929  break;
930  }
931  break;
932  }
933  } catch (const exception& e) {
934  error_message(hwndDlg, e.what());
935  }
936 
937  return false;
938 }
#define IDC_GENERATION_ERRS
Definition: resource.h:326
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
#define IDOK
Definition: winuser.h:824
#define IDC_FLUSH_ERRS
Definition: resource.h:322
uint32_t next_entry
Definition: btrfsioctl.h:102
btrfs_device * devices
Definition: volpropsheet.h:100
GLdouble GLdouble t
Definition: gl.h:2047
#define BCM_SETSHIELD
Definition: commctrl.h:4649
#define IDS_CANNOT_FIND_DEVICE
Definition: resource.h:29
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
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 error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define e
Definition: ke_i.h:82
#define IDC_DEVICE_ID
Definition: resource.h:318
#define IDC_RESET_STATS
Definition: resource.h:273
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BN_CLICKED
Definition: winuser.h:1907
void ResetStats(HWND hwndDlg)
GLdouble s
Definition: gl.h:2039
#define WM_COMMAND
Definition: winuser.h:1722
BYTE uint8_t
Definition: msvideo1.c:66
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_WRITE_ERRS
Definition: resource.h:319
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
uint64_t dev_id
uint64_t dev_id
Definition: btrfsioctl.h:103
#define IDC_CORRUPTION_ERRS
Definition: resource.h:324
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define IDC_READ_ERRS
Definition: resource.h:320
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82

Referenced by stub_StatsDlgProc().

◆ UsageDlgProc()

INT_PTR CALLBACK BtrfsVolPropSheet::UsageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 485 of file volpropsheet.cpp.

485  {
486  try {
487  switch (uMsg) {
488  case WM_INITDIALOG:
489  {
490  wstring s;
491  int i;
492  ULONG usagesize;
495 
497 
500 
501  if (h != INVALID_HANDLE_VALUE) {
503 
504  i = 0;
505  usagesize = 1024;
506 
507  usage = (btrfs_usage*)malloc(usagesize);
508 
509  while (true) {
510  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_USAGE, nullptr, 0, usage, usagesize);
512  if (i < 8) {
513  usagesize += 1024;
514 
515  free(usage);
516  usage = (btrfs_usage*)malloc(usagesize);
517 
518  i++;
519  } else
520  break;
521  } else
522  break;
523  }
524 
525  if (!NT_SUCCESS(Status)) {
526  free(usage);
527  break;
528  }
529 
530  FormatUsage(hwndDlg, s, usage);
531 
532  SetDlgItemTextW(hwndDlg, IDC_USAGE_BOX, s.c_str());
533 
534  free(usage);
535  }
536 
537  break;
538  }
539 
540  case WM_COMMAND:
541  switch (HIWORD(wParam)) {
542  case BN_CLICKED:
543  switch (LOWORD(wParam)) {
544  case IDOK:
545  case IDCANCEL:
546  EndDialog(hwndDlg, 0);
547  return true;
548 
549  case IDC_USAGE_REFRESH:
550  RefreshUsage(hwndDlg);
551  return true;
552  }
553  break;
554  }
555  break;
556  }
557  } catch (const exception& e) {
558  error_message(hwndDlg, e.what());
559  }
560 
561  return false;
562 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define IDOK
Definition: winuser.h:824
#define free
Definition: debug_ros.c:5
#define FSCTL_BTRFS_GET_USAGE
Definition: btrfsioctl.h:13
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
#define IDC_USAGE_BOX
Definition: resource.h:228
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
void FormatUsage(HWND hwndDlg, wstring &s, btrfs_usage *usage)
#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 error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define e
Definition: ke_i.h:82
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
#define OPEN_EXISTING
Definition: compat.h:434
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define BN_CLICKED
Definition: winuser.h:1907
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_USAGE_REFRESH
Definition: resource.h:231
Status
Definition: gdiplustypes.h:24
void RefreshUsage(HWND hwndDlg)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define CreateFileW
Definition: compat.h:408
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82

Referenced by stub_UsageDlgProc().

Member Data Documentation

◆ balance

BtrfsBalance* BtrfsVolPropSheet::balance

◆ devices

◆ fn

wstring BtrfsVolPropSheet::fn
private

◆ ignore

bool BtrfsVolPropSheet::ignore
private

Definition at line 108 of file volpropsheet.h.

Referenced by AddPages(), BtrfsVolPropSheet(), Initialize(), and RefreshUsage().

◆ readonly

bool BtrfsVolPropSheet::readonly

Definition at line 101 of file volpropsheet.h.

Referenced by DeviceDlgProc(), and StatsDlgProc().

◆ refcount

LONG BtrfsVolPropSheet::refcount
private

Definition at line 107 of file volpropsheet.h.

Referenced by AddRef(), BtrfsVolPropSheet(), and Release().

◆ stats_dev

uint64_t BtrfsVolPropSheet::stats_dev
private

Definition at line 112 of file volpropsheet.h.

Referenced by ResetStats(), ShowStats(), and StatsDlgProc().

◆ stgm

STGMEDIUM BtrfsVolPropSheet::stgm
private

Definition at line 109 of file volpropsheet.h.

Referenced by Initialize(), and ~BtrfsVolPropSheet().

◆ stgm_set

bool BtrfsVolPropSheet::stgm_set
private

Definition at line 110 of file volpropsheet.h.

Referenced by BtrfsVolPropSheet(), Initialize(), and ~BtrfsVolPropSheet().

◆ uuid

BTRFS_UUID BtrfsVolPropSheet::uuid

Definition at line 103 of file volpropsheet.h.

◆ uuid_set

bool BtrfsVolPropSheet::uuid_set

Definition at line 104 of file volpropsheet.h.

Referenced by Initialize().


The documentation for this class was generated from the following files: