22#define WIN32_NO_STATUS
49#include "../btrfsioctl.h"
53#if defined(_X86_) || defined(_AMD64_)
63#define malloc(size) RtlAllocateHeap(RtlGetProcessHeap(), 0, (size))
64#define free(ptr) RtlFreeHeap(RtlGetProcessHeap(), 0, (ptr))
67#define SHA256_HASH_SIZE 32
70#define BLAKE2_HASH_SIZE 32
71void blake2b(
void *
out,
size_t outlen,
const void*
in,
size_t inlen);
74#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
75#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
76#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
79#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000
106#define FORMAT_FLAG_QUICK_FORMAT 0x00000001
107#define FORMAT_FLAG_UNKNOWN1 0x00000002
108#define FORMAT_FLAG_DISMOUNT_FIRST 0x00000004
109#define FORMAT_FLAG_UNKNOWN2 0x00000040
110#define FORMAT_FLAG_LARGE_RECORDS 0x00000100
111#define FORMAT_FLAG_INTEGRITY_DISABLE 0x00000100
128 Blink = ListHead->
Blink;
129 Entry->Flink = ListHead;
130 Entry->Blink = Blink;
168#define keycmp(key1, key2)\
169 ((key1.obj_id < key2.obj_id) ? -1 :\
170 ((key1.obj_id > key2.obj_id) ? 1 :\
171 ((key1.obj_type < key2.obj_type) ? -1 :\
172 ((key1.obj_type > key2.obj_type) ? 1 :\
173 ((key1.offset < key2.offset) ? -1 :\
174 ((key1.offset > key2.offset) ? 1 :\
271 TextOut.Output =
"stub, not implemented";
301 while (le != roots) {
305 le3 =
r->items.Flink;
306 while (le3 != &
r->items) {
328 while (le != chunks) {
345 item->key.obj_id = obj_id;
346 item->key.obj_type = obj_type;
358 while (le != &
r->items) {
376 off =
dev->last_alloc;
379 dev->dev_item.bytes_used +=
size;
401 while (le != chunks) {
404 if (
c->offset +
c->chunk_item->size > off)
405 off =
c->offset +
c->chunk_item->size;
411 if (
dev->dev_item.num_bytes > 0xC80000000)
423 if (
dev->dev_item.num_bytes -
dev->dev_item.bytes_used < stripes *
size)
433 c->chunk_item->size =
size;
436 c->chunk_item->type =
flags;
440 c->chunk_item->num_stripes = stripes;
441 c->chunk_item->sub_stripes = 0;
445 for (
i = 0;
i < stripes;
i++) {
463 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
485 addr =
addr - ((
addr -
c->offset) %
c->chunk_item->stripe_length) +
c->chunk_item->stripe_length;
487 if (
addr >=
c->offset +
c->chunk_item->size)
512 while (le != roots) {
518 c->lastoff =
r->header.address + node_size;
519 c->used += node_size;
535 if (
r->items.Flink == &
r->items) {
589 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
628 while (le != roots) {
635 r->header.num_items = 0;
636 r->header.fs_uuid = *fsuuid;
638 r->header.chunk_tree_uuid = *chunkuuid;
639 r->header.generation = 1;
640 r->header.tree_id =
r->id;
644 dp =
tree + node_size;
647 while (le2 != &
r->items) {
653 if (
item->size > 0) {
663 r->header.num_items++;
693 for (
i = 0;
i < 16;
i+=2) {
700 uuid->uuid[
i] = (
r & 0xff00) >> 8;
701 uuid->uuid[
i+1] =
r & 0xff;
711 dev->dev_item.num_bytes =
size;
712 dev->dev_item.bytes_used = 0;
716 dev->dev_item.type = 0;
717 dev->dev_item.generation = 0;
718 dev->dev_item.start_offset = 0;
719 dev->dev_item.dev_group = 0;
720 dev->dev_item.seek_speed = 0;
721 dev->dev_item.bandwidth = 0;
727 dev->dev_item.fs_uuid = *fsuuid;
729 dev->last_alloc = 0x100000;
770 while (le != &extent_root->
items) {
774 bytes_used +=
item->key.offset;
776 bytes_used += node_size;
804 if (
label->Length > 0) {
813 for (
unsigned int i = 0;
i <
label->Length /
sizeof(
WCHAR);
i++) {
815 if (
label->Buffer[
i] ==
'/' ||
label->Buffer[
i] ==
'\\') {
880 out->seconds =
l / 10000000;
881 out->nanoseconds = (
l % 10000000) * 100;
898 lpFileTime->dwLowDateTime = SystemTime.
LowPart;
899 lpFileTime->dwHighDateTime = SystemTime.
HighPart;
944 while (le != chunks) {
950 bgi.
flags =
c->chunk_item->type;
1034 static const char default_subvol[] =
"default";
1035 static const uint32_t default_hash = 0x8dbfc2d2;
1116 if (!metadata_chunk)
1138 Status =
write_superblocks(
h, &
dev, chunk_root, root_root, extent_root,
sys_chunk, node_size, &fsuuid,
sector_size,
label, incompat_flags);
1214 static WCHAR btrfs[] =
L"\\Btrfs";
1216 sblen =
sizeof(*sb);
1273 if (bfs2->num_devices == 1)
1281 if (bfs2->next_entry == 0)
1315 return ((
i != 0) && !(
i & (
i - 1)));
1318#if !defined(__REACTOS__) && (defined(_X86_) || defined(_AMD64_))
1319static void check_cpu() {
1320 unsigned int cpuInfo[4];
1324 __get_cpuid(1, &cpuInfo[0], &cpuInfo[1], &cpuInfo[2], &cpuInfo[3]);
1325 have_sse42 = cpuInfo[2] & bit_SSE4_2;
1328 have_sse42 = cpuInfo[2] & (1 << 20);
1355 static WCHAR btrfs[] =
L"\\Btrfs";
1366 tp.PrivilegeCount = 1;
1367 tp.Privileges[0].Luid = luid;
1377#if defined(_X86_) || defined(_AMD64_)
1454 Label = &empty_label;
1520 if (BackwardCompatible)
#define STATUS_PRIVILEGE_NOT_HELD
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
unsigned short int uint16_t
#define IDE_COMMAND_IDENTIFY
_In_ uint16_t _Out_ ULONG * atts
#define IOCTL_BTRFS_QUERY_FILESYSTEMS
#define IOCTL_BTRFS_PROBE_VOLUME
void __stdcall SetSizes(ULONG sector, ULONG node)
static void add_inode_ref(btrfs_root *r, uint64_t inode, uint64_t parent, uint64_t index, const char *name)
uint64_t def_incompat_flags
#define keycmp(key1, key2)
static uint64_t find_chunk_offset(uint64_t size, uint64_t offset, btrfs_dev *dev, btrfs_root *dev_root, BTRFS_UUID *chunkuuid)
static bool is_ssd(HANDLE h)
static void add_item(btrfs_root *r, uint64_t obj_id, uint8_t obj_type, uint64_t offset, void *data, uint16_t size)
#define FSCTL_LOCK_VOLUME
NTSTATUS WINAPI ChkdskEx(PUNICODE_STRING DriveRoot, BOOLEAN FixErrors, BOOLEAN Verbose, BOOLEAN CheckOnlyIfDirty, BOOLEAN ScanDrive, PFMIFSCALLBACK Callback)
void blake2b(void *out, size_t outlen, const void *in, size_t inlen)
static btrfs_chunk * add_chunk(LIST_ENTRY *chunks, uint64_t flags, btrfs_root *chunk_root, btrfs_dev *dev, btrfs_root *dev_root, BTRFS_UUID *chunkuuid, uint32_t sector_size)
static void calc_superblock_checksum(superblock *sb)
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, void *lpReserved)
BOOL __stdcall GetFilesystemInformation(uint32_t unk1, uint32_t unk2, void *unk3)
static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME *out)
#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED
static bool check_superblock_checksum(superblock *sb)
BOOL __stdcall FormatEx(DSTRING *root, STREAM_MESSAGE *message, options *opts, uint32_t unk1)
static bool is_power_of_two(ULONG i)
BOOLEAN(NTAPI * PFMIFSCALLBACK)(CALLBACKCOMMAND Command, ULONG SubAction, PVOID ActionInfo)
static NTSTATUS write_superblocks(HANDLE h, btrfs_dev *dev, btrfs_root *chunk_root, btrfs_root *root_root, btrfs_root *extent_root, btrfs_chunk *sys_chunk, uint32_t node_size, BTRFS_UUID *fsuuid, uint32_t sector_size, PUNICODE_STRING label, uint64_t incompat_flags)
static void get_uuid(BTRFS_UUID *uuid)
static NTSTATUS clear_first_megabyte(HANDLE h)
struct TEXTOUTPUT * PTEXTOUTPUT
static bool look_for_device(btrfs_filesystem *bfs, BTRFS_UUID *devuuid)
static void add_block_group_items(LIST_ENTRY *chunks, btrfs_root *extent_root)
#define FORMAT_FLAG_QUICK_FORMAT
static NTSTATUS NTAPI FormatEx2(PUNICODE_STRING DriveRoot, FMIFS_MEDIA_FLAG MediaFlag, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFMIFSCALLBACK Callback)
static void init_device(btrfs_dev *dev, uint64_t id, uint64_t size, BTRFS_UUID *fsuuid, uint32_t sector_size)
void __stdcall SetIncompatFlags(uint64_t incompat_flags)
#define FSCTL_UNLOCK_VOLUME
void calc_sha256(uint8_t *hash, const void *input, size_t len)
static btrfs_root * add_root(LIST_ENTRY *roots, uint64_t id)
static NTSTATUS write_roots(HANDLE h, LIST_ENTRY *roots, uint32_t node_size, BTRFS_UUID *fsuuid, BTRFS_UUID *chunkuuid)
static void calc_tree_checksum(tree_header *th, uint32_t node_size)
static uint64_t get_next_address(btrfs_chunk *c)
static NTSTATUS write_btrfs(HANDLE h, uint64_t size, PUNICODE_STRING label, uint32_t sector_size, uint32_t node_size, uint64_t incompat_flags)
static bool is_mounted_multi_device(HANDLE h, uint32_t sector_size)
static void init_fs_tree(btrfs_root *r, uint32_t node_size)
static void free_roots(LIST_ENTRY *roots)
static void do_full_trim(HANDLE h)
static bool superblock_collision(btrfs_chunk *c, uint64_t address)
static void add_dir_item(btrfs_root *root, uint64_t inode, uint32_t hash, uint64_t key_objid, uint8_t key_type, uint64_t key_offset, uint64_t transid, uint8_t type, const char *name)
#define FSCTL_DISMOUNT_VOLUME
static void set_default_subvol(btrfs_root *root_root, uint32_t node_size)
static void free_chunks(LIST_ENTRY *chunks)
NTSTATUS NTAPI NtWriteFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
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)
static void assign_addresses(LIST_ENTRY *roots, btrfs_chunk *sys_chunk, btrfs_chunk *metadata_chunk, uint32_t node_size, btrfs_root *root_root, btrfs_root *extent_root, bool skinny)
void __stdcall SetCsumType(uint16_t csum_type)
BOOLEAN NTAPI BtrfsFormat(IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN QuickFormat, IN BOOLEAN BackwardCompatible, IN MEDIA_TYPE MediaType, IN PUNICODE_STRING Label, IN ULONG ClusterSize)
BOOLEAN NTAPI BtrfsChkdsk(IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID pUnknown1, IN PVOID pUnknown2, IN PVOID pUnknown3, IN PVOID pUnknown4, IN PULONG ExitStatus)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
#define NT_SUCCESS(StatCode)
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define DLL_PROCESS_ATTACH
#define GetCurrentProcess()
#define WideCharToMultiByte
#define crc32(crc, buf, len)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
#define BTRFS_INCOMPAT_FLAGS_SKINNY_METADATA
#define BTRFS_ROOT_DATA_RELOC
static const uint64_t superblock_addrs[]
#define HEADER_FLAG_WRITTEN
#define BTRFS_INCOMPAT_FLAGS_MIXED_GROUPS
#define EXTENT_ITEM_TREE_BLOCK
#define HEADER_FLAG_MIXED_BACKREF
#define TYPE_BLOCK_GROUP_ITEM
#define BTRFS_ROOT_TREEDIR
#define BTRFS_INCOMPAT_FLAGS_MIXED_BACKREF
#define TYPE_TREE_BLOCK_REF
#define BTRFS_INCOMPAT_FLAGS_BIG_METADATA
#define BTRFS_ROOT_DEVTREE
#define BTRFS_ROOT_FSTREE
#define BTRFS_ROOT_EXTENT
#define BTRFS_ROOT_CHECKSUM
#define TYPE_METADATA_ITEM
#define BTRFS_INCOMPAT_FLAGS_EXTENDED_IREF
#define InsertTailList(ListHead, Entry)
#define RtlCompareMemory(s1, s2, l)
#define InitializeListHead(ListHead)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
#define FILE_SYNCHRONOUS_IO_ALERT
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLenum const GLvoid * addr
GLenum GLenum GLenum input
GLfloat GLfloat GLfloat GLfloat h
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
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
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
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ int __cdecl rand(void)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
#define memcpy(s1, s2, n)
#define IOCTL_DISK_GET_LENGTH_INFO
static const WCHAR label[]
static PIO_STATUS_BLOCK iosb
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE ApcRoutine
NTSYSAPI ULONG NTAPI RtlRandom(_Inout_ PULONG Seed)
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)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_READ_ATTRIBUTES
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)
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)
#define FILE_GENERIC_READ
#define FILE_GENERIC_WRITE
enum _MEDIA_TYPE MEDIA_TYPE
_In_ ULONG _In_ ULONG _In_ ULONG Length
struct _DEVICE_MANAGE_DATA_SET_ATTRIBUTES DEVICE_MANAGE_DATA_SET_ATTRIBUTES
#define DEVICE_DSM_FLAG_ENTIRE_DATA_SET_RANGE
#define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES
#define DeviceDsmAction_Trim
#define STATUS_INTERNAL_ERROR
#define offsetof(TYPE, MEMBER)
#define IOCTL_ATA_PASS_THROUGH
struct _ATA_PASS_THROUGH_EX ATA_PASS_THROUGH_EX
#define SUBVOL_ROOT_INODE
#define BTRFS_TYPE_DIRECTORY
#define BLOCK_FLAG_DUPLICATE
#define BLOCK_FLAG_SYSTEM
#define STATUS_BUFFER_OVERFLOW
#define BLOCK_FLAG_METADATA
BTRFS_UUID chunktree_uuid
base of all file and directory entries
ULONG_PTR DataBufferOffset
DEVICE_DATA_MANAGEMENT_SET_ACTION Action
ULONG ParameterBlockLength
ULONG ParameterBlockOffset
ULONG DataSetRangesOffset
ULONG DataSetRangesLength
USHORT NominalMediaRotationRate
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
btrfs_filesystem_device device
struct btrfs_disk_key key
uint64_t chunk_root_generation
uint64_t root_dir_objectid
uint8_t sys_chunk_array[SYS_CHUNK_ARRAY_SIZE]
char label[MAX_LABEL_SIZE]
uint64_t cache_generation
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define ATA_FLAGS_DATA_IN
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_INVALID_VOLUME_LABEL
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
#define success(from, fromstr, to, tostr)
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED
XXH_PUBLIC_API unsigned long long XXH64(const void *input, size_t len, unsigned long long seed)