ReactOS  0.4.13-dev-551-gf37fb1f
devices.cpp File Reference
#include "shellext.h"
#include "devices.h"
#include "resource.h"
#include "balance.h"
#include <stddef.h>
#include <uxtheme.h>
#include <setupapi.h>
#include <strsafe.h>
#include <mountmgr.h>
#include <algorithm>
#include "../btrfs.h"
Include dependency graph for devices.cpp:

Go to the source code of this file.

Macros

#define ISOLATION_AWARE_ENABLED   1
 
#define STRSAFE_NO_DEPRECATE
 

Functions

 DEFINE_GUID (GUID_DEVINTERFACE_HIDDEN_VOLUME, 0x7f108a28L, 0x9833, 0x4b3b, 0xb7, 0x80, 0x2c, 0x6b, 0x5f, 0xa5, 0xc0, 0x62)
 
static wstring get_mountdev_name (const nt_handle &h)
 
static void find_devices (HWND hwnd, const GUID *guid, const nt_handle &mountmgr, vector< device > &device_list)
 
static bool sort_devices (device i, device j)
 
static INT_PTR CALLBACK stub_DeviceAddDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK stub_DeviceResizeDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void CALLBACK AddDeviceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 
void CALLBACK RemoveDeviceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 
void CALLBACK ResizeDeviceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 

Macro Definition Documentation

◆ ISOLATION_AWARE_ENABLED

#define ISOLATION_AWARE_ENABLED   1

Definition at line 18 of file devices.cpp.

◆ STRSAFE_NO_DEPRECATE

#define STRSAFE_NO_DEPRECATE

Definition at line 19 of file devices.cpp.

Function Documentation

◆ AddDeviceW()

