22#if defined(_MSC_VER) && (_MSC_VER < 1900)
27#define ISOLATION_AWARE_ENABLED 1
28#define STRSAFE_NO_DEPRECATE
32#define _WIN32_WINNT 0x0A00
39#define WIN32_NO_STATUS
49#define string_view string
50#define wstring_view wstring
56#include "../btrfsioctl.h"
65#define STATUS_SUCCESS (NTSTATUS)0x00000000
66#define STATUS_BUFFER_OVERFLOW (NTSTATUS)0x80000005
67#define STATUS_END_OF_FILE (NTSTATUS)0xc0000011
68#define STATUS_MORE_PROCESSING_REQUIRED (NTSTATUS)0xc0000016
69#define STATUS_BUFFER_TOO_SMALL (NTSTATUS)0xc0000023
70#define STATUS_DEVICE_NOT_READY (NTSTATUS)0xc00000a3
71#define STATUS_CANNOT_DELETE (NTSTATUS)0xc0000121
72#define STATUS_NOT_FOUND (NTSTATUS)0xc0000225
75#define BLOCK_FLAG_DATA 0x001
76#define BLOCK_FLAG_SYSTEM 0x002
77#define BLOCK_FLAG_METADATA 0x004
78#define BLOCK_FLAG_RAID0 0x008
79#define BLOCK_FLAG_RAID1 0x010
80#define BLOCK_FLAG_DUPLICATE 0x020
81#define BLOCK_FLAG_RAID10 0x040
82#define BLOCK_FLAG_RAID5 0x080
83#define BLOCK_FLAG_RAID6 0x100
85#define BTRFS_TYPE_FILE 1
86#define BTRFS_TYPE_DIRECTORY 2
87#define BTRFS_TYPE_CHARDEV 3
88#define BTRFS_TYPE_BLOCKDEV 4
89#define BTRFS_TYPE_FIFO 5
90#define BTRFS_TYPE_SOCKET 6
91#define BTRFS_TYPE_SYMLINK 7
94#define funcname __FUNCTION__
96#define funcname __func__
100#pragma warning(disable: 4800)
123#define FileBasicInformation (FILE_INFORMATION_CLASS)4
124#define FileStandardInformation (FILE_INFORMATION_CLASS)5
125#define FileDispositionInformation (FILE_INFORMATION_CLASS)13
126#define FileEndOfFileInformation (FILE_INFORMATION_CLASS)20
127#define FileStreamInformation (FILE_INFORMATION_CLASS)22
140 FileFsSectorSizeInformation,
141 FileFsDataCopyInformation,
142 FileFsMetadataSizeInformation,
143 FileFsFullSizeInformationEx,
193#define SYMLINK_FLAG_RELATIVE 1
196#ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING
205#define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_ACCESS)
221#define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
222#define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
unsigned short int uint16_t
fff_handle & operator=(const HANDLE nh)
const char * what() const noexcept
nt_handle & operator=(const HANDLE nh)
const char * what() const noexcept
const char * what() const noexcept
win_handle & operator=(const HANDLE nh)
#define INVALID_HANDLE_VALUE
BOOL WINAPI FindClose(HANDLE hFindFile)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ FS_INFORMATION_CLASS FsInformationClass
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG FsControlCode
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
enum _FSINFOCLASS * PFS_INFORMATION_CLASS
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
@ FileFsVolumeFlagsInformation
@ FileFsControlInformation
@ FileFsDeviceInformation
@ FileFsAttributeInformation
@ FileFsVolumeInformation
@ FileFsMaximumInformation
enum _FSINFOCLASS FS_INFORMATION_CLASS
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat GLfloat h
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
struct _FILE_STREAM_INFORMATION FILE_STREAM_INFORMATION
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
static OUT PIO_STATUS_BLOCK IoStatusBlock
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
DWORD SECURITY_INFORMATION
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE ApcRoutine
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(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)
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define FileFsDriverPathInformation
#define FileFsFullSizeInformation
#define FileFsObjectIdInformation
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER FSCTL_GET_INTEGRITY_INFORMATION_BUFFER
NTSTATUS WINAPI NtSetEaFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length)
bool load_string(HMODULE module, UINT id, wstring &s)
wstring format_message(ULONG last_error)
void error_message(HWND hwnd, const char *msg)
wstring format_ntstatus(NTSTATUS Status)
void wstring_sprintf(wstring &s, wstring fmt,...)
void format_size(uint64_t size, wstring &s, bool show_bytes)
struct _REPARSE_DATA_BUFFER REPARSE_DATA_BUFFER
struct _DUPLICATE_EXTENTS_DATA DUPLICATE_EXTENTS_DATA
struct _REPARSE_DATA_BUFFER * PREPARSE_DATA_BUFFER
struct _DUPLICATE_EXTENTS_DATA * PDUPLICATE_EXTENTS_DATA
void command_line_to_args(LPWSTR cmdline, vector< wstring > &args)
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER FSCTL_SET_INTEGRITY_INFORMATION_BUFFER
wstring utf8_to_utf16(const string_view &utf8)
NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
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)
LARGE_INTEGER SourceFileOffset
LARGE_INTEGER TargetFileOffset
struct _REPARSE_DATA_BUFFER::@313::@315 SymbolicLinkReparseBuffer
USHORT SubstituteNameLength
struct _REPARSE_DATA_BUFFER::@313::@317 GenericReparseBuffer
USHORT SubstituteNameOffset
struct _REPARSE_DATA_BUFFER::@313::@316 MountPointReparseBuffer
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor