ReactOS  0.4.15-dev-1397-g19779b3
balance.cpp File Reference
#include "shellext.h"
#include "balance.h"
#include "resource.h"
#include "../btrfsioctl.h"
#include <shlobj.h>
#include <uxtheme.h>
#include <stdio.h>
#include <strsafe.h>
#include <winternl.h>
#include <shlwapi.h>
Include dependency graph for balance.cpp:

Go to the source code of this file.

Macros

#define NO_SHLWAPI_STRFCNS
 

Functions

static WCHAR hex_digit (uint8_t u)
 
static void serialize (void *data, ULONG len, WCHAR *s)
 
static INT_PTR CALLBACK stub_BalanceOptsDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK stub_BalanceDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static uint8_t from_hex_digit (WCHAR c)
 
static void unserialize (void *data, ULONG len, WCHAR *s)
 
void CALLBACK StartBalanceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 
void CALLBACK PauseBalanceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 
void CALLBACK StopBalanceW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 

Variables

static uint64_t convtypes2 [] = { BLOCK_FLAG_SINGLE, BLOCK_FLAG_DUPLICATE, BLOCK_FLAG_RAID0, BLOCK_FLAG_RAID1, BLOCK_FLAG_RAID5, BLOCK_FLAG_RAID6, BLOCK_FLAG_RAID10 }
 

Macro Definition Documentation

◆ NO_SHLWAPI_STRFCNS

#define NO_SHLWAPI_STRFCNS

Definition at line 41 of file balance.cpp.

Function Documentation

◆ from_hex_digit()

static uint8_t from_hex_digit ( WCHAR  c)
static

Definition at line 1041 of file balance.cpp.

1041  {
1042  if (c >= 'a' && c <= 'f')
1043  return (uint8_t)(c - 'a' + 0xa);
1044  else if (c >= 'A' && c <= 'F')
1045  return (uint8_t)(c - 'A' + 0xa);
1046  else
1047  return (uint8_t)(c - '0');
1048 }
const GLubyte * c
Definition: glext.h:8905
BYTE uint8_t
Definition: msvideo1.c:66

Referenced by unserialize().

◆ hex_digit()

static WCHAR hex_digit ( uint8_t  u)
static

Definition at line 47 of file balance.cpp.

47  {
48  if (u >= 0xa && u <= 0xf)
49  return (uint8_t)(u - 0xa + 'a');
50  else
51  return (uint8_t)(u + '0');
52 }
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
BYTE uint8_t
Definition: msvideo1.c:66

Referenced by serialize().

◆ PauseBalanceW()

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

Definition at line 1129 of file balance.cpp.

1129  {
1130  try {
1131  win_handle h, token;
1133  LUID luid;
1134 
1136  throw last_error(GetLastError());
1137 
1138  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1139  throw last_error(GetLastError());
1140 
1141  tp.PrivilegeCount = 1;
1142  tp.Privileges[0].Luid = luid;
1143  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1144 
1145  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1146  throw last_error(GetLastError());
1147 
1150 
1151  if (h != INVALID_HANDLE_VALUE) {
1152  NTSTATUS Status;
1154  btrfs_query_balance bqb2;
1155 
1156  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_BALANCE, nullptr, 0, &bqb2, sizeof(btrfs_query_balance));
1157  if (!NT_SUCCESS(Status))
1158  throw ntstatus_error(Status);
1159 
1160  if (bqb2.status & BTRFS_BALANCE_PAUSED)
1161  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_RESUME_BALANCE, nullptr, 0, nullptr, 0);
1162  else if (bqb2.status & BTRFS_BALANCE_RUNNING)
1163  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_PAUSE_BALANCE, nullptr, 0, nullptr, 0);
1164  else
1165  return;
1166 
1167  if (!NT_SUCCESS(Status))
1168  throw ntstatus_error(Status);
1169  } else
1170  throw last_error(GetLastError());
1171  } catch (const exception& e) {
1172  error_message(hwnd, e.what());
1173  }
1174 }
#define FSCTL_BTRFS_QUERY_BALANCE
Definition: btrfsioctl.h:15
#define FSCTL_BTRFS_RESUME_BALANCE
Definition: btrfsioctl.h:17
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
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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 BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
#define FILE_SHARE_READ
Definition: compat.h:136
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:785
#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 FSCTL_BTRFS_PAUSE_BALANCE
Definition: btrfsioctl.h:16
#define OPEN_EXISTING
Definition: compat.h:634
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2930
Status
Definition: gdiplustypes.h:24
#define TOKEN_QUERY
Definition: setypes.h:874
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
#define GetCurrentProcess()
Definition: compat.h:618
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
#define CreateFileW
Definition: compat.h:600
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:161
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

