1 /*++ NDK Version: 0098 2 3 Copyright (c) Alex Ionescu. All rights reserved. 4 5 Header Name: 6 7 iotypes.h 8 9 Abstract: 10 11 Type definitions for the I/O Manager. 12 13 Author: 14 15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 16 17 --*/ 18 #ifndef _IOTYPES_H 19 #define _IOTYPES_H 20 21 // 22 // Dependencies 23 // 24 #include <umtypes.h> 25 #include <ifssupp.h> 26 #include <potypes.h> 27 28 // 29 // I/O Completion Access Rights 30 // 31 #define IO_COMPLETION_QUERY_STATE 0x0001 32 #ifndef NTOS_MODE_USER 33 #define IO_COMPLETION_MODIFY_STATE 0x0002 34 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ 35 SYNCHRONIZE | \ 36 0x3) 37 38 // 39 // Kernel Exported Object Types 40 // 41 extern POBJECT_TYPE NTSYSAPI IoAdapterObjectType; 42 extern POBJECT_TYPE NTSYSAPI IoDeviceHandlerObjectType; 43 extern POBJECT_TYPE NTSYSAPI IoDeviceObjectType; 44 extern POBJECT_TYPE NTSYSAPI IoDriverObjectType; 45 46 #else 47 48 // 49 // Symbolic Link Access Rights 50 // 51 #define SYMBOLIC_LINK_QUERY 0x0001 52 #define SYMBOLIC_LINK_ALL_ACCESS STANDARD_RIGHTS_REQUIRED | 0x0001 53 #endif 54 55 #ifdef NTOS_MODE_USER 56 57 /* File System Attributes Flags */ 58 #define FILE_READ_ONLY_VOLUME 0x00080000 59 60 #endif 61 62 // 63 // NtCreateFile Result Flags 64 // 65 #define FILE_SUPERSEDED 0x00000000 66 #define FILE_OPENED 0x00000001 67 #define FILE_CREATED 0x00000002 68 #define FILE_OVERWRITTEN 0x00000003 69 #define FILE_EXISTS 0x00000004 70 #define FILE_DOES_NOT_EXIST 0x00000005 71 72 // 73 // Pipe Flags 74 // 75 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000 76 #define FILE_PIPE_MESSAGE_TYPE 0x00000001 77 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000 78 #define FILE_PIPE_MESSAGE_MODE 0x00000001 79 #define FILE_PIPE_QUEUE_OPERATION 0x00000000 80 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001 81 #define FILE_PIPE_INBOUND 0x00000000 82 #define FILE_PIPE_OUTBOUND 0x00000001 83 #define FILE_PIPE_FULL_DUPLEX 0x00000002 84 #define FILE_PIPE_CLIENT_END 0x00000000 85 #define FILE_PIPE_SERVER_END 0x00000001 86 87 // 88 // NtCreateFile Attributes 89 // 90 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7 91 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7 92 93 // 94 // NtCreateFile OpenType Flags 95 // 96 #define FILE_SUPERSEDE 0x00000000 97 #define FILE_OPEN 0x00000001 98 #define FILE_CREATE 0x00000002 99 #define FILE_OPEN_IF 0x00000003 100 #define FILE_OVERWRITE 0x00000004 101 #define FILE_OVERWRITE_IF 0x00000005 102 #define FILE_MAXIMUM_DISPOSITION 0x00000005 103 104 // 105 // NtCreateFile Flags 106 // 107 #define FILE_DIRECTORY_FILE 0x00000001 108 #define FILE_WRITE_THROUGH 0x00000002 109 #define FILE_SEQUENTIAL_ONLY 0x00000004 110 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 111 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 112 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 113 #define FILE_NON_DIRECTORY_FILE 0x00000040 114 #define FILE_CREATE_TREE_CONNECTION 0x00000080 115 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100 116 #define FILE_NO_EA_KNOWLEDGE 0x00000200 117 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400 118 #define FILE_RANDOM_ACCESS 0x00000800 119 #define FILE_DELETE_ON_CLOSE 0x00001000 120 #define FILE_OPEN_BY_FILE_ID 0x00002000 121 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 122 #define FILE_NO_COMPRESSION 0x00008000 123 #define FILE_RESERVE_OPFILTER 0x00100000 124 #define FILE_OPEN_REPARSE_POINT 0x00200000 125 #define FILE_OPEN_NO_RECALL 0x00400000 126 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 127 128 // 129 // Device Charactertics 130 // 131 #define FILE_REMOVABLE_MEDIA 0x00000001 132 #define FILE_READ_ONLY_DEVICE 0x00000002 133 #define FILE_FLOPPY_DISKETTE 0x00000004 134 #define FILE_WRITE_ONCE_MEDIA 0x00000008 135 #define FILE_REMOTE_DEVICE 0x00000010 136 #define FILE_DEVICE_IS_MOUNTED 0x00000020 137 #define FILE_VIRTUAL_VOLUME 0x00000040 138 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 139 #define FILE_DEVICE_SECURE_OPEN 0x00000100 140 141 // 142 // File Object Flags 143 // 144 #define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000 145 146 // 147 // Device Object Extension Flags 148 // 149 #define DOE_UNLOAD_PENDING 0x1 150 #define DOE_DELETE_PENDING 0x2 151 #define DOE_REMOVE_PENDING 0x4 152 #define DOE_REMOVE_PROCESSED 0x8 153 #define DOE_START_PENDING 0x10 154 155 // 156 // Device Object StartIo Flags 157 // 158 #define DOE_SIO_NO_KEY 0x20 159 #define DOE_SIO_WITH_KEY 0x40 160 #define DOE_SIO_CANCELABLE 0x80 161 #define DOE_SIO_DEFERRED 0x100 162 #define DOE_SIO_NO_CANCEL 0x200 163 164 // 165 // Device Node Flags 166 // 167 #define DNF_PROCESSED 0x00000001 168 #define DNF_STARTED 0x00000002 169 #define DNF_START_FAILED 0x00000004 170 #define DNF_ENUMERATED 0x00000008 171 #define DNF_DELETED 0x00000010 172 #define DNF_MADEUP 0x00000020 173 #define DNF_START_REQUEST_PENDING 0x00000040 174 #define DNF_NO_RESOURCE_REQUIRED 0x00000080 175 #define DNF_INSUFFICIENT_RESOURCES 0x00000100 176 #define DNF_RESOURCE_ASSIGNED 0x00000200 177 #define DNF_RESOURCE_REPORTED 0x00000400 178 #define DNF_HAL_NODE 0x00000800 // ??? 179 #define DNF_ADDED 0x00001000 180 #define DNF_ADD_FAILED 0x00002000 181 #define DNF_LEGACY_DRIVER 0x00004000 182 #define DNF_STOPPED 0x00008000 183 #define DNF_WILL_BE_REMOVED 0x00010000 184 #define DNF_LEGACY_RESOURCE_DEVICENODE 0x00020000 185 #define DNF_NOT_CONFIGURED 0x00040000 186 #define DNF_REINSTALL 0x00080000 187 #define DNF_RESOURCE_REQUIREMENTS_NEED_FILTERED 0x00100000 // ??? 188 #define DNF_DISABLED 0x00200000 189 #define DNF_RESTART_OK 0x00400000 190 #define DNF_NEED_RESTART 0x00800000 191 #define DNF_VISITED 0x01000000 192 #define DNF_ASSIGNING_RESOURCES 0x02000000 193 #define DNF_BEEING_ENUMERATED 0x04000000 194 #define DNF_NEED_ENUMERATION_ONLY 0x08000000 195 #define DNF_LOCKED 0x10000000 196 #define DNF_HAS_BOOT_CONFIG 0x20000000 197 #define DNF_BOOT_CONFIG_RESERVED 0x40000000 198 #define DNF_HAS_PROBLEM 0x80000000 // ??? 199 200 // 201 // Device Node User Flags 202 // 203 #define DNUF_DONT_SHOW_IN_UI 0x0002 204 #define DNUF_NOT_DISABLEABLE 0x0008 205 206 // 207 // Internal Option Flags 208 // 209 #define IO_ATTACH_DEVICE_API 0x80000000 210 211 // 212 // Undocumented WMI Registration Flags 213 // 214 #define WMIREG_FLAG_TRACE_PROVIDER 0x00010000 215 #define WMIREG_FLAG_TRACE_NOTIFY_MASK 0x00F00000 216 #define WMIREG_NOTIFY_DISK_IO 0x00100000 217 #define WMIREG_NOTIFY_TDI_IO 0x00200000 218 219 // 220 // I/O Completion Information Class for NtQueryIoCompletionInformation 221 // 222 typedef enum _IO_COMPLETION_INFORMATION_CLASS 223 { 224 IoCompletionBasicInformation 225 } IO_COMPLETION_INFORMATION_CLASS; 226 227 #ifdef NTOS_MODE_USER 228 229 // 230 // Hardware Interface Type 231 // 232 typedef enum _INTERFACE_TYPE 233 { 234 InterfaceTypeUndefined = -1, 235 Internal, 236 Isa, 237 Eisa, 238 MicroChannel, 239 TurboChannel, 240 PCIBus, 241 VMEBus, 242 NuBus, 243 PCMCIABus, 244 CBus, 245 MPIBus, 246 MPSABus, 247 ProcessorInternal, 248 InternalPowerBus, 249 PNPISABus, 250 PNPBus, 251 MaximumInterfaceType 252 }INTERFACE_TYPE, *PINTERFACE_TYPE; 253 254 typedef enum _BUS_DATA_TYPE 255 { 256 ConfigurationSpaceUndefined = -1, 257 Cmos, 258 EisaConfiguration, 259 Pos, 260 CbusConfiguration, 261 PCIConfiguration, 262 VMEConfiguration, 263 NuBusConfiguration, 264 PCMCIAConfiguration, 265 MPIConfiguration, 266 MPSAConfiguration, 267 PNPISAConfiguration, 268 SgiInternalConfiguration, 269 MaximumBusDataType 270 } BUS_DATA_TYPE, *PBUS_DATA_TYPE; 271 272 // 273 // File Information Classes for NtQueryInformationFile 274 // 275 typedef enum _FILE_INFORMATION_CLASS 276 { 277 FileDirectoryInformation = 1, 278 FileFullDirectoryInformation, 279 FileBothDirectoryInformation, 280 FileBasicInformation, 281 FileStandardInformation, 282 FileInternalInformation, 283 FileEaInformation, 284 FileAccessInformation, 285 FileNameInformation, 286 FileRenameInformation, 287 FileLinkInformation, 288 FileNamesInformation, 289 FileDispositionInformation, 290 FilePositionInformation, 291 FileFullEaInformation, 292 FileModeInformation, 293 FileAlignmentInformation, 294 FileAllInformation, 295 FileAllocationInformation, 296 FileEndOfFileInformation, 297 FileAlternateNameInformation, 298 FileStreamInformation, 299 FilePipeInformation, 300 FilePipeLocalInformation, 301 FilePipeRemoteInformation, 302 FileMailslotQueryInformation, 303 FileMailslotSetInformation, 304 FileCompressionInformation, 305 FileObjectIdInformation, 306 FileCompletionInformation, 307 FileMoveClusterInformation, 308 FileQuotaInformation, 309 FileReparsePointInformation, 310 FileNetworkOpenInformation, 311 FileAttributeTagInformation, 312 FileTrackingInformation, 313 FileIdBothDirectoryInformation, 314 FileIdFullDirectoryInformation, 315 FileValidDataLengthInformation, 316 FileShortNameInformation, 317 #if (NTDDI_VERSION >= NTDDI_VISTA) 318 FileIoCompletionNotificationInformation, 319 FileIoStatusBlockRangeInformation, 320 FileIoPriorityHintInformation, 321 FileSfioReserveInformation, 322 FileSfioVolumeInformation, 323 FileHardLinkInformation, 324 FileProcessIdsUsingFileInformation, 325 FileNormalizedNameInformation, 326 FileNetworkPhysicalNameInformation, 327 #endif 328 #if (NTDDI_VERSION >= NTDDI_WIN7) 329 FileIdGlobalTxDirectoryInformation, 330 FileIsRemoteDeviceInformation, 331 FileUnusedInformation, 332 FileNumaNodeInformation, 333 FileStandardLinkInformation, 334 FileRemoteProtocolInformation, 335 #endif 336 FileMaximumInformation 337 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; 338 339 // 340 // File Information Classes for NtQueryInformationFileSystem 341 // 342 typedef enum _FSINFOCLASS 343 { 344 FileFsVolumeInformation = 1, 345 FileFsLabelInformation, 346 FileFsSizeInformation, 347 FileFsDeviceInformation, 348 FileFsAttributeInformation, 349 FileFsControlInformation, 350 FileFsFullSizeInformation, 351 FileFsObjectIdInformation, 352 FileFsDriverPathInformation, 353 FileFsMaximumInformation 354 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; 355 356 #endif 357 358 // 359 // Dock Profile Status 360 // 361 typedef enum _PROFILE_STATUS 362 { 363 DOCK_NOTDOCKDEVICE, 364 DOCK_QUIESCENT, 365 DOCK_ARRIVING, 366 DOCK_DEPARTING, 367 DOCK_EJECTIRP_COMPLETED 368 } PROFILE_STATUS, *PPROFILE_STATUS; 369 370 // 371 // Device Node States 372 // 373 typedef enum _PNP_DEVNODE_STATE 374 { 375 DeviceNodeUnspecified = 0x300, 376 DeviceNodeUninitialized = 0x301, 377 DeviceNodeInitialized = 0x302, 378 DeviceNodeDriversAdded = 0x303, 379 DeviceNodeResourcesAssigned = 0x304, 380 DeviceNodeStartPending = 0x305, 381 DeviceNodeStartCompletion = 0x306, 382 DeviceNodeStartPostWork = 0x307, 383 DeviceNodeStarted = 0x308, 384 DeviceNodeQueryStopped = 0x309, 385 DeviceNodeStopped = 0x30a, 386 DeviceNodeRestartCompletion = 0x30b, 387 DeviceNodeEnumeratePending = 0x30c, 388 DeviceNodeEnumerateCompletion = 0x30d, 389 DeviceNodeAwaitingQueuedDeletion = 0x30e, 390 DeviceNodeAwaitingQueuedRemoval = 0x30f, 391 DeviceNodeQueryRemoved = 0x310, 392 DeviceNodeRemovePendingCloses = 0x311, 393 DeviceNodeRemoved = 0x312, 394 DeviceNodeDeletePendingCloses = 0x313, 395 DeviceNodeDeleted = 0x314, 396 MaxDeviceNodeState = 0x315, 397 } PNP_DEVNODE_STATE; 398 399 #ifdef NTOS_MODE_USER 400 401 // 402 // I/O Status Block 403 // 404 typedef struct _IO_STATUS_BLOCK 405 { 406 union 407 { 408 NTSTATUS Status; 409 PVOID Pointer; 410 }; 411 ULONG_PTR Information; 412 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; 413 414 // 415 // File Information structures for NtQueryInformationFile 416 // 417 typedef struct _FILE_BASIC_INFORMATION 418 { 419 LARGE_INTEGER CreationTime; 420 LARGE_INTEGER LastAccessTime; 421 LARGE_INTEGER LastWriteTime; 422 LARGE_INTEGER ChangeTime; 423 ULONG FileAttributes; 424 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; 425 426 typedef struct _FILE_STANDARD_INFORMATION 427 { 428 LARGE_INTEGER AllocationSize; 429 LARGE_INTEGER EndOfFile; 430 ULONG NumberOfLinks; 431 BOOLEAN DeletePending; 432 BOOLEAN Directory; 433 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; 434 435 typedef struct _FILE_STREAM_INFORMATION 436 { 437 ULONG NextEntryOffset; 438 ULONG StreamNameLength; 439 LARGE_INTEGER StreamSize; 440 LARGE_INTEGER StreamAllocationSize; 441 WCHAR StreamName[1]; 442 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION; 443 444 typedef struct _FILE_NETWORK_OPEN_INFORMATION 445 { 446 LARGE_INTEGER CreationTime; 447 LARGE_INTEGER LastAccessTime; 448 LARGE_INTEGER LastWriteTime; 449 LARGE_INTEGER ChangeTime; 450 LARGE_INTEGER AllocationSize; 451 LARGE_INTEGER EndOfFile; 452 ULONG FileAttributes; 453 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; 454 455 typedef struct _FILE_EA_INFORMATION 456 { 457 ULONG EaSize; 458 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; 459 460 typedef struct _FILE_ACCESS_INFORMATION 461 { 462 ACCESS_MASK AccessFlags; 463 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; 464 465 typedef struct _FILE_COMPRESSION_INFORMATION 466 { 467 LARGE_INTEGER CompressedFileSize; 468 USHORT CompressionFormat; 469 UCHAR CompressionUnitShift; 470 UCHAR ChunkShift; 471 UCHAR ClusterShift; 472 UCHAR Reserved[3]; 473 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION; 474 475 typedef struct _FILE_POSITION_INFORMATION 476 { 477 LARGE_INTEGER CurrentByteOffset; 478 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; 479 480 typedef struct _FILE_DISPOSITION_INFORMATION 481 { 482 BOOLEAN DeleteFile; 483 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; 484 485 typedef struct _FILE_FULL_EA_INFORMATION 486 { 487 ULONG NextEntryOffset; 488 UCHAR Flags; 489 UCHAR EaNameLength; 490 USHORT EaValueLength; 491 CHAR EaName[1]; 492 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION; 493 494 typedef struct _FILE_QUOTA_INFORMATION 495 { 496 ULONG NextEntryOffset; 497 ULONG SidLength; 498 LARGE_INTEGER ChangeTime; 499 LARGE_INTEGER QuotaUsed; 500 LARGE_INTEGER QuotaThreshold; 501 LARGE_INTEGER QuotaLimit; 502 SID Sid; 503 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION; 504 505 typedef struct _FILE_INTERNAL_INFORMATION 506 { 507 LARGE_INTEGER IndexNumber; 508 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; 509 510 typedef struct _FILE_RENAME_INFORMATION 511 { 512 BOOLEAN ReplaceIfExists; 513 HANDLE RootDirectory; 514 ULONG FileNameLength; 515 WCHAR FileName[1]; 516 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION; 517 518 typedef struct _FILE_PIPE_INFORMATION 519 { 520 ULONG ReadMode; 521 ULONG CompletionMode; 522 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; 523 524 typedef struct _FILE_PIPE_LOCAL_INFORMATION 525 { 526 ULONG NamedPipeType; 527 ULONG NamedPipeConfiguration; 528 ULONG MaximumInstances; 529 ULONG CurrentInstances; 530 ULONG InboundQuota; 531 ULONG ReadDataAvailable; 532 ULONG OutboundQuota; 533 ULONG WriteQuotaAvailable; 534 ULONG NamedPipeState; 535 ULONG NamedPipeEnd; 536 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; 537 538 typedef struct _FILE_PIPE_REMOTE_INFORMATION 539 { 540 LARGE_INTEGER CollectDataTime; 541 ULONG MaximumCollectionCount; 542 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION; 543 544 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION 545 { 546 ULONG MaximumMessageSize; 547 ULONG MailslotQuota; 548 ULONG NextMessageSize; 549 ULONG MessagesAvailable; 550 LARGE_INTEGER ReadTimeout; 551 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION; 552 553 typedef struct _FILE_MAILSLOT_SET_INFORMATION 554 { 555 PLARGE_INTEGER ReadTimeout; 556 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION; 557 558 typedef struct _FILE_FULL_DIR_INFORMATION 559 { 560 ULONG NextEntryOffset; 561 ULONG FileIndex; 562 LARGE_INTEGER CreationTime; 563 LARGE_INTEGER LastAccessTime; 564 LARGE_INTEGER LastWriteTime; 565 LARGE_INTEGER ChangeTime; 566 LARGE_INTEGER EndOfFile; 567 LARGE_INTEGER AllocationSize; 568 ULONG FileAttributes; 569 ULONG FileNameLength; 570 ULONG EaSize; 571 WCHAR FileName[1]; 572 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; 573 574 typedef struct _FILE_BOTH_DIR_INFORMATION 575 { 576 ULONG NextEntryOffset; 577 ULONG FileIndex; 578 LARGE_INTEGER CreationTime; 579 LARGE_INTEGER LastAccessTime; 580 LARGE_INTEGER LastWriteTime; 581 LARGE_INTEGER ChangeTime; 582 LARGE_INTEGER EndOfFile; 583 LARGE_INTEGER AllocationSize; 584 ULONG FileAttributes; 585 ULONG FileNameLength; 586 ULONG EaSize; 587 CCHAR ShortNameLength; 588 WCHAR ShortName[12]; 589 WCHAR FileName[1]; 590 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; 591 592 typedef struct _FILE_COMPLETION_INFORMATION 593 { 594 HANDLE Port; 595 PVOID Key; 596 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION; 597 598 typedef struct _FILE_LINK_INFORMATION 599 { 600 BOOLEAN ReplaceIfExists; 601 HANDLE RootDirectory; 602 ULONG FileNameLength; 603 WCHAR FileName[1]; 604 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; 605 606 typedef struct _FILE_NAME_INFORMATION 607 { 608 ULONG FileNameLength; 609 WCHAR FileName[1]; 610 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; 611 612 typedef struct _FILE_ALLOCATION_INFORMATION 613 { 614 LARGE_INTEGER AllocationSize; 615 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION; 616 617 typedef struct _FILE_END_OF_FILE_INFORMATION 618 { 619 LARGE_INTEGER EndOfFile; 620 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; 621 622 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION 623 { 624 LARGE_INTEGER ValidDataLength; 625 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; 626 627 typedef struct _FILE_DIRECTORY_INFORMATION 628 { 629 ULONG NextEntryOffset; 630 ULONG FileIndex; 631 LARGE_INTEGER CreationTime; 632 LARGE_INTEGER LastAccessTime; 633 LARGE_INTEGER LastWriteTime; 634 LARGE_INTEGER ChangeTime; 635 LARGE_INTEGER EndOfFile; 636 LARGE_INTEGER AllocationSize; 637 ULONG FileAttributes; 638 ULONG FileNameLength; 639 WCHAR FileName[1]; 640 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; 641 642 typedef struct _FILE_IO_COMPLETION_INFORMATION 643 { 644 PVOID KeyContext; 645 PVOID ApcContext; 646 IO_STATUS_BLOCK IoStatusBlock; 647 } FILE_IO_COMPLETION_INFORMATION, *PFILE_IO_COMPLETION_INFORMATION; 648 649 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION 650 { 651 ULONG FileAttributes; 652 ULONG ReparseTag; 653 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; 654 655 typedef struct _FILE_TRACKING_INFORMATION 656 { 657 HANDLE DestinationFile; 658 ULONG ObjectInformationLength; 659 CHAR ObjectInformation[1]; 660 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION; 661 662 // 663 // File System Information structures for NtQueryInformationFile 664 // 665 typedef struct _FILE_FS_DEVICE_INFORMATION 666 { 667 DEVICE_TYPE DeviceType; 668 ULONG Characteristics; 669 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; 670 671 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION 672 { 673 ULONG FileSystemAttributes; 674 ULONG MaximumComponentNameLength; 675 ULONG FileSystemNameLength; 676 WCHAR FileSystemName[1]; 677 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION; 678 679 typedef struct _FILE_FS_SIZE_INFORMATION 680 { 681 LARGE_INTEGER TotalAllocationUnits; 682 LARGE_INTEGER AvailableAllocationUnits; 683 ULONG SectorsPerAllocationUnit; 684 ULONG BytesPerSector; 685 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; 686 687 typedef struct _FILE_FS_FULL_SIZE_INFORMATION 688 { 689 LARGE_INTEGER TotalAllocationUnits; 690 LARGE_INTEGER CallerAvailableAllocationUnits; 691 LARGE_INTEGER ActualAvailableAllocationUnits; 692 ULONG SectorsPerAllocationUnit; 693 ULONG BytesPerSector; 694 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; 695 696 typedef struct _FILE_FS_LABEL_INFORMATION 697 { 698 ULONG VolumeLabelLength; 699 WCHAR VolumeLabel[1]; 700 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; 701 702 typedef struct _FILE_FS_VOLUME_INFORMATION 703 { 704 LARGE_INTEGER VolumeCreationTime; 705 ULONG VolumeSerialNumber; 706 ULONG VolumeLabelLength; 707 BOOLEAN SupportsObjects; 708 WCHAR VolumeLabel[1]; 709 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; 710 711 // 712 // Pipe Structures for IOCTL_PIPE_XXX 713 // 714 typedef struct _FILE_PIPE_WAIT_FOR_BUFFER 715 { 716 LARGE_INTEGER Timeout; 717 ULONG NameLength; 718 BOOLEAN TimeoutSpecified; 719 WCHAR Name[1]; 720 } FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER; 721 722 typedef struct _FILE_PIPE_PEEK_BUFFER 723 { 724 ULONG NamedPipeState; 725 ULONG ReadDataAvailable; 726 ULONG NumberOfMessages; 727 ULONG MessageLength; 728 CHAR Data[1]; 729 } FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER; 730 731 // 732 // I/O Error Log Structures 733 // 734 typedef struct _IO_ERROR_LOG_PACKET 735 { 736 UCHAR MajorFunctionCode; 737 UCHAR RetryCount; 738 USHORT DumpDataSize; 739 USHORT NumberOfStrings; 740 USHORT StringOffset; 741 USHORT EventCategory; 742 NTSTATUS ErrorCode; 743 ULONG UniqueErrorValue; 744 NTSTATUS FinalStatus; 745 ULONG SequenceNumber; 746 ULONG IoControlCode; 747 LARGE_INTEGER DeviceOffset; 748 ULONG DumpData[1]; 749 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET; 750 751 typedef struct _IO_ERROR_LOG_MESSAGE 752 { 753 USHORT Type; 754 USHORT Size; 755 USHORT DriverNameLength; 756 LARGE_INTEGER TimeStamp; 757 ULONG DriverNameOffset; 758 IO_ERROR_LOG_PACKET EntryData; 759 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE; 760 761 #endif 762 763 // 764 // I/O Completion Information structures 765 // 766 typedef struct _IO_COMPLETION_BASIC_INFORMATION 767 { 768 LONG Depth; 769 } IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION; 770 771 // 772 // Parameters for NtCreateMailslotFile/NtCreateNamedPipeFile 773 // 774 typedef struct _MAILSLOT_CREATE_PARAMETERS 775 { 776 ULONG MailslotQuota; 777 ULONG MaximumMessageSize; 778 LARGE_INTEGER ReadTimeout; 779 BOOLEAN TimeoutSpecified; 780 } MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS; 781 782 typedef struct _NAMED_PIPE_CREATE_PARAMETERS 783 { 784 ULONG NamedPipeType; 785 ULONG ReadMode; 786 ULONG CompletionMode; 787 ULONG MaximumInstances; 788 ULONG InboundQuota; 789 ULONG OutboundQuota; 790 LARGE_INTEGER DefaultTimeout; 791 BOOLEAN TimeoutSpecified; 792 } NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS; 793 794 #ifndef NTOS_MODE_USER 795 796 // 797 // I/O Timer Object 798 // 799 typedef struct _IO_TIMER 800 { 801 USHORT Type; 802 USHORT TimerEnabled; 803 LIST_ENTRY IoTimerList; 804 PIO_TIMER_ROUTINE TimerRoutine; 805 PVOID Context; 806 PDEVICE_OBJECT DeviceObject; 807 } IO_TIMER; 808 809 // 810 // Driver Extension 811 // 812 typedef struct _IO_CLIENT_EXTENSION 813 { 814 struct _IO_CLIENT_EXTENSION *NextExtension; 815 PVOID ClientIdentificationAddress; 816 } IO_CLIENT_EXTENSION, *PIO_CLIENT_EXTENSION; 817 818 // 819 // Device Node 820 // 821 typedef struct _DEVICE_NODE 822 { 823 struct _DEVICE_NODE *Sibling; 824 struct _DEVICE_NODE *Child; 825 struct _DEVICE_NODE *Parent; 826 struct _DEVICE_NODE *LastChild; 827 ULONG Level; 828 struct _PO_DEVICE_NOTIFY *Notify; 829 PO_IRP_MANAGER PoIrpManager; 830 PNP_DEVNODE_STATE State; 831 PNP_DEVNODE_STATE PreviousState; 832 PNP_DEVNODE_STATE StateHistory[20]; 833 ULONG StateHistoryEntry; 834 NTSTATUS CompletionStatus; 835 PIRP PendingIrp; 836 ULONG Flags; 837 ULONG UserFlags; 838 ULONG Problem; 839 PDEVICE_OBJECT PhysicalDeviceObject; 840 PCM_RESOURCE_LIST ResourceList; 841 PCM_RESOURCE_LIST ResourceListTranslated; 842 UNICODE_STRING InstancePath; 843 UNICODE_STRING ServiceName; 844 PDEVICE_OBJECT DuplicatePDO; 845 PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements; 846 INTERFACE_TYPE InterfaceType; 847 ULONG BusNumber; 848 INTERFACE_TYPE ChildInterfaceType; 849 ULONG ChildBusNumber; 850 USHORT ChildBusTypeIndex; 851 UCHAR RemovalPolicy; 852 UCHAR HardwareRemovalPolicy; 853 LIST_ENTRY TargetDeviceNotify; 854 LIST_ENTRY DeviceArbiterList; 855 LIST_ENTRY DeviceTranslatorList; 856 USHORT NoTranslatorMask; 857 USHORT QueryTranslatorMask; 858 USHORT NoArbiterMask; 859 USHORT QueryArbiterMask; 860 union 861 { 862 struct _DEVICE_NODE *LegacyDeviceNode; 863 PDEVICE_RELATIONS PendingDeviceRelations; 864 } OverUsed1; 865 union 866 { 867 struct _DEVICE_NODE *NextResourceDeviceNode; 868 } OverUsed2; 869 PCM_RESOURCE_LIST BootResources; 870 #if (NTDDI_VERSION >= NTDDI_LONGHORN) 871 PCM_RESOURCE_LIST BootResourcesTranslated; 872 #endif 873 ULONG CapabilityFlags; 874 struct 875 { 876 PROFILE_STATUS DockStatus; 877 LIST_ENTRY ListEntry; 878 WCHAR *SerialNumber; 879 } DockInfo; 880 ULONG DisableableDepends; 881 LIST_ENTRY PendedSetInterfaceState; 882 LIST_ENTRY LegacyBusListEntry; 883 ULONG DriverUnloadRetryCount; 884 struct _DEVICE_NODE *PreviousParent; 885 ULONG DeletedChildren; 886 #if (NTDDI_VERSION >= NTDDI_LONGHORN) 887 ULONG NumaNodeIndex; 888 #endif 889 } DEVICE_NODE, *PDEVICE_NODE; 890 891 // 892 // Resource Aribtrer Entry 893 // 894 typedef struct _PI_RESOURCE_ARBITER_ENTRY 895 { 896 LIST_ENTRY DeviceArbiterList; 897 UCHAR ResourceType; 898 PARBITER_INTERFACE ArbiterInterface; 899 ULONG Level; 900 LIST_ENTRY ResourceList; 901 LIST_ENTRY BestResourceList; 902 LIST_ENTRY BestConfig; 903 LIST_ENTRY ActiveArbiterList; 904 UCHAR State; 905 UCHAR ResourcesChanged; 906 } PI_RESOURCE_ARBITER_ENTRY, *PPI_RESOURCE_ARBITER_ENTRY; 907 908 // 909 // Extended Device Object Extension Structure 910 // 911 typedef struct _EXTENDED_DEVOBJ_EXTENSION 912 { 913 CSHORT Type; 914 USHORT Size; 915 PDEVICE_OBJECT DeviceObject; 916 ULONG PowerFlags; 917 struct _DEVICE_OBJECT_POWER_EXTENSION *Dope; 918 ULONG ExtensionFlags; 919 struct _DEVICE_NODE *DeviceNode; 920 PDEVICE_OBJECT AttachedTo; 921 LONG StartIoCount; 922 LONG StartIoKey; 923 ULONG StartIoFlags; 924 struct _VPB *Vpb; 925 } EXTENDED_DEVOBJ_EXTENSION, *PEXTENDED_DEVOBJ_EXTENSION; 926 927 // 928 // Extended Driver Object Extension Structure 929 // 930 typedef struct _EXTENDED_DRIVER_EXTENSION 931 { 932 struct _DRIVER_OBJECT *DriverObject; 933 PDRIVER_ADD_DEVICE AddDevice; 934 ULONG Count; 935 UNICODE_STRING ServiceKeyName; 936 PIO_CLIENT_EXTENSION ClientDriverExtension; 937 PFS_FILTER_CALLBACKS FsFilterCallbacks; 938 } EXTENDED_DRIVER_EXTENSION, *PEXTENDED_DRIVER_EXTENSION; 939 940 #endif // !NTOS_MODE_USER 941 942 // 943 // Firmware Boot File Path 944 // 945 typedef struct _FILE_PATH 946 { 947 ULONG Version; 948 ULONG Length; 949 ULONG Type; 950 CHAR FilePath[1]; 951 } FILE_PATH, *PFILE_PATH; 952 953 // 954 // Firmware Boot Options 955 // 956 typedef struct _BOOT_OPTIONS 957 { 958 ULONG Version; 959 ULONG Length; 960 ULONG Timeout; 961 ULONG CurrentBootEntryId; 962 ULONG NextBootEntryId; 963 WCHAR HeadlessRedirection[1]; 964 } BOOT_OPTIONS, *PBOOT_OPTIONS; 965 966 // 967 // Firmware Boot Entry 968 // 969 typedef struct _BOOT_ENTRY 970 { 971 ULONG Version; 972 ULONG Length; 973 ULONG Id; 974 ULONG Attributes; 975 ULONG FriendlyNameOffset; 976 ULONG BootFilePathOffset; 977 ULONG OsOptionsLength; 978 CHAR OsOptions[1]; 979 } BOOT_ENTRY, *PBOOT_ENTRY; 980 981 // 982 // Firmware Driver Entry 983 // 984 typedef struct _EFI_DRIVER_ENTRY 985 { 986 ULONG Version; 987 ULONG Length; 988 ULONG Id; 989 ULONG Attributes; 990 ULONG FriendlyNameOffset; 991 ULONG DriverFilePathOffset; 992 } EFI_DRIVER_ENTRY, *PEFI_DRIVER_ENTRY; 993 994 #ifdef NTOS_MODE_USER 995 996 // 997 // APC Callback for NtCreateFile 998 // 999 typedef VOID 1000 (NTAPI *PIO_APC_ROUTINE)( 1001 _In_ PVOID ApcContext, 1002 _In_ PIO_STATUS_BLOCK IoStatusBlock, 1003 _In_ ULONG Reserved); 1004 1005 // 1006 // Mailslot IOCTL Codes 1007 // 1008 #define FSCTL_MAILSLOT_PEEK \ 1009 CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA) 1010 1011 // 1012 // Pipe IOCTL Codes 1013 // 1014 #define FSCTL_PIPE_ASSIGN_EVENT \ 1015 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) 1016 #define FSCTL_PIPE_DISCONNECT \ 1017 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) 1018 #define FSCTL_PIPE_LISTEN \ 1019 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 1020 #define FSCTL_PIPE_PEEK \ 1021 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA) 1022 #define FSCTL_PIPE_QUERY_EVENT \ 1023 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) 1024 #define FSCTL_PIPE_TRANSCEIVE \ 1025 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) 1026 #define FSCTL_PIPE_WAIT \ 1027 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) 1028 #define FSCTL_PIPE_IMPERSONATE \ 1029 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) 1030 #define FSCTL_PIPE_SET_CLIENT_PROCESS \ 1031 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) 1032 #define FSCTL_PIPE_QUERY_CLIENT_PROCESS \ 1033 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) 1034 #define FSCTL_PIPE_INTERNAL_READ \ 1035 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA) 1036 #define FSCTL_PIPE_INTERNAL_WRITE \ 1037 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA) 1038 #define FSCTL_PIPE_INTERNAL_TRANSCEIVE \ 1039 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) 1040 #define FSCTL_PIPE_INTERNAL_READ_OVFLOW \ 1041 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA) 1042 1043 // 1044 // Tape IOCTL Codes 1045 // 1046 #define IOCTL_TAPE_ERASE \ 1047 CTL_CODE(FILE_DEVICE_TAPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 1048 #define IOCTL_TAPE_PREPARE \ 1049 CTL_CODE(FILE_DEVICE_TAPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS) 1050 #define IOCTL_TAPE_WRITE_MARKS \ 1051 CTL_CODE(FILE_DEVICE_TAPE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 1052 #define IOCTL_TAPE_GET_POSITION \ 1053 CTL_CODE(FILE_DEVICE_TAPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS) 1054 #define IOCTL_TAPE_SET_POSITION \ 1055 CTL_CODE(FILE_DEVICE_TAPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS) 1056 #define IOCTL_TAPE_GET_DRIVE_PARAMS \ 1057 CTL_CODE(FILE_DEVICE_TAPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS) 1058 #define IOCTL_TAPE_SET_DRIVE_PARAMS \ 1059 CTL_CODE(FILE_DEVICE_TAPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 1060 #define IOCTL_TAPE_GET_MEDIA_PARAMS \ 1061 CTL_CODE(FILE_DEVICE_TAPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS) 1062 #define IOCTL_TAPE_SET_MEDIA_PARAMS \ 1063 CTL_CODE(FILE_DEVICE_TAPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS) 1064 #define IOCTL_TAPE_GET_STATUS \ 1065 CTL_CODE(FILE_DEVICE_TAPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS) 1066 #define IOCTL_TAPE_CREATE_PARTITION \ 1067 CTL_CODE(FILE_DEVICE_TAPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 1068 1069 // 1070 // Reparse points 1071 // 1072 1073 #define SYMLINK_FLAG_RELATIVE 1 1074 1075 typedef struct _REPARSE_DATA_BUFFER { 1076 ULONG ReparseTag; 1077 USHORT ReparseDataLength; 1078 USHORT Reserved; 1079 _ANONYMOUS_UNION union { 1080 struct { 1081 USHORT SubstituteNameOffset; 1082 USHORT SubstituteNameLength; 1083 USHORT PrintNameOffset; 1084 USHORT PrintNameLength; 1085 ULONG Flags; 1086 WCHAR PathBuffer[1]; 1087 } SymbolicLinkReparseBuffer; 1088 struct { 1089 USHORT SubstituteNameOffset; 1090 USHORT SubstituteNameLength; 1091 USHORT PrintNameOffset; 1092 USHORT PrintNameLength; 1093 WCHAR PathBuffer[1]; 1094 } MountPointReparseBuffer; 1095 struct { 1096 UCHAR DataBuffer[1]; 1097 } GenericReparseBuffer; 1098 } DUMMYUNIONNAME; 1099 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; 1100 1101 #endif // NTOS_MODE_USER 1102 1103 #endif 1104