void CALLBACK AddDeviceW ( HWND  hwnd,
HINSTANCE  hinst,
LPWSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 878 of file devices.cpp.

878  {
879  try {
882  LUID luid;
883 
884  set_dpi_aware();
885 
887  throw last_error(GetLastError());
888 
889  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
890  throw last_error(GetLastError());
891 
892  tp.PrivilegeCount = 1;
893  tp.Privileges[0].Luid = luid;
894  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
895 
896  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
897  throw last_error(GetLastError());
898 
899  BtrfsDeviceAdd bda(hinst, hwnd, lpszCmdLine);
900  bda.ShowDialog();
901  } catch (const exception& e) {
902  error_message(hwnd, e.what());
903  }
904 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:738
#define e
Definition: ke_i.h:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
static HINSTANCE hinst
Definition: edit.c:551
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
void set_dpi_aware()
Definition: main.cpp:50

◆ DEFINE_GUID()

DEFINE_GUID ( GUID_DEVINTERFACE_HIDDEN_VOLUME  ,
0x7f108a28L  ,
0x9833  ,
0x4b3b  ,
0xb7  ,
0x80  ,
0x2c  ,
0x6b  ,
0x5f  ,
0xa5  ,
0xc0  ,
0x62   
)

◆ find_devices()

static void find_devices ( HWND  hwnd,
const GUID guid,
const nt_handle mountmgr,
vector< device > &  device_list 
)
static

Definition at line 72 of file devices.cpp.

72  {
73  HDEVINFO h;
74 
75  static WCHAR dosdevices[] = L"\\DosDevices\\";
76 
78 
79  if (h != INVALID_HANDLE_VALUE) {
80  DWORD index = 0;
82 
83  did.cbSize = sizeof(did);
84 
85  if (!SetupDiEnumDeviceInterfaces(h, nullptr, guid, index, &did))
86  return;
87 
88  do {
89  SP_DEVINFO_DATA dd;
91  DWORD size;
92 
93  dd.cbSize = sizeof(dd);
94 
95  SetupDiGetDeviceInterfaceDetailW(h, &did, nullptr, 0, &size, nullptr);
96 
98  memset(detail, 0, size);
99 
100  detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
101 
102  if (SetupDiGetDeviceInterfaceDetailW(h, &did, detail, size, &size, &dd)) {
104  nt_handle file;
105  device dev;
111  ULONG i;
112  uint8_t sb[4096];
113 
114  path.Buffer = detail->DevicePath;
115  path.Length = path.MaximumLength = (uint16_t)(wcslen(detail->DevicePath) * sizeof(WCHAR));
116 
117  if (path.Length > 4 * sizeof(WCHAR) && path.Buffer[0] == '\\' && path.Buffer[1] == '\\' && path.Buffer[2] == '?' && path.Buffer[3] == '\\')
118  path.Buffer[1] = '?';
119 
120  InitializeObjectAttributes(&attr, &path, 0, nullptr, nullptr);
121 
123 
124  if (!NT_SUCCESS(Status)) {
125  free(detail);
126  index++;
127  continue;
128  }
129 
130  dev.pnp_name = detail->DevicePath;
131 
132  Status = NtDeviceIoControlFile(file, nullptr, nullptr, nullptr, &iosb, IOCTL_DISK_GET_LENGTH_INFO, nullptr, 0, &gli, sizeof(GET_LENGTH_INFORMATION));
133  if (!NT_SUCCESS(Status)) {
134  free(detail);
135  index++;
136  continue;
137  }
138 
139  dev.size = gli.Length.QuadPart;
140 
141  Status = NtDeviceIoControlFile(file, nullptr, nullptr, nullptr, &iosb, IOCTL_STORAGE_GET_DEVICE_NUMBER, nullptr, 0, &sdn, sizeof(STORAGE_DEVICE_NUMBER));
142  if (!NT_SUCCESS(Status)) {
143  dev.disk_num = 0xffffffff;
144  dev.part_num = 0xffffffff;
145  } else {
146  dev.disk_num = sdn.DeviceNumber;
147  dev.part_num = sdn.PartitionNumber;
148  }
149 
150  dev.friendly_name = L"";
151  dev.drive = L"";
152  dev.fstype = L"";
153  dev.has_parts = false;
154  dev.ignore = false;
155  dev.multi_device = false;
156 
157  dev.is_disk = RtlCompareMemory(guid, &GUID_DEVINTERFACE_DISK, sizeof(GUID)) == sizeof(GUID);
158 
159  if (dev.is_disk) {
161  STORAGE_DEVICE_DESCRIPTOR sdd, *sdd2;
162  ULONG dlisize;
164 
167  spq.AdditionalParameters[0] = 0;
168 
169  Status = NtDeviceIoControlFile(file, nullptr, nullptr, nullptr, &iosb, IOCTL_STORAGE_QUERY_PROPERTY,
170  &spq, sizeof(STORAGE_PROPERTY_QUERY), &sdd, sizeof(STORAGE_DEVICE_DESCRIPTOR));
171 
173  sdd2 = (STORAGE_DEVICE_DESCRIPTOR*)malloc(sdd.Size);
174 
175  Status = NtDeviceIoControlFile(file, nullptr, nullptr, nullptr, &iosb, IOCTL_STORAGE_QUERY_PROPERTY,
176  &spq, sizeof(STORAGE_PROPERTY_QUERY), sdd2, sdd.Size);
177  if (NT_SUCCESS(Status)) {
178  string desc2;
179 
180  desc2 = "";
181 
182  if (sdd2->VendorIdOffset != 0) {
183  desc2 += (char*)((uint8_t*)sdd2 + sdd2->VendorIdOffset);
184 
185  while (desc2.length() > 0 && desc2[desc2.length() - 1] == ' ')
186  desc2 = desc2.substr(0, desc2.length() - 1);
187  }
188 
189  if (sdd2->ProductIdOffset != 0) {
190  if (sdd2->VendorIdOffset != 0 && desc2.length() != 0 && desc2[desc2.length() - 1] != ' ')
191  desc2 += " ";
192 
193  desc2 += (char*)((uint8_t*)sdd2 + sdd2->ProductIdOffset);
194 
195  while (desc2.length() > 0 && desc2[desc2.length() - 1] == ' ')
196  desc2 = desc2.substr(0, desc2.length() - 1);
197  }
198 
199  if (sdd2->VendorIdOffset != 0 || sdd2->ProductIdOffset != 0) {
200  ULONG ss;
201 
202  ss = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, desc2.c_str(), -1, nullptr, 0);
203 
204  if (ss > 0) {
205  WCHAR* desc3 = (WCHAR*)malloc(ss * sizeof(WCHAR));
206 
207  if (MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, desc2.c_str(), -1, desc3, ss * sizeof(WCHAR)))
208  dev.friendly_name = desc3;
209 
210  free(desc3);
211  }
212  }
213  }
214 
215  free(sdd2);
216  }
217 
218  dlisize = 0;
219  dli = nullptr;
220 
221  do {
222  dlisize += 1024;
223 
224  if (dli)
225  free(dli);
226 
227  dli = (DRIVE_LAYOUT_INFORMATION_EX*)malloc(dlisize);
228 
229  Status = NtDeviceIoControlFile(file, nullptr, nullptr, nullptr, &iosb, IOCTL_DISK_GET_DRIVE_LAYOUT_EX,
230  nullptr, 0, dli, dlisize);
231  } while (Status == STATUS_BUFFER_TOO_SMALL);
232 
233  if (NT_SUCCESS(Status) && dli->PartitionCount > 0)
234  dev.has_parts = true;
235 
236  free(dli);
237  } else {
238  ULONG mmpsize;
241 
242  mmpsize = sizeof(MOUNTMGR_MOUNT_POINT) + path.Length;
243 
244  mmp = (MOUNTMGR_MOUNT_POINT*)malloc(mmpsize);
245 
246  RtlZeroMemory(mmp, sizeof(MOUNTMGR_MOUNT_POINT));
247  mmp->DeviceNameOffset = sizeof(MOUNTMGR_MOUNT_POINT);
248  mmp->DeviceNameLength = path.Length;
249  RtlCopyMemory(&mmp[1], path.Buffer, path.Length);
250 
251  Status = NtDeviceIoControlFile(mountmgr, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_QUERY_POINTS,
252  mmp, mmpsize, &mmps, sizeof(MOUNTMGR_MOUNT_POINTS));
254  MOUNTMGR_MOUNT_POINTS* mmps2;
255 
256  mmps2 = (MOUNTMGR_MOUNT_POINTS*)malloc(mmps.Size);
257 
258  Status = NtDeviceIoControlFile(mountmgr, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_QUERY_POINTS,
259  mmp, mmpsize, mmps2, mmps.Size);
260 
261  if (NT_SUCCESS(Status)) {
262  ULONG i;
263 
264  for (i = 0; i < mmps2->NumberOfMountPoints; i++) {
265  WCHAR* symlink = (WCHAR*)((uint8_t*)mmps2 + mmps2->MountPoints[i].SymbolicLinkNameOffset);
266 
267  if (mmps2->MountPoints[i].SymbolicLinkNameLength == 0x1c &&
268  RtlCompareMemory(symlink, dosdevices, wcslen(dosdevices) * sizeof(WCHAR)) == wcslen(dosdevices) * sizeof(WCHAR) &&
269  symlink[13] == ':'
270  ) {
271  WCHAR dr[3];
272 
273  dr[0] = symlink[12];
274  dr[1] = ':';
275  dr[2] = 0;
276 
277  dev.drive = dr;
278  break;
279  }
280  }
281  }
282  }
283 
284  free(mmp);
285  }
286 
287  if (!dev.is_disk || !dev.has_parts) {
288  i = 0;
289  while (fs_ident[i].name) {
290  if (i == 0 || fs_ident[i].kboff != fs_ident[i-1].kboff) {
292 
293  off.QuadPart = fs_ident[i].kboff * 1024;
294  Status = NtReadFile(file, nullptr, nullptr, nullptr, &iosb, sb, sizeof(sb), &off, nullptr);
295  }
296 
297  if (NT_SUCCESS(Status)) {
298  if (RtlCompareMemory(sb + fs_ident[i].sboff, fs_ident[i].magic, fs_ident[i].magiclen) == fs_ident[i].magiclen) {
299  dev.fstype = fs_ident[i].name;
300 
301  if (dev.fstype == L"Btrfs") {
302  superblock* bsb = (superblock*)sb;
303 
304  RtlCopyMemory(&dev.fs_uuid, &bsb->uuid, sizeof(BTRFS_UUID));
305  RtlCopyMemory(&dev.dev_uuid, &bsb->dev_item.device_uuid, sizeof(BTRFS_UUID));
306  }
307 
308  break;
309  }
310  }
311 
312  i++;
313  }
314 
315  if (dev.fstype == L"Btrfs" && RtlCompareMemory(guid, &GUID_DEVINTERFACE_DISK, sizeof(GUID)) != sizeof(GUID)) {
316  wstring name;
317  wstring pref = L"\\Device\\Btrfs{";
318 
320 
321  if (name.length() > pref.length() && RtlCompareMemory(name.c_str(), pref.c_str(), pref.length() * sizeof(WCHAR)) == pref.length() * sizeof(WCHAR))
322  dev.ignore = true;
323  }
324  }
325 
326  device_list.push_back(dev);
327  }
328 
329  free(detail);
330 
331  index++;
332  } while (SetupDiEnumDeviceInterfaces(h, nullptr, guid, index, &did));
333 
335  } else
336  throw last_error(GetLastError());
337 }
#define FILE_GENERIC_READ
Definition: nt_native.h:653
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:850
superblock * sb
Definition: btrfs.c:3952
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _MOUNTMGR_MOUNT_POINT MOUNTMGR_MOUNT_POINT
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3016
#define free
Definition: debug_ros.c:5
LONG NTSTATUS
Definition: precomp.h:26
#define MB_PRECOMPOSED
Definition: winnls.h:278
const WCHAR * name
Definition: devices.h:54
u32_t magic(void)
uint32_t kboff
Definition: devices.h:58
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define uint16_t
Definition: nsiface.idl:60
static int dev
Definition: mkdosfs.c:536
#define FILE_SHARE_READ
Definition: compat.h:125
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
static wstring get_mountdev_name(const nt_handle &h)
Definition: devices.cpp:42
#define IOCTL_MOUNTMGR_QUERY_POINTS
Definition: mountmgr.h:30
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 FILE_SYNCHRONOUS_IO_ALERT
Definition: from_kernel.h:30
const GUID * guid
Definition: devices.h:37
DEV_ITEM dev_item
Definition: btrfs.h:233
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
Definition: ntddstor.h:132
GLuint index
Definition: glext.h:6031
#define IOCTL_DISK_GET_LENGTH_INFO
Definition: imports.h:192
USHORT DeviceNameLength
Definition: imports.h:171
BTRFS_UUID device_uuid
Definition: btrfs.h:172
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:167
GLsizeiptr size
Definition: glext.h:5919
STORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:457
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:376
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: cookie.c:170
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
__u8 attr
Definition: mkdosfs.c:359
static const WCHAR L[]
Definition: oid.c:1250
#define SetupDiGetClassDevs
Definition: setupapi.h:2588
BYTE uint8_t
Definition: msvideo1.c:66
LARGE_INTEGER Length
Definition: winioctl.h:423
Status
Definition: gdiplustypes.h:24
MOUNTMGR_MOUNT_POINT MountPoints[1]
Definition: imports.h:177
struct _GUID GUID
STORAGE_QUERY_TYPE QueryType
Definition: ntddstor.h:434
static const fs_identifier fs_ident[]
Definition: devices.h:64
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX
Definition: ntddk_ex.h:207
BTRFS_UUID uuid
Definition: btrfs.h:207
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
Definition: services.c:325
STORAGE_PROPERTY_ID PropertyId
Definition: ntddstor.h:433
#define MultiByteToWideChar
Definition: compat.h:100
UCHAR AdditionalParameters[1]
Definition: ntddstor.h:435
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
Definition: name.c:36
ULONG SymbolicLinkNameOffset
Definition: imports.h:166
unsigned int ULONG
Definition: retypes.h:1
USHORT SymbolicLinkNameLength
Definition: imports.h:167
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define malloc
Definition: debug_ros.c:4
uint64_t size
#define ss
Definition: i386-dis.c:432
#define memset(x, y, z)
Definition: compat.h:39
#define CP_OEMCP
Definition: winnls.h:228
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
LONGLONG QuadPart
Definition: typedefs.h:112
#define DIGCF_PRESENT
Definition: setupapi.h:171
off
Definition: i386-dis.c:3909
Definition: fci.c:126
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by BtrfsDeviceAdd::populate_device_tree().