◆ serialize()

static void serialize ( void data,
ULONG  len,
WCHAR s 
)
static

Definition at line 54 of file balance.cpp.

54  {
55  uint8_t* d;
56 
57  d = (uint8_t*)data;
58 
59  while (true) {
60  *s = hex_digit((uint8_t)(*d >> 4)); s++;
61  *s = hex_digit(*d & 0xf); s++;
62 
63  d++;
64  len--;
65 
66  if (len == 0) {
67  *s = 0;
68  return;
69  }
70  }
71 }
static WCHAR hex_digit(uint8_t u)
Definition: balance.cpp:47
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
BYTE uint8_t
Definition: msvideo1.c:66
#define d
Definition: ke_i.h:81

Referenced by BtrfsBalance::StartBalance().

◆ StartBalanceW()

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

Definition at line 1068 of file balance.cpp.

1068  {
1069  try {
1070  WCHAR *s, *vol, *block;
1071  win_handle h, token;
1072  btrfs_start_balance bsb;
1074  LUID luid;
1075 
1076  s = wcsstr(lpszCmdLine, L" ");
1077  if (!s)
1078  return;
1079 
1080  s[0] = 0;
1081 
1082  vol = lpszCmdLine;
1083  block = &s[1];
1084 
1085  RtlZeroMemory(&bsb, sizeof(btrfs_start_balance));
1086  unserialize(&bsb, sizeof(btrfs_start_balance), block);
1087 
1089  throw last_error(GetLastError());
1090 
1091  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1092  throw last_error(GetLastError());
1093 
1094  tp.PrivilegeCount = 1;
1095  tp.Privileges[0].Luid = luid;
1096  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1097 
1098  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1099  throw last_error(GetLastError());
1100 
1103 
1104  if (h != INVALID_HANDLE_VALUE) {
1105  NTSTATUS Status;
1107 
1108  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_START_BALANCE, &bsb, sizeof(btrfs_start_balance), nullptr, 0);
1109 
1111  btrfs_query_scrub bqs;
1112  NTSTATUS Status2;
1113 
1114  Status2 = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_SCRUB, nullptr, 0, &bqs, sizeof(btrfs_query_scrub));
1115 
1116  if ((NT_SUCCESS(Status2) || Status2 == STATUS_BUFFER_OVERFLOW) && bqs.status != BTRFS_SCRUB_STOPPED)
1118  }
1119 
1120  if (!NT_SUCCESS(Status))
1121  throw ntstatus_error(Status);
1122  } else
1123  throw last_error(GetLastError());
1124  } catch (const exception& e) {
1125  error_message(hwnd, e.what());
1126  }
1127 }
static unsigned int block
Definition: xmlmemory.c:118
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define BTRFS_SCRUB_STOPPED
Definition: btrfsioctl.h:194
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)
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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:136
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
static void unserialize(void *data, ULONG len, WCHAR *s)
Definition: balance.cpp:1050
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#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:634
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2930
Status
Definition: gdiplustypes.h:24
#define TOKEN_QUERY
Definition: setypes.h:874
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FSCTL_BTRFS_QUERY_SCRUB
Definition: btrfsioctl.h:24
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
#define GetCurrentProcess()
Definition: compat.h:618
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define IDS_BALANCE_SCRUB_RUNNING
Definition: resource.h:117
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define CreateFileW
Definition: compat.h:600
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
#define FSCTL_BTRFS_START_BALANCE
Definition: btrfsioctl.h:14
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70

