1 /* 2 * winioctl.h 3 * 4 * 32-Bit Windows Device I/O control codes. 5 * Definitions extracted from various NT DDK headers. 6 * 7 * This file is part of the w32api package. 8 * 9 * Contributors: 10 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net> 11 * Amine Khaldi <amine.khaldi@reactos.org> 12 * Pierre Schweitzer <pierre@reactos.org> 13 * Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 14 * 15 * THIS SOFTWARE IS NOT COPYRIGHTED 16 * 17 * This source code is offered for use in the public domain. You may 18 * use, modify or distribute it freely. 19 * 20 * This code is distributed in the hope that it will be useful but 21 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 22 * DISCLAIMED. This includes but is not limited to warranties of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 24 * 25 */ 26 27 #ifndef _WINIOCTL_ 28 #define _WINIOCTL_ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #ifdef _MSC_VER 35 #pragma warning(push) 36 #pragma warning(disable:4201) 37 #pragma warning(disable:4820) 38 #endif 39 40 41 #ifndef _DEVIOCTL_ 42 #define _DEVIOCTL_ 43 44 #define DEVICE_TYPE DWORD 45 46 #define FILE_DEVICE_BEEP 1 47 #define FILE_DEVICE_CD_ROM 2 48 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 3 49 #define FILE_DEVICE_CONTROLLER 4 50 #define FILE_DEVICE_DATALINK 5 51 #define FILE_DEVICE_DFS 6 52 #define FILE_DEVICE_DISK 7 53 #define FILE_DEVICE_DISK_FILE_SYSTEM 8 54 #define FILE_DEVICE_FILE_SYSTEM 9 55 #define FILE_DEVICE_INPORT_PORT 10 56 #define FILE_DEVICE_KEYBOARD 11 57 #define FILE_DEVICE_MAILSLOT 12 58 #define FILE_DEVICE_MIDI_IN 13 59 #define FILE_DEVICE_MIDI_OUT 14 60 #define FILE_DEVICE_MOUSE 15 61 #define FILE_DEVICE_MULTI_UNC_PROVIDER 16 62 #define FILE_DEVICE_NAMED_PIPE 17 63 #define FILE_DEVICE_NETWORK 18 64 #define FILE_DEVICE_NETWORK_BROWSER 19 65 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 20 66 #define FILE_DEVICE_NULL 21 67 #define FILE_DEVICE_PARALLEL_PORT 22 68 #define FILE_DEVICE_PHYSICAL_NETCARD 23 69 #define FILE_DEVICE_PRINTER 24 70 #define FILE_DEVICE_SCANNER 25 71 #define FILE_DEVICE_SERIAL_MOUSE_PORT 26 72 #define FILE_DEVICE_SERIAL_PORT 27 73 #define FILE_DEVICE_SCREEN 28 74 #define FILE_DEVICE_SOUND 29 75 #define FILE_DEVICE_STREAMS 30 76 #define FILE_DEVICE_TAPE 31 77 #define FILE_DEVICE_TAPE_FILE_SYSTEM 32 78 #define FILE_DEVICE_TRANSPORT 33 79 #define FILE_DEVICE_UNKNOWN 34 80 #define FILE_DEVICE_VIDEO 35 81 #define FILE_DEVICE_VIRTUAL_DISK 36 82 #define FILE_DEVICE_WAVE_IN 37 83 #define FILE_DEVICE_WAVE_OUT 38 84 #define FILE_DEVICE_8042_PORT 39 85 #define FILE_DEVICE_NETWORK_REDIRECTOR 40 86 #define FILE_DEVICE_BATTERY 41 87 #define FILE_DEVICE_BUS_EXTENDER 42 88 #define FILE_DEVICE_MODEM 43 89 #define FILE_DEVICE_VDM 44 90 #define FILE_DEVICE_MASS_STORAGE 45 91 #define FILE_DEVICE_SMB 46 92 #define FILE_DEVICE_KS 47 93 #define FILE_DEVICE_CHANGER 48 94 #define FILE_DEVICE_SMARTCARD 49 95 #define FILE_DEVICE_ACPI 50 96 #define FILE_DEVICE_DVD 51 97 #define FILE_DEVICE_FULLSCREEN_VIDEO 52 98 #define FILE_DEVICE_DFS_FILE_SYSTEM 53 99 #define FILE_DEVICE_DFS_VOLUME 54 100 #define FILE_DEVICE_SERENUM 55 101 #define FILE_DEVICE_TERMSRV 56 102 #define FILE_DEVICE_KSEC 57 103 #define FILE_DEVICE_FIPS 58 104 #define FILE_DEVICE_INFINIBAND 59 105 #define FILE_DEVICE_VMBUS 62 106 #define FILE_DEVICE_CRYPT_PROVIDER 63 107 #define FILE_DEVICE_WPD 64 108 #define FILE_DEVICE_BLUETOOTH 65 109 #define FILE_DEVICE_MT_COMPOSITE 66 110 #define FILE_DEVICE_MT_TRANSPORT 67 111 #define FILE_DEVICE_BIOMETRIC 68 112 #define FILE_DEVICE_PMI 69 113 #define FILE_DEVICE_EHSTOR 70 114 #define FILE_DEVICE_DEVAPI 71 115 #define FILE_DEVICE_GPIO 72 116 #define FILE_DEVICE_USBEX 73 117 #define FILE_DEVICE_CONSOLE 80 118 #define FILE_DEVICE_NFP 81 119 #define FILE_DEVICE_SYSENV 82 120 #define FILE_DEVICE_VIRTUAL_BLOCK 83 121 #define FILE_DEVICE_POINT_OF_SERVICE 84 122 #define FILE_DEVICE_STORAGE_REPLICATION 85 123 #define FILE_DEVICE_TRUST_ENV 86 124 #define FILE_DEVICE_UCM 87 125 #define FILE_DEVICE_UCMTCPCI 88 126 #define FILE_DEVICE_PERSISTENT_MEMORY 89 127 #define FILE_DEVICE_NVDIMM 90 128 #define FILE_DEVICE_HOLOGRAPHIC 91 129 #define FILE_DEVICE_SDFXHCI 92 130 #define FILE_DEVICE_UCMUCSI 93 131 132 /* Also in ddk/winddk.h */ 133 #define FILE_ANY_ACCESS 0x00000000 134 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS 135 #define FILE_READ_ACCESS 0x00000001 136 #define FILE_WRITE_ACCESS 0x00000002 137 138 #define METHOD_BUFFERED 0 139 #define METHOD_IN_DIRECT 1 140 #define METHOD_OUT_DIRECT 2 141 #define METHOD_NEITHER 3 142 143 #define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m)) 144 #define DEVICE_TYPE_FROM_CTL_CODE(c) (((DWORD)((c)&0xffff0000))>>16) 145 146 #endif /* _DEVIOCTL_ */ 147 148 #ifndef _NTDDSTOR_H_ 149 // #define _NTDDSTOR_H_ 150 151 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE 152 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS) 153 #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS) 154 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS) 155 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS) 156 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS) 157 #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS) 158 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS) 159 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS) 160 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS) 161 #define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS) 162 #define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS) 163 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS) 164 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS) 165 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS) 166 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS) 167 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS) 168 #define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS) 169 170 typedef struct _PREVENT_MEDIA_REMOVAL { 171 BOOLEAN PreventMediaRemoval; 172 } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL; 173 174 #endif /* _NTDDSTOR_H_ */ 175 176 #ifndef _NTDDDISK_H_ 177 // #define _NTDDDISK_H_ 178 179 #define IOCTL_DISK_BASE FILE_DEVICE_DISK 180 #define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE,0,METHOD_BUFFERED, FILE_ANY_ACCESS) 181 #define IOCTL_DISK_GET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,1,METHOD_BUFFERED,FILE_READ_ACCESS) 182 #define IOCTL_DISK_SET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) 183 #define IOCTL_DISK_GET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS) 184 #define IOCTL_DISK_SET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,4,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) 185 #define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS) 186 #define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE,6,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) 187 #define IOCTL_DISK_REASSIGN_BLOCKS CTL_CODE(IOCTL_DISK_BASE,7,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) 188 #define IOCTL_DISK_PERFORMANCE CTL_CODE(IOCTL_DISK_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS) 189 #define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS) 190 #define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS) 191 #define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE,11,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) 192 #define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS) 193 #define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS) 194 #define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS) 195 #define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS) 196 #define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS) 197 #define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x12,METHOD_BUFFERED,FILE_ANY_ACCESS) 198 #define IOCTL_DISK_SET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x13,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 199 #define IOCTL_DISK_GET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x14,METHOD_BUFFERED,FILE_ANY_ACCESS) 200 #define IOCTL_DISK_SET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x15,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 201 #define IOCTL_DISK_CREATE_DISK CTL_CODE(IOCTL_DISK_BASE,0x16,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 202 #define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE,0x17,METHOD_BUFFERED,FILE_READ_ACCESS) 203 #define IOCTL_DISK_PERFORMANCE_OFF CTL_CODE(IOCTL_DISK_BASE,0x18,METHOD_BUFFERED,FILE_ANY_ACCESS) 204 #define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE,0x28,METHOD_BUFFERED,FILE_ANY_ACCESS) 205 #define IOCTL_DISK_GROW_PARTITION CTL_CODE(IOCTL_DISK_BASE,0x34,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 206 #define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x35,METHOD_BUFFERED,FILE_READ_ACCESS) 207 #define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x36,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 208 #define IOCTL_DISK_DELETE_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x40,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 209 #define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x50,METHOD_BUFFERED,FILE_ANY_ACCESS) 210 #define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x200,METHOD_BUFFERED,FILE_READ_ACCESS) 211 #define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS) 212 #define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS) 213 #define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS) 214 #define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE,0x204,METHOD_BUFFERED,FILE_READ_ACCESS) 215 #define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS) 216 #define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE,0x206,METHOD_BUFFERED,FILE_READ_ACCESS) 217 #define IOCTL_DISK_REMOVE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS) 218 #define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE,0x300,METHOD_BUFFERED,FILE_ANY_ACCESS) 219 #define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 220 221 222 #define PARTITION_ENTRY_UNUSED 0x00 223 #define PARTITION_FAT_12 0x01 224 #define PARTITION_XENIX_1 0x02 225 #define PARTITION_XENIX_2 0x03 226 #define PARTITION_FAT_16 0x04 227 #define PARTITION_EXTENDED 0x05 228 #define PARTITION_HUGE 0x06 229 #define PARTITION_IFS 0x07 230 #define PARTITION_OS2BOOTMGR 0x0A 231 #define PARTITION_FAT32 0x0B 232 #define PARTITION_FAT32_XINT13 0x0C 233 #define PARTITION_XINT13 0x0E 234 #define PARTITION_XINT13_EXTENDED 0x0F 235 #define PARTITION_MSFT_RECOVERY 0x27 236 #define PARTITION_MAIN_OS 0x28 237 #define PARTIITON_OS_DATA 0x29 238 #define PARTITION_PRE_INSTALLED 0x2a 239 #define PARTITION_BSP 0x2b 240 #define PARTITION_DPP 0x2c 241 #define PARTITION_WINDOWS_SYSTEM 0x2d 242 #define PARTITION_PREP 0x41 243 #define PARTITION_LDM 0x42 244 #define PARTITION_DM 0x54 245 #define PARTITION_EZDRIVE 0x55 246 #define PARTITION_UNIX 0x63 247 #define PARTITION_SPACES_DATA 0xD7 248 #define PARTITION_SPACES 0xE7 249 #define PARTITION_GPT 0xEE 250 #define PARTITION_SYSTEM 0xEF 251 252 #define VALID_NTFT 0xC0 253 #define PARTITION_NTFT 0x80 254 255 #ifdef __REACTOS__ 256 #define PARTITION_OLD_LINUX 0x43 257 #define PARTITION_LINUX 0x83 258 #define PARTITION_ISO9660 0x96 259 #define PARTITION_FREEBSD 0xA5 260 #define PARTITION_OPENBSD 0xA6 261 #define PARTITION_NETBSD 0xA9 262 #endif 263 264 /* 265 * NOTE: Support for partition types removed from IsFTPartition() and 266 * IsRecognizedPartition() because they conflict with 3rd-party types: 267 * PARTITION_NTFT | PARTITION_FAT_12 : Conflict with 0x81 "Linux or MINIX" 268 * PARTITION_NTFT | PARTITION_FAT_16 : Conflict with 0x84 "Hibernation" 269 * PARTITION_NTFT | PARTITION_XINT13 : Conflict with 0x8E "Linux LVM" 270 */ 271 #define IsFTPartition(PartitionType) \ 272 ( ((PartitionType) & PARTITION_NTFT) && ((((PartitionType) & ~VALID_NTFT) == PARTITION_HUGE) || \ 273 (((PartitionType) & ~VALID_NTFT) == PARTITION_IFS) || \ 274 (((PartitionType) & ~VALID_NTFT) == PARTITION_FAT32) || \ 275 (((PartitionType) & ~VALID_NTFT) == PARTITION_FAT32_XINT13)) ) 276 277 #define IsContainerPartition(PartitionType) \ 278 ( ((PartitionType) == PARTITION_EXTENDED) || \ 279 ((PartitionType) == PARTITION_XINT13_EXTENDED) ) 280 281 #ifdef __REACTOS__ 282 #define IsRecognizedPartition(PartitionType) \ 283 ( IsFTPartition(PartitionType) || \ 284 ((PartitionType) == PARTITION_FAT_12) || \ 285 ((PartitionType) == PARTITION_FAT_16) || \ 286 ((PartitionType) == PARTITION_HUGE) || \ 287 ((PartitionType) == PARTITION_IFS) || \ 288 ((PartitionType) == PARTITION_FAT32) || \ 289 ((PartitionType) == PARTITION_FAT32_XINT13) || \ 290 ((PartitionType) == PARTITION_XINT13) || \ 291 ((PartitionType) == PARTITION_LINUX) || \ 292 ((PartitionType) == PARTITION_OLD_LINUX) || \ 293 ((PartitionType) == PARTITION_ISO9660) || \ 294 ((PartitionType) == PARTITION_FREEBSD) || \ 295 ((PartitionType) == PARTITION_OPENBSD) || \ 296 ((PartitionType) == PARTITION_NETBSD) ) 297 #else 298 #define IsRecognizedPartition(PartitionType) \ 299 ( IsFTPartition(PartitionType) || \ 300 ((PartitionType) == PARTITION_FAT_12) || \ 301 ((PartitionType) == PARTITION_FAT_16) || \ 302 ((PartitionType) == PARTITION_HUGE) || \ 303 ((PartitionType) == PARTITION_IFS) || \ 304 ((PartitionType) == PARTITION_FAT32) || \ 305 ((PartitionType) == PARTITION_FAT32_XINT13) || \ 306 ((PartitionType) == PARTITION_XINT13) ) 307 #endif 308 309 310 #define DISK_LOGGING_START 0 311 #define DISK_LOGGING_STOP 1 312 #define DISK_LOGGING_DUMP 2 313 #define DISK_BINNING 3 314 typedef WORD BAD_TRACK_NUMBER, *PBAD_TRACK_NUMBER; 315 typedef enum _BIN_TYPES { 316 RequestSize, 317 RequestLocation 318 } BIN_TYPES; 319 typedef struct _BIN_RANGE { 320 LARGE_INTEGER StartValue; 321 LARGE_INTEGER Length; 322 } BIN_RANGE, *PBIN_RANGE; 323 typedef struct _BIN_COUNT { 324 BIN_RANGE BinRange; 325 DWORD BinCount; 326 } BIN_COUNT, *PBIN_COUNT; 327 typedef struct _BIN_RESULTS { 328 DWORD NumberOfBins; 329 BIN_COUNT BinCounts[1]; 330 } BIN_RESULTS, *PBIN_RESULTS; 331 332 typedef enum _MEDIA_TYPE { 333 Unknown, 334 F5_1Pt2_512, 335 F3_1Pt44_512, 336 F3_2Pt88_512, 337 F3_20Pt8_512, 338 F3_720_512, 339 F5_360_512, 340 F5_320_512, 341 F5_320_1024, 342 F5_180_512, 343 F5_160_512, 344 RemovableMedia, 345 FixedMedia, 346 F3_120M_512, 347 F3_640_512, 348 F5_640_512, 349 F5_720_512, 350 F3_1Pt2_512, 351 F3_1Pt23_1024, 352 F5_1Pt23_1024, 353 F3_128Mb_512, 354 F3_230Mb_512, 355 F8_256_128, 356 F3_200Mb_512, 357 F3_240M_512, 358 F3_32M_512 359 } MEDIA_TYPE, *PMEDIA_TYPE; 360 361 typedef struct _DISK_GEOMETRY { 362 LARGE_INTEGER Cylinders; 363 MEDIA_TYPE MediaType; 364 DWORD TracksPerCylinder; 365 DWORD SectorsPerTrack; 366 DWORD BytesPerSector; 367 } DISK_GEOMETRY, *PDISK_GEOMETRY; 368 typedef struct _PARTITION_INFORMATION { 369 LARGE_INTEGER StartingOffset; 370 LARGE_INTEGER PartitionLength; 371 DWORD HiddenSectors; 372 DWORD PartitionNumber; 373 BYTE PartitionType; 374 BOOLEAN BootIndicator; 375 BOOLEAN RecognizedPartition; 376 BOOLEAN RewritePartition; 377 } PARTITION_INFORMATION, *PPARTITION_INFORMATION; 378 typedef struct _DRIVE_LAYOUT_INFORMATION { 379 DWORD PartitionCount; 380 DWORD Signature; 381 PARTITION_INFORMATION PartitionEntry[1]; 382 } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION; 383 typedef struct _SET_PARTITION_INFORMATION { 384 BYTE PartitionType; 385 } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION; 386 387 #if (_WIN32_WINNT >= 0x0500) 388 /* Actually it should be > 0x0500, since this is not present in Windows 2000; 389 * however we keep >= 0x0500 for compatibility with MS PSDK. */ 390 391 typedef enum _PARTITION_STYLE { 392 PARTITION_STYLE_MBR, 393 PARTITION_STYLE_GPT, 394 PARTITION_STYLE_RAW 395 } PARTITION_STYLE; 396 397 typedef struct _CREATE_DISK_GPT { 398 GUID DiskId; 399 DWORD MaxPartitionCount; 400 } CREATE_DISK_GPT, *PCREATE_DISK_GPT; 401 typedef struct _CREATE_DISK_MBR { 402 DWORD Signature; 403 } CREATE_DISK_MBR, *PCREATE_DISK_MBR; 404 typedef struct _CREATE_DISK { 405 PARTITION_STYLE PartitionStyle; 406 _ANONYMOUS_UNION union { 407 CREATE_DISK_MBR Mbr; 408 CREATE_DISK_GPT Gpt; 409 }; 410 } CREATE_DISK, *PCREATE_DISK; 411 412 typedef enum _DETECTION_TYPE { 413 DetectNone, 414 DetectInt13, 415 DetectExInt13 416 } DETECTION_TYPE; 417 typedef struct _DISK_INT13_INFO { 418 WORD DriveSelect; 419 DWORD MaxCylinders; 420 WORD SectorsPerTrack; 421 WORD MaxHeads; 422 WORD NumberDrives; 423 } DISK_INT13_INFO, *PDISK_INT13_INFO; 424 typedef struct _DISK_EX_INT13_INFO { 425 WORD ExBufferSize; 426 WORD ExFlags; 427 DWORD ExCylinders; 428 DWORD ExHeads; 429 DWORD ExSectorsPerTrack; 430 DWORD64 ExSectorsPerDrive; 431 WORD ExSectorSize; 432 WORD ExReserved; 433 } DISK_EX_INT13_INFO, *PDISK_EX_INT13_INFO; 434 typedef struct _DISK_DETECTION_INFO { 435 DWORD SizeOfDetectInfo; 436 DETECTION_TYPE DetectionType; 437 _ANONYMOUS_UNION union { 438 _ANONYMOUS_STRUCT struct { 439 DISK_INT13_INFO Int13; 440 DISK_EX_INT13_INFO ExInt13; 441 }; 442 }; 443 } DISK_DETECTION_INFO, *PDISK_DETECTION_INFO; 444 typedef struct _DISK_PARTITION_INFO { 445 DWORD SizeOfPartitionInfo; 446 PARTITION_STYLE PartitionStyle; 447 _ANONYMOUS_UNION union { 448 struct { 449 DWORD Signature; 450 DWORD CheckSum; 451 } Mbr; 452 struct { 453 GUID DiskId; 454 } Gpt; 455 }; 456 } DISK_PARTITION_INFO, *PDISK_PARTITION_INFO; 457 typedef struct _DISK_GEOMETRY_EX { 458 DISK_GEOMETRY Geometry; 459 LARGE_INTEGER DiskSize; 460 BYTE Data[1]; 461 } DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX; 462 463 #if (NTDDI_VERSION < NTDDI_WS03) 464 #define DiskGeometryGetPartition(Geometry) \ 465 ((PDISK_PARTITION_INFO)((Geometry) + 1)) 466 467 #define DiskGeometryGetDetect(Geometry)\ 468 ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \ 469 DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) 470 #else 471 #define DiskGeometryGetPartition(Geometry) \ 472 ((PDISK_PARTITION_INFO)((Geometry)->Data)) 473 474 #define DiskGeometryGetDetect(Geometry)\ 475 ((PDISK_DETECTION_INFO)(((ULONG_PTR)DiskGeometryGetPartition(Geometry) + \ 476 DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) 477 #endif 478 479 typedef struct _PARTITION_INFORMATION_GPT { 480 GUID PartitionType; 481 GUID PartitionId; 482 DWORD64 Attributes; 483 WCHAR Name[36]; 484 } PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT; 485 typedef struct _PARTITION_INFORMATION_MBR { 486 BYTE PartitionType; 487 BOOLEAN BootIndicator; 488 BOOLEAN RecognizedPartition; 489 DWORD HiddenSectors; 490 } PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR; 491 typedef struct _PARTITION_INFORMATION_EX { 492 PARTITION_STYLE PartitionStyle; 493 LARGE_INTEGER StartingOffset; 494 LARGE_INTEGER PartitionLength; 495 DWORD PartitionNumber; 496 BOOLEAN RewritePartition; 497 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3) 498 BOOLEAN IsServicePartition; 499 #endif 500 _ANONYMOUS_UNION union { 501 PARTITION_INFORMATION_MBR Mbr; 502 PARTITION_INFORMATION_GPT Gpt; 503 }; 504 } PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX; 505 506 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT { 507 GUID DiskId; 508 LARGE_INTEGER StartingUsableOffset; 509 LARGE_INTEGER UsableLength; 510 DWORD MaxPartitionCount; 511 } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT; 512 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR { 513 DWORD Signature; 514 #if (NTDDI_VERSION >= NTDDI_WIN10_RS1) 515 DWORD CheckSum; 516 #endif 517 } DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR; 518 typedef struct _DRIVE_LAYOUT_INFORMATION_EX { 519 DWORD PartitionStyle; 520 DWORD PartitionCount; 521 _ANONYMOUS_UNION union { 522 DRIVE_LAYOUT_INFORMATION_MBR Mbr; 523 DRIVE_LAYOUT_INFORMATION_GPT Gpt; 524 }; 525 PARTITION_INFORMATION_EX PartitionEntry[1]; 526 } DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX; 527 528 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR; 529 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT; 530 531 typedef struct _SET_PARTITION_INFORMATION_EX { 532 PARTITION_STYLE PartitionStyle; 533 _ANONYMOUS_UNION union { 534 SET_PARTITION_INFORMATION_MBR Mbr; 535 SET_PARTITION_INFORMATION_GPT Gpt; 536 } DUMMYUNIONNAME; 537 } SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX; 538 539 #endif // (_WIN32_WINNT >= 0x0500) 540 541 typedef struct _DISK_GROW_PARTITION { 542 DWORD PartitionNumber; 543 LARGE_INTEGER BytesToGrow; 544 } DISK_GROW_PARTITION, *PDISK_GROW_PARTITION; 545 typedef enum { 546 EqualPriority, 547 KeepPrefetchedData, 548 KeepReadData 549 } DISK_CACHE_RETENTION_PRIORITY; 550 typedef struct _DISK_CACHE_INFORMATION { 551 BOOLEAN ParametersSavable; 552 BOOLEAN ReadCacheEnabled; 553 BOOLEAN WriteCacheEnabled; 554 DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority; 555 DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority; 556 WORD DisablePrefetchTransferLength; 557 BOOLEAN PrefetchScalar; 558 _ANONYMOUS_UNION union { 559 struct { 560 WORD Minimum; 561 WORD Maximum; 562 WORD MaximumBlocks; 563 } ScalarPrefetch; 564 struct { 565 WORD Minimum; 566 WORD Maximum; 567 } BlockPrefetch; 568 }; 569 } DISK_CACHE_INFORMATION, *PDISK_CACHE_INFORMATION; 570 571 typedef struct _DISK_PERFORMANCE { 572 LARGE_INTEGER BytesRead; 573 LARGE_INTEGER BytesWritten; 574 LARGE_INTEGER ReadTime; 575 LARGE_INTEGER WriteTime; 576 LARGE_INTEGER IdleTime; 577 DWORD ReadCount; 578 DWORD WriteCount; 579 DWORD QueueDepth; 580 DWORD SplitCount; 581 LARGE_INTEGER QueryTime; 582 DWORD StorageDeviceNumber; 583 WCHAR StorageManagerName[8]; 584 } DISK_PERFORMANCE, *PDISK_PERFORMANCE; 585 typedef struct _DISK_RECORD { 586 LARGE_INTEGER ByteOffset; 587 LARGE_INTEGER StartTime; 588 LARGE_INTEGER EndTime; 589 PVOID VirtualAddress; 590 DWORD NumberOfBytes; 591 BYTE DeviceNumber; 592 BOOLEAN ReadRequest; 593 } DISK_RECORD, *PDISK_RECORD; 594 typedef struct _DISK_LOGGING { 595 BYTE Function; 596 PVOID BufferAddress; 597 DWORD BufferSize; 598 } DISK_LOGGING, *PDISK_LOGGING; 599 typedef struct DiskQuotaUserInformation { 600 LONGLONG QuotaUsed; 601 LONGLONG QuotaThreshold; 602 LONGLONG QuotaLimit; 603 } DISKQUOTA_USER_INFORMATION, *PDISKQUOTA_USER_INFORMATION; 604 605 typedef struct _FORMAT_PARAMETERS { 606 MEDIA_TYPE MediaType; 607 DWORD StartCylinderNumber; 608 DWORD EndCylinderNumber; 609 DWORD StartHeadNumber; 610 DWORD EndHeadNumber; 611 } FORMAT_PARAMETERS, *PFORMAT_PARAMETERS; 612 typedef struct _FORMAT_EX_PARAMETERS { 613 MEDIA_TYPE MediaType; 614 DWORD StartCylinderNumber; 615 DWORD EndCylinderNumber; 616 DWORD StartHeadNumber; 617 DWORD EndHeadNumber; 618 WORD FormatGapLength; 619 WORD SectorsPerTrack; 620 WORD SectorNumber[1]; 621 } FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS; 622 623 typedef struct _GET_LENGTH_INFORMATION { 624 LARGE_INTEGER Length; 625 } GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION; 626 627 #define HIST_NO_OF_BUCKETS 24 628 #define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET) 629 #define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM) 630 631 typedef struct _HISTOGRAM_BUCKET { 632 DWORD Reads; 633 DWORD Writes; 634 } HISTOGRAM_BUCKET, *PHISTOGRAM_BUCKET; 635 typedef struct _DISK_HISTOGRAM { 636 LARGE_INTEGER DiskSize; 637 LARGE_INTEGER Start; 638 LARGE_INTEGER End; 639 LARGE_INTEGER Average; 640 LARGE_INTEGER AverageRead; 641 LARGE_INTEGER AverageWrite; 642 DWORD Granularity; 643 DWORD Size; 644 DWORD ReadCount; 645 DWORD WriteCount; 646 PHISTOGRAM_BUCKET Histogram; 647 } DISK_HISTOGRAM, *PDISK_HISTOGRAM; 648 649 typedef struct _PERF_BIN { 650 DWORD NumberOfBins; 651 DWORD TypeOfBin; 652 BIN_RANGE BinsRanges[1]; 653 } PERF_BIN, *PPERF_BIN; 654 655 typedef struct _VERIFY_INFORMATION { 656 LARGE_INTEGER StartingOffset; 657 DWORD Length; 658 } VERIFY_INFORMATION, *PVERIFY_INFORMATION; 659 660 typedef struct _REASSIGN_BLOCKS { 661 WORD Reserved; 662 WORD Count; 663 DWORD BlockNumber[1]; 664 } REASSIGN_BLOCKS, *PREASSIGN_BLOCKS; 665 666 #endif /* _NTDDDISK_H_ */ 667 668 // #ifndef _NTDDSER_ 669 // #define _NTDDSER_ 670 671 /* Device GUIDs */ 672 #ifdef DEFINE_GUID 673 674 DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089, 675 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73); 676 DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 677 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18); 678 679 /* obsolete GUID names */ 680 #define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT 681 #define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR 682 683 #endif /* DEFINE_GUID */ 684 685 #define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS) 686 687 #define SERIAL_LSRMST_ESCAPE 0 688 #define SERIAL_LSRMST_LSR_DATA 1 689 #define SERIAL_LSRMST_LSR_NODATA 2 690 #define SERIAL_LSRMST_MST 3 691 692 // #endif /* _NTDDSER_ */ 693 694 // #ifndef _NTDDVOL_ 695 // #define _NTDDVOL_ 696 697 #define IOCTL_VOLUME_BASE ((DWORD)'V') 698 699 #if (NTDDI_VERSION >= NTDDI_WIN2K) 700 #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) 701 702 typedef struct _DISK_EXTENT { 703 DWORD DiskNumber; 704 LARGE_INTEGER StartingOffset; 705 LARGE_INTEGER ExtentLength; 706 } DISK_EXTENT, *PDISK_EXTENT; 707 typedef struct _VOLUME_DISK_EXTENTS { 708 DWORD NumberOfDiskExtents; 709 DISK_EXTENT Extents[1]; 710 } VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS; 711 712 #define IOCTL_VOLUME_ONLINE CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 713 #define IOCTL_VOLUME_OFFLINE CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 714 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 715 716 #if (NTDDI_VERSION >= NTDDI_WINXP) 717 #define IOCTL_VOLUME_IS_CLUSTERED \ 718 CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 719 #define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \ 720 CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) 721 722 typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION { 723 DWORDLONG GptAttributes; 724 } VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION; 725 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 726 727 // #endif /* _NTDDVOL_ */ 728 729 #ifndef _FILESYSTEMFSCTL_ 730 #define _FILESYSTEMFSCTL_ 731 732 #define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS) 733 #define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS) 734 #define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) 735 #define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS) 736 #define FSCTL_MOUNT_DBLS_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS) 737 #define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS) 738 #define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA) 739 #define FSCTL_READ_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA) 740 #define FSCTL_WRITE_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA) 741 #define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS) 742 #define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM,26,METHOD_BUFFERED,FILE_ANY_ACCESS) 743 #define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS) 744 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS) 745 #define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_ANY_ACCESS) 746 #define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) 747 #define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS) 748 #define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_ANY_ACCESS) 749 #define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 750 751 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 752 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) 753 754 #if (_WIN32_WINNT >= _WIN32_WINNT_NT4) 755 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) 756 #endif 757 758 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) 759 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS) 760 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) 761 #endif 762 763 #if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE) 764 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_DATA) 765 #endif 766 767 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) 768 #define VOLUME_IS_DIRTY (0x00000001) 769 #define VOLUME_UPGRADE_SCHEDULED (0x00000002) 770 #define VOLUME_SESSION_OPEN (0x00000004) 771 #endif 772 773 774 typedef struct { 775 HANDLE FileHandle; 776 LARGE_INTEGER StartingVcn; 777 LARGE_INTEGER StartingLcn; 778 DWORD ClusterCount; 779 } MOVE_FILE_DATA, *PMOVE_FILE_DATA; 780 typedef struct RETRIEVAL_POINTERS_BUFFER { 781 DWORD ExtentCount; 782 LARGE_INTEGER StartingVcn; 783 struct { 784 LARGE_INTEGER NextVcn; 785 LARGE_INTEGER Lcn; 786 } Extents[1]; 787 } RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER; 788 typedef struct { 789 LARGE_INTEGER StartingLcn; 790 } STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER; 791 typedef struct { 792 LARGE_INTEGER StartingVcn; 793 } STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER; 794 typedef struct { 795 LARGE_INTEGER StartingLcn; 796 LARGE_INTEGER BitmapSize; 797 BYTE Buffer[1]; 798 } VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER; 799 typedef struct { 800 LARGE_INTEGER VolumeSerialNumber; 801 LARGE_INTEGER NumberSectors; 802 LARGE_INTEGER TotalClusters; 803 LARGE_INTEGER FreeClusters; 804 LARGE_INTEGER TotalReserved; 805 DWORD BytesPerSector; 806 DWORD BytesPerCluster; 807 DWORD BytesPerFileRecordSegment; 808 DWORD ClustersPerFileRecordSegment; 809 LARGE_INTEGER MftValidDataLength; 810 LARGE_INTEGER MftStartLcn; 811 LARGE_INTEGER Mft2StartLcn; 812 LARGE_INTEGER MftZoneStart; 813 LARGE_INTEGER MftZoneEnd; 814 } NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER; 815 typedef struct { 816 ULONG ByteCount; 817 USHORT MajorVersion; 818 USHORT MinorVersion; 819 } NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA; 820 typedef struct { 821 LARGE_INTEGER FileReferenceNumber; 822 } NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER; 823 typedef struct { 824 LARGE_INTEGER FileReferenceNumber; 825 ULONG FileRecordLength; 826 UCHAR FileRecordBuffer[1]; 827 } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER; 828 829 830 typedef struct _FILESYSTEM_STATISTICS { 831 USHORT FileSystemType; 832 USHORT Version; 833 ULONG SizeOfCompleteStructure; 834 ULONG UserFileReads; 835 ULONG UserFileReadBytes; 836 ULONG UserDiskReads; 837 ULONG UserFileWrites; 838 ULONG UserFileWriteBytes; 839 ULONG UserDiskWrites; 840 ULONG MetaDataReads; 841 ULONG MetaDataReadBytes; 842 ULONG MetaDataDiskReads; 843 ULONG MetaDataWrites; 844 ULONG MetaDataWriteBytes; 845 ULONG MetaDataDiskWrites; 846 } FILESYSTEM_STATISTICS, *PFILESYSTEM_STATISTICS; 847 848 #define FILESYSTEM_STATISTICS_TYPE_NTFS 1 849 #define FILESYSTEM_STATISTICS_TYPE_FAT 2 850 #define FILESYSTEM_STATISTICS_TYPE_EXFAT 3 851 852 typedef struct _FAT_STATISTICS { 853 ULONG CreateHits; 854 ULONG SuccessfulCreates; 855 ULONG FailedCreates; 856 ULONG NonCachedReads; 857 ULONG NonCachedReadBytes; 858 ULONG NonCachedWrites; 859 ULONG NonCachedWriteBytes; 860 ULONG NonCachedDiskReads; 861 ULONG NonCachedDiskWrites; 862 } FAT_STATISTICS, *PFAT_STATISTICS; 863 864 typedef struct _EXFAT_STATISTICS { 865 ULONG CreateHits; 866 ULONG SuccessfulCreates; 867 ULONG FailedCreates; 868 ULONG NonCachedReads; 869 ULONG NonCachedReadBytes; 870 ULONG NonCachedWrites; 871 ULONG NonCachedWriteBytes; 872 ULONG NonCachedDiskReads; 873 ULONG NonCachedDiskWrites; 874 } EXFAT_STATISTICS, *PEXFAT_STATISTICS; 875 876 typedef struct _NTFS_STATISTICS { 877 ULONG LogFileFullExceptions; 878 ULONG OtherExceptions; 879 ULONG MftReads; 880 ULONG MftReadBytes; 881 ULONG MftWrites; 882 ULONG MftWriteBytes; 883 struct { 884 USHORT Write; 885 USHORT Create; 886 USHORT SetInfo; 887 USHORT Flush; 888 } MftWritesUserLevel; 889 USHORT MftWritesFlushForLogFileFull; 890 USHORT MftWritesLazyWriter; 891 USHORT MftWritesUserRequest; 892 ULONG Mft2Writes; 893 ULONG Mft2WriteBytes; 894 struct { 895 USHORT Write; 896 USHORT Create; 897 USHORT SetInfo; 898 USHORT Flush; 899 } Mft2WritesUserLevel; 900 USHORT Mft2WritesFlushForLogFileFull; 901 USHORT Mft2WritesLazyWriter; 902 USHORT Mft2WritesUserRequest; 903 ULONG RootIndexReads; 904 ULONG RootIndexReadBytes; 905 ULONG RootIndexWrites; 906 ULONG RootIndexWriteBytes; 907 ULONG BitmapReads; 908 ULONG BitmapReadBytes; 909 ULONG BitmapWrites; 910 ULONG BitmapWriteBytes; 911 USHORT BitmapWritesFlushForLogFileFull; 912 USHORT BitmapWritesLazyWriter; 913 USHORT BitmapWritesUserRequest; 914 struct { 915 USHORT Write; 916 USHORT Create; 917 USHORT SetInfo; 918 } BitmapWritesUserLevel; 919 ULONG MftBitmapReads; 920 ULONG MftBitmapReadBytes; 921 ULONG MftBitmapWrites; 922 ULONG MftBitmapWriteBytes; 923 USHORT MftBitmapWritesFlushForLogFileFull; 924 USHORT MftBitmapWritesLazyWriter; 925 USHORT MftBitmapWritesUserRequest; 926 struct { 927 USHORT Write; 928 USHORT Create; 929 USHORT SetInfo; 930 USHORT Flush; 931 } MftBitmapWritesUserLevel; 932 ULONG UserIndexReads; 933 ULONG UserIndexReadBytes; 934 ULONG UserIndexWrites; 935 ULONG UserIndexWriteBytes; 936 ULONG LogFileReads; 937 ULONG LogFileReadBytes; 938 ULONG LogFileWrites; 939 ULONG LogFileWriteBytes; 940 struct { 941 ULONG Calls; 942 ULONG Clusters; 943 ULONG Hints; 944 ULONG RunsReturned; 945 ULONG HintsHonored; 946 ULONG HintsClusters; 947 ULONG Cache; 948 ULONG CacheClusters; 949 ULONG CacheMiss; 950 ULONG CacheMissClusters; 951 } Allocate; 952 } NTFS_STATISTICS, *PNTFS_STATISTICS; 953 954 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) 955 typedef struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER { 956 WORD ChecksumAlgorithm; 957 WORD Reserved; 958 DWORD Flags; 959 DWORD ChecksumChunkSizeInBytes; 960 DWORD ClusterSizeInBytes; 961 } FSCTL_GET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER; 962 963 typedef struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER { 964 WORD ChecksumAlgorithm; 965 WORD Reserved; 966 DWORD Flags; 967 } FSCTL_SET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER; 968 #endif 969 970 #if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE) 971 typedef struct _DUPLICATE_EXTENTS_DATA { 972 HANDLE FileHandle; 973 LARGE_INTEGER SourceFileOffset; 974 LARGE_INTEGER TargetFileOffset; 975 LARGE_INTEGER ByteCount; 976 } DUPLICATE_EXTENTS_DATA, *PDUPLICATE_EXTENTS_DATA; 977 #endif 978 979 #endif /* _FILESYSTEMFSCTL_ */ 980 981 982 #ifdef _MSC_VER 983 #pragma warning(pop) 984 #endif 985 986 #ifdef __cplusplus 987 } 988 #endif 989 #endif /* _WINIOCTL_ */ 990