◆ get_mountdev_name()

static wstring get_mountdev_name ( const nt_handle h)
static

Definition at line 42 of file devices.cpp.

42  {
45  MOUNTDEV_NAME mdn, *mdn2;
46  ULONG mdnsize;
47  wstring name;
48 
49  Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME,
50  nullptr, 0, &mdn, sizeof(MOUNTDEV_NAME));
52  return L"";
53 
54  mdnsize = offsetof(MOUNTDEV_NAME, Name[0]) + mdn.NameLength;
55 
56  mdn2 = (MOUNTDEV_NAME*)malloc(mdnsize);
57 
58  Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME,
59  nullptr, 0, mdn2, mdnsize);
60  if (!NT_SUCCESS(Status)) {
61  free(mdn2);
62  return L"";
63  }
64 
65  name = wstring(mdn2->Name, mdn2->NameLength / sizeof(WCHAR));
66 
67  free(mdn2);
68 
69  return name;
70 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define free
Definition: debug_ros.c:5
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
Definition: imports.h:93
#define offsetof(TYPE, MEMBER)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR Name[1]
Definition: imports.h:144
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
USHORT NameLength
Definition: imports.h:143
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by find_devices().

◆ RemoveDeviceW()

void CALLBACK RemoveDeviceW ( HWND  hwnd,
HINSTANCE  hinst,
LPWSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 906 of file devices.cpp.

906  {
907  try {
908  WCHAR *s, *vol, *dev;
909  uint64_t devid;
910  win_handle h, token;
912  LUID luid;
915 
916  set_dpi_aware();
917 
919  throw last_error(GetLastError());
920 
921  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
922  throw last_error(GetLastError());
923 
924  tp.PrivilegeCount = 1;
925  tp.Privileges[0].Luid = luid;
926  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
927 
928  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
929  throw last_error(GetLastError());
930 
931  s = wcsstr(lpszCmdLine, L"|");
932  if (!s)
933  return;
934 
935  s[0] = 0;
936 
937  vol = lpszCmdLine;
938  dev = &s[1];
939 
940  devid = _wtoi(dev);
941  if (devid == 0)
942  return;
943 
946 
947  if (h == INVALID_HANDLE_VALUE)
948  throw last_error(GetLastError());
949 
950  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_REMOVE_DEVICE, &devid, sizeof(uint64_t), nullptr, 0);
951  if (!NT_SUCCESS(Status)) {
954  else
955  throw ntstatus_error(Status);
956 
957  return;
958  }
959 
960  BtrfsBalance bb(vol, true);
961  bb.ShowBalance(hwnd);
962  } catch (const exception& e) {
963  error_message(hwnd, e.what());
964  }
965 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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)
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
static int dev
Definition: mkdosfs.c:536
#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
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:738
#define e
Definition: ke_i.h:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define OPEN_EXISTING
Definition: compat.h:426
#define IDS_CANNOT_REMOVE_RAID
Definition: resource.h:94
#define TOKEN_QUERY
Definition: setypes.h:874
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
Status
Definition: gdiplustypes.h:24
UINT64 uint64_t
Definition: types.h:77
#define FSCTL_BTRFS_REMOVE_DEVICE
Definition: btrfsioctl.h:21
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define CreateFileW
Definition: compat.h:400
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
void set_dpi_aware()
Definition: main.cpp:50

◆ ResizeDeviceW()

void CALLBACK ResizeDeviceW ( HWND  hwnd,
HINSTANCE  hinst,
LPWSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 967 of file devices.cpp.

967  {
968  try {
969  WCHAR *s, *vol, *dev;
970  uint64_t devid;
973  LUID luid;
974 
975  set_dpi_aware();
976 
978  throw last_error(GetLastError());
979 
980  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
981  throw last_error(GetLastError());
982 
983  tp.PrivilegeCount = 1;
984  tp.Privileges[0].Luid = luid;
985  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
986 
987  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
988  throw last_error(GetLastError());
989 
990  s = wcsstr(lpszCmdLine, L"|");
991  if (!s)
992  return;
993 
994  s[0] = 0;
995 
996  vol = lpszCmdLine;
997  dev = &s[1];
998 
999  devid = _wtoi(dev);
1000  if (devid == 0)
1001  return;
1002 
1003  BtrfsDeviceResize bdr;
1004  bdr.ShowDialog(hwnd, vol, devid);
1005  } catch (const exception& e) {
1006  error_message(hwnd, e.what());
1007  }
1008 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
static int dev
Definition: mkdosfs.c:536
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:738
#define e
Definition: ke_i.h:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define TOKEN_QUERY
Definition: setypes.h:874
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
UINT64 uint64_t
Definition: types.h:77
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
void set_dpi_aware()
Definition: main.cpp:50
void ShowDialog(HWND hwnd, const wstring &fn, uint64_t dev_id)
Definition: devices.cpp:867

◆ sort_devices()

static bool sort_devices ( device  i,
device  j 
)
static

Definition at line 340 of file devices.cpp.

340  {
341  if (i.disk_num < j.disk_num)
342  return true;
343 
344  if (i.disk_num == j.disk_num && i.part_num < j.part_num)
345  return true;
346 
347  return false;
348 }
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
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

Referenced by BtrfsDeviceAdd::populate_device_tree().

◆ stub_DeviceAddDlgProc()

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

Definition at line 657 of file devices.cpp.

657  {
658  BtrfsDeviceAdd* bda;
659 
660  if (uMsg == WM_INITDIALOG) {
662  bda = (BtrfsDeviceAdd*)lParam;
663  } else {
665  }
666 
667  if (bda)
668  return bda->DeviceAddDlgProc(hwndDlg, uMsg, wParam, lParam);
669  else
670  return false;
671 }
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
INT_PTR CALLBACK DeviceAddDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: devices.cpp:597
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139

Referenced by BtrfsDeviceAdd::ShowDialog().

◆ stub_DeviceResizeDlgProc()

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

Definition at line 852 of file devices.cpp.

852  {
853  BtrfsDeviceResize* bdr;
854 
855  if (uMsg == WM_INITDIALOG) {
857  bdr = (BtrfsDeviceResize*)lParam;
858  } else
860 
861  if (bdr)
862  return bdr->DeviceResizeDlgProc(hwndDlg, uMsg, wParam, lParam);
863  else
864  return false;
865 }
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
INT_PTR CALLBACK DeviceResizeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: devices.cpp:726
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139

Referenced by BtrfsDeviceResize::ShowDialog().