-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilesystem.h
More file actions
182 lines (165 loc) · 5.2 KB
/
filesystem.h
File metadata and controls
182 lines (165 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#pragma once
#pragma pack(push, 8)
// @note: originally "_FSINFOCLASS"
using FS_INFORMATION_CLASS = enum _FS_INFORMATION_CLASS
{
FileFsVolumeInformation = 1,
FileFsLabelInformation = 2, // requires 'FILE_WRITE_DATA'
FileFsSizeInformation = 3,
FileFsDeviceInformation = 4,
FileFsAttributeInformation = 5,
FileFsControlInformation = 6,
FileFsFullSizeInformation = 7,
FileFsObjectIdInformation = 8, // requires 'FILE_WRITE_DATA'
FileFsDriverPathInformation = 9,
FileFsVolumeFlagsInformation = 10, // requires 'FILE_READ_ATTRIBUTES' or 'FILE_WRITE_ATTRIBUTES'
#if Q_NT_VERSION >= Q_NT_WIN8
FileFsSectorSizeInformation = 11,
FileFsDataCopyInformation = 12,
#endif
#if Q_NT_VERSION >= Q_NT_WIN10
FileFsMetadataSizeInformation = 13,
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS5
FileFsFullSizeInformationEx = 14,
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_23H2
FileFsGuidInformation = 15,
#endif
MaxFileFsInfoClass // @note: originally "FileFsMaximumInformation"
};
struct FILE_FS_VOLUME_INFORMATION
{
LARGE_INTEGER VolumeCreationTime; // 0x00
std::uint32_t VolumeSerialNumber; // 0x08
std::uint32_t VolumeLabelLength; // 0x0C
bool SupportsObjects; // 0x10
wchar_t VolumeLabel[ANYSIZE_ARRAY]; // 0x12
};
struct FILE_FS_LABEL_INFORMATION
{
std::uint32_t VolumeLabelLength; // 0x0
wchar_t VolumeLabel[ANYSIZE_ARRAY]; // 0x4
};
struct FILE_FS_SIZE_INFORMATION
{
LARGE_INTEGER TotalAllocationUnits; // 0x00
LARGE_INTEGER AvailableAllocationUnits; // 0x08
std::uint32_t SectorsPerAllocationUnit; // 0x10
std::uint32_t BytesPerSector; // 0x14
};
static_assert(sizeof(FILE_FS_SIZE_INFORMATION) == 0x18);
// @todo: move to "io.h"?
using DEVICE_TYPE = std::uint32_t; // FILE_DEVICE_*
struct FILE_FS_DEVICE_INFORMATION
{
DEVICE_TYPE DeviceType; // 0x0
std::uint32_t Characteristics; // 0x4
};
static_assert(sizeof(FILE_FS_DEVICE_INFORMATION) == 0x8);
struct FILE_FS_ATTRIBUTE_INFORMATION
{
std::uint32_t FileSystemAttributes; // 0x0
std::int32_t MaximumComponentNameLength; // 0x4
std::uint32_t FileSystemNameLength; // 0x8
wchar_t FileSystemName[ANYSIZE_ARRAY]; // 0xC
};
struct FILE_FS_CONTROL_INFORMATION
{
LARGE_INTEGER FreeSpaceStartFiltering; // 0x00
LARGE_INTEGER FreeSpaceThreshold; // 0x08
LARGE_INTEGER FreeSpaceStopFiltering; // 0x10
LARGE_INTEGER DefaultQuotaThreshold; // 0x18
LARGE_INTEGER DefaultQuotaLimit; // 0x20
std::uint32_t FileSystemControlFlags; // 0x28
};
static_assert(sizeof(FILE_FS_CONTROL_INFORMATION) == 0x30);
struct FILE_FS_FULL_SIZE_INFORMATION
{
LARGE_INTEGER TotalAllocationUnits; // 0x00
LARGE_INTEGER CallerAvailableAllocationUnits; // 0x08
LARGE_INTEGER ActualAvailableAllocationUnits; // 0x10
std::uint32_t SectorsPerAllocationUnit; // 0x18
std::uint32_t BytesPerSector; // 0x1C
};
static_assert(sizeof(FILE_FS_FULL_SIZE_INFORMATION) == 0x20);
struct FILE_FS_OBJECTID_INFORMATION
{
GUID ObjectId; // 0x00
union
{
std::uint8_t ExtendedInfo[48];
struct
{
GUID BirthVolumeId;
GUID BirthObjectId;
GUID DomainId;
};
}; // 0x10
};
static_assert(sizeof(FILE_FS_OBJECTID_INFORMATION) == 0x40);
struct FILE_FS_DRIVER_PATH_INFORMATION
{
bool DriverInPath; // 0x0
std::uint32_t DriverNameLength; // 0x4
wchar_t DriverName[ANYSIZE_ARRAY]; // 0x8
};
struct FILE_FS_VOLUME_FLAGS_INFORMATION
{
std::uint32_t Flags;
};
static_assert(sizeof(FILE_FS_VOLUME_FLAGS_INFORMATION) == 0x4);
#if Q_NT_VERSION >= Q_NT_WIN8
struct FILE_FS_SECTOR_SIZE_INFORMATION
{
std::uint32_t LogicalBytesPerSector; // 0x00
std::uint32_t PhysicalBytesPerSectorForAtomicity; // 0x04
std::uint32_t PhysicalBytesPerSectorForPerformance; // 0x08
std::uint32_t FileSystemEffectivePhysicalBytesPerSectorForAtomicity; // 0x0C
std::uint32_t Flags; // 0x10
std::uint32_t ByteOffsetForSectorAlignment; // 0x14
std::uint32_t ByteOffsetForPartitionAlignment; // 0x18
};
static_assert(sizeof(FILE_FS_SECTOR_SIZE_INFORMATION) == 0x1C);
struct FILE_FS_DATA_COPY_INFORMATION
{
std::uint32_t NumberOfCopies;
};
static_assert(sizeof(FILE_FS_DATA_COPY_INFORMATION) == 0x4);
#endif
#if Q_NT_VERSION >= Q_NT_WIN10
struct FILE_FS_METADATA_SIZE_INFORMATION
{
LARGE_INTEGER TotalMetadataAllocationUnits; // 0x0
std::uint32_t SectorsPerAllocationUnit; // 0x8
std::uint32_t BytesPerSector; // 0xC
};
static_assert(sizeof(FILE_FS_METADATA_SIZE_INFORMATION) == 0x10);
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS5
struct FILE_FS_FULL_SIZE_INFORMATION_EX
{
std::uint64_t ActualTotalAllocationUnits; // 0x00
std::uint64_t ActualAvailableAllocationUnits; // 0x08
std::uint64_t ActualPoolUnavailableAllocationUnits; // 0x10
std::uint64_t CallerTotalAllocationUnits; // 0x18
std::uint64_t CallerAvailableAllocationUnits; // 0x20
std::uint64_t CallerPoolUnavailableAllocationUnits; // 0x28
std::uint64_t UsedAllocationUnits; // 0x30
std::uint64_t TotalReservedAllocationUnits; // 0x38
std::uint64_t VolumeStorageReserveAllocationUnits; // 0x40
std::uint64_t AvailableCommittedAllocationUnits; // 0x48
std::uint64_t PoolAvailableAllocationUnits; // 0x50
std::uint32_t SectorsPerAllocationUnit; // 0x58
std::uint32_t BytesPerSector; // 0x5C
};
static_assert(sizeof(FILE_FS_FULL_SIZE_INFORMATION_EX) == 0x60);
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_23H2
struct FILE_FS_GUID_INFORMATION
{
GUID FsGuid;
};
static_assert(sizeof(FILE_FS_GUID_INFORMATION) == 0x10);
#endif
#pragma pack(pop)