ReactOS  0.4.13-dev-563-g0561610
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 1037 of file balance.cpp.

1037  {
1038  if (c >= 'a' && c <= 'f')
1039  return (uint8_t)(c - 'a' + 0xa);
1040  else if (c >= 'A' && c <= 'F')
1041  return (uint8_t)(c - 'A' + 0xa);
1042  else
1043  return (uint8_t)(c - '0');
1044 }
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 1125 of file balance.cpp.

1125  {
1126  try {
1127  win_handle h, token;
1129  LUID luid;
1130 
1132  throw last_error(GetLastError());
1133 
1134  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1135  throw last_error(GetLastError());
1136 
1137  tp.PrivilegeCount = 1;
1138  tp.Privileges[0].Luid = luid;
1139  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1140 
1141  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1142  throw last_error(GetLastError());
1143 
1146 
1147  if (h != INVALID_HANDLE_VALUE) {
1148  NTSTATUS Status;
1150  btrfs_query_balance bqb2;
1151 
1152  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_BALANCE, nullptr, 0, &bqb2, sizeof(btrfs_query_balance));
1153  if (!NT_SUCCESS(Status))
1154  throw ntstatus_error(Status);
1155 
1156  if (bqb2.status & BTRFS_BALANCE_PAUSED)
1157  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_RESUME_BALANCE, nullptr, 0, nullptr, 0);
1158  else if (bqb2.status & BTRFS_BALANCE_RUNNING)
1159  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_PAUSE_BALANCE, nullptr, 0, nullptr, 0);
1160  else
1161  return;
1162 
1163  if (!NT_SUCCESS(Status))
1164  throw ntstatus_error(Status);
1165  } else
1166  throw last_error(GetLastError());
1167  } catch (const exception& e) {
1168  error_message(hwnd, e.what());
1169  }
1170 }
#define FSCTL_BTRFS_QUERY_BALANCE
Definition: btrfsioctl.h:16
#define FSCTL_BTRFS_RESUME_BALANCE
Definition: btrfsioctl.h:18
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: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
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:174
#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 FSCTL_BTRFS_PAUSE_BALANCE
Definition: btrfsioctl.h:17
#define OPEN_EXISTING
Definition: compat.h:426
#define TOKEN_QUERY
Definition: setypes.h:874
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
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
Status
Definition: gdiplustypes.h:24
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 BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:175
#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
#define d
Definition: ke_i.h:81
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

Referenced by BtrfsBalance::StartBalance().

◆ StartBalanceW()

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

Definition at line 1064 of file balance.cpp.

1064  {
1065  try {
1066  WCHAR *s, *vol, *block;
1067  win_handle h, token;
1068  btrfs_start_balance bsb;
1070  LUID luid;
1071 
1072  s = wcsstr(lpszCmdLine, L" ");
1073  if (!s)
1074  return;
1075 
1076  s[0] = 0;
1077 
1078  vol = lpszCmdLine;
1079  block = &s[1];
1080 
1081  RtlZeroMemory(&bsb, sizeof(btrfs_start_balance));
1082  unserialize(&bsb, sizeof(btrfs_start_balance), block);
1083 
1085  throw last_error(GetLastError());
1086 
1087  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1088  throw last_error(GetLastError());
1089 
1090  tp.PrivilegeCount = 1;
1091  tp.Privileges[0].Luid = luid;
1092  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1093 
1094  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1095  throw last_error(GetLastError());
1096 
1099 
1100  if (h != INVALID_HANDLE_VALUE) {
1101  NTSTATUS Status;
1103 
1104  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_START_BALANCE, &bsb, sizeof(btrfs_start_balance), nullptr, 0);
1105 
1107  btrfs_query_scrub bqs;
1108  NTSTATUS Status2;
1109 
1110  Status2 = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_SCRUB, nullptr, 0, &bqs, sizeof(btrfs_query_scrub));
1111 
1112  if ((NT_SUCCESS(Status2) || Status2 == STATUS_BUFFER_OVERFLOW) && bqs.status != BTRFS_SCRUB_STOPPED)
1114  }
1115 
1116  if (!NT_SUCCESS(Status))
1117  throw ntstatus_error(Status);
1118  } else
1119  throw last_error(GetLastError());
1120  } catch (const exception& e) {
1121  error_message(hwnd, e.what());
1122  }
1123 }
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:208
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: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
#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
static void unserialize(void *data, ULONG len, WCHAR *s)
Definition: balance.cpp:1046
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 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:25
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#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
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define IDS_BALANCE_SCRUB_RUNNING
Definition: resource.h:116
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 RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
#define FSCTL_BTRFS_START_BALANCE
Definition: btrfsioctl.h:15
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65