◆ StopBalanceW()

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

Definition at line 1176 of file balance.cpp.

1176  {
1177  try {
1178  win_handle h, token;
1180  LUID luid;
1181 
1183  throw last_error(GetLastError());
1184 
1185  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1186  throw last_error(GetLastError());
1187 
1188  tp.PrivilegeCount = 1;
1189  tp.Privileges[0].Luid = luid;
1190  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1191 
1192  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1193  throw last_error(GetLastError());
1194 
1197 
1198  if (h != INVALID_HANDLE_VALUE) {
1199  NTSTATUS Status;
1201  btrfs_query_balance bqb2;
1202 
1203  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_BALANCE, nullptr, 0, &bqb2, sizeof(btrfs_query_balance));
1204  if (!NT_SUCCESS(Status))
1205  throw ntstatus_error(Status);
1206 
1208  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_STOP_BALANCE, nullptr, 0, nullptr, 0);
1209  else
1210  return;
1211 
1212  if (!NT_SUCCESS(Status))
1213  throw ntstatus_error(Status);
1214  } else
1215  throw last_error(GetLastError());
1216  } catch (const exception& e) {
1217  error_message(hwnd, e.what());
1218  }
1219 }
#define FSCTL_BTRFS_QUERY_BALANCE
Definition: btrfsioctl.h:15
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
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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 BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
#define FILE_SHARE_READ
Definition: compat.h:136
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:785
#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 FSCTL_BTRFS_STOP_BALANCE
Definition: btrfsioctl.h:18
#define OPEN_EXISTING
Definition: compat.h:634
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2930
Status
Definition: gdiplustypes.h:24
#define TOKEN_QUERY
Definition: setypes.h:874
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
#define GetCurrentProcess()
Definition: compat.h:618
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
#define CreateFileW
Definition: compat.h:600
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:161
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

◆ stub_BalanceDlgProc()

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

Definition at line 963 of file balance.cpp.

963  {
964  BtrfsBalance* bb;
965 
966  if (uMsg == WM_INITDIALOG) {
968  bb = (BtrfsBalance*)lParam;
969  } else {
971  }
972 
973  if (bb)
974  return bb->BalanceDlgProc(hwndDlg, uMsg, wParam, lParam);
975  else
976  return false;
977 }
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
INT_PTR CALLBACK BalanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: balance.cpp:859
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by BtrfsBalance::ShowBalance().

◆ stub_BalanceOptsDlgProc()

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

Definition at line 838 of file balance.cpp.

838  {
839  BtrfsBalance* bb;
840 
841  if (uMsg == WM_INITDIALOG) {
843  bb = (BtrfsBalance*)lParam;
844  } else {
846  }
847 
848  if (bb)
849  return bb->BalanceOptsDlgProc(hwndDlg, uMsg, wParam, lParam);
850  else
851  return false;
852 }
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtr
Definition: treelist.c:73
INT_PTR CALLBACK BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: balance.cpp:512
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by BtrfsBalance::ShowBalanceOptions().

◆ unserialize()

static void unserialize ( void data,
ULONG  len,
WCHAR s 
)
static

Definition at line 1050 of file balance.cpp.

1050  {
1051  uint8_t* d;
1052 
1053  d = (uint8_t*)data;
1054 
1055  while (s[0] != 0 && s[1] != 0 && len > 0) {
1056  *d = (uint8_t)(from_hex_digit(s[0]) << 4) | from_hex_digit(s[1]);
1057 
1058  s += 2;
1059  d++;
1060  len--;
1061  }
1062 }
static uint8_t from_hex_digit(WCHAR c)
Definition: balance.cpp:1041
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
BYTE uint8_t
Definition: msvideo1.c:66
#define uint8_t
Definition: nsiface.idl:59
#define d
Definition: ke_i.h:81

Referenced by StartBalanceW().

Variable Documentation

◆ convtypes2