◆ StopBalanceW()

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

Definition at line 1172 of file balance.cpp.

1172  {
1173  try {
1174  win_handle h, token;
1176  LUID luid;
1177 
1179  throw last_error(GetLastError());
1180 
1181  if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid))
1182  throw last_error(GetLastError());
1183 
1184  tp.PrivilegeCount = 1;
1185  tp.Privileges[0].Luid = luid;
1186  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1187 
1188  if (!AdjustTokenPrivileges(token, false, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
1189  throw last_error(GetLastError());
1190 
1193 
1194  if (h != INVALID_HANDLE_VALUE) {
1195  NTSTATUS Status;
1197  btrfs_query_balance bqb2;
1198 
1199  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_BALANCE, nullptr, 0, &bqb2, sizeof(btrfs_query_balance));
1200  if (!NT_SUCCESS(Status))
1201  throw ntstatus_error(Status);
1202 
1204  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_STOP_BALANCE, nullptr, 0, nullptr, 0);
1205  else
1206  return;
1207 
1208  if (!NT_SUCCESS(Status))
1209  throw ntstatus_error(Status);
1210  } else
1211  throw last_error(GetLastError());
1212  } catch (const exception& e) {
1213  error_message(hwnd, e.what());
1214  }
1215 }
#define FSCTL_BTRFS_QUERY_BALANCE
Definition: btrfsioctl.h:16
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: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
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:174
#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 FSCTL_BTRFS_STOP_BALANCE
Definition: btrfsioctl.h:19
#define OPEN_EXISTING
Definition: compat.h:426
#define TOKEN_QUERY
Definition: setypes.h:874
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
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
Status
Definition: gdiplustypes.h:24
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 BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:175
#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 959 of file balance.cpp.

959  {
960  BtrfsBalance* bb;
961 
962  if (uMsg == WM_INITDIALOG) {
964  bb = (BtrfsBalance*)lParam;
965  } else {
967  }
968 
969  if (bb)
970  return bb->BalanceDlgProc(hwndDlg, uMsg, wParam, lParam);
971  else
972  return false;
973 }
#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:855
__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 BtrfsBalance::ShowBalance().

◆ stub_BalanceOptsDlgProc()

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

Definition at line 834 of file balance.cpp.

834  {
835  BtrfsBalance* bb;
836 
837  if (uMsg == WM_INITDIALOG) {
839  bb = (BtrfsBalance*)lParam;
840  } else {
842  }
843 
844  if (bb)
845  return bb->BalanceOptsDlgProc(hwndDlg, uMsg, wParam, lParam);
846  else
847  return false;
848 }
#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:514
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139

Referenced by BtrfsBalance::ShowBalanceOptions().

◆ unserialize()

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

Definition at line 1046 of file balance.cpp.

1046  {
1047  uint8_t* d;
1048 
1049  d = (uint8_t*)data;
1050 
1051  while (s[0] != 0 && s[1] != 0 && len > 0) {
1052  *d = (uint8_t)(from_hex_digit(s[0]) << 4) | from_hex_digit(s[1]);
1053 
1054  s += 2;
1055  d++;
1056  len--;
1057  }
1058 }
static uint8_t from_hex_digit(WCHAR c)
Definition: balance.cpp:1037
#define d
Definition: ke_i.h:81
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

Referenced by StartBalanceW().

Variable Documentation

◆ convtypes2