1 $if (_WDMDDK_ || _NTDDK_) 2 /****************************************************************************** 3 * I/O Manager Types * 4 ******************************************************************************/ 5 $endif (_WDMDDK_ || _NTDDK_) 6 7 $if (_WDMDDK_) 8 9 #define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS 10 11 #define CONNECT_FULLY_SPECIFIED 0x1 12 #define CONNECT_LINE_BASED 0x2 13 #define CONNECT_MESSAGE_BASED 0x3 14 #define CONNECT_FULLY_SPECIFIED_GROUP 0x4 15 #define CONNECT_CURRENT_VERSION 0x4 16 17 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x8 18 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x10 19 #define POOL_COLD_ALLOCATION 0x100 20 #define POOL_NX_ALLOCATION 0x200 21 #define POOL_ZERO_ALLOCATION 0x400 22 23 #define IO_TYPE_ADAPTER 1 24 #define IO_TYPE_CONTROLLER 2 25 #define IO_TYPE_DEVICE 3 26 #define IO_TYPE_DRIVER 4 27 #define IO_TYPE_FILE 5 28 #define IO_TYPE_IRP 6 29 #define IO_TYPE_MASTER_ADAPTER 7 30 #define IO_TYPE_OPEN_PACKET 8 31 #define IO_TYPE_TIMER 9 32 #define IO_TYPE_VPB 10 33 #define IO_TYPE_ERROR_LOG 11 34 #define IO_TYPE_ERROR_MESSAGE 12 35 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 13 36 37 #define IO_TYPE_CSQ_IRP_CONTEXT 1 38 #define IO_TYPE_CSQ 2 39 #define IO_TYPE_CSQ_EX 3 40 41 /* IO_RESOURCE_DESCRIPTOR.Option */ 42 #define IO_RESOURCE_PREFERRED 0x01 43 #define IO_RESOURCE_DEFAULT 0x02 44 #define IO_RESOURCE_ALTERNATIVE 0x08 45 46 $endif (_WDMDDK_) 47 $if (_WDMDDK_ || _DEVIOCTL_) 48 #define FILE_DEVICE_BEEP 0x00000001 49 #define FILE_DEVICE_CD_ROM 0x00000002 50 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 51 #define FILE_DEVICE_CONTROLLER 0x00000004 52 #define FILE_DEVICE_DATALINK 0x00000005 53 #define FILE_DEVICE_DFS 0x00000006 54 #define FILE_DEVICE_DISK 0x00000007 55 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 56 #define FILE_DEVICE_FILE_SYSTEM 0x00000009 57 #define FILE_DEVICE_INPORT_PORT 0x0000000a 58 #define FILE_DEVICE_KEYBOARD 0x0000000b 59 #define FILE_DEVICE_MAILSLOT 0x0000000c 60 #define FILE_DEVICE_MIDI_IN 0x0000000d 61 #define FILE_DEVICE_MIDI_OUT 0x0000000e 62 #define FILE_DEVICE_MOUSE 0x0000000f 63 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 64 #define FILE_DEVICE_NAMED_PIPE 0x00000011 65 #define FILE_DEVICE_NETWORK 0x00000012 66 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013 67 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 68 #define FILE_DEVICE_NULL 0x00000015 69 #define FILE_DEVICE_PARALLEL_PORT 0x00000016 70 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 71 #define FILE_DEVICE_PRINTER 0x00000018 72 #define FILE_DEVICE_SCANNER 0x00000019 73 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a 74 #define FILE_DEVICE_SERIAL_PORT 0x0000001b 75 #define FILE_DEVICE_SCREEN 0x0000001c 76 #define FILE_DEVICE_SOUND 0x0000001d 77 #define FILE_DEVICE_STREAMS 0x0000001e 78 #define FILE_DEVICE_TAPE 0x0000001f 79 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 80 #define FILE_DEVICE_TRANSPORT 0x00000021 81 #define FILE_DEVICE_UNKNOWN 0x00000022 82 #define FILE_DEVICE_VIDEO 0x00000023 83 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024 84 #define FILE_DEVICE_WAVE_IN 0x00000025 85 #define FILE_DEVICE_WAVE_OUT 0x00000026 86 #define FILE_DEVICE_8042_PORT 0x00000027 87 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 88 #define FILE_DEVICE_BATTERY 0x00000029 89 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a 90 #define FILE_DEVICE_MODEM 0x0000002b 91 #define FILE_DEVICE_VDM 0x0000002c 92 #define FILE_DEVICE_MASS_STORAGE 0x0000002d 93 #define FILE_DEVICE_SMB 0x0000002e 94 #define FILE_DEVICE_KS 0x0000002f 95 #define FILE_DEVICE_CHANGER 0x00000030 96 #define FILE_DEVICE_SMARTCARD 0x00000031 97 #define FILE_DEVICE_ACPI 0x00000032 98 #define FILE_DEVICE_DVD 0x00000033 99 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 100 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 101 #define FILE_DEVICE_DFS_VOLUME 0x00000036 102 #define FILE_DEVICE_SERENUM 0x00000037 103 #define FILE_DEVICE_TERMSRV 0x00000038 104 #define FILE_DEVICE_KSEC 0x00000039 105 #define FILE_DEVICE_FIPS 0x0000003A 106 #define FILE_DEVICE_INFINIBAND 0x0000003B 107 #define FILE_DEVICE_VMBUS 0x0000003E 108 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F 109 #define FILE_DEVICE_WPD 0x00000040 110 #define FILE_DEVICE_BLUETOOTH 0x00000041 111 #define FILE_DEVICE_MT_COMPOSITE 0x00000042 112 #define FILE_DEVICE_MT_TRANSPORT 0x00000043 113 #define FILE_DEVICE_BIOMETRIC 0x00000044 114 #define FILE_DEVICE_PMI 0x00000045 115 116 $endif (_WDMDDK_ || _DEVIOCTL_) 117 $if (_WDMDDK_) 118 #if defined(NT_PROCESSOR_GROUPS) 119 120 typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; 121 122 enum _IRQ_DEVICE_POLICY_USHORT { 123 IrqPolicyMachineDefault = 0, 124 IrqPolicyAllCloseProcessors = 1, 125 IrqPolicyOneCloseProcessor = 2, 126 IrqPolicyAllProcessorsInMachine = 3, 127 IrqPolicyAllProcessorsInGroup = 3, 128 IrqPolicySpecifiedProcessors = 4, 129 IrqPolicySpreadMessagesAcrossAllProcessors = 5}; 130 131 #else /* defined(NT_PROCESSOR_GROUPS) */ 132 133 typedef enum _IRQ_DEVICE_POLICY { 134 IrqPolicyMachineDefault = 0, 135 IrqPolicyAllCloseProcessors, 136 IrqPolicyOneCloseProcessor, 137 IrqPolicyAllProcessorsInMachine, 138 IrqPolicySpecifiedProcessors, 139 IrqPolicySpreadMessagesAcrossAllProcessors 140 } IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; 141 142 #endif 143 144 typedef enum _IRQ_PRIORITY { 145 IrqPriorityUndefined = 0, 146 IrqPriorityLow, 147 IrqPriorityNormal, 148 IrqPriorityHigh 149 } IRQ_PRIORITY, *PIRQ_PRIORITY; 150 151 typedef enum _IRQ_GROUP_POLICY { 152 GroupAffinityAllGroupZero = 0, 153 GroupAffinityDontCare 154 } IRQ_GROUP_POLICY, *PIRQ_GROUP_POLICY; 155 156 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR)) 157 158 typedef struct _OBJECT_HANDLE_INFORMATION { 159 ULONG HandleAttributes; 160 ACCESS_MASK GrantedAccess; 161 } OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION; 162 163 typedef struct _CLIENT_ID { 164 HANDLE UniqueProcess; 165 HANDLE UniqueThread; 166 } CLIENT_ID, *PCLIENT_ID; 167 168 typedef struct _VPB { 169 CSHORT Type; 170 CSHORT Size; 171 USHORT Flags; 172 USHORT VolumeLabelLength; 173 struct _DEVICE_OBJECT *DeviceObject; 174 struct _DEVICE_OBJECT *RealDevice; 175 ULONG SerialNumber; 176 ULONG ReferenceCount; 177 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)]; 178 } VPB, *PVPB; 179 180 typedef enum _IO_ALLOCATION_ACTION { 181 KeepObject = 1, 182 DeallocateObject, 183 DeallocateObjectKeepRegisters 184 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION; 185 186 _Function_class_(DRIVER_CONTROL) 187 _IRQL_requires_same_ 188 typedef IO_ALLOCATION_ACTION 189 (NTAPI DRIVER_CONTROL)( 190 _In_ struct _DEVICE_OBJECT *DeviceObject, 191 _Inout_ struct _IRP *Irp, 192 _In_ PVOID MapRegisterBase, 193 _In_ PVOID Context); 194 typedef DRIVER_CONTROL *PDRIVER_CONTROL; 195 196 typedef struct _WAIT_CONTEXT_BLOCK { 197 KDEVICE_QUEUE_ENTRY WaitQueueEntry; 198 PDRIVER_CONTROL DeviceRoutine; 199 PVOID DeviceContext; 200 ULONG NumberOfMapRegisters; 201 PVOID DeviceObject; 202 PVOID CurrentIrp; 203 PKDPC BufferChainingDpc; 204 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; 205 206 $endif (_WDMDDK_) 207 $if (_NTDDK_) 208 /* DEVICE_OBJECT.Flags */ 209 #define DO_DEVICE_HAS_NAME 0x00000040 210 #define DO_SYSTEM_BOOT_PARTITION 0x00000100 211 #define DO_LONG_TERM_REQUESTS 0x00000200 212 #define DO_NEVER_LAST_DEVICE 0x00000400 213 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 214 #define DO_SUPPORTS_TRANSACTIONS 0x00040000 215 #define DO_FORCE_NEITHER_IO 0x00080000 216 #define DO_VOLUME_DEVICE_OBJECT 0x00100000 217 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000 218 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000 219 #define DO_DISALLOW_EXECUTE 0x00800000 220 221 $endif (_NTDDK_) 222 $if (_WDMDDK_) 223 /* DEVICE_OBJECT.Flags */ 224 #define DO_UNLOAD_PENDING 0x00000001 225 #define DO_VERIFY_VOLUME 0x00000002 226 #define DO_BUFFERED_IO 0x00000004 227 #define DO_EXCLUSIVE 0x00000008 228 #define DO_DIRECT_IO 0x00000010 229 #define DO_MAP_IO_BUFFER 0x00000020 230 #define DO_DEVICE_INITIALIZING 0x00000080 231 #define DO_SHUTDOWN_REGISTERED 0x00000800 232 #define DO_BUS_ENUMERATED_DEVICE 0x00001000 233 #define DO_POWER_PAGABLE 0x00002000 234 #define DO_POWER_INRUSH 0x00004000 235 236 /* DEVICE_OBJECT.Characteristics */ 237 #define FILE_REMOVABLE_MEDIA 0x00000001 238 #define FILE_READ_ONLY_DEVICE 0x00000002 239 #define FILE_FLOPPY_DISKETTE 0x00000004 240 #define FILE_WRITE_ONCE_MEDIA 0x00000008 241 #define FILE_REMOTE_DEVICE 0x00000010 242 #define FILE_DEVICE_IS_MOUNTED 0x00000020 243 #define FILE_VIRTUAL_VOLUME 0x00000040 244 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 245 #define FILE_DEVICE_SECURE_OPEN 0x00000100 246 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800 247 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000 248 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000 249 #define FILE_PORTABLE_DEVICE 0x00004000 250 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000 251 252 /* DEVICE_OBJECT.AlignmentRequirement */ 253 #define FILE_BYTE_ALIGNMENT 0x00000000 254 #define FILE_WORD_ALIGNMENT 0x00000001 255 #define FILE_LONG_ALIGNMENT 0x00000003 256 #define FILE_QUAD_ALIGNMENT 0x00000007 257 #define FILE_OCTA_ALIGNMENT 0x0000000f 258 #define FILE_32_BYTE_ALIGNMENT 0x0000001f 259 #define FILE_64_BYTE_ALIGNMENT 0x0000003f 260 #define FILE_128_BYTE_ALIGNMENT 0x0000007f 261 #define FILE_256_BYTE_ALIGNMENT 0x000000ff 262 #define FILE_512_BYTE_ALIGNMENT 0x000001ff 263 264 $endif (_NTDDK_) 265 $if (_WDMDDK_ || _DEVIOCTL_) 266 /* DEVICE_OBJECT.DeviceType */ 267 #define DEVICE_TYPE ULONG 268 269 $endif (_WDMDDK_ || _DEVIOCTL_) 270 $if (_WDMDDK_) 271 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT { 272 CSHORT Type; 273 USHORT Size; 274 LONG ReferenceCount; 275 struct _DRIVER_OBJECT *DriverObject; 276 struct _DEVICE_OBJECT *NextDevice; 277 struct _DEVICE_OBJECT *AttachedDevice; 278 struct _IRP *CurrentIrp; 279 PIO_TIMER Timer; 280 ULONG Flags; 281 ULONG Characteristics; 282 volatile PVPB Vpb; 283 PVOID DeviceExtension; 284 DEVICE_TYPE DeviceType; 285 CCHAR StackSize; 286 union { 287 LIST_ENTRY ListEntry; 288 WAIT_CONTEXT_BLOCK Wcb; 289 } Queue; 290 ULONG AlignmentRequirement; 291 KDEVICE_QUEUE DeviceQueue; 292 KDPC Dpc; 293 ULONG ActiveThreadCount; 294 PSECURITY_DESCRIPTOR SecurityDescriptor; 295 KEVENT DeviceLock; 296 USHORT SectorSize; 297 USHORT Spare1; 298 struct _DEVOBJ_EXTENSION *DeviceObjectExtension; 299 PVOID Reserved; 300 } DEVICE_OBJECT, *PDEVICE_OBJECT; 301 302 typedef enum _IO_SESSION_STATE { 303 IoSessionStateCreated = 1, 304 IoSessionStateInitialized, 305 IoSessionStateConnected, 306 IoSessionStateDisconnected, 307 IoSessionStateDisconnectedLoggedOn, 308 IoSessionStateLoggedOn, 309 IoSessionStateLoggedOff, 310 IoSessionStateTerminated, 311 IoSessionStateMax 312 } IO_SESSION_STATE, *PIO_SESSION_STATE; 313 314 typedef enum _IO_COMPLETION_ROUTINE_RESULT { 315 ContinueCompletion = STATUS_CONTINUE_COMPLETION, 316 StopCompletion = STATUS_MORE_PROCESSING_REQUIRED 317 } IO_COMPLETION_ROUTINE_RESULT, *PIO_COMPLETION_ROUTINE_RESULT; 318 319 typedef struct _IO_INTERRUPT_MESSAGE_INFO_ENTRY { 320 PHYSICAL_ADDRESS MessageAddress; 321 KAFFINITY TargetProcessorSet; 322 PKINTERRUPT InterruptObject; 323 ULONG MessageData; 324 ULONG Vector; 325 KIRQL Irql; 326 KINTERRUPT_MODE Mode; 327 KINTERRUPT_POLARITY Polarity; 328 } IO_INTERRUPT_MESSAGE_INFO_ENTRY, *PIO_INTERRUPT_MESSAGE_INFO_ENTRY; 329 330 typedef struct _IO_INTERRUPT_MESSAGE_INFO { 331 KIRQL UnifiedIrql; 332 ULONG MessageCount; 333 IO_INTERRUPT_MESSAGE_INFO_ENTRY MessageInfo[1]; 334 } IO_INTERRUPT_MESSAGE_INFO, *PIO_INTERRUPT_MESSAGE_INFO; 335 336 typedef struct _IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS { 337 _In_ PDEVICE_OBJECT PhysicalDeviceObject; 338 _Out_ PKINTERRUPT *InterruptObject; 339 _In_ PKSERVICE_ROUTINE ServiceRoutine; 340 _In_ PVOID ServiceContext; 341 _In_opt_ PKSPIN_LOCK SpinLock; 342 _In_ KIRQL SynchronizeIrql; 343 _In_ BOOLEAN FloatingSave; 344 _In_ BOOLEAN ShareVector; 345 _In_ ULONG Vector; 346 _In_ KIRQL Irql; 347 _In_ KINTERRUPT_MODE InterruptMode; 348 _In_ KAFFINITY ProcessorEnableMask; 349 _In_ USHORT Group; 350 } IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS, *PIO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS; 351 352 typedef struct _IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS { 353 _In_ PDEVICE_OBJECT PhysicalDeviceObject; 354 _Out_ PKINTERRUPT *InterruptObject; 355 _In_ PKSERVICE_ROUTINE ServiceRoutine; 356 _In_ PVOID ServiceContext; 357 _In_opt_ PKSPIN_LOCK SpinLock; 358 _In_opt_ KIRQL SynchronizeIrql; 359 _In_ BOOLEAN FloatingSave; 360 } IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS, *PIO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS; 361 362 typedef struct _IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS { 363 _In_ PDEVICE_OBJECT PhysicalDeviceObject; 364 union { 365 _Out_ PVOID *Generic; 366 _Out_ PIO_INTERRUPT_MESSAGE_INFO *InterruptMessageTable; 367 _Out_ PKINTERRUPT *InterruptObject; 368 } ConnectionContext; 369 _In_ PKMESSAGE_SERVICE_ROUTINE MessageServiceRoutine; 370 _In_ PVOID ServiceContext; 371 _In_opt_ PKSPIN_LOCK SpinLock; 372 _In_opt_ KIRQL SynchronizeIrql; 373 _In_ BOOLEAN FloatingSave; 374 _In_opt_ PKSERVICE_ROUTINE FallBackServiceRoutine; 375 } IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS, *PIO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS; 376 377 typedef struct _IO_CONNECT_INTERRUPT_PARAMETERS { 378 _Inout_ ULONG Version; 379 _ANONYMOUS_UNION union { 380 IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS FullySpecified; 381 IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS LineBased; 382 IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS MessageBased; 383 } DUMMYUNIONNAME; 384 } IO_CONNECT_INTERRUPT_PARAMETERS, *PIO_CONNECT_INTERRUPT_PARAMETERS; 385 386 typedef struct _IO_DISCONNECT_INTERRUPT_PARAMETERS { 387 _In_ ULONG Version; 388 union { 389 _In_ PVOID Generic; 390 _In_ PKINTERRUPT InterruptObject; 391 _In_ PIO_INTERRUPT_MESSAGE_INFO InterruptMessageTable; 392 } ConnectionContext; 393 } IO_DISCONNECT_INTERRUPT_PARAMETERS, *PIO_DISCONNECT_INTERRUPT_PARAMETERS; 394 395 typedef struct _IO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS 396 { 397 ULONG Version; 398 union 399 { 400 PVOID Generic; 401 PKINTERRUPT InterruptObject; 402 PIO_INTERRUPT_MESSAGE_INFO InterruptMessageTable; 403 } ConnectionContext; 404 } IO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS, *PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS; 405 406 typedef enum _IO_ACCESS_TYPE { 407 ReadAccess, 408 WriteAccess, 409 ModifyAccess 410 } IO_ACCESS_TYPE; 411 412 typedef enum _IO_ACCESS_MODE { 413 SequentialAccess, 414 RandomAccess 415 } IO_ACCESS_MODE; 416 417 typedef enum _IO_CONTAINER_NOTIFICATION_CLASS { 418 IoSessionStateNotification, 419 IoMaxContainerNotificationClass 420 } IO_CONTAINER_NOTIFICATION_CLASS; 421 422 typedef struct _IO_SESSION_STATE_NOTIFICATION { 423 ULONG Size; 424 ULONG Flags; 425 PVOID IoObject; 426 ULONG EventMask; 427 PVOID Context; 428 } IO_SESSION_STATE_NOTIFICATION, *PIO_SESSION_STATE_NOTIFICATION; 429 430 typedef enum _IO_CONTAINER_INFORMATION_CLASS { 431 IoSessionStateInformation, 432 IoMaxContainerInformationClass 433 } IO_CONTAINER_INFORMATION_CLASS; 434 435 typedef struct _IO_SESSION_STATE_INFORMATION { 436 ULONG SessionId; 437 IO_SESSION_STATE SessionState; 438 BOOLEAN LocalSession; 439 } IO_SESSION_STATE_INFORMATION, *PIO_SESSION_STATE_INFORMATION; 440 441 #if (NTDDI_VERSION >= NTDDI_WIN7) 442 443 typedef NTSTATUS 444 (NTAPI *PIO_CONTAINER_NOTIFICATION_FUNCTION)( 445 VOID); 446 447 typedef NTSTATUS 448 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)( 449 _In_ PVOID SessionObject, 450 _In_ PVOID IoObject, 451 _In_ ULONG Event, 452 _In_ PVOID Context, 453 _In_reads_bytes_opt_(PayloadLength) PVOID NotificationPayload, 454 _In_ ULONG PayloadLength); 455 456 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION; 457 458 #endif 459 460 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK; 461 462 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK { 463 BOOLEAN Removed; 464 BOOLEAN Reserved[3]; 465 volatile LONG IoCount; 466 KEVENT RemoveEvent; 467 } IO_REMOVE_LOCK_COMMON_BLOCK; 468 469 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK { 470 LONG Signature; 471 LONG HighWatermark; 472 LONGLONG MaxLockedTicks; 473 LONG AllocateTag; 474 LIST_ENTRY LockList; 475 KSPIN_LOCK Spin; 476 volatile LONG LowMemoryCount; 477 ULONG Reserved1[4]; 478 PVOID Reserved2; 479 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks; 480 } IO_REMOVE_LOCK_DBG_BLOCK; 481 482 typedef struct _IO_REMOVE_LOCK { 483 IO_REMOVE_LOCK_COMMON_BLOCK Common; 484 #if DBG 485 IO_REMOVE_LOCK_DBG_BLOCK Dbg; 486 #endif 487 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK; 488 489 typedef struct _IO_WORKITEM *PIO_WORKITEM; 490 491 _Function_class_(IO_WORKITEM_ROUTINE) 492 _IRQL_requires_(PASSIVE_LEVEL) 493 _IRQL_requires_same_ 494 typedef VOID 495 (NTAPI IO_WORKITEM_ROUTINE)( 496 _In_ PDEVICE_OBJECT DeviceObject, 497 _In_opt_ PVOID Context); 498 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE; 499 500 typedef VOID 501 (NTAPI IO_WORKITEM_ROUTINE_EX)( 502 _In_ PVOID IoObject, 503 _In_opt_ PVOID Context, 504 _In_ PIO_WORKITEM IoWorkItem); 505 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX; 506 507 typedef struct _SHARE_ACCESS { 508 ULONG OpenCount; 509 ULONG Readers; 510 ULONG Writers; 511 ULONG Deleters; 512 ULONG SharedRead; 513 ULONG SharedWrite; 514 ULONG SharedDelete; 515 } SHARE_ACCESS, *PSHARE_ACCESS; 516 517 typedef enum _CREATE_FILE_TYPE { 518 CreateFileTypeNone, 519 CreateFileTypeNamedPipe, 520 CreateFileTypeMailslot 521 } CREATE_FILE_TYPE; 522 523 #define IO_FORCE_ACCESS_CHECK 0x001 524 #define IO_NO_PARAMETER_CHECKING 0x100 525 526 #define IO_REPARSE 0x0 527 #define IO_REMOUNT 0x1 528 529 typedef struct _IO_STATUS_BLOCK { 530 _ANONYMOUS_UNION union { 531 NTSTATUS Status; 532 PVOID Pointer; 533 } DUMMYUNIONNAME; 534 ULONG_PTR Information; 535 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; 536 537 #if defined(_WIN64) 538 typedef struct _IO_STATUS_BLOCK32 { 539 NTSTATUS Status; 540 ULONG Information; 541 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32; 542 #endif 543 544 typedef VOID 545 (NTAPI *PIO_APC_ROUTINE)( 546 _In_ PVOID ApcContext, 547 _In_ PIO_STATUS_BLOCK IoStatusBlock, 548 _In_ ULONG Reserved); 549 550 #define PIO_APC_ROUTINE_DEFINED 551 552 typedef enum _IO_SESSION_EVENT { 553 IoSessionEventIgnore = 0, 554 IoSessionEventCreated, 555 IoSessionEventTerminated, 556 IoSessionEventConnected, 557 IoSessionEventDisconnected, 558 IoSessionEventLogon, 559 IoSessionEventLogoff, 560 IoSessionEventMax 561 } IO_SESSION_EVENT, *PIO_SESSION_EVENT; 562 563 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff 564 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001 565 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002 566 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004 567 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008 568 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010 569 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020 570 571 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f 572 573 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L 574 575 typedef struct _IO_SESSION_CONNECT_INFO { 576 ULONG SessionId; 577 BOOLEAN LocalSession; 578 } IO_SESSION_CONNECT_INFO, *PIO_SESSION_CONNECT_INFO; 579 580 #define EVENT_INCREMENT 1 581 #define IO_NO_INCREMENT 0 582 #define IO_CD_ROM_INCREMENT 1 583 #define IO_DISK_INCREMENT 1 584 #define IO_KEYBOARD_INCREMENT 6 585 #define IO_MAILSLOT_INCREMENT 2 586 #define IO_MOUSE_INCREMENT 6 587 #define IO_NAMED_PIPE_INCREMENT 2 588 #define IO_NETWORK_INCREMENT 2 589 #define IO_PARALLEL_INCREMENT 1 590 #define IO_SERIAL_INCREMENT 2 591 #define IO_SOUND_INCREMENT 8 592 #define IO_VIDEO_INCREMENT 1 593 #define SEMAPHORE_INCREMENT 1 594 595 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000) 596 597 typedef struct _BOOTDISK_INFORMATION { 598 LONGLONG BootPartitionOffset; 599 LONGLONG SystemPartitionOffset; 600 ULONG BootDeviceSignature; 601 ULONG SystemDeviceSignature; 602 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION; 603 604 typedef struct _BOOTDISK_INFORMATION_EX { 605 LONGLONG BootPartitionOffset; 606 LONGLONG SystemPartitionOffset; 607 ULONG BootDeviceSignature; 608 ULONG SystemDeviceSignature; 609 GUID BootDeviceGuid; 610 GUID SystemDeviceGuid; 611 BOOLEAN BootDeviceIsGpt; 612 BOOLEAN SystemDeviceIsGpt; 613 } BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX; 614 615 #if (NTDDI_VERSION >= NTDDI_WIN7) 616 617 typedef struct _LOADER_PARTITION_INFORMATION_EX { 618 ULONG PartitionStyle; 619 ULONG PartitionNumber; 620 _ANONYMOUS_UNION union { 621 ULONG Signature; 622 GUID DeviceId; 623 } DUMMYUNIONNAME; 624 ULONG Flags; 625 } LOADER_PARTITION_INFORMATION_EX, *PLOADER_PARTITION_INFORMATION_EX; 626 627 typedef struct _BOOTDISK_INFORMATION_LITE { 628 ULONG NumberEntries; 629 LOADER_PARTITION_INFORMATION_EX Entries[1]; 630 } BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE; 631 632 #else 633 634 #if (NTDDI_VERSION >= NTDDI_VISTA) 635 typedef struct _BOOTDISK_INFORMATION_LITE { 636 ULONG BootDeviceSignature; 637 ULONG SystemDeviceSignature; 638 GUID BootDeviceGuid; 639 GUID SystemDeviceGuid; 640 BOOLEAN BootDeviceIsGpt; 641 BOOLEAN SystemDeviceIsGpt; 642 } BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE; 643 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 644 645 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 646 647 #include <pshpack1.h> 648 649 typedef struct _EISA_MEMORY_TYPE { 650 UCHAR ReadWrite:1; 651 UCHAR Cached:1; 652 UCHAR Reserved0:1; 653 UCHAR Type:2; 654 UCHAR Shared:1; 655 UCHAR Reserved1:1; 656 UCHAR MoreEntries:1; 657 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE; 658 659 typedef struct _EISA_MEMORY_CONFIGURATION { 660 EISA_MEMORY_TYPE ConfigurationByte; 661 UCHAR DataSize; 662 USHORT AddressLowWord; 663 UCHAR AddressHighByte; 664 USHORT MemorySize; 665 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION; 666 667 typedef struct _EISA_IRQ_DESCRIPTOR { 668 UCHAR Interrupt:4; 669 UCHAR Reserved:1; 670 UCHAR LevelTriggered:1; 671 UCHAR Shared:1; 672 UCHAR MoreEntries:1; 673 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR; 674 675 typedef struct _EISA_IRQ_CONFIGURATION { 676 EISA_IRQ_DESCRIPTOR ConfigurationByte; 677 UCHAR Reserved; 678 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION; 679 680 typedef struct _DMA_CONFIGURATION_BYTE0 { 681 UCHAR Channel:3; 682 UCHAR Reserved:3; 683 UCHAR Shared:1; 684 UCHAR MoreEntries:1; 685 } DMA_CONFIGURATION_BYTE0; 686 687 typedef struct _DMA_CONFIGURATION_BYTE1 { 688 UCHAR Reserved0:2; 689 UCHAR TransferSize:2; 690 UCHAR Timing:2; 691 UCHAR Reserved1:2; 692 } DMA_CONFIGURATION_BYTE1; 693 694 typedef struct _EISA_DMA_CONFIGURATION { 695 DMA_CONFIGURATION_BYTE0 ConfigurationByte0; 696 DMA_CONFIGURATION_BYTE1 ConfigurationByte1; 697 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION; 698 699 typedef struct _EISA_PORT_DESCRIPTOR { 700 UCHAR NumberPorts:5; 701 UCHAR Reserved:1; 702 UCHAR Shared:1; 703 UCHAR MoreEntries:1; 704 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR; 705 706 typedef struct _EISA_PORT_CONFIGURATION { 707 EISA_PORT_DESCRIPTOR Configuration; 708 USHORT PortAddress; 709 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION; 710 711 typedef struct _CM_EISA_SLOT_INFORMATION { 712 UCHAR ReturnCode; 713 UCHAR ReturnFlags; 714 UCHAR MajorRevision; 715 UCHAR MinorRevision; 716 USHORT Checksum; 717 UCHAR NumberFunctions; 718 UCHAR FunctionInformation; 719 ULONG CompressedId; 720 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION; 721 722 typedef struct _CM_EISA_FUNCTION_INFORMATION { 723 ULONG CompressedId; 724 UCHAR IdSlotFlags1; 725 UCHAR IdSlotFlags2; 726 UCHAR MinorRevision; 727 UCHAR MajorRevision; 728 UCHAR Selections[26]; 729 UCHAR FunctionFlags; 730 UCHAR TypeString[80]; 731 EISA_MEMORY_CONFIGURATION EisaMemory[9]; 732 EISA_IRQ_CONFIGURATION EisaIrq[7]; 733 EISA_DMA_CONFIGURATION EisaDma[4]; 734 EISA_PORT_CONFIGURATION EisaPort[20]; 735 UCHAR InitializationData[60]; 736 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION; 737 738 #include <poppack.h> 739 740 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */ 741 742 #define EISA_FUNCTION_ENABLED 0x80 743 #define EISA_FREE_FORM_DATA 0x40 744 #define EISA_HAS_PORT_INIT_ENTRY 0x20 745 #define EISA_HAS_PORT_RANGE 0x10 746 #define EISA_HAS_DMA_ENTRY 0x08 747 #define EISA_HAS_IRQ_ENTRY 0x04 748 #define EISA_HAS_MEMORY_ENTRY 0x02 749 #define EISA_HAS_TYPE_ENTRY 0x01 750 #define EISA_HAS_INFORMATION \ 751 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \ 752 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY) 753 754 #define EISA_MORE_ENTRIES 0x80 755 #define EISA_SYSTEM_MEMORY 0x00 756 #define EISA_MEMORY_TYPE_RAM 0x01 757 758 /* CM_EISA_SLOT_INFORMATION.ReturnCode */ 759 760 #define EISA_INVALID_SLOT 0x80 761 #define EISA_INVALID_FUNCTION 0x81 762 #define EISA_INVALID_CONFIGURATION 0x82 763 #define EISA_EMPTY_SLOT 0x83 764 #define EISA_INVALID_BIOS_CALL 0x86 765 766 /* 767 ** Plug and Play structures 768 */ 769 770 typedef VOID 771 (NTAPI *PINTERFACE_REFERENCE)( 772 PVOID Context); 773 774 typedef VOID 775 (NTAPI *PINTERFACE_DEREFERENCE)( 776 PVOID Context); 777 778 _Function_class_(TRANSLATE_BUS_ADDRESS) 779 _IRQL_requires_same_ 780 typedef BOOLEAN 781 (NTAPI TRANSLATE_BUS_ADDRESS)( 782 _Inout_opt_ PVOID Context, 783 _In_ PHYSICAL_ADDRESS BusAddress, 784 _In_ ULONG Length, 785 _Out_ PULONG AddressSpace, 786 _Out_ PPHYSICAL_ADDRESS TranslatedAddress); 787 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS; 788 789 _Function_class_(GET_DMA_ADAPTER) 790 _IRQL_requires_same_ 791 typedef struct _DMA_ADAPTER* 792 (NTAPI GET_DMA_ADAPTER)( 793 _Inout_opt_ PVOID Context, 794 _In_ struct _DEVICE_DESCRIPTION *DeviceDescriptor, 795 _Out_ PULONG NumberOfMapRegisters); 796 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER; 797 798 _Function_class_(GET_SET_DEVICE_DATA) 799 _IRQL_requires_same_ 800 typedef ULONG 801 (NTAPI GET_SET_DEVICE_DATA)( 802 _Inout_opt_ PVOID Context, 803 _In_ ULONG DataType, 804 _Inout_updates_bytes_(Length) PVOID Buffer, 805 _In_ ULONG Offset, 806 _In_ ULONG Length); 807 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA; 808 809 typedef enum _DEVICE_INSTALL_STATE { 810 InstallStateInstalled, 811 InstallStateNeedsReinstall, 812 InstallStateFailedInstall, 813 InstallStateFinishInstall 814 } DEVICE_INSTALL_STATE, *PDEVICE_INSTALL_STATE; 815 816 typedef struct _LEGACY_BUS_INFORMATION { 817 GUID BusTypeGuid; 818 INTERFACE_TYPE LegacyBusType; 819 ULONG BusNumber; 820 } LEGACY_BUS_INFORMATION, *PLEGACY_BUS_INFORMATION; 821 822 typedef enum _DEVICE_REMOVAL_POLICY { 823 RemovalPolicyExpectNoRemoval = 1, 824 RemovalPolicyExpectOrderlyRemoval = 2, 825 RemovalPolicyExpectSurpriseRemoval = 3 826 } DEVICE_REMOVAL_POLICY, *PDEVICE_REMOVAL_POLICY; 827 828 typedef VOID 829 (NTAPI *PREENUMERATE_SELF)( 830 _In_ PVOID Context); 831 832 typedef struct _REENUMERATE_SELF_INTERFACE_STANDARD { 833 USHORT Size; 834 USHORT Version; 835 PVOID Context; 836 PINTERFACE_REFERENCE InterfaceReference; 837 PINTERFACE_DEREFERENCE InterfaceDereference; 838 PREENUMERATE_SELF SurpriseRemoveAndReenumerateSelf; 839 } REENUMERATE_SELF_INTERFACE_STANDARD, *PREENUMERATE_SELF_INTERFACE_STANDARD; 840 841 typedef VOID 842 (NTAPI *PIO_DEVICE_EJECT_CALLBACK)( 843 _In_ NTSTATUS Status, 844 _Inout_opt_ PVOID Context); 845 846 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1 847 848 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */ 849 #define PCI_USE_SUBSYSTEM_IDS 0x00000001 850 #define PCI_USE_REVISION 0x00000002 851 #define PCI_USE_VENDEV_IDS 0x00000004 852 #define PCI_USE_CLASS_SUBCLASS 0x00000008 853 #define PCI_USE_PROGIF 0x00000010 854 #define PCI_USE_LOCAL_BUS 0x00000020 855 #define PCI_USE_LOCAL_DEVICE 0x00000040 856 857 typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS { 858 ULONG Size; 859 ULONG Flags; 860 USHORT VendorID; 861 USHORT DeviceID; 862 UCHAR RevisionID; 863 USHORT SubVendorID; 864 USHORT SubSystemID; 865 UCHAR BaseClass; 866 UCHAR SubClass; 867 UCHAR ProgIf; 868 } PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS; 869 870 _IRQL_requires_max_(PASSIVE_LEVEL) 871 _Must_inspect_result_ 872 typedef BOOLEAN 873 (NTAPI PCI_IS_DEVICE_PRESENT)( 874 _In_ USHORT VendorID, 875 _In_ USHORT DeviceID, 876 _In_ UCHAR RevisionID, 877 _In_ USHORT SubVendorID, 878 _In_ USHORT SubSystemID, 879 _In_ ULONG Flags); 880 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT; 881 882 _IRQL_requires_max_(PASSIVE_LEVEL) 883 _Must_inspect_result_ 884 typedef BOOLEAN 885 (NTAPI PCI_IS_DEVICE_PRESENT_EX)( 886 _In_ PVOID Context, 887 _In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters); 888 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX; 889 890 typedef struct _BUS_INTERFACE_STANDARD { 891 USHORT Size; 892 USHORT Version; 893 PVOID Context; 894 PINTERFACE_REFERENCE InterfaceReference; 895 PINTERFACE_DEREFERENCE InterfaceDereference; 896 PTRANSLATE_BUS_ADDRESS TranslateBusAddress; 897 PGET_DMA_ADAPTER GetDmaAdapter; 898 PGET_SET_DEVICE_DATA SetBusData; 899 PGET_SET_DEVICE_DATA GetBusData; 900 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD; 901 902 typedef struct _PCI_DEVICE_PRESENT_INTERFACE { 903 USHORT Size; 904 USHORT Version; 905 PVOID Context; 906 PINTERFACE_REFERENCE InterfaceReference; 907 PINTERFACE_DEREFERENCE InterfaceDereference; 908 PPCI_IS_DEVICE_PRESENT IsDevicePresent; 909 PPCI_IS_DEVICE_PRESENT_EX IsDevicePresentEx; 910 } PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE; 911 912 _Struct_size_bytes_(Size) 913 typedef struct _DEVICE_CAPABILITIES { 914 _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size; 915 USHORT Version; 916 ULONG DeviceD1:1; 917 ULONG DeviceD2:1; 918 ULONG LockSupported:1; 919 ULONG EjectSupported:1; 920 ULONG Removable:1; 921 ULONG DockDevice:1; 922 ULONG UniqueID:1; 923 ULONG SilentInstall:1; 924 ULONG RawDeviceOK:1; 925 ULONG SurpriseRemovalOK:1; 926 ULONG WakeFromD0:1; 927 ULONG WakeFromD1:1; 928 ULONG WakeFromD2:1; 929 ULONG WakeFromD3:1; 930 ULONG HardwareDisabled:1; 931 ULONG NonDynamic:1; 932 ULONG WarmEjectSupported:1; 933 ULONG NoDisplayInUI:1; 934 ULONG Reserved1:1; 935 ULONG WakeFromInterrupt:1; 936 ULONG SecureDevice:1; 937 ULONG ChildOfVgaEnabledBridge:1; 938 ULONG DecodeIoOnBoot:1; 939 ULONG Reserved:9; 940 ULONG Address; 941 ULONG UINumber; 942 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum]; 943 SYSTEM_POWER_STATE SystemWake; 944 DEVICE_POWER_STATE DeviceWake; 945 ULONG D1Latency; 946 ULONG D2Latency; 947 ULONG D3Latency; 948 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES; 949 950 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION { 951 USHORT Version; 952 USHORT Size; 953 GUID Event; 954 GUID InterfaceClassGuid; 955 PUNICODE_STRING SymbolicLinkName; 956 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION; 957 958 typedef struct _HWPROFILE_CHANGE_NOTIFICATION { 959 USHORT Version; 960 USHORT Size; 961 GUID Event; 962 } HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION; 963 964 #undef INTERFACE 965 966 typedef struct _INTERFACE { 967 USHORT Size; 968 USHORT Version; 969 PVOID Context; 970 PINTERFACE_REFERENCE InterfaceReference; 971 PINTERFACE_DEREFERENCE InterfaceDereference; 972 } INTERFACE, *PINTERFACE; 973 974 typedef struct _PLUGPLAY_NOTIFICATION_HEADER { 975 USHORT Version; 976 USHORT Size; 977 GUID Event; 978 } PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER; 979 980 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE; 981 982 /* PNP_DEVICE_STATE */ 983 984 #define PNP_DEVICE_DISABLED 0x00000001 985 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002 986 #define PNP_DEVICE_FAILED 0x00000004 987 #define PNP_DEVICE_REMOVED 0x00000008 988 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010 989 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020 990 991 typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION { 992 USHORT Version; 993 USHORT Size; 994 GUID Event; 995 struct _FILE_OBJECT *FileObject; 996 LONG NameBufferOffset; 997 UCHAR CustomDataBuffer[1]; 998 } TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION; 999 1000 typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION { 1001 USHORT Version; 1002 USHORT Size; 1003 GUID Event; 1004 struct _FILE_OBJECT *FileObject; 1005 } TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION; 1006 1007 #if (NTDDI_VERSION >= NTDDI_VISTA) 1008 #include <devpropdef.h> 1009 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001 1010 #endif 1011 1012 #define PNP_REPLACE_NO_MAP MAXLONGLONG 1013 1014 _Must_inspect_result_ 1015 typedef NTSTATUS 1016 (NTAPI *PREPLACE_MAP_MEMORY)( 1017 _In_ PHYSICAL_ADDRESS TargetPhysicalAddress, 1018 _In_ PHYSICAL_ADDRESS SparePhysicalAddress, 1019 _Inout_ PLARGE_INTEGER NumberOfBytes, 1020 _Outptr_ PVOID *TargetAddress, 1021 _Outptr_ PVOID *SpareAddress); 1022 1023 typedef struct _PNP_REPLACE_MEMORY_LIST { 1024 ULONG AllocatedCount; 1025 ULONG Count; 1026 ULONGLONG TotalLength; 1027 struct { 1028 PHYSICAL_ADDRESS Address; 1029 ULONGLONG Length; 1030 } Ranges[ANYSIZE_ARRAY]; 1031 } PNP_REPLACE_MEMORY_LIST, *PPNP_REPLACE_MEMORY_LIST; 1032 1033 typedef struct _PNP_REPLACE_PROCESSOR_LIST { 1034 PKAFFINITY Affinity; 1035 _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount; 1036 ULONG AllocatedCount; 1037 ULONG Count; 1038 ULONG ApicIds[ANYSIZE_ARRAY]; 1039 } PNP_REPLACE_PROCESSOR_LIST, *PPNP_REPLACE_PROCESSOR_LIST; 1040 1041 typedef struct _PNP_REPLACE_PROCESSOR_LIST_V1 { 1042 KAFFINITY AffinityMask; 1043 ULONG AllocatedCount; 1044 ULONG Count; 1045 ULONG ApicIds[ANYSIZE_ARRAY]; 1046 } PNP_REPLACE_PROCESSOR_LIST_V1, *PPNP_REPLACE_PROCESSOR_LIST_V1; 1047 1048 #define PNP_REPLACE_PARAMETERS_VERSION 2 1049 1050 typedef struct _PNP_REPLACE_PARAMETERS { 1051 ULONG Size; 1052 ULONG Version; 1053 ULONG64 Target; 1054 ULONG64 Spare; 1055 PPNP_REPLACE_PROCESSOR_LIST TargetProcessors; 1056 PPNP_REPLACE_PROCESSOR_LIST SpareProcessors; 1057 PPNP_REPLACE_MEMORY_LIST TargetMemory; 1058 PPNP_REPLACE_MEMORY_LIST SpareMemory; 1059 PREPLACE_MAP_MEMORY MapMemory; 1060 } PNP_REPLACE_PARAMETERS, *PPNP_REPLACE_PARAMETERS; 1061 1062 typedef VOID 1063 (NTAPI *PREPLACE_UNLOAD)( 1064 VOID); 1065 1066 _Must_inspect_result_ 1067 typedef NTSTATUS 1068 (NTAPI *PREPLACE_BEGIN)( 1069 _In_ PPNP_REPLACE_PARAMETERS Parameters, 1070 _Outptr_ PVOID *Context); 1071 1072 _Must_inspect_result_ 1073 typedef NTSTATUS 1074 (NTAPI *PREPLACE_END)( 1075 _In_ PVOID Context); 1076 1077 _Must_inspect_result_ 1078 typedef NTSTATUS 1079 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)( 1080 _In_ PVOID Context, 1081 _In_ PHYSICAL_ADDRESS PhysicalAddress, 1082 _In_ LARGE_INTEGER ByteCount); 1083 1084 _Must_inspect_result_ 1085 typedef NTSTATUS 1086 (NTAPI *PREPLACE_SET_PROCESSOR_ID)( 1087 _In_ PVOID Context, 1088 _In_ ULONG ApicId, 1089 _In_ BOOLEAN Target); 1090 1091 _Must_inspect_result_ 1092 typedef NTSTATUS 1093 (NTAPI *PREPLACE_SWAP)( 1094 _In_ PVOID Context); 1095 1096 _Must_inspect_result_ 1097 typedef NTSTATUS 1098 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)( 1099 _In_ PVOID Context); 1100 1101 _Must_inspect_result_ 1102 typedef NTSTATUS 1103 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)( 1104 _In_ PVOID Context); 1105 1106 _Must_inspect_result_ 1107 typedef NTSTATUS 1108 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)( 1109 _In_ PVOID Context, 1110 _In_ PHYSICAL_ADDRESS SourceAddress, 1111 _Out_ PPHYSICAL_ADDRESS DestinationAddress); 1112 1113 _Must_inspect_result_ 1114 typedef NTSTATUS 1115 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)( 1116 _In_ PVOID Context, 1117 _In_ BOOLEAN Enable); 1118 1119 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1 1120 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \ 1121 FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror) 1122 1123 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001 1124 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002 1125 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004 1126 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008 1127 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010 1128 1129 typedef struct _PNP_REPLACE_DRIVER_INTERFACE { 1130 ULONG Size; 1131 ULONG Version; 1132 ULONG Flags; 1133 PREPLACE_UNLOAD Unload; 1134 PREPLACE_BEGIN BeginReplace; 1135 PREPLACE_END EndReplace; 1136 PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory; 1137 PREPLACE_SET_PROCESSOR_ID SetProcessorId; 1138 PREPLACE_SWAP Swap; 1139 PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror; 1140 PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory; 1141 PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination; 1142 PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce; 1143 } PNP_REPLACE_DRIVER_INTERFACE, *PPNP_REPLACE_DRIVER_INTERFACE; 1144 1145 _Must_inspect_result_ 1146 typedef NTSTATUS 1147 (NTAPI *PREPLACE_DRIVER_INIT)( 1148 _Inout_ PPNP_REPLACE_DRIVER_INTERFACE Interface, 1149 _In_ PVOID Unused); 1150 1151 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE { 1152 DeviceUsageTypeUndefined, 1153 DeviceUsageTypePaging, 1154 DeviceUsageTypeHibernation, 1155 DeviceUsageTypeDumpFile, 1156 DeviceUsageTypeBoot, 1157 DeviceUsageTypePostDisplay, 1158 DeviceUsageTypeGuestAssigned, 1159 } DEVICE_USAGE_NOTIFICATION_TYPE; 1160 1161 typedef struct _POWER_SEQUENCE { 1162 ULONG SequenceD1; 1163 ULONG SequenceD2; 1164 ULONG SequenceD3; 1165 } POWER_SEQUENCE, *PPOWER_SEQUENCE; 1166 1167 #ifdef _PREFAST_ 1168 #define __string_type 0x1000 1169 #define __guid_type 0x2000 1170 #define __multiString_type 0x4000 1171 #else 1172 #define __string_type 0 1173 #define __guid_type 0 1174 #define __multiString_type 0 1175 #endif 1176 1177 typedef enum { 1178 DevicePropertyDeviceDescription = 0x0 | __string_type, 1179 DevicePropertyHardwareID = 0x1 | __multiString_type, 1180 DevicePropertyCompatibleIDs = 0x2 | __multiString_type, 1181 DevicePropertyBootConfiguration = 0x3, 1182 DevicePropertyBootConfigurationTranslated = 0x4, 1183 DevicePropertyClassName = 0x5 | __string_type, 1184 DevicePropertyClassGuid = 0x6 | __string_type, 1185 DevicePropertyDriverKeyName = 0x7 | __string_type, 1186 DevicePropertyManufacturer = 0x8 | __string_type, 1187 DevicePropertyFriendlyName = 0x9 | __string_type, 1188 DevicePropertyLocationInformation = 0xa | __string_type, 1189 DevicePropertyPhysicalDeviceObjectName = 0xb | __string_type, 1190 DevicePropertyBusTypeGuid = 0xc | __guid_type, 1191 DevicePropertyLegacyBusType = 0xd, 1192 DevicePropertyBusNumber = 0xe, 1193 DevicePropertyEnumeratorName = 0xf | __string_type, 1194 DevicePropertyAddress = 0x10, 1195 DevicePropertyUINumber = 0x11, 1196 DevicePropertyInstallState = 0x12, 1197 DevicePropertyRemovalPolicy = 0x13, 1198 DevicePropertyResourceRequirements = 0x14, 1199 DevicePropertyAllocatedResources = 0x15, 1200 DevicePropertyContainerID = 0x16 | __string_type 1201 } DEVICE_REGISTRY_PROPERTY; 1202 1203 typedef enum _IO_NOTIFICATION_EVENT_CATEGORY { 1204 EventCategoryReserved, 1205 EventCategoryHardwareProfileChange, 1206 EventCategoryDeviceInterfaceChange, 1207 EventCategoryTargetDeviceChange 1208 } IO_NOTIFICATION_EVENT_CATEGORY; 1209 1210 typedef enum _IO_PRIORITY_HINT { 1211 IoPriorityVeryLow = 0, 1212 IoPriorityLow, 1213 IoPriorityNormal, 1214 IoPriorityHigh, 1215 IoPriorityCritical, 1216 MaxIoPriorityTypes 1217 } IO_PRIORITY_HINT; 1218 1219 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001 1220 1221 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) 1222 _IRQL_requires_max_(PASSIVE_LEVEL) 1223 typedef NTSTATUS 1224 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)( 1225 _In_ PVOID NotificationStructure, 1226 _Inout_opt_ PVOID Context); 1227 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE; 1228 1229 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK) 1230 _IRQL_requires_same_ 1231 typedef VOID 1232 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)( 1233 _Inout_opt_ PVOID Context); 1234 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK; 1235 1236 typedef enum _FILE_INFORMATION_CLASS { 1237 FileDirectoryInformation = 1, 1238 FileFullDirectoryInformation, 1239 FileBothDirectoryInformation, 1240 FileBasicInformation, 1241 FileStandardInformation, 1242 FileInternalInformation, 1243 FileEaInformation, 1244 FileAccessInformation, 1245 FileNameInformation, 1246 FileRenameInformation, 1247 FileLinkInformation, 1248 FileNamesInformation, 1249 FileDispositionInformation, 1250 FilePositionInformation, 1251 FileFullEaInformation, 1252 FileModeInformation, 1253 FileAlignmentInformation, 1254 FileAllInformation, 1255 FileAllocationInformation, 1256 FileEndOfFileInformation, 1257 FileAlternateNameInformation, 1258 FileStreamInformation, 1259 FilePipeInformation, 1260 FilePipeLocalInformation, 1261 FilePipeRemoteInformation, 1262 FileMailslotQueryInformation, 1263 FileMailslotSetInformation, 1264 FileCompressionInformation, 1265 FileObjectIdInformation, 1266 FileCompletionInformation, 1267 FileMoveClusterInformation, 1268 FileQuotaInformation, 1269 FileReparsePointInformation, 1270 FileNetworkOpenInformation, 1271 FileAttributeTagInformation, 1272 FileTrackingInformation, 1273 FileIdBothDirectoryInformation, 1274 FileIdFullDirectoryInformation, 1275 FileValidDataLengthInformation, 1276 FileShortNameInformation, 1277 #if (NTDDI_VERSION >= NTDDI_VISTA) 1278 FileIoCompletionNotificationInformation, 1279 FileIoStatusBlockRangeInformation, 1280 FileIoPriorityHintInformation, 1281 FileSfioReserveInformation, 1282 FileSfioVolumeInformation, 1283 FileHardLinkInformation, 1284 FileProcessIdsUsingFileInformation, 1285 FileNormalizedNameInformation, 1286 FileNetworkPhysicalNameInformation, 1287 #endif 1288 #if (NTDDI_VERSION >= NTDDI_WIN7) 1289 FileIdGlobalTxDirectoryInformation, 1290 FileIsRemoteDeviceInformation, 1291 FileAttributeCacheInformation, 1292 FileNumaNodeInformation, 1293 FileStandardLinkInformation, 1294 FileRemoteProtocolInformation, 1295 #endif 1296 FileMaximumInformation 1297 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; 1298 1299 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS { 1300 DirectoryNotifyInformation = 1, 1301 DirectoryNotifyExtendedInformation 1302 } DIRECTORY_NOTIFY_INFORMATION_CLASS, *PDIRECTORY_NOTIFY_INFORMATION_CLASS; 1303 1304 typedef struct _FILE_POSITION_INFORMATION { 1305 LARGE_INTEGER CurrentByteOffset; 1306 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; 1307 1308 typedef struct _FILE_BASIC_INFORMATION { 1309 LARGE_INTEGER CreationTime; 1310 LARGE_INTEGER LastAccessTime; 1311 LARGE_INTEGER LastWriteTime; 1312 LARGE_INTEGER ChangeTime; 1313 ULONG FileAttributes; 1314 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; 1315 1316 typedef struct _FILE_IO_PRIORITY_HINT_INFORMATION { 1317 IO_PRIORITY_HINT PriorityHint; 1318 } FILE_IO_PRIORITY_HINT_INFORMATION, *PFILE_IO_PRIORITY_HINT_INFORMATION; 1319 1320 typedef struct _FILE_IO_COMPLETION_NOTIFICATION_INFORMATION { 1321 ULONG Flags; 1322 } FILE_IO_COMPLETION_NOTIFICATION_INFORMATION, *PFILE_IO_COMPLETION_NOTIFICATION_INFORMATION; 1323 1324 typedef struct _FILE_IOSTATUSBLOCK_RANGE_INFORMATION { 1325 PUCHAR IoStatusBlockRange; 1326 ULONG Length; 1327 } FILE_IOSTATUSBLOCK_RANGE_INFORMATION, *PFILE_IOSTATUSBLOCK_RANGE_INFORMATION; 1328 1329 typedef struct _FILE_IS_REMOTE_DEVICE_INFORMATION { 1330 BOOLEAN IsRemote; 1331 } FILE_IS_REMOTE_DEVICE_INFORMATION, *PFILE_IS_REMOTE_DEVICE_INFORMATION; 1332 1333 typedef struct _FILE_NUMA_NODE_INFORMATION { 1334 USHORT NodeNumber; 1335 } FILE_NUMA_NODE_INFORMATION, *PFILE_NUMA_NODE_INFORMATION; 1336 1337 typedef struct _FILE_PROCESS_IDS_USING_FILE_INFORMATION { 1338 ULONG NumberOfProcessIdsInList; 1339 ULONG_PTR ProcessIdList[1]; 1340 } FILE_PROCESS_IDS_USING_FILE_INFORMATION, *PFILE_PROCESS_IDS_USING_FILE_INFORMATION; 1341 1342 typedef struct _FILE_STANDARD_INFORMATION { 1343 LARGE_INTEGER AllocationSize; 1344 LARGE_INTEGER EndOfFile; 1345 ULONG NumberOfLinks; 1346 BOOLEAN DeletePending; 1347 BOOLEAN Directory; 1348 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; 1349 1350 typedef struct _FILE_NETWORK_OPEN_INFORMATION { 1351 LARGE_INTEGER CreationTime; 1352 LARGE_INTEGER LastAccessTime; 1353 LARGE_INTEGER LastWriteTime; 1354 LARGE_INTEGER ChangeTime; 1355 LARGE_INTEGER AllocationSize; 1356 LARGE_INTEGER EndOfFile; 1357 ULONG FileAttributes; 1358 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; 1359 1360 typedef enum _FSINFOCLASS { 1361 FileFsVolumeInformation = 1, 1362 FileFsLabelInformation, 1363 FileFsSizeInformation, 1364 FileFsDeviceInformation, 1365 FileFsAttributeInformation, 1366 FileFsControlInformation, 1367 FileFsFullSizeInformation, 1368 FileFsObjectIdInformation, 1369 FileFsDriverPathInformation, 1370 FileFsVolumeFlagsInformation, 1371 FileFsMaximumInformation 1372 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; 1373 1374 typedef struct _FILE_FS_DEVICE_INFORMATION { 1375 DEVICE_TYPE DeviceType; 1376 ULONG Characteristics; 1377 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; 1378 1379 typedef struct _FILE_FULL_EA_INFORMATION { 1380 ULONG NextEntryOffset; 1381 UCHAR Flags; 1382 UCHAR EaNameLength; 1383 USHORT EaValueLength; 1384 CHAR EaName[1]; 1385 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION; 1386 1387 typedef struct _FILE_SFIO_RESERVE_INFORMATION { 1388 ULONG RequestsPerPeriod; 1389 ULONG Period; 1390 BOOLEAN RetryFailures; 1391 BOOLEAN Discardable; 1392 ULONG RequestSize; 1393 ULONG NumOutstandingRequests; 1394 } FILE_SFIO_RESERVE_INFORMATION, *PFILE_SFIO_RESERVE_INFORMATION; 1395 1396 typedef struct _FILE_SFIO_VOLUME_INFORMATION { 1397 ULONG MaximumRequestsPerPeriod; 1398 ULONG MinimumPeriod; 1399 ULONG MinimumTransferSize; 1400 } FILE_SFIO_VOLUME_INFORMATION, *PFILE_SFIO_VOLUME_INFORMATION; 1401 1402 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 1403 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 1404 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4 1405 1406 #define FM_LOCK_BIT (0x1) 1407 #define FM_LOCK_BIT_V (0x0) 1408 #define FM_LOCK_WAITER_WOKEN (0x2) 1409 #define FM_LOCK_WAITER_INC (0x4) 1410 1411 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE) 1412 _IRQL_requires_same_ 1413 typedef BOOLEAN 1414 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)( 1415 _In_ struct _FILE_OBJECT *FileObject, 1416 _In_ PLARGE_INTEGER FileOffset, 1417 _In_ ULONG Length, 1418 _In_ BOOLEAN Wait, 1419 _In_ ULONG LockKey, 1420 _In_ BOOLEAN CheckForReadOperation, 1421 _Out_ PIO_STATUS_BLOCK IoStatus, 1422 _In_ struct _DEVICE_OBJECT *DeviceObject); 1423 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE; 1424 1425 _Function_class_(FAST_IO_READ) 1426 _IRQL_requires_same_ 1427 typedef BOOLEAN 1428 (NTAPI FAST_IO_READ)( 1429 _In_ struct _FILE_OBJECT *FileObject, 1430 _In_ PLARGE_INTEGER FileOffset, 1431 _In_ ULONG Length, 1432 _In_ BOOLEAN Wait, 1433 _In_ ULONG LockKey, 1434 _Out_ PVOID Buffer, 1435 _Out_ PIO_STATUS_BLOCK IoStatus, 1436 _In_ struct _DEVICE_OBJECT *DeviceObject); 1437 typedef FAST_IO_READ *PFAST_IO_READ; 1438 1439 _Function_class_(FAST_IO_WRITE) 1440 _IRQL_requires_same_ 1441 typedef BOOLEAN 1442 (NTAPI FAST_IO_WRITE)( 1443 _In_ struct _FILE_OBJECT *FileObject, 1444 _In_ PLARGE_INTEGER FileOffset, 1445 _In_ ULONG Length, 1446 _In_ BOOLEAN Wait, 1447 _In_ ULONG LockKey, 1448 _In_ PVOID Buffer, 1449 _Out_ PIO_STATUS_BLOCK IoStatus, 1450 _In_ struct _DEVICE_OBJECT *DeviceObject); 1451 typedef FAST_IO_WRITE *PFAST_IO_WRITE; 1452 1453 _Function_class_(FAST_IO_QUERY_BASIC_INFO) 1454 _IRQL_requires_same_ 1455 typedef BOOLEAN 1456 (NTAPI FAST_IO_QUERY_BASIC_INFO)( 1457 _In_ struct _FILE_OBJECT *FileObject, 1458 _In_ BOOLEAN Wait, 1459 _Out_ PFILE_BASIC_INFORMATION Buffer, 1460 _Out_ PIO_STATUS_BLOCK IoStatus, 1461 _In_ struct _DEVICE_OBJECT *DeviceObject); 1462 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO; 1463 1464 _Function_class_(FAST_IO_QUERY_STANDARD_INFO) 1465 _IRQL_requires_same_ 1466 typedef BOOLEAN 1467 (NTAPI FAST_IO_QUERY_STANDARD_INFO)( 1468 _In_ struct _FILE_OBJECT *FileObject, 1469 _In_ BOOLEAN Wait, 1470 _Out_ PFILE_STANDARD_INFORMATION Buffer, 1471 _Out_ PIO_STATUS_BLOCK IoStatus, 1472 _In_ struct _DEVICE_OBJECT *DeviceObject); 1473 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO; 1474 1475 _Function_class_(FAST_IO_LOCK) 1476 _IRQL_requires_same_ 1477 typedef BOOLEAN 1478 (NTAPI FAST_IO_LOCK)( 1479 _In_ struct _FILE_OBJECT *FileObject, 1480 _In_ PLARGE_INTEGER FileOffset, 1481 _In_ PLARGE_INTEGER Length, 1482 _In_ PEPROCESS ProcessId, 1483 _In_ ULONG Key, 1484 _In_ BOOLEAN FailImmediately, 1485 _In_ BOOLEAN ExclusiveLock, 1486 _Out_ PIO_STATUS_BLOCK IoStatus, 1487 _In_ struct _DEVICE_OBJECT *DeviceObject); 1488 typedef FAST_IO_LOCK *PFAST_IO_LOCK; 1489 1490 _Function_class_(FAST_IO_UNLOCK_SINGLE) 1491 _IRQL_requires_same_ 1492 typedef BOOLEAN 1493 (NTAPI FAST_IO_UNLOCK_SINGLE)( 1494 _In_ struct _FILE_OBJECT *FileObject, 1495 _In_ PLARGE_INTEGER FileOffset, 1496 _In_ PLARGE_INTEGER Length, 1497 _In_ PEPROCESS ProcessId, 1498 _In_ ULONG Key, 1499 _Out_ PIO_STATUS_BLOCK IoStatus, 1500 _In_ struct _DEVICE_OBJECT *DeviceObject); 1501 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE; 1502 1503 _Function_class_(FAST_IO_UNLOCK_ALL) 1504 _IRQL_requires_same_ 1505 typedef BOOLEAN 1506 (NTAPI FAST_IO_UNLOCK_ALL)( 1507 _In_ struct _FILE_OBJECT *FileObject, 1508 _In_ PEPROCESS ProcessId, 1509 _Out_ PIO_STATUS_BLOCK IoStatus, 1510 _In_ struct _DEVICE_OBJECT *DeviceObject); 1511 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL; 1512 1513 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY) 1514 _IRQL_requires_same_ 1515 typedef BOOLEAN 1516 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)( 1517 _In_ struct _FILE_OBJECT *FileObject, 1518 _In_ PVOID ProcessId, 1519 _In_ ULONG Key, 1520 _Out_ PIO_STATUS_BLOCK IoStatus, 1521 _In_ struct _DEVICE_OBJECT *DeviceObject); 1522 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY; 1523 1524 _Function_class_(FAST_IO_DEVICE_CONTROL) 1525 _IRQL_requires_same_ 1526 typedef BOOLEAN 1527 (NTAPI FAST_IO_DEVICE_CONTROL)( 1528 _In_ struct _FILE_OBJECT *FileObject, 1529 _In_ BOOLEAN Wait, 1530 _In_opt_ PVOID InputBuffer, 1531 _In_ ULONG InputBufferLength, 1532 _Out_opt_ PVOID OutputBuffer, 1533 _In_ ULONG OutputBufferLength, 1534 _In_ ULONG IoControlCode, 1535 _Out_ PIO_STATUS_BLOCK IoStatus, 1536 _In_ struct _DEVICE_OBJECT *DeviceObject); 1537 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL; 1538 1539 _Function_class_(FAST_IO_ACQUIRE_FILE) 1540 _IRQL_requires_same_ 1541 typedef VOID 1542 (NTAPI FAST_IO_ACQUIRE_FILE)( 1543 _In_ struct _FILE_OBJECT *FileObject); 1544 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE; 1545 1546 _Function_class_(FAST_IO_RELEASE_FILE) 1547 _IRQL_requires_same_ 1548 typedef VOID 1549 (NTAPI FAST_IO_RELEASE_FILE)( 1550 _In_ struct _FILE_OBJECT *FileObject); 1551 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE; 1552 1553 _Function_class_(FAST_IO_DETACH_DEVICE) 1554 _IRQL_requires_same_ 1555 typedef VOID 1556 (NTAPI FAST_IO_DETACH_DEVICE)( 1557 _In_ struct _DEVICE_OBJECT *SourceDevice, 1558 _In_ struct _DEVICE_OBJECT *TargetDevice); 1559 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE; 1560 1561 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO) 1562 _IRQL_requires_same_ 1563 typedef BOOLEAN 1564 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)( 1565 _In_ struct _FILE_OBJECT *FileObject, 1566 _In_ BOOLEAN Wait, 1567 _Out_ struct _FILE_NETWORK_OPEN_INFORMATION *Buffer, 1568 _Out_ struct _IO_STATUS_BLOCK *IoStatus, 1569 _In_ struct _DEVICE_OBJECT *DeviceObject); 1570 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO; 1571 1572 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE) 1573 _IRQL_requires_same_ 1574 typedef NTSTATUS 1575 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)( 1576 _In_ struct _FILE_OBJECT *FileObject, 1577 _In_ PLARGE_INTEGER EndingOffset, 1578 _Out_ struct _ERESOURCE **ResourceToRelease, 1579 _In_ struct _DEVICE_OBJECT *DeviceObject); 1580 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE; 1581 1582 _Function_class_(FAST_IO_MDL_READ) 1583 _IRQL_requires_same_ 1584 typedef BOOLEAN 1585 (NTAPI FAST_IO_MDL_READ)( 1586 _In_ struct _FILE_OBJECT *FileObject, 1587 _In_ PLARGE_INTEGER FileOffset, 1588 _In_ ULONG Length, 1589 _In_ ULONG LockKey, 1590 _Out_ PMDL *MdlChain, 1591 _Out_ PIO_STATUS_BLOCK IoStatus, 1592 _In_ struct _DEVICE_OBJECT *DeviceObject); 1593 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ; 1594 1595 _Function_class_(FAST_IO_MDL_READ_COMPLETE) 1596 _IRQL_requires_same_ 1597 typedef BOOLEAN 1598 (NTAPI FAST_IO_MDL_READ_COMPLETE)( 1599 _In_ struct _FILE_OBJECT *FileObject, 1600 _In_ PMDL MdlChain, 1601 _In_ struct _DEVICE_OBJECT *DeviceObject); 1602 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE; 1603 1604 _Function_class_(FAST_IO_PREPARE_MDL_WRITE) 1605 _IRQL_requires_same_ 1606 typedef BOOLEAN 1607 (NTAPI FAST_IO_PREPARE_MDL_WRITE)( 1608 _In_ struct _FILE_OBJECT *FileObject, 1609 _In_ PLARGE_INTEGER FileOffset, 1610 _In_ ULONG Length, 1611 _In_ ULONG LockKey, 1612 _Out_ PMDL *MdlChain, 1613 _Out_ PIO_STATUS_BLOCK IoStatus, 1614 _In_ struct _DEVICE_OBJECT *DeviceObject); 1615 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE; 1616 1617 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE) 1618 _IRQL_requires_same_ 1619 typedef BOOLEAN 1620 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)( 1621 _In_ struct _FILE_OBJECT *FileObject, 1622 _In_ PLARGE_INTEGER FileOffset, 1623 _In_ PMDL MdlChain, 1624 _In_ struct _DEVICE_OBJECT *DeviceObject); 1625 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE; 1626 1627 _Function_class_(FAST_IO_READ_COMPRESSED) 1628 _IRQL_requires_same_ 1629 typedef BOOLEAN 1630 (NTAPI FAST_IO_READ_COMPRESSED)( 1631 _In_ struct _FILE_OBJECT *FileObject, 1632 _In_ PLARGE_INTEGER FileOffset, 1633 _In_ ULONG Length, 1634 _In_ ULONG LockKey, 1635 _Out_ PVOID Buffer, 1636 _Out_ PMDL *MdlChain, 1637 _Out_ PIO_STATUS_BLOCK IoStatus, 1638 _Out_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo, 1639 _In_ ULONG CompressedDataInfoLength, 1640 _In_ struct _DEVICE_OBJECT *DeviceObject); 1641 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED; 1642 1643 _Function_class_(FAST_IO_WRITE_COMPRESSED) 1644 _IRQL_requires_same_ 1645 typedef BOOLEAN 1646 (NTAPI FAST_IO_WRITE_COMPRESSED)( 1647 _In_ struct _FILE_OBJECT *FileObject, 1648 _In_ PLARGE_INTEGER FileOffset, 1649 _In_ ULONG Length, 1650 _In_ ULONG LockKey, 1651 _In_ PVOID Buffer, 1652 _Out_ PMDL *MdlChain, 1653 _Out_ PIO_STATUS_BLOCK IoStatus, 1654 _In_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo, 1655 _In_ ULONG CompressedDataInfoLength, 1656 _In_ struct _DEVICE_OBJECT *DeviceObject); 1657 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED; 1658 1659 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED) 1660 _IRQL_requires_same_ 1661 typedef BOOLEAN 1662 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)( 1663 _In_ struct _FILE_OBJECT *FileObject, 1664 _In_ PMDL MdlChain, 1665 _In_ struct _DEVICE_OBJECT *DeviceObject); 1666 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED; 1667 1668 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED) 1669 _IRQL_requires_same_ 1670 typedef BOOLEAN 1671 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)( 1672 _In_ struct _FILE_OBJECT *FileObject, 1673 _In_ PLARGE_INTEGER FileOffset, 1674 _In_ PMDL MdlChain, 1675 _In_ struct _DEVICE_OBJECT *DeviceObject); 1676 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED; 1677 1678 _Function_class_(FAST_IO_QUERY_OPEN) 1679 _IRQL_requires_same_ 1680 typedef BOOLEAN 1681 (NTAPI FAST_IO_QUERY_OPEN)( 1682 _Inout_ struct _IRP *Irp, 1683 _Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, 1684 _In_ struct _DEVICE_OBJECT *DeviceObject); 1685 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN; 1686 1687 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE) 1688 _IRQL_requires_same_ 1689 typedef NTSTATUS 1690 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)( 1691 _In_ struct _FILE_OBJECT *FileObject, 1692 _In_ struct _ERESOURCE *ResourceToRelease, 1693 _In_ struct _DEVICE_OBJECT *DeviceObject); 1694 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE; 1695 1696 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH) 1697 _IRQL_requires_same_ 1698 typedef NTSTATUS 1699 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)( 1700 _In_ struct _FILE_OBJECT *FileObject, 1701 _In_ struct _DEVICE_OBJECT *DeviceObject); 1702 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH; 1703 1704 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH) 1705 _IRQL_requires_same_ 1706 typedef NTSTATUS 1707 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)( 1708 _In_ struct _FILE_OBJECT *FileObject, 1709 _In_ struct _DEVICE_OBJECT *DeviceObject); 1710 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH; 1711 1712 typedef struct _FAST_IO_DISPATCH { 1713 ULONG SizeOfFastIoDispatch; 1714 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible; 1715 PFAST_IO_READ FastIoRead; 1716 PFAST_IO_WRITE FastIoWrite; 1717 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo; 1718 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo; 1719 PFAST_IO_LOCK FastIoLock; 1720 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle; 1721 PFAST_IO_UNLOCK_ALL FastIoUnlockAll; 1722 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey; 1723 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl; 1724 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection; 1725 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection; 1726 PFAST_IO_DETACH_DEVICE FastIoDetachDevice; 1727 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo; 1728 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite; 1729 PFAST_IO_MDL_READ MdlRead; 1730 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete; 1731 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite; 1732 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete; 1733 PFAST_IO_READ_COMPRESSED FastIoReadCompressed; 1734 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed; 1735 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed; 1736 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed; 1737 PFAST_IO_QUERY_OPEN FastIoQueryOpen; 1738 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite; 1739 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush; 1740 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush; 1741 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH; 1742 1743 typedef struct _SECTION_OBJECT_POINTERS { 1744 PVOID DataSectionObject; 1745 PVOID SharedCacheMap; 1746 PVOID ImageSectionObject; 1747 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS; 1748 1749 typedef struct _IO_COMPLETION_CONTEXT { 1750 PVOID Port; 1751 PVOID Key; 1752 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT; 1753 1754 /* FILE_OBJECT.Flags */ 1755 #define FO_FILE_OPEN 0x00000001 1756 #define FO_SYNCHRONOUS_IO 0x00000002 1757 #define FO_ALERTABLE_IO 0x00000004 1758 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008 1759 #define FO_WRITE_THROUGH 0x00000010 1760 #define FO_SEQUENTIAL_ONLY 0x00000020 1761 #define FO_CACHE_SUPPORTED 0x00000040 1762 #define FO_NAMED_PIPE 0x00000080 1763 #define FO_STREAM_FILE 0x00000100 1764 #define FO_MAILSLOT 0x00000200 1765 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400 1766 #define FO_QUEUE_IRP_TO_THREAD 0x00000400 1767 #define FO_DIRECT_DEVICE_OPEN 0x00000800 1768 #define FO_FILE_MODIFIED 0x00001000 1769 #define FO_FILE_SIZE_CHANGED 0x00002000 1770 #define FO_CLEANUP_COMPLETE 0x00004000 1771 #define FO_TEMPORARY_FILE 0x00008000 1772 #define FO_DELETE_ON_CLOSE 0x00010000 1773 #define FO_OPENED_CASE_SENSITIVE 0x00020000 1774 #define FO_HANDLE_CREATED 0x00040000 1775 #define FO_FILE_FAST_IO_READ 0x00080000 1776 #define FO_RANDOM_ACCESS 0x00100000 1777 #define FO_FILE_OPEN_CANCELLED 0x00200000 1778 #define FO_VOLUME_OPEN 0x00400000 1779 #define FO_REMOTE_ORIGIN 0x01000000 1780 #define FO_DISALLOW_EXCLUSIVE 0x02000000 1781 #define FO_SKIP_COMPLETION_PORT 0x02000000 1782 #define FO_SKIP_SET_EVENT 0x04000000 1783 #define FO_SKIP_SET_FAST_IO 0x08000000 1784 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE 1785 1786 /* VPB.Flags */ 1787 #define VPB_MOUNTED 0x0001 1788 #define VPB_LOCKED 0x0002 1789 #define VPB_PERSISTENT 0x0004 1790 #define VPB_REMOVE_PENDING 0x0008 1791 #define VPB_RAW_MOUNT 0x0010 1792 #define VPB_DIRECT_WRITES_ALLOWED 0x0020 1793 1794 /* IO_STACK_LOCATION.Flags */ 1795 1796 #define SL_FORCE_ACCESS_CHECK 0x01 1797 #define SL_OPEN_PAGING_FILE 0x02 1798 #define SL_OPEN_TARGET_DIRECTORY 0x04 1799 #define SL_STOP_ON_SYMLINK 0x08 1800 #define SL_CASE_SENSITIVE 0x80 1801 1802 #define SL_KEY_SPECIFIED 0x01 1803 #define SL_OVERRIDE_VERIFY_VOLUME 0x02 1804 #define SL_WRITE_THROUGH 0x04 1805 #define SL_FT_SEQUENTIAL_WRITE 0x08 1806 #define SL_FORCE_DIRECT_WRITE 0x10 1807 #define SL_REALTIME_STREAM 0x20 1808 1809 #define SL_READ_ACCESS_GRANTED 0x01 1810 #define SL_WRITE_ACCESS_GRANTED 0x04 1811 1812 #define SL_FAIL_IMMEDIATELY 0x01 1813 #define SL_EXCLUSIVE_LOCK 0x02 1814 1815 #define SL_RESTART_SCAN 0x01 1816 #define SL_RETURN_SINGLE_ENTRY 0x02 1817 #define SL_INDEX_SPECIFIED 0x04 1818 1819 #define SL_WATCH_TREE 0x01 1820 1821 #define SL_ALLOW_RAW_MOUNT 0x01 1822 1823 $endif (_WDMDDK_) 1824 $if (_WDMDDK_ || _DEVIOCTL_) 1825 #define CTL_CODE(DeviceType, Function, Method, Access) \ 1826 (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) 1827 1828 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16) 1829 1830 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3)) 1831 1832 $endif (_WDMDDK_ || _DEVIOCTL_) 1833 $if (_WDMDDK_) 1834 1835 /* IRP.Flags */ 1836 #define IRP_NOCACHE 0x00000001 1837 #define IRP_PAGING_IO 0x00000002 1838 #define IRP_MOUNT_COMPLETION 0x00000002 1839 #define IRP_SYNCHRONOUS_API 0x00000004 1840 #define IRP_ASSOCIATED_IRP 0x00000008 1841 #define IRP_BUFFERED_IO 0x00000010 1842 #define IRP_DEALLOCATE_BUFFER 0x00000020 1843 #define IRP_INPUT_OPERATION 0x00000040 1844 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 1845 #define IRP_CREATE_OPERATION 0x00000080 1846 #define IRP_READ_OPERATION 0x00000100 1847 #define IRP_WRITE_OPERATION 0x00000200 1848 #define IRP_CLOSE_OPERATION 0x00000400 1849 #define IRP_DEFER_IO_COMPLETION 0x00000800 1850 #define IRP_OB_QUERY_NAME 0x00001000 1851 #define IRP_HOLD_DEVICE_QUEUE 0x00002000 1852 /* The following 2 are missing in latest WDK */ 1853 #define IRP_RETRY_IO_COMPLETION 0x00004000 1854 #define IRP_CLASS_CACHE_OPERATION 0x00008000 1855 1856 /* IRP.AllocationFlags */ 1857 #define IRP_QUOTA_CHARGED 0x01 1858 #define IRP_ALLOCATED_MUST_SUCCEED 0x02 1859 #define IRP_ALLOCATED_FIXED_SIZE 0x04 1860 #define IRP_LOOKASIDE_ALLOCATION 0x08 1861 1862 /* 1863 ** IRP function codes 1864 */ 1865 1866 #define IRP_MJ_CREATE 0x00 1867 #define IRP_MJ_CREATE_NAMED_PIPE 0x01 1868 #define IRP_MJ_CLOSE 0x02 1869 #define IRP_MJ_READ 0x03 1870 #define IRP_MJ_WRITE 0x04 1871 #define IRP_MJ_QUERY_INFORMATION 0x05 1872 #define IRP_MJ_SET_INFORMATION 0x06 1873 #define IRP_MJ_QUERY_EA 0x07 1874 #define IRP_MJ_SET_EA 0x08 1875 #define IRP_MJ_FLUSH_BUFFERS 0x09 1876 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a 1877 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b 1878 #define IRP_MJ_DIRECTORY_CONTROL 0x0c 1879 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d 1880 #define IRP_MJ_DEVICE_CONTROL 0x0e 1881 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f 1882 #define IRP_MJ_SCSI 0x0f 1883 #define IRP_MJ_SHUTDOWN 0x10 1884 #define IRP_MJ_LOCK_CONTROL 0x11 1885 #define IRP_MJ_CLEANUP 0x12 1886 #define IRP_MJ_CREATE_MAILSLOT 0x13 1887 #define IRP_MJ_QUERY_SECURITY 0x14 1888 #define IRP_MJ_SET_SECURITY 0x15 1889 #define IRP_MJ_POWER 0x16 1890 #define IRP_MJ_SYSTEM_CONTROL 0x17 1891 #define IRP_MJ_DEVICE_CHANGE 0x18 1892 #define IRP_MJ_QUERY_QUOTA 0x19 1893 #define IRP_MJ_SET_QUOTA 0x1a 1894 #define IRP_MJ_PNP 0x1b 1895 #define IRP_MJ_PNP_POWER 0x1b 1896 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b 1897 1898 #define IRP_MN_SCSI_CLASS 0x01 1899 1900 #define IRP_MN_START_DEVICE 0x00 1901 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01 1902 #define IRP_MN_REMOVE_DEVICE 0x02 1903 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 1904 #define IRP_MN_STOP_DEVICE 0x04 1905 #define IRP_MN_QUERY_STOP_DEVICE 0x05 1906 #define IRP_MN_CANCEL_STOP_DEVICE 0x06 1907 1908 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 1909 #define IRP_MN_QUERY_INTERFACE 0x08 1910 #define IRP_MN_QUERY_CAPABILITIES 0x09 1911 #define IRP_MN_QUERY_RESOURCES 0x0A 1912 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B 1913 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C 1914 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D 1915 1916 #define IRP_MN_READ_CONFIG 0x0F 1917 #define IRP_MN_WRITE_CONFIG 0x10 1918 #define IRP_MN_EJECT 0x11 1919 #define IRP_MN_SET_LOCK 0x12 1920 #define IRP_MN_QUERY_ID 0x13 1921 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 1922 #define IRP_MN_QUERY_BUS_INFORMATION 0x15 1923 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 1924 #define IRP_MN_SURPRISE_REMOVAL 0x17 1925 #if (NTDDI_VERSION >= NTDDI_WIN7) 1926 #define IRP_MN_DEVICE_ENUMERATED 0x19 1927 #endif 1928 1929 #define IRP_MN_WAIT_WAKE 0x00 1930 #define IRP_MN_POWER_SEQUENCE 0x01 1931 #define IRP_MN_SET_POWER 0x02 1932 #define IRP_MN_QUERY_POWER 0x03 1933 1934 #define IRP_MN_QUERY_ALL_DATA 0x00 1935 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 1936 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 1937 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03 1938 #define IRP_MN_ENABLE_EVENTS 0x04 1939 #define IRP_MN_DISABLE_EVENTS 0x05 1940 #define IRP_MN_ENABLE_COLLECTION 0x06 1941 #define IRP_MN_DISABLE_COLLECTION 0x07 1942 #define IRP_MN_REGINFO 0x08 1943 #define IRP_MN_EXECUTE_METHOD 0x09 1944 1945 #define IRP_MN_REGINFO_EX 0x0b 1946 1947 typedef struct _FILE_OBJECT { 1948 CSHORT Type; 1949 CSHORT Size; 1950 PDEVICE_OBJECT DeviceObject; 1951 PVPB Vpb; 1952 PVOID FsContext; 1953 PVOID FsContext2; 1954 PSECTION_OBJECT_POINTERS SectionObjectPointer; 1955 PVOID PrivateCacheMap; 1956 NTSTATUS FinalStatus; 1957 struct _FILE_OBJECT *RelatedFileObject; 1958 BOOLEAN LockOperation; 1959 BOOLEAN DeletePending; 1960 BOOLEAN ReadAccess; 1961 BOOLEAN WriteAccess; 1962 BOOLEAN DeleteAccess; 1963 BOOLEAN SharedRead; 1964 BOOLEAN SharedWrite; 1965 BOOLEAN SharedDelete; 1966 ULONG Flags; 1967 UNICODE_STRING FileName; 1968 LARGE_INTEGER CurrentByteOffset; 1969 volatile ULONG Waiters; 1970 volatile ULONG Busy; 1971 PVOID LastLock; 1972 KEVENT Lock; 1973 KEVENT Event; 1974 volatile PIO_COMPLETION_CONTEXT CompletionContext; 1975 KSPIN_LOCK IrpListLock; 1976 LIST_ENTRY IrpList; 1977 volatile PVOID FileObjectExtension; 1978 } FILE_OBJECT, *PFILE_OBJECT; 1979 1980 typedef struct _IO_ERROR_LOG_PACKET { 1981 UCHAR MajorFunctionCode; 1982 UCHAR RetryCount; 1983 USHORT DumpDataSize; 1984 USHORT NumberOfStrings; 1985 USHORT StringOffset; 1986 USHORT EventCategory; 1987 NTSTATUS ErrorCode; 1988 ULONG UniqueErrorValue; 1989 NTSTATUS FinalStatus; 1990 ULONG SequenceNumber; 1991 ULONG IoControlCode; 1992 LARGE_INTEGER DeviceOffset; 1993 ULONG DumpData[1]; 1994 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET; 1995 1996 typedef struct _IO_ERROR_LOG_MESSAGE { 1997 USHORT Type; 1998 USHORT Size; 1999 USHORT DriverNameLength; 2000 LARGE_INTEGER TimeStamp; 2001 ULONG DriverNameOffset; 2002 IO_ERROR_LOG_PACKET EntryData; 2003 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE; 2004 2005 /* See ndk/lpctypes.h */ 2006 #ifdef _WIN64 2007 #define PORT_MAXIMUM_MESSAGE_LENGTH 512 2008 #else 2009 #define PORT_MAXIMUM_MESSAGE_LENGTH 256 2010 #endif 2011 2012 #define ERROR_LOG_LIMIT_SIZE 240 2013 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \ 2014 sizeof(IO_ERROR_LOG_PACKET) + \ 2015 (sizeof(WCHAR) * 40)) 2016 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \ 2017 (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH) 2018 #define IO_ERROR_LOG_MESSAGE_LENGTH \ 2019 ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \ 2020 ERROR_LOG_MESSAGE_LIMIT_SIZE : \ 2021 PORT_MAXIMUM_MESSAGE_LENGTH) 2022 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \ 2023 IO_ERROR_LOG_MESSAGE_HEADER_LENGTH) 2024 2025 typedef enum _DMA_WIDTH { 2026 Width8Bits, 2027 Width16Bits, 2028 Width32Bits, 2029 MaximumDmaWidth 2030 } DMA_WIDTH, *PDMA_WIDTH; 2031 2032 typedef enum _DMA_SPEED { 2033 Compatible, 2034 TypeA, 2035 TypeB, 2036 TypeC, 2037 TypeF, 2038 MaximumDmaSpeed 2039 } DMA_SPEED, *PDMA_SPEED; 2040 2041 /* DEVICE_DESCRIPTION.Version */ 2042 2043 #define DEVICE_DESCRIPTION_VERSION 0x0000 2044 #define DEVICE_DESCRIPTION_VERSION1 0x0001 2045 #define DEVICE_DESCRIPTION_VERSION2 0x0002 2046 #define DEVICE_DESCRIPTION_VERSION3 0x0003 2047 2048 typedef struct _DEVICE_DESCRIPTION { 2049 ULONG Version; 2050 BOOLEAN Master; 2051 BOOLEAN ScatterGather; 2052 BOOLEAN DemandMode; 2053 BOOLEAN AutoInitialize; 2054 BOOLEAN Dma32BitAddresses; 2055 BOOLEAN IgnoreCount; 2056 BOOLEAN Reserved1; 2057 BOOLEAN Dma64BitAddresses; 2058 ULONG BusNumber; 2059 ULONG DmaChannel; 2060 INTERFACE_TYPE InterfaceType; 2061 DMA_WIDTH DmaWidth; 2062 DMA_SPEED DmaSpeed; 2063 ULONG MaximumLength; 2064 ULONG DmaPort; 2065 #if (NTDDI_VERSION >= NTDDI_WIN8) 2066 ULONG DmaAddressWidth; 2067 ULONG DmaControllerInstance; 2068 ULONG DmaRequestLine; 2069 PHYSICAL_ADDRESS DeviceAddress; 2070 #endif // NTDDI_WIN8 2071 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION; 2072 2073 #define DMA_ADAPTER_INFO_VERSION1 1 2074 2075 #define ADAPTER_INFO_SYNCHRONOUS_CALLBACK 0x0001 2076 #define ADAPTER_INFO_API_BYPASS 0x0002 2077 2078 typedef struct _DMA_ADAPTER_INFO_V1 2079 { 2080 ULONG ReadDmaCounterAvailable; 2081 ULONG ScatterGatherLimit; 2082 ULONG DmaAddressWidth; 2083 ULONG Flags; 2084 ULONG MinimumTransferUnit; 2085 } DMA_ADAPTER_INFO_V1, *PDMA_ADAPTER_INFO_V1; 2086 2087 typedef struct _DMA_ADAPTER_INFO 2088 { 2089 ULONG Version; 2090 union 2091 { 2092 DMA_ADAPTER_INFO_V1 V1; 2093 }; 2094 } DMA_ADAPTER_INFO, *PDMA_ADAPTER_INFO; 2095 2096 #define DMA_TRANSFER_INFO_VERSION1 1 2097 #define DMA_TRANSFER_INFO_VERSION2 2 2098 2099 typedef struct _DMA_TRANSFER_INFO_V1 2100 { 2101 ULONG MapRegisterCount; 2102 ULONG ScatterGatherElementCount; 2103 ULONG ScatterGatherListSize; 2104 } DMA_TRANSFER_INFO_V1, *PDMA_TRANSFER_INFO_V1; 2105 2106 typedef struct _DMA_TRANSFER_INFO_V2 2107 { 2108 ULONG MapRegisterCount; 2109 ULONG ScatterGatherElementCount; 2110 ULONG ScatterGatherListSize; 2111 ULONG LogicalPageCount; 2112 } DMA_TRANSFER_INFO_V2, *PDMA_TRANSFER_INFO_V2; 2113 2114 typedef struct _DMA_TRANSFER_INFO 2115 { 2116 ULONG Version; 2117 union { 2118 DMA_TRANSFER_INFO_V1 V1; 2119 DMA_TRANSFER_INFO_V2 V2; 2120 }; 2121 } DMA_TRANSFER_INFO, *PDMA_TRANSFER_INFO; 2122 2123 #define DMA_TRANSFER_CONTEXT_VERSION1 1 2124 2125 #ifdef _WIN64 2126 #define DMA_TRANSFER_CONTEXT_SIZE_V1 128 2127 #else 2128 #define DMA_TRANSFER_CONTEXT_SIZE_V1 64 2129 #endif 2130 2131 typedef enum _DEVICE_RELATION_TYPE { 2132 BusRelations, 2133 EjectionRelations, 2134 PowerRelations, 2135 RemovalRelations, 2136 TargetDeviceRelation, 2137 SingleBusRelations, 2138 TransportRelations 2139 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE; 2140 2141 typedef struct _DEVICE_RELATIONS { 2142 ULONG Count; 2143 PDEVICE_OBJECT Objects[1]; 2144 } DEVICE_RELATIONS, *PDEVICE_RELATIONS; 2145 2146 typedef struct _DEVOBJ_EXTENSION { 2147 CSHORT Type; 2148 USHORT Size; 2149 PDEVICE_OBJECT DeviceObject; 2150 } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION; 2151 2152 typedef struct _SCATTER_GATHER_ELEMENT { 2153 PHYSICAL_ADDRESS Address; 2154 ULONG Length; 2155 ULONG_PTR Reserved; 2156 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT; 2157 2158 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__) 2159 2160 #if defined(_MSC_VER) 2161 #if _MSC_VER >= 1200 2162 #pragma warning(push) 2163 #endif 2164 #pragma warning(disable:4200) 2165 #endif /* _MSC_VER */ 2166 2167 typedef struct _SCATTER_GATHER_LIST { 2168 ULONG NumberOfElements; 2169 ULONG_PTR Reserved; 2170 SCATTER_GATHER_ELEMENT Elements[1]; 2171 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; 2172 2173 #if defined(_MSC_VER) 2174 #if _MSC_VER >= 1200 2175 #pragma warning(pop) 2176 #else 2177 #pragma warning(default:4200) 2178 #endif 2179 #endif /* _MSC_VER */ 2180 2181 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */ 2182 2183 struct _SCATTER_GATHER_LIST; 2184 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; 2185 2186 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */ 2187 2188 _Function_class_(DRIVER_ADD_DEVICE) 2189 _IRQL_requires_(PASSIVE_LEVEL) 2190 _IRQL_requires_same_ 2191 _When_(return>=0, _Kernel_clear_do_init_(__yes)) 2192 typedef NTSTATUS 2193 (NTAPI DRIVER_ADD_DEVICE)( 2194 _In_ struct _DRIVER_OBJECT *DriverObject, 2195 _In_ struct _DEVICE_OBJECT *PhysicalDeviceObject); 2196 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE; 2197 2198 typedef struct _DRIVER_EXTENSION { 2199 struct _DRIVER_OBJECT *DriverObject; 2200 PDRIVER_ADD_DEVICE AddDevice; 2201 ULONG Count; 2202 UNICODE_STRING ServiceKeyName; 2203 } DRIVER_EXTENSION, *PDRIVER_EXTENSION; 2204 2205 #define DRVO_UNLOAD_INVOKED 0x00000001 2206 #define DRVO_LEGACY_DRIVER 0x00000002 2207 #define DRVO_BUILTIN_DRIVER 0x00000004 2208 2209 _Function_class_(DRIVER_INITIALIZE) 2210 _IRQL_requires_same_ 2211 typedef NTSTATUS 2212 (NTAPI DRIVER_INITIALIZE)( 2213 _In_ struct _DRIVER_OBJECT *DriverObject, 2214 _In_ PUNICODE_STRING RegistryPath); 2215 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE; 2216 2217 _Function_class_(DRIVER_STARTIO) 2218 _IRQL_always_function_min_(DISPATCH_LEVEL) 2219 _IRQL_requires_(DISPATCH_LEVEL) 2220 _IRQL_requires_same_ 2221 typedef VOID 2222 (NTAPI DRIVER_STARTIO)( 2223 _Inout_ struct _DEVICE_OBJECT *DeviceObject, 2224 _Inout_ struct _IRP *Irp); 2225 typedef DRIVER_STARTIO *PDRIVER_STARTIO; 2226 2227 _Function_class_(DRIVER_UNLOAD) 2228 _IRQL_requires_(PASSIVE_LEVEL) 2229 _IRQL_requires_same_ 2230 typedef VOID 2231 (NTAPI DRIVER_UNLOAD)( 2232 _In_ struct _DRIVER_OBJECT *DriverObject); 2233 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD; 2234 2235 _Function_class_(DRIVER_DISPATCH) 2236 _IRQL_requires_max_(DISPATCH_LEVEL) 2237 _IRQL_requires_same_ 2238 typedef NTSTATUS 2239 (NTAPI DRIVER_DISPATCH)( 2240 _In_ struct _DEVICE_OBJECT *DeviceObject, 2241 _Inout_ struct _IRP *Irp); 2242 typedef DRIVER_DISPATCH *PDRIVER_DISPATCH; 2243 typedef DRIVER_DISPATCH DRIVER_DISPATCH_RAISED; 2244 2245 _Function_class_(DRIVER_DISPATCH) 2246 _IRQL_requires_(PASSIVE_LEVEL) 2247 _IRQL_requires_same_ 2248 typedef NTSTATUS 2249 (NTAPI DRIVER_DISPATCH_PAGED)( 2250 _In_ struct _DEVICE_OBJECT *DeviceObject, 2251 _Inout_ struct _IRP *Irp); 2252 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED; 2253 2254 typedef struct _DRIVER_OBJECT { 2255 CSHORT Type; 2256 CSHORT Size; 2257 PDEVICE_OBJECT DeviceObject; 2258 ULONG Flags; 2259 PVOID DriverStart; 2260 ULONG DriverSize; 2261 PVOID DriverSection; 2262 PDRIVER_EXTENSION DriverExtension; 2263 UNICODE_STRING DriverName; 2264 PUNICODE_STRING HardwareDatabase; 2265 struct _FAST_IO_DISPATCH *FastIoDispatch; 2266 PDRIVER_INITIALIZE DriverInit; 2267 PDRIVER_STARTIO DriverStartIo; 2268 PDRIVER_UNLOAD DriverUnload; 2269 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1]; 2270 } DRIVER_OBJECT, *PDRIVER_OBJECT; 2271 2272 typedef struct _DMA_ADAPTER { 2273 USHORT Version; 2274 USHORT Size; 2275 struct _DMA_OPERATIONS* DmaOperations; 2276 } DMA_ADAPTER, *PDMA_ADAPTER; 2277 2278 typedef enum 2279 { 2280 DmaComplete, 2281 DmaAborted, 2282 DmaError, 2283 DmaCancelled 2284 } DMA_COMPLETION_STATUS; 2285 2286 typedef VOID 2287 (NTAPI *PPUT_DMA_ADAPTER)( 2288 PDMA_ADAPTER DmaAdapter); 2289 2290 typedef PVOID 2291 (NTAPI *PALLOCATE_COMMON_BUFFER)( 2292 _In_ PDMA_ADAPTER DmaAdapter, 2293 _In_ ULONG Length, 2294 _Out_ PPHYSICAL_ADDRESS LogicalAddress, 2295 _In_ BOOLEAN CacheEnabled); 2296 2297 typedef VOID 2298 (NTAPI *PFREE_COMMON_BUFFER)( 2299 _In_ PDMA_ADAPTER DmaAdapter, 2300 _In_ ULONG Length, 2301 _In_ PHYSICAL_ADDRESS LogicalAddress, 2302 _In_ PVOID VirtualAddress, 2303 _In_ BOOLEAN CacheEnabled); 2304 2305 typedef NTSTATUS 2306 (NTAPI *PALLOCATE_ADAPTER_CHANNEL)( 2307 _In_ PDMA_ADAPTER DmaAdapter, 2308 _In_ PDEVICE_OBJECT DeviceObject, 2309 _In_ ULONG NumberOfMapRegisters, 2310 _In_ PDRIVER_CONTROL ExecutionRoutine, 2311 _In_ PVOID Context); 2312 2313 typedef BOOLEAN 2314 (NTAPI *PFLUSH_ADAPTER_BUFFERS)( 2315 _In_ PDMA_ADAPTER DmaAdapter, 2316 _In_ PMDL Mdl, 2317 _In_ PVOID MapRegisterBase, 2318 _In_ PVOID CurrentVa, 2319 _In_ ULONG Length, 2320 _In_ BOOLEAN WriteToDevice); 2321 2322 typedef VOID 2323 (NTAPI *PFREE_ADAPTER_CHANNEL)( 2324 _In_ PDMA_ADAPTER DmaAdapter); 2325 2326 typedef VOID 2327 (NTAPI *PFREE_MAP_REGISTERS)( 2328 _In_ PDMA_ADAPTER DmaAdapter, 2329 PVOID MapRegisterBase, 2330 ULONG NumberOfMapRegisters); 2331 2332 typedef PHYSICAL_ADDRESS 2333 (NTAPI *PMAP_TRANSFER)( 2334 _In_ PDMA_ADAPTER DmaAdapter, 2335 _In_ PMDL Mdl, 2336 _In_ PVOID MapRegisterBase, 2337 _In_ PVOID CurrentVa, 2338 _Inout_ PULONG Length, 2339 _In_ BOOLEAN WriteToDevice); 2340 2341 typedef ULONG 2342 (NTAPI *PGET_DMA_ALIGNMENT)( 2343 _In_ PDMA_ADAPTER DmaAdapter); 2344 2345 typedef ULONG 2346 (NTAPI *PREAD_DMA_COUNTER)( 2347 _In_ PDMA_ADAPTER DmaAdapter); 2348 2349 _Function_class_(DRIVER_LIST_CONTROL) 2350 _IRQL_requires_same_ 2351 typedef VOID 2352 (NTAPI DRIVER_LIST_CONTROL)( 2353 _In_ struct _DEVICE_OBJECT *DeviceObject, 2354 _In_ struct _IRP *Irp, 2355 _In_ struct _SCATTER_GATHER_LIST *ScatterGather, 2356 _In_ PVOID Context); 2357 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL; 2358 2359 typedef NTSTATUS 2360 (NTAPI *PGET_SCATTER_GATHER_LIST)( 2361 _In_ PDMA_ADAPTER DmaAdapter, 2362 _In_ PDEVICE_OBJECT DeviceObject, 2363 _In_ PMDL Mdl, 2364 _In_ PVOID CurrentVa, 2365 _In_ ULONG Length, 2366 _In_ PDRIVER_LIST_CONTROL ExecutionRoutine, 2367 _In_ PVOID Context, 2368 _In_ BOOLEAN WriteToDevice); 2369 2370 typedef VOID 2371 (NTAPI *PPUT_SCATTER_GATHER_LIST)( 2372 _In_ PDMA_ADAPTER DmaAdapter, 2373 _In_ PSCATTER_GATHER_LIST ScatterGather, 2374 _In_ BOOLEAN WriteToDevice); 2375 2376 typedef NTSTATUS 2377 (NTAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)( 2378 _In_ PDMA_ADAPTER DmaAdapter, 2379 _In_ PMDL Mdl OPTIONAL, 2380 _In_ PVOID CurrentVa, 2381 _In_ ULONG Length, 2382 _Out_ PULONG ScatterGatherListSize, 2383 _Out_ OPTIONAL PULONG pNumberOfMapRegisters); 2384 2385 typedef NTSTATUS 2386 (NTAPI *PBUILD_SCATTER_GATHER_LIST)( 2387 _In_ PDMA_ADAPTER DmaAdapter, 2388 _In_ PDEVICE_OBJECT DeviceObject, 2389 _In_ PMDL Mdl, 2390 _In_ PVOID CurrentVa, 2391 _In_ ULONG Length, 2392 _In_ PDRIVER_LIST_CONTROL ExecutionRoutine, 2393 _In_ PVOID Context, 2394 _In_ BOOLEAN WriteToDevice, 2395 _In_ PVOID ScatterGatherBuffer, 2396 _In_ ULONG ScatterGatherLength); 2397 2398 typedef NTSTATUS 2399 (NTAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)( 2400 _In_ PDMA_ADAPTER DmaAdapter, 2401 _In_ PSCATTER_GATHER_LIST ScatterGather, 2402 _In_ PMDL OriginalMdl, 2403 _Out_ PMDL *TargetMdl); 2404 2405 typedef NTSTATUS 2406 (NTAPI *PGET_DMA_ADAPTER_INFO)( 2407 _In_ PDMA_ADAPTER DmaAdapter, 2408 _Inout_ PDMA_ADAPTER_INFO AdapterInfo); 2409 2410 typedef NTSTATUS 2411 (NTAPI *PGET_DMA_TRANSFER_INFO)( 2412 _In_ PDMA_ADAPTER DmaAdapter, 2413 _In_ PMDL Mdl, 2414 _In_ ULONGLONG Offset, 2415 _In_ ULONG Length, 2416 _In_ BOOLEAN WriteOnly, 2417 _Inout_ PDMA_TRANSFER_INFO TransferInfo); 2418 2419 typedef NTSTATUS 2420 (NTAPI *PINITIALIZE_DMA_TRANSFER_CONTEXT)( 2421 _In_ PDMA_ADAPTER DmaAdapter, 2422 _Out_ PVOID DmaTransferContext); 2423 2424 typedef PVOID 2425 (NTAPI *PALLOCATE_COMMON_BUFFER_EX)( 2426 _In_ PDMA_ADAPTER DmaAdapter, 2427 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress, 2428 _In_ ULONG Length, 2429 _Out_ PPHYSICAL_ADDRESS LogicalAddress, 2430 _In_ BOOLEAN CacheEnabled, 2431 _In_ NODE_REQUIREMENT PreferredNode); 2432 2433 typedef NTSTATUS 2434 (NTAPI *PALLOCATE_ADAPTER_CHANNEL_EX)( 2435 _In_ PDMA_ADAPTER DmaAdapter, 2436 _In_ PDEVICE_OBJECT DeviceObject, 2437 _In_ PVOID DmaTransferContext, 2438 _In_ ULONG NumberOfMapRegisters, 2439 _In_ ULONG Flags, 2440 _In_opt_ PDRIVER_CONTROL ExecutionRoutine, 2441 _In_opt_ PVOID ExecutionContext, 2442 _Out_opt_ PVOID *MapRegisterBase); 2443 2444 typedef NTSTATUS 2445 (NTAPI *PCONFIGURE_ADAPTER_CHANNEL)( 2446 _In_ PDMA_ADAPTER DmaAdapter, 2447 _In_ ULONG FunctionNumber, 2448 _In_ PVOID Context); 2449 2450 typedef BOOLEAN 2451 (NTAPI *PCANCEL_ADAPTER_CHANNEL)( 2452 _In_ PDMA_ADAPTER DmaAdapter, 2453 _In_ PDEVICE_OBJECT DeviceObject, 2454 _In_ PVOID DmaTransferContext); 2455 2456 typedef 2457 _Function_class_(DMA_COMPLETION_ROUTINE) 2458 _IRQL_requires_max_(DISPATCH_LEVEL) 2459 _IRQL_requires_min_(DISPATCH_LEVEL) 2460 VOID 2461 NTAPI 2462 DMA_COMPLETION_ROUTINE( 2463 _In_ PDMA_ADAPTER DmaAdapter, 2464 _In_ PDEVICE_OBJECT DeviceObject, 2465 _In_ PVOID CompletionContext, 2466 _In_ DMA_COMPLETION_STATUS Status); 2467 2468 typedef DMA_COMPLETION_ROUTINE *PDMA_COMPLETION_ROUTINE; 2469 2470 typedef NTSTATUS 2471 (NTAPI *PMAP_TRANSFER_EX)( 2472 _In_ PDMA_ADAPTER DmaAdapter, 2473 _In_ PMDL Mdl, 2474 _In_ PVOID MapRegisterBase, 2475 _In_ ULONGLONG Offset, 2476 _In_ ULONG DeviceOffset, 2477 _Inout_ PULONG Length, 2478 _In_ BOOLEAN WriteToDevice, 2479 _Out_writes_bytes_opt_(ScatterGatherBufferLength) PSCATTER_GATHER_LIST ScatterGatherBuffer, 2480 _In_ ULONG ScatterGatherBufferLength, 2481 _In_opt_ PDMA_COMPLETION_ROUTINE DmaCompletionRoutine, 2482 _In_opt_ PVOID CompletionContext); 2483 2484 typedef NTSTATUS 2485 (NTAPI *PGET_SCATTER_GATHER_LIST_EX)( 2486 _In_ PDMA_ADAPTER DmaAdapter, 2487 _In_ PDEVICE_OBJECT DeviceObject, 2488 _In_ PVOID DmaTransferContext, 2489 _In_ PMDL Mdl, 2490 _In_ ULONGLONG Offset, 2491 _In_ ULONG Length, 2492 _In_ ULONG Flags, 2493 _In_opt_ PDRIVER_LIST_CONTROL ExecutionRoutine, 2494 _In_opt_ PVOID Context, 2495 _In_ BOOLEAN WriteToDevice, 2496 _In_opt_ PDMA_COMPLETION_ROUTINE DmaCompletionRoutine, 2497 _In_opt_ PVOID CompletionContext, 2498 _Out_opt_ PSCATTER_GATHER_LIST *ScatterGatherList); 2499 2500 typedef NTSTATUS 2501 (NTAPI *PBUILD_SCATTER_GATHER_LIST_EX)( 2502 _In_ PDMA_ADAPTER DmaAdapter, 2503 _In_ PDEVICE_OBJECT DeviceObject, 2504 _In_ PVOID DmaTransferContext, 2505 _In_ PMDL Mdl, 2506 _In_ ULONGLONG Offset, 2507 _In_ ULONG Length, 2508 _In_ ULONG Flags, 2509 _In_opt_ PDRIVER_LIST_CONTROL ExecutionRoutine, 2510 _In_opt_ PVOID Context, 2511 _In_ BOOLEAN WriteToDevice, 2512 _In_ PVOID ScatterGatherBuffer, 2513 _In_ ULONG ScatterGatherLength, 2514 _In_opt_ PDMA_COMPLETION_ROUTINE DmaCompletionRoutine, 2515 _In_opt_ PVOID CompletionContext, 2516 _Out_opt_ PVOID ScatterGatherList); 2517 2518 typedef NTSTATUS 2519 (NTAPI *PFLUSH_ADAPTER_BUFFERS_EX)( 2520 _In_ PDMA_ADAPTER DmaAdapter, 2521 _In_ PMDL Mdl, 2522 _In_ PVOID MapRegisterBase, 2523 _In_ ULONGLONG Offset, 2524 _In_ ULONG Length, 2525 _In_ BOOLEAN WriteToDevice); 2526 2527 typedef VOID 2528 (NTAPI *PFREE_ADAPTER_OBJECT)( 2529 _In_ PDMA_ADAPTER DmaAdapter, 2530 _In_ IO_ALLOCATION_ACTION AllocationAction); 2531 2532 typedef NTSTATUS 2533 (NTAPI *PCANCEL_MAPPED_TRANSFER)( 2534 _In_ PDMA_ADAPTER DmaAdapter, 2535 _In_ PVOID DmaTransferContext); 2536 2537 typedef NTSTATUS 2538 (NTAPI *PALLOCATE_DOMAIN_COMMON_BUFFER)( 2539 _In_ PDMA_ADAPTER DmaAdapter, 2540 _In_ HANDLE DomainHandle, 2541 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress, 2542 _In_ ULONG Length, 2543 _In_ ULONG Flags, 2544 _In_opt_ MEMORY_CACHING_TYPE *CacheType, 2545 _In_ NODE_REQUIREMENT PreferredNode, 2546 _Out_ PPHYSICAL_ADDRESS LogicalAddress, 2547 _Out_ PVOID *VirtualAddress); 2548 2549 typedef NTSTATUS 2550 (NTAPI *PFLUSH_DMA_BUFFER)( 2551 _In_ PDMA_ADAPTER DmaAdapter, 2552 _In_ PMDL Mdl, 2553 _In_ BOOLEAN ReadOperation); 2554 2555 typedef NTSTATUS 2556 (NTAPI *PJOIN_DMA_DOMAIN)( 2557 _In_ PDMA_ADAPTER DmaAdapter, 2558 _In_ HANDLE DomainHandle); 2559 2560 typedef NTSTATUS 2561 (NTAPI *PLEAVE_DMA_DOMAIN)( 2562 _In_ PDMA_ADAPTER DmaAdapter); 2563 2564 typedef HANDLE 2565 (NTAPI *PGET_DMA_DOMAIN)( 2566 _In_ PDMA_ADAPTER DmaAdapter); 2567 2568 typedef PVOID 2569 (NTAPI *PALLOCATE_COMMON_BUFFER_WITH_BOUNDS)( 2570 _In_ PDMA_ADAPTER DmaAdapter, 2571 _In_opt_ PPHYSICAL_ADDRESS MinimumAddress, 2572 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress, 2573 _In_ ULONG Length, 2574 _In_ ULONG Flags, 2575 _In_opt_ MEMORY_CACHING_TYPE *CacheType, 2576 _In_ NODE_REQUIREMENT PreferredNode, 2577 _Out_ PPHYSICAL_ADDRESS LogicalAddress); 2578 2579 typedef struct _DMA_COMMON_BUFFER_VECTOR DMA_COMMON_BUFFER_VECTOR, *PDMA_COMMON_BUFFER_VECTOR; 2580 2581 typedef NTSTATUS 2582 (NTAPI *PALLOCATE_COMMON_BUFFER_VECTOR)( 2583 _In_ PDMA_ADAPTER DmaAdapter, 2584 _In_ PHYSICAL_ADDRESS LowAddress, 2585 _In_ PHYSICAL_ADDRESS HighAddress, 2586 _In_ MEMORY_CACHING_TYPE CacheType, 2587 _In_ ULONG IdealNode, 2588 _In_ ULONG Flags, 2589 _In_ ULONG NumberOfElements, 2590 _In_ ULONGLONG SizeOfElements, 2591 _Out_ PDMA_COMMON_BUFFER_VECTOR *VectorOut); 2592 2593 typedef VOID 2594 (NTAPI *PGET_COMMON_BUFFER_FROM_VECTOR_BY_INDEX)( 2595 _In_ PDMA_ADAPTER DmaAdapter, 2596 _In_ PDMA_COMMON_BUFFER_VECTOR Vector, 2597 _In_ ULONG Index, 2598 _Out_ PVOID *VirtualAddressOut, 2599 _Out_ PPHYSICAL_ADDRESS LogicalAddressOut); 2600 2601 typedef VOID 2602 (NTAPI *PFREE_COMMON_BUFFER_FROM_VECTOR)( 2603 _In_ PDMA_ADAPTER DmaAdapter, 2604 _In_ PDMA_COMMON_BUFFER_VECTOR Vector, 2605 _In_ ULONG Index); 2606 2607 typedef VOID 2608 (NTAPI *PFREE_COMMON_BUFFER_VECTOR)( 2609 _In_ PDMA_ADAPTER DmaAdapter, 2610 _In_ PDMA_COMMON_BUFFER_VECTOR Vector); 2611 2612 typedef struct _DMA_OPERATIONS { 2613 ULONG Size; 2614 PPUT_DMA_ADAPTER PutDmaAdapter; 2615 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer; 2616 PFREE_COMMON_BUFFER FreeCommonBuffer; 2617 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel; 2618 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers; 2619 PFREE_ADAPTER_CHANNEL FreeAdapterChannel; 2620 PFREE_MAP_REGISTERS FreeMapRegisters; 2621 PMAP_TRANSFER MapTransfer; 2622 PGET_DMA_ALIGNMENT GetDmaAlignment; 2623 PREAD_DMA_COUNTER ReadDmaCounter; 2624 PGET_SCATTER_GATHER_LIST GetScatterGatherList; 2625 PPUT_SCATTER_GATHER_LIST PutScatterGatherList; 2626 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList; 2627 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList; 2628 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList; 2629 PGET_DMA_ADAPTER_INFO GetDmaAdapterInfo; 2630 PGET_DMA_TRANSFER_INFO GetDmaTransferInfo; 2631 PINITIALIZE_DMA_TRANSFER_CONTEXT InitializeDmaTransferContext; 2632 PALLOCATE_COMMON_BUFFER_EX AllocateCommonBufferEx; 2633 PALLOCATE_ADAPTER_CHANNEL_EX AllocateAdapterChannelEx; 2634 PCONFIGURE_ADAPTER_CHANNEL ConfigureAdapterChannel; 2635 PCANCEL_ADAPTER_CHANNEL CancelAdapterChannel; 2636 PMAP_TRANSFER_EX MapTransferEx; 2637 PGET_SCATTER_GATHER_LIST_EX GetScatterGatherListEx; 2638 PBUILD_SCATTER_GATHER_LIST_EX BuildScatterGatherListEx; 2639 PFLUSH_ADAPTER_BUFFERS_EX FlushAdapterBuffersEx; 2640 PFREE_ADAPTER_OBJECT FreeAdapterObject; 2641 PCANCEL_MAPPED_TRANSFER CancelMappedTransfer; 2642 PALLOCATE_DOMAIN_COMMON_BUFFER AllocateDomainCommonBuffer; 2643 PFLUSH_DMA_BUFFER FlushDmaBuffer; 2644 PJOIN_DMA_DOMAIN JoinDmaDomain; 2645 PLEAVE_DMA_DOMAIN LeaveDmaDomain; 2646 PGET_DMA_DOMAIN GetDmaDomain; 2647 PALLOCATE_COMMON_BUFFER_WITH_BOUNDS AllocateCommonBufferWithBounds; 2648 PALLOCATE_COMMON_BUFFER_VECTOR AllocateCommonBufferVector; 2649 PGET_COMMON_BUFFER_FROM_VECTOR_BY_INDEX GetCommonBufferFromVectorByIndex; 2650 PFREE_COMMON_BUFFER_FROM_VECTOR FreeCommonBufferFromVector; 2651 PFREE_COMMON_BUFFER_VECTOR FreeCommonBufferVector; 2652 } DMA_OPERATIONS, *PDMA_OPERATIONS; 2653 2654 typedef struct _IO_RESOURCE_DESCRIPTOR { 2655 UCHAR Option; 2656 UCHAR Type; 2657 UCHAR ShareDisposition; 2658 UCHAR Spare1; 2659 USHORT Flags; 2660 USHORT Spare2; 2661 union { 2662 struct { 2663 ULONG Length; 2664 ULONG Alignment; 2665 PHYSICAL_ADDRESS MinimumAddress; 2666 PHYSICAL_ADDRESS MaximumAddress; 2667 } Port; 2668 struct { 2669 ULONG Length; 2670 ULONG Alignment; 2671 PHYSICAL_ADDRESS MinimumAddress; 2672 PHYSICAL_ADDRESS MaximumAddress; 2673 } Memory; 2674 struct { 2675 ULONG MinimumVector; 2676 ULONG MaximumVector; 2677 #if defined(NT_PROCESSOR_GROUPS) 2678 IRQ_DEVICE_POLICY AffinityPolicy; 2679 USHORT Group; 2680 #else 2681 IRQ_DEVICE_POLICY AffinityPolicy; 2682 #endif 2683 IRQ_PRIORITY PriorityPolicy; 2684 KAFFINITY TargetedProcessors; 2685 } Interrupt; 2686 struct { 2687 ULONG MinimumChannel; 2688 ULONG MaximumChannel; 2689 } Dma; 2690 struct { 2691 ULONG Length; 2692 ULONG Alignment; 2693 PHYSICAL_ADDRESS MinimumAddress; 2694 PHYSICAL_ADDRESS MaximumAddress; 2695 } Generic; 2696 struct { 2697 ULONG Data[3]; 2698 } DevicePrivate; 2699 struct { 2700 ULONG Length; 2701 ULONG MinBusNumber; 2702 ULONG MaxBusNumber; 2703 ULONG Reserved; 2704 } BusNumber; 2705 struct { 2706 ULONG Priority; 2707 ULONG Reserved1; 2708 ULONG Reserved2; 2709 } ConfigData; 2710 } u; 2711 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; 2712 2713 typedef struct _IO_RESOURCE_LIST { 2714 USHORT Version; 2715 USHORT Revision; 2716 ULONG Count; 2717 IO_RESOURCE_DESCRIPTOR Descriptors[1]; 2718 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; 2719 2720 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST { 2721 ULONG ListSize; 2722 INTERFACE_TYPE InterfaceType; 2723 ULONG BusNumber; 2724 ULONG SlotNumber; 2725 ULONG Reserved[3]; 2726 ULONG AlternativeLists; 2727 IO_RESOURCE_LIST List[1]; 2728 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; 2729 2730 _Function_class_(DRIVER_CANCEL) 2731 _Requires_lock_held_(_Global_cancel_spin_lock_) 2732 _Releases_lock_(_Global_cancel_spin_lock_) 2733 _IRQL_requires_min_(DISPATCH_LEVEL) 2734 _IRQL_requires_(DISPATCH_LEVEL) 2735 typedef VOID 2736 (NTAPI DRIVER_CANCEL)( 2737 _Inout_ struct _DEVICE_OBJECT *DeviceObject, 2738 _Inout_ _IRQL_uses_cancel_ struct _IRP *Irp); 2739 typedef DRIVER_CANCEL *PDRIVER_CANCEL; 2740 2741 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP { 2742 CSHORT Type; 2743 USHORT Size; 2744 struct _MDL *MdlAddress; 2745 ULONG Flags; 2746 union { 2747 struct _IRP *MasterIrp; 2748 volatile LONG IrpCount; 2749 PVOID SystemBuffer; 2750 } AssociatedIrp; 2751 LIST_ENTRY ThreadListEntry; 2752 IO_STATUS_BLOCK IoStatus; 2753 KPROCESSOR_MODE RequestorMode; 2754 BOOLEAN PendingReturned; 2755 CHAR StackCount; 2756 CHAR CurrentLocation; 2757 BOOLEAN Cancel; 2758 KIRQL CancelIrql; 2759 CCHAR ApcEnvironment; 2760 UCHAR AllocationFlags; 2761 PIO_STATUS_BLOCK UserIosb; 2762 PKEVENT UserEvent; 2763 union { 2764 struct { 2765 _ANONYMOUS_UNION union { 2766 PIO_APC_ROUTINE UserApcRoutine; 2767 PVOID IssuingProcess; 2768 } DUMMYUNIONNAME; 2769 PVOID UserApcContext; 2770 } AsynchronousParameters; 2771 LARGE_INTEGER AllocationSize; 2772 } Overlay; 2773 volatile PDRIVER_CANCEL CancelRoutine; 2774 PVOID UserBuffer; 2775 union { 2776 struct { 2777 _ANONYMOUS_UNION union { 2778 KDEVICE_QUEUE_ENTRY DeviceQueueEntry; 2779 _ANONYMOUS_STRUCT struct { 2780 PVOID DriverContext[4]; 2781 } DUMMYSTRUCTNAME; 2782 } DUMMYUNIONNAME; 2783 PETHREAD Thread; 2784 PCHAR AuxiliaryBuffer; 2785 _ANONYMOUS_STRUCT struct { 2786 LIST_ENTRY ListEntry; 2787 _ANONYMOUS_UNION union { 2788 struct _IO_STACK_LOCATION *CurrentStackLocation; 2789 ULONG PacketType; 2790 } DUMMYUNIONNAME; 2791 } DUMMYSTRUCTNAME; 2792 struct _FILE_OBJECT *OriginalFileObject; 2793 } Overlay; 2794 KAPC Apc; 2795 PVOID CompletionKey; 2796 } Tail; 2797 } IRP, *PIRP; 2798 2799 typedef enum _IO_PAGING_PRIORITY { 2800 IoPagingPriorityInvalid, 2801 IoPagingPriorityNormal, 2802 IoPagingPriorityHigh, 2803 IoPagingPriorityReserved1, 2804 IoPagingPriorityReserved2 2805 } IO_PAGING_PRIORITY; 2806 2807 _Function_class_(IO_COMPLETION_ROUTINE) 2808 _IRQL_requires_same_ 2809 typedef NTSTATUS 2810 (NTAPI IO_COMPLETION_ROUTINE)( 2811 _In_ struct _DEVICE_OBJECT *DeviceObject, 2812 _In_ struct _IRP *Irp, 2813 _In_opt_ PVOID Context); 2814 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE; 2815 2816 _Function_class_(IO_DPC_ROUTINE) 2817 _IRQL_always_function_min_(DISPATCH_LEVEL) 2818 _IRQL_requires_(DISPATCH_LEVEL) 2819 _IRQL_requires_same_ 2820 typedef VOID 2821 (NTAPI IO_DPC_ROUTINE)( 2822 _In_ struct _KDPC *Dpc, 2823 _In_ struct _DEVICE_OBJECT *DeviceObject, 2824 _Inout_ struct _IRP *Irp, 2825 _In_opt_ PVOID Context); 2826 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE; 2827 2828 typedef NTSTATUS 2829 (NTAPI *PMM_DLL_INITIALIZE)( 2830 _In_ PUNICODE_STRING RegistryPath); 2831 2832 typedef NTSTATUS 2833 (NTAPI *PMM_DLL_UNLOAD)( 2834 VOID); 2835 2836 _Function_class_(IO_TIMER_ROUTINE) 2837 _IRQL_requires_same_ 2838 typedef VOID 2839 (NTAPI IO_TIMER_ROUTINE)( 2840 _In_ struct _DEVICE_OBJECT *DeviceObject, 2841 _In_opt_ PVOID Context); 2842 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE; 2843 2844 typedef struct _IO_SECURITY_CONTEXT { 2845 PSECURITY_QUALITY_OF_SERVICE SecurityQos; 2846 PACCESS_STATE AccessState; 2847 ACCESS_MASK DesiredAccess; 2848 ULONG FullCreateOptions; 2849 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT; 2850 2851 struct _IO_CSQ; 2852 2853 typedef struct _IO_CSQ_IRP_CONTEXT { 2854 ULONG Type; 2855 struct _IRP *Irp; 2856 struct _IO_CSQ *Csq; 2857 } IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT; 2858 2859 typedef VOID 2860 (NTAPI IO_CSQ_INSERT_IRP)( 2861 _In_ struct _IO_CSQ *Csq, 2862 _In_ PIRP Irp); 2863 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP; 2864 2865 typedef NTSTATUS 2866 (NTAPI IO_CSQ_INSERT_IRP_EX)( 2867 _In_ struct _IO_CSQ *Csq, 2868 _In_ PIRP Irp, 2869 _In_ PVOID InsertContext); 2870 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX; 2871 2872 typedef VOID 2873 (NTAPI IO_CSQ_REMOVE_IRP)( 2874 _In_ struct _IO_CSQ *Csq, 2875 _In_ PIRP Irp); 2876 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP; 2877 2878 typedef PIRP 2879 (NTAPI IO_CSQ_PEEK_NEXT_IRP)( 2880 _In_ struct _IO_CSQ *Csq, 2881 _In_ PIRP Irp, 2882 _In_ PVOID PeekContext); 2883 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP; 2884 2885 typedef VOID 2886 (NTAPI IO_CSQ_ACQUIRE_LOCK)( 2887 _In_ struct _IO_CSQ *Csq, 2888 _Out_ PKIRQL Irql); 2889 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK; 2890 2891 typedef VOID 2892 (NTAPI IO_CSQ_RELEASE_LOCK)( 2893 _In_ struct _IO_CSQ *Csq, 2894 _In_ KIRQL Irql); 2895 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK; 2896 2897 typedef VOID 2898 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)( 2899 _In_ struct _IO_CSQ *Csq, 2900 _In_ PIRP Irp); 2901 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP; 2902 2903 typedef struct _IO_CSQ { 2904 ULONG Type; 2905 PIO_CSQ_INSERT_IRP CsqInsertIrp; 2906 PIO_CSQ_REMOVE_IRP CsqRemoveIrp; 2907 PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp; 2908 PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock; 2909 PIO_CSQ_RELEASE_LOCK CsqReleaseLock; 2910 PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp; 2911 PVOID ReservePointer; 2912 } IO_CSQ, *PIO_CSQ; 2913 2914 typedef enum _BUS_QUERY_ID_TYPE { 2915 BusQueryDeviceID, 2916 BusQueryHardwareIDs, 2917 BusQueryCompatibleIDs, 2918 BusQueryInstanceID, 2919 BusQueryDeviceSerialNumber, 2920 BusQueryContainerID 2921 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE; 2922 2923 typedef enum _DEVICE_TEXT_TYPE { 2924 DeviceTextDescription, 2925 DeviceTextLocationInformation 2926 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE; 2927 2928 typedef BOOLEAN 2929 (NTAPI *PGPE_SERVICE_ROUTINE)( 2930 PVOID, 2931 PVOID); 2932 2933 _IRQL_requires_max_(DISPATCH_LEVEL) 2934 _Must_inspect_result_ 2935 typedef NTSTATUS 2936 (NTAPI *PGPE_CONNECT_VECTOR)( 2937 PDEVICE_OBJECT, 2938 ULONG, 2939 KINTERRUPT_MODE, 2940 BOOLEAN, 2941 PGPE_SERVICE_ROUTINE, 2942 PVOID, 2943 PVOID); 2944 2945 _IRQL_requires_max_(DISPATCH_LEVEL) 2946 _Must_inspect_result_ 2947 typedef NTSTATUS 2948 (NTAPI *PGPE_DISCONNECT_VECTOR)( 2949 PVOID); 2950 2951 _IRQL_requires_max_(DISPATCH_LEVEL) 2952 _Must_inspect_result_ 2953 typedef NTSTATUS 2954 (NTAPI *PGPE_ENABLE_EVENT)( 2955 PDEVICE_OBJECT, 2956 PVOID); 2957 2958 _IRQL_requires_max_(DISPATCH_LEVEL) 2959 _Must_inspect_result_ 2960 typedef NTSTATUS 2961 (NTAPI *PGPE_DISABLE_EVENT)( 2962 PDEVICE_OBJECT, 2963 PVOID); 2964 2965 _IRQL_requires_max_(DISPATCH_LEVEL) 2966 _Must_inspect_result_ 2967 typedef NTSTATUS 2968 (NTAPI *PGPE_CLEAR_STATUS)( 2969 PDEVICE_OBJECT, 2970 PVOID); 2971 2972 typedef VOID 2973 (NTAPI *PDEVICE_NOTIFY_CALLBACK)( 2974 PVOID, 2975 ULONG); 2976 2977 _IRQL_requires_max_(DISPATCH_LEVEL) 2978 _Must_inspect_result_ 2979 typedef NTSTATUS 2980 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)( 2981 PDEVICE_OBJECT, 2982 PDEVICE_NOTIFY_CALLBACK, 2983 PVOID); 2984 2985 _IRQL_requires_max_(DISPATCH_LEVEL) 2986 typedef VOID 2987 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)( 2988 PDEVICE_OBJECT, 2989 PDEVICE_NOTIFY_CALLBACK); 2990 2991 typedef struct _ACPI_INTERFACE_STANDARD { 2992 USHORT Size; 2993 USHORT Version; 2994 PVOID Context; 2995 PINTERFACE_REFERENCE InterfaceReference; 2996 PINTERFACE_DEREFERENCE InterfaceDereference; 2997 PGPE_CONNECT_VECTOR GpeConnectVector; 2998 PGPE_DISCONNECT_VECTOR GpeDisconnectVector; 2999 PGPE_ENABLE_EVENT GpeEnableEvent; 3000 PGPE_DISABLE_EVENT GpeDisableEvent; 3001 PGPE_CLEAR_STATUS GpeClearStatus; 3002 PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications; 3003 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications; 3004 } ACPI_INTERFACE_STANDARD, *PACPI_INTERFACE_STANDARD; 3005 3006 typedef BOOLEAN 3007 (NTAPI *PGPE_SERVICE_ROUTINE2)( 3008 PVOID ObjectContext, 3009 PVOID ServiceContext); 3010 3011 _IRQL_requires_max_(DISPATCH_LEVEL) 3012 _Must_inspect_result_ 3013 typedef NTSTATUS 3014 (NTAPI *PGPE_CONNECT_VECTOR2)( 3015 PVOID Context, 3016 ULONG GpeNumber, 3017 KINTERRUPT_MODE Mode, 3018 BOOLEAN Shareable, 3019 PGPE_SERVICE_ROUTINE ServiceRoutine, 3020 PVOID ServiceContext, 3021 PVOID *ObjectContext); 3022 3023 _IRQL_requires_max_(DISPATCH_LEVEL) 3024 _Must_inspect_result_ 3025 typedef NTSTATUS 3026 (NTAPI *PGPE_DISCONNECT_VECTOR2)( 3027 PVOID Context, 3028 PVOID ObjectContext); 3029 3030 _IRQL_requires_max_(DISPATCH_LEVEL) 3031 _Must_inspect_result_ 3032 typedef NTSTATUS 3033 (NTAPI *PGPE_ENABLE_EVENT2)( 3034 PVOID Context, 3035 PVOID ObjectContext); 3036 3037 _IRQL_requires_max_(DISPATCH_LEVEL) 3038 _Must_inspect_result_ 3039 typedef NTSTATUS 3040 (NTAPI *PGPE_DISABLE_EVENT2)( 3041 PVOID Context, 3042 PVOID ObjectContext); 3043 3044 _IRQL_requires_max_(DISPATCH_LEVEL) 3045 _Must_inspect_result_ 3046 typedef NTSTATUS 3047 (NTAPI *PGPE_CLEAR_STATUS2)( 3048 PVOID Context, 3049 PVOID ObjectContext); 3050 3051 _IRQL_requires_max_(DISPATCH_LEVEL) 3052 typedef VOID 3053 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)( 3054 PVOID NotificationContext, 3055 ULONG NotifyCode); 3056 3057 _IRQL_requires_max_(DISPATCH_LEVEL) 3058 _Must_inspect_result_ 3059 typedef NTSTATUS 3060 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)( 3061 PVOID Context, 3062 PDEVICE_NOTIFY_CALLBACK2 NotificationHandler, 3063 PVOID NotificationContext); 3064 3065 _IRQL_requires_max_(DISPATCH_LEVEL) 3066 typedef VOID 3067 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)( 3068 PVOID Context); 3069 3070 typedef struct _ACPI_INTERFACE_STANDARD2 { 3071 USHORT Size; 3072 USHORT Version; 3073 PVOID Context; 3074 PINTERFACE_REFERENCE InterfaceReference; 3075 PINTERFACE_DEREFERENCE InterfaceDereference; 3076 PGPE_CONNECT_VECTOR2 GpeConnectVector; 3077 PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector; 3078 PGPE_ENABLE_EVENT2 GpeEnableEvent; 3079 PGPE_DISABLE_EVENT2 GpeDisableEvent; 3080 PGPE_CLEAR_STATUS2 GpeClearStatus; 3081 PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications; 3082 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications; 3083 } ACPI_INTERFACE_STANDARD2, *PACPI_INTERFACE_STANDARD2; 3084 3085 #if !defined(_AMD64_) && !defined(_ARM_) 3086 #include <pshpack4.h> 3087 #endif 3088 3089 typedef struct _IO_STACK_LOCATION { 3090 UCHAR MajorFunction; 3091 UCHAR MinorFunction; 3092 UCHAR Flags; 3093 UCHAR Control; 3094 union { 3095 struct { 3096 PIO_SECURITY_CONTEXT SecurityContext; 3097 ULONG Options; 3098 USHORT POINTER_ALIGNMENT FileAttributes; 3099 USHORT ShareAccess; 3100 ULONG POINTER_ALIGNMENT EaLength; 3101 } Create; 3102 struct { 3103 struct _IO_SECURITY_CONTEXT *SecurityContext; 3104 ULONG Options; 3105 USHORT POINTER_ALIGNMENT Reserved; 3106 USHORT ShareAccess; 3107 struct _NAMED_PIPE_CREATE_PARAMETERS *Parameters; 3108 } CreatePipe; 3109 struct { 3110 PIO_SECURITY_CONTEXT SecurityContext; 3111 ULONG Options; 3112 USHORT POINTER_ALIGNMENT Reserved; 3113 USHORT ShareAccess; 3114 struct _MAILSLOT_CREATE_PARAMETERS *Parameters; 3115 } CreateMailslot; 3116 struct { 3117 ULONG Length; 3118 ULONG POINTER_ALIGNMENT Key; 3119 LARGE_INTEGER ByteOffset; 3120 } Read; 3121 struct { 3122 ULONG Length; 3123 ULONG POINTER_ALIGNMENT Key; 3124 LARGE_INTEGER ByteOffset; 3125 } Write; 3126 struct { 3127 ULONG Length; 3128 PUNICODE_STRING FileName; 3129 FILE_INFORMATION_CLASS FileInformationClass; 3130 ULONG POINTER_ALIGNMENT FileIndex; 3131 } QueryDirectory; 3132 struct { 3133 ULONG Length; 3134 ULONG POINTER_ALIGNMENT CompletionFilter; 3135 } NotifyDirectory; 3136 struct { 3137 ULONG Length; 3138 ULONG POINTER_ALIGNMENT CompletionFilter; 3139 DIRECTORY_NOTIFY_INFORMATION_CLASS POINTER_ALIGNMENT DirectoryNotifyInformationClass; 3140 } NotifyDirectoryEx; 3141 struct { 3142 ULONG Length; 3143 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; 3144 } QueryFile; 3145 struct { 3146 ULONG Length; 3147 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; 3148 PFILE_OBJECT FileObject; 3149 _ANONYMOUS_UNION union { 3150 _ANONYMOUS_STRUCT struct { 3151 BOOLEAN ReplaceIfExists; 3152 BOOLEAN AdvanceOnly; 3153 } DUMMYSTRUCTNAME; 3154 ULONG ClusterCount; 3155 HANDLE DeleteHandle; 3156 } DUMMYUNIONNAME; 3157 } SetFile; 3158 struct { 3159 ULONG Length; 3160 PVOID EaList; 3161 ULONG EaListLength; 3162 ULONG POINTER_ALIGNMENT EaIndex; 3163 } QueryEa; 3164 struct { 3165 ULONG Length; 3166 } SetEa; 3167 struct { 3168 ULONG Length; 3169 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; 3170 } QueryVolume; 3171 struct { 3172 ULONG Length; 3173 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; 3174 } SetVolume; 3175 struct { 3176 ULONG OutputBufferLength; 3177 ULONG POINTER_ALIGNMENT InputBufferLength; 3178 ULONG POINTER_ALIGNMENT FsControlCode; 3179 PVOID Type3InputBuffer; 3180 } FileSystemControl; 3181 struct { 3182 PLARGE_INTEGER Length; 3183 ULONG POINTER_ALIGNMENT Key; 3184 LARGE_INTEGER ByteOffset; 3185 } LockControl; 3186 struct { 3187 ULONG OutputBufferLength; 3188 ULONG POINTER_ALIGNMENT InputBufferLength; 3189 ULONG POINTER_ALIGNMENT IoControlCode; 3190 PVOID Type3InputBuffer; 3191 } DeviceIoControl; 3192 struct { 3193 SECURITY_INFORMATION SecurityInformation; 3194 ULONG POINTER_ALIGNMENT Length; 3195 } QuerySecurity; 3196 struct { 3197 SECURITY_INFORMATION SecurityInformation; 3198 PSECURITY_DESCRIPTOR SecurityDescriptor; 3199 } SetSecurity; 3200 struct { 3201 PVPB Vpb; 3202 PDEVICE_OBJECT DeviceObject; 3203 } MountVolume; 3204 struct { 3205 PVPB Vpb; 3206 PDEVICE_OBJECT DeviceObject; 3207 } VerifyVolume; 3208 struct { 3209 struct _SCSI_REQUEST_BLOCK *Srb; 3210 } Scsi; 3211 struct { 3212 ULONG Length; 3213 PSID StartSid; 3214 struct _FILE_GET_QUOTA_INFORMATION *SidList; 3215 ULONG SidListLength; 3216 } QueryQuota; 3217 struct { 3218 ULONG Length; 3219 } SetQuota; 3220 struct { 3221 DEVICE_RELATION_TYPE Type; 3222 } QueryDeviceRelations; 3223 struct { 3224 CONST GUID *InterfaceType; 3225 USHORT Size; 3226 USHORT Version; 3227 PINTERFACE Interface; 3228 PVOID InterfaceSpecificData; 3229 } QueryInterface; 3230 struct { 3231 PDEVICE_CAPABILITIES Capabilities; 3232 } DeviceCapabilities; 3233 struct { 3234 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList; 3235 } FilterResourceRequirements; 3236 struct { 3237 ULONG WhichSpace; 3238 PVOID Buffer; 3239 ULONG Offset; 3240 ULONG POINTER_ALIGNMENT Length; 3241 } ReadWriteConfig; 3242 struct { 3243 BOOLEAN Lock; 3244 } SetLock; 3245 struct { 3246 BUS_QUERY_ID_TYPE IdType; 3247 } QueryId; 3248 struct { 3249 DEVICE_TEXT_TYPE DeviceTextType; 3250 LCID POINTER_ALIGNMENT LocaleId; 3251 } QueryDeviceText; 3252 struct { 3253 BOOLEAN InPath; 3254 BOOLEAN Reserved[3]; 3255 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type; 3256 } UsageNotification; 3257 struct { 3258 SYSTEM_POWER_STATE PowerState; 3259 } WaitWake; 3260 struct { 3261 PPOWER_SEQUENCE PowerSequence; 3262 } PowerSequence; 3263 struct { 3264 union { 3265 ULONG SystemContext; 3266 #if (NTDDI_VERSION >= NTDDI_VISTA) 3267 SYSTEM_POWER_STATE_CONTEXT SystemPowerStateContext; 3268 #endif // (NTDDI_VERSION >= NTDDI_VISTA) 3269 }; 3270 POWER_STATE_TYPE POINTER_ALIGNMENT Type; 3271 POWER_STATE POINTER_ALIGNMENT State; 3272 POWER_ACTION POINTER_ALIGNMENT ShutdownType; 3273 } Power; 3274 struct { 3275 PCM_RESOURCE_LIST AllocatedResources; 3276 PCM_RESOURCE_LIST AllocatedResourcesTranslated; 3277 } StartDevice; 3278 struct { 3279 ULONG_PTR ProviderId; 3280 PVOID DataPath; 3281 ULONG BufferSize; 3282 PVOID Buffer; 3283 } WMI; 3284 struct { 3285 PVOID Argument1; 3286 PVOID Argument2; 3287 PVOID Argument3; 3288 PVOID Argument4; 3289 } Others; 3290 } Parameters; 3291 PDEVICE_OBJECT DeviceObject; 3292 PFILE_OBJECT FileObject; 3293 PIO_COMPLETION_ROUTINE CompletionRoutine; 3294 PVOID Context; 3295 } IO_STACK_LOCATION, *PIO_STACK_LOCATION; 3296 3297 #if !defined(_AMD64_) && !defined(_ARM_) 3298 #include "poppack.h" 3299 #endif 3300 3301 3302 /* IO_STACK_LOCATION.Control */ 3303 3304 #define SL_PENDING_RETURNED 0x01 3305 #define SL_ERROR_RETURNED 0x02 3306 #define SL_INVOKE_ON_CANCEL 0x20 3307 #define SL_INVOKE_ON_SUCCESS 0x40 3308 #define SL_INVOKE_ON_ERROR 0x80 3309 3310 $endif (_WDMDDK_) 3311 $if (_WDMDDK_ || _DEVIOCTL_) 3312 #define METHOD_BUFFERED 0 3313 #define METHOD_IN_DIRECT 1 3314 #define METHOD_OUT_DIRECT 2 3315 #define METHOD_NEITHER 3 3316 3317 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT 3318 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT 3319 3320 $endif (_WDMDDK_ || _DEVIOCTL_) 3321 $if (_WDMDDK_) 3322 #define FILE_SUPERSEDED 0x00000000 3323 #define FILE_OPENED 0x00000001 3324 #define FILE_CREATED 0x00000002 3325 #define FILE_OVERWRITTEN 0x00000003 3326 #define FILE_EXISTS 0x00000004 3327 #define FILE_DOES_NOT_EXIST 0x00000005 3328 3329 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe 3330 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff 3331 3332 /* also in winnt.h */ 3333 #define FILE_LIST_DIRECTORY 0x00000001 3334 #define FILE_READ_DATA 0x00000001 3335 #define FILE_ADD_FILE 0x00000002 3336 #define FILE_WRITE_DATA 0x00000002 3337 #define FILE_ADD_SUBDIRECTORY 0x00000004 3338 #define FILE_APPEND_DATA 0x00000004 3339 #define FILE_CREATE_PIPE_INSTANCE 0x00000004 3340 #define FILE_READ_EA 0x00000008 3341 #define FILE_WRITE_EA 0x00000010 3342 #define FILE_EXECUTE 0x00000020 3343 #define FILE_TRAVERSE 0x00000020 3344 #define FILE_DELETE_CHILD 0x00000040 3345 #define FILE_READ_ATTRIBUTES 0x00000080 3346 #define FILE_WRITE_ATTRIBUTES 0x00000100 3347 3348 #define FILE_SHARE_READ 0x00000001 3349 #define FILE_SHARE_WRITE 0x00000002 3350 #define FILE_SHARE_DELETE 0x00000004 3351 #define FILE_SHARE_VALID_FLAGS 0x00000007 3352 3353 #define FILE_ATTRIBUTE_READONLY 0x00000001 3354 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 3355 #define FILE_ATTRIBUTE_SYSTEM 0x00000004 3356 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 3357 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 3358 #define FILE_ATTRIBUTE_DEVICE 0x00000040 3359 #define FILE_ATTRIBUTE_NORMAL 0x00000080 3360 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 3361 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 3362 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 3363 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 3364 #define FILE_ATTRIBUTE_OFFLINE 0x00001000 3365 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 3366 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 3367 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000 3368 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000 3369 3370 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7 3371 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7 3372 3373 #define FILE_VALID_OPTION_FLAGS 0x00ffffff 3374 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 3375 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 3376 #define FILE_VALID_SET_FLAGS 0x00000036 3377 3378 #define FILE_SUPERSEDE 0x00000000 3379 #define FILE_OPEN 0x00000001 3380 #define FILE_CREATE 0x00000002 3381 #define FILE_OPEN_IF 0x00000003 3382 #define FILE_OVERWRITE 0x00000004 3383 #define FILE_OVERWRITE_IF 0x00000005 3384 #define FILE_MAXIMUM_DISPOSITION 0x00000005 3385 3386 #define FILE_DIRECTORY_FILE 0x00000001 3387 #define FILE_WRITE_THROUGH 0x00000002 3388 #define FILE_SEQUENTIAL_ONLY 0x00000004 3389 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 3390 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 3391 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 3392 #define FILE_NON_DIRECTORY_FILE 0x00000040 3393 #define FILE_CREATE_TREE_CONNECTION 0x00000080 3394 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100 3395 #define FILE_NO_EA_KNOWLEDGE 0x00000200 3396 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400 3397 #define FILE_RANDOM_ACCESS 0x00000800 3398 #define FILE_DELETE_ON_CLOSE 0x00001000 3399 #define FILE_OPEN_BY_FILE_ID 0x00002000 3400 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 3401 #define FILE_NO_COMPRESSION 0x00008000 3402 #if (NTDDI_VERSION >= NTDDI_WIN7) 3403 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000 3404 #define FILE_DISALLOW_EXCLUSIVE 0x00020000 3405 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 3406 #define FILE_RESERVE_OPFILTER 0x00100000 3407 #define FILE_OPEN_REPARSE_POINT 0x00200000 3408 #define FILE_OPEN_NO_RECALL 0x00400000 3409 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 3410 3411 $endif (_WDMDDK_) 3412 $if (_WDMDDK_ || _DEVIOCTL_) 3413 #define FILE_ANY_ACCESS 0x00000000 3414 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS 3415 #define FILE_READ_ACCESS 0x00000001 3416 #define FILE_WRITE_ACCESS 0x00000002 3417 3418 $endif (_WDMDDK_ || _DEVIOCTL_) 3419 $if (_WDMDDK_) 3420 #define FILE_ALL_ACCESS \ 3421 (STANDARD_RIGHTS_REQUIRED | \ 3422 SYNCHRONIZE | \ 3423 0x1FF) 3424 3425 #define FILE_GENERIC_EXECUTE \ 3426 (STANDARD_RIGHTS_EXECUTE | \ 3427 FILE_READ_ATTRIBUTES | \ 3428 FILE_EXECUTE | \ 3429 SYNCHRONIZE) 3430 3431 #define FILE_GENERIC_READ \ 3432 (STANDARD_RIGHTS_READ | \ 3433 FILE_READ_DATA | \ 3434 FILE_READ_ATTRIBUTES | \ 3435 FILE_READ_EA | \ 3436 SYNCHRONIZE) 3437 3438 #define FILE_GENERIC_WRITE \ 3439 (STANDARD_RIGHTS_WRITE | \ 3440 FILE_WRITE_DATA | \ 3441 FILE_WRITE_ATTRIBUTES | \ 3442 FILE_WRITE_EA | \ 3443 FILE_APPEND_DATA | \ 3444 SYNCHRONIZE) 3445 3446 /* end winnt.h */ 3447 3448 #define WMIREG_ACTION_REGISTER 1 3449 #define WMIREG_ACTION_DEREGISTER 2 3450 #define WMIREG_ACTION_REREGISTER 3 3451 #define WMIREG_ACTION_UPDATE_GUIDS 4 3452 #define WMIREG_ACTION_BLOCK_IRPS 5 3453 3454 #define WMIREGISTER 0 3455 #define WMIUPDATE 1 3456 3457 _Function_class_(WMI_NOTIFICATION_CALLBACK) 3458 _IRQL_requires_same_ 3459 typedef VOID 3460 (NTAPI FWMI_NOTIFICATION_CALLBACK)( 3461 PVOID Wnode, 3462 PVOID Context); 3463 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK; 3464 3465 #ifndef _PCI_X_ 3466 #define _PCI_X_ 3467 3468 typedef struct _PCI_SLOT_NUMBER { 3469 union { 3470 struct { 3471 ULONG DeviceNumber:5; 3472 ULONG FunctionNumber:3; 3473 ULONG Reserved:24; 3474 } bits; 3475 ULONG AsULONG; 3476 } u; 3477 } PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER; 3478 3479 #define PCI_TYPE0_ADDRESSES 6 3480 #define PCI_TYPE1_ADDRESSES 2 3481 #define PCI_TYPE2_ADDRESSES 5 3482 3483 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as 3484 inheritance, even from a struct renders the type non-POD. So we use 3485 this hack */ 3486 #define PCI_COMMON_HEADER_LAYOUT \ 3487 USHORT VendorID; \ 3488 USHORT DeviceID; \ 3489 USHORT Command; \ 3490 USHORT Status; \ 3491 UCHAR RevisionID; \ 3492 UCHAR ProgIf; \ 3493 UCHAR SubClass; \ 3494 UCHAR BaseClass; \ 3495 UCHAR CacheLineSize; \ 3496 UCHAR LatencyTimer; \ 3497 UCHAR HeaderType; \ 3498 UCHAR BIST; \ 3499 union { \ 3500 struct _PCI_HEADER_TYPE_0 { \ 3501 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \ 3502 ULONG CIS; \ 3503 USHORT SubVendorID; \ 3504 USHORT SubSystemID; \ 3505 ULONG ROMBaseAddress; \ 3506 UCHAR CapabilitiesPtr; \ 3507 UCHAR Reserved1[3]; \ 3508 ULONG Reserved2; \ 3509 UCHAR InterruptLine; \ 3510 UCHAR InterruptPin; \ 3511 UCHAR MinimumGrant; \ 3512 UCHAR MaximumLatency; \ 3513 } type0; \ 3514 struct _PCI_HEADER_TYPE_1 { \ 3515 ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \ 3516 UCHAR PrimaryBus; \ 3517 UCHAR SecondaryBus; \ 3518 UCHAR SubordinateBus; \ 3519 UCHAR SecondaryLatency; \ 3520 UCHAR IOBase; \ 3521 UCHAR IOLimit; \ 3522 USHORT SecondaryStatus; \ 3523 USHORT MemoryBase; \ 3524 USHORT MemoryLimit; \ 3525 USHORT PrefetchBase; \ 3526 USHORT PrefetchLimit; \ 3527 ULONG PrefetchBaseUpper32; \ 3528 ULONG PrefetchLimitUpper32; \ 3529 USHORT IOBaseUpper16; \ 3530 USHORT IOLimitUpper16; \ 3531 UCHAR CapabilitiesPtr; \ 3532 UCHAR Reserved1[3]; \ 3533 ULONG ROMBaseAddress; \ 3534 UCHAR InterruptLine; \ 3535 UCHAR InterruptPin; \ 3536 USHORT BridgeControl; \ 3537 } type1; \ 3538 struct _PCI_HEADER_TYPE_2 { \ 3539 ULONG SocketRegistersBaseAddress; \ 3540 UCHAR CapabilitiesPtr; \ 3541 UCHAR Reserved; \ 3542 USHORT SecondaryStatus; \ 3543 UCHAR PrimaryBus; \ 3544 UCHAR SecondaryBus; \ 3545 UCHAR SubordinateBus; \ 3546 UCHAR SecondaryLatency; \ 3547 struct { \ 3548 ULONG Base; \ 3549 ULONG Limit; \ 3550 } Range[PCI_TYPE2_ADDRESSES-1]; \ 3551 UCHAR InterruptLine; \ 3552 UCHAR InterruptPin; \ 3553 USHORT BridgeControl; \ 3554 } type2; \ 3555 } u; 3556 3557 typedef struct _PCI_COMMON_HEADER { 3558 PCI_COMMON_HEADER_LAYOUT 3559 } PCI_COMMON_HEADER, *PPCI_COMMON_HEADER; 3560 3561 #ifdef __cplusplus 3562 typedef struct _PCI_COMMON_CONFIG { 3563 PCI_COMMON_HEADER_LAYOUT 3564 UCHAR DeviceSpecific[192]; 3565 } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; 3566 #else 3567 typedef struct _PCI_COMMON_CONFIG { 3568 PCI_COMMON_HEADER DUMMYSTRUCTNAME; 3569 UCHAR DeviceSpecific[192]; 3570 } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; 3571 #endif 3572 3573 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific)) 3574 3575 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000 3576 3577 #define PCI_MAX_DEVICES 32 3578 #define PCI_MAX_FUNCTION 8 3579 #define PCI_MAX_BRIDGE_NUMBER 0xFF 3580 #define PCI_INVALID_VENDORID 0xFFFF 3581 3582 /* PCI_COMMON_CONFIG.HeaderType */ 3583 #define PCI_MULTIFUNCTION 0x80 3584 #define PCI_DEVICE_TYPE 0x00 3585 #define PCI_BRIDGE_TYPE 0x01 3586 #define PCI_CARDBUS_BRIDGE_TYPE 0x02 3587 3588 #define PCI_CONFIGURATION_TYPE(PciData) \ 3589 (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION) 3590 3591 #define PCI_MULTIFUNCTION_DEVICE(PciData) \ 3592 ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0) 3593 3594 /* PCI_COMMON_CONFIG.Command */ 3595 #define PCI_ENABLE_IO_SPACE 0x0001 3596 #define PCI_ENABLE_MEMORY_SPACE 0x0002 3597 #define PCI_ENABLE_BUS_MASTER 0x0004 3598 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008 3599 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010 3600 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020 3601 #define PCI_ENABLE_PARITY 0x0040 3602 #define PCI_ENABLE_WAIT_CYCLE 0x0080 3603 #define PCI_ENABLE_SERR 0x0100 3604 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200 3605 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400 3606 3607 /* PCI_COMMON_CONFIG.Status */ 3608 #define PCI_STATUS_INTERRUPT_PENDING 0x0008 3609 #define PCI_STATUS_CAPABILITIES_LIST 0x0010 3610 #define PCI_STATUS_66MHZ_CAPABLE 0x0020 3611 #define PCI_STATUS_UDF_SUPPORTED 0x0040 3612 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080 3613 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100 3614 #define PCI_STATUS_DEVSEL 0x0600 3615 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800 3616 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000 3617 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000 3618 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000 3619 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000 3620 3621 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */ 3622 3623 #define PCI_WHICHSPACE_CONFIG 0x0 3624 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */ 3625 3626 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01 3627 #define PCI_CAPABILITY_ID_AGP 0x02 3628 #define PCI_CAPABILITY_ID_VPD 0x03 3629 #define PCI_CAPABILITY_ID_SLOT_ID 0x04 3630 #define PCI_CAPABILITY_ID_MSI 0x05 3631 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06 3632 #define PCI_CAPABILITY_ID_PCIX 0x07 3633 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08 3634 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09 3635 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A 3636 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B 3637 #define PCI_CAPABILITY_ID_SHPC 0x0C 3638 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D 3639 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E 3640 #define PCI_CAPABILITY_ID_SECURE 0x0F 3641 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 3642 #define PCI_CAPABILITY_ID_MSIX 0x11 3643 3644 typedef struct _PCI_CAPABILITIES_HEADER { 3645 UCHAR CapabilityID; 3646 UCHAR Next; 3647 } PCI_CAPABILITIES_HEADER, *PPCI_CAPABILITIES_HEADER; 3648 3649 typedef struct _PCI_PMC { 3650 UCHAR Version:3; 3651 UCHAR PMEClock:1; 3652 UCHAR Rsvd1:1; 3653 UCHAR DeviceSpecificInitialization:1; 3654 UCHAR Rsvd2:2; 3655 struct _PM_SUPPORT { 3656 UCHAR Rsvd2:1; 3657 UCHAR D1:1; 3658 UCHAR D2:1; 3659 UCHAR PMED0:1; 3660 UCHAR PMED1:1; 3661 UCHAR PMED2:1; 3662 UCHAR PMED3Hot:1; 3663 UCHAR PMED3Cold:1; 3664 } Support; 3665 } PCI_PMC, *PPCI_PMC; 3666 3667 typedef struct _PCI_PMCSR { 3668 USHORT PowerState:2; 3669 USHORT Rsvd1:6; 3670 USHORT PMEEnable:1; 3671 USHORT DataSelect:4; 3672 USHORT DataScale:2; 3673 USHORT PMEStatus:1; 3674 } PCI_PMCSR, *PPCI_PMCSR; 3675 3676 typedef struct _PCI_PMCSR_BSE { 3677 UCHAR Rsvd1:6; 3678 UCHAR D3HotSupportsStopClock:1; 3679 UCHAR BusPowerClockControlEnabled:1; 3680 } PCI_PMCSR_BSE, *PPCI_PMCSR_BSE; 3681 3682 typedef struct _PCI_PM_CAPABILITY { 3683 PCI_CAPABILITIES_HEADER Header; 3684 union { 3685 PCI_PMC Capabilities; 3686 USHORT AsUSHORT; 3687 } PMC; 3688 union { 3689 PCI_PMCSR ControlStatus; 3690 USHORT AsUSHORT; 3691 } PMCSR; 3692 union { 3693 PCI_PMCSR_BSE BridgeSupport; 3694 UCHAR AsUCHAR; 3695 } PMCSR_BSE; 3696 UCHAR Data; 3697 } PCI_PM_CAPABILITY, *PPCI_PM_CAPABILITY; 3698 3699 typedef struct { 3700 PCI_CAPABILITIES_HEADER Header; 3701 union { 3702 struct { 3703 USHORT DataParityErrorRecoveryEnable:1; 3704 USHORT EnableRelaxedOrdering:1; 3705 USHORT MaxMemoryReadByteCount:2; 3706 USHORT MaxOutstandingSplitTransactions:3; 3707 USHORT Reserved:9; 3708 } bits; 3709 USHORT AsUSHORT; 3710 } Command; 3711 union { 3712 struct { 3713 ULONG FunctionNumber:3; 3714 ULONG DeviceNumber:5; 3715 ULONG BusNumber:8; 3716 ULONG Device64Bit:1; 3717 ULONG Capable133MHz:1; 3718 ULONG SplitCompletionDiscarded:1; 3719 ULONG UnexpectedSplitCompletion:1; 3720 ULONG DeviceComplexity:1; 3721 ULONG DesignedMaxMemoryReadByteCount:2; 3722 ULONG DesignedMaxOutstandingSplitTransactions:3; 3723 ULONG DesignedMaxCumulativeReadSize:3; 3724 ULONG ReceivedSplitCompletionErrorMessage:1; 3725 ULONG CapablePCIX266:1; 3726 ULONG CapablePCIX533:1; 3727 } bits; 3728 ULONG AsULONG; 3729 } Status; 3730 } PCI_X_CAPABILITY, *PPCI_X_CAPABILITY; 3731 3732 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001 3733 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002 3734 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003 3735 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004 3736 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005 3737 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006 3738 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007 3739 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008 3740 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009 3741 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A 3742 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010 3743 3744 typedef struct _PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER { 3745 USHORT CapabilityID; 3746 USHORT Version:4; 3747 USHORT Next:12; 3748 } PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER, *PPCI_EXPRESS_ENHANCED_CAPABILITY_HEADER; 3749 3750 typedef struct _PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY { 3751 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; 3752 ULONG LowSerialNumber; 3753 ULONG HighSerialNumber; 3754 } PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY, *PPCI_EXPRESS_SERIAL_NUMBER_CAPABILITY; 3755 3756 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS { 3757 _ANONYMOUS_STRUCT struct { 3758 ULONG Undefined:1; 3759 ULONG Reserved1:3; 3760 ULONG DataLinkProtocolError:1; 3761 ULONG SurpriseDownError:1; 3762 ULONG Reserved2:6; 3763 ULONG PoisonedTLP:1; 3764 ULONG FlowControlProtocolError:1; 3765 ULONG CompletionTimeout:1; 3766 ULONG CompleterAbort:1; 3767 ULONG UnexpectedCompletion:1; 3768 ULONG ReceiverOverflow:1; 3769 ULONG MalformedTLP:1; 3770 ULONG ECRCError:1; 3771 ULONG UnsupportedRequestError:1; 3772 ULONG Reserved3:11; 3773 } DUMMYSTRUCTNAME; 3774 ULONG AsULONG; 3775 } PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS; 3776 3777 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK { 3778 _ANONYMOUS_STRUCT struct { 3779 ULONG Undefined:1; 3780 ULONG Reserved1:3; 3781 ULONG DataLinkProtocolError:1; 3782 ULONG SurpriseDownError:1; 3783 ULONG Reserved2:6; 3784 ULONG PoisonedTLP:1; 3785 ULONG FlowControlProtocolError:1; 3786 ULONG CompletionTimeout:1; 3787 ULONG CompleterAbort:1; 3788 ULONG UnexpectedCompletion:1; 3789 ULONG ReceiverOverflow:1; 3790 ULONG MalformedTLP:1; 3791 ULONG ECRCError:1; 3792 ULONG UnsupportedRequestError:1; 3793 ULONG Reserved3:11; 3794 } DUMMYSTRUCTNAME; 3795 ULONG AsULONG; 3796 } PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_MASK; 3797 3798 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY { 3799 _ANONYMOUS_STRUCT struct { 3800 ULONG Undefined:1; 3801 ULONG Reserved1:3; 3802 ULONG DataLinkProtocolError:1; 3803 ULONG SurpriseDownError:1; 3804 ULONG Reserved2:6; 3805 ULONG PoisonedTLP:1; 3806 ULONG FlowControlProtocolError:1; 3807 ULONG CompletionTimeout:1; 3808 ULONG CompleterAbort:1; 3809 ULONG UnexpectedCompletion:1; 3810 ULONG ReceiverOverflow:1; 3811 ULONG MalformedTLP:1; 3812 ULONG ECRCError:1; 3813 ULONG UnsupportedRequestError:1; 3814 ULONG Reserved3:11; 3815 } DUMMYSTRUCTNAME; 3816 ULONG AsULONG; 3817 } PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY; 3818 3819 typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_STATUS { 3820 _ANONYMOUS_STRUCT struct { 3821 ULONG ReceiverError:1; 3822 ULONG Reserved1:5; 3823 ULONG BadTLP:1; 3824 ULONG BadDLLP:1; 3825 ULONG ReplayNumRollover:1; 3826 ULONG Reserved2:3; 3827 ULONG ReplayTimerTimeout:1; 3828 ULONG AdvisoryNonFatalError:1; 3829 ULONG Reserved3:18; 3830 } DUMMYSTRUCTNAME; 3831 ULONG AsULONG; 3832 } PCI_EXPRESS_CORRECTABLE_ERROR_STATUS, *PPCI_CORRECTABLE_ERROR_STATUS; 3833 3834 typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_MASK { 3835 _ANONYMOUS_STRUCT struct { 3836 ULONG ReceiverError:1; 3837 ULONG Reserved1:5; 3838 ULONG BadTLP:1; 3839 ULONG BadDLLP:1; 3840 ULONG ReplayNumRollover:1; 3841 ULONG Reserved2:3; 3842 ULONG ReplayTimerTimeout:1; 3843 ULONG AdvisoryNonFatalError:1; 3844 ULONG Reserved3:18; 3845 } DUMMYSTRUCTNAME; 3846 ULONG AsULONG; 3847 } PCI_EXPRESS_CORRECTABLE_ERROR_MASK, *PPCI_CORRECTABLE_ERROR_MASK; 3848 3849 typedef union _PCI_EXPRESS_AER_CAPABILITIES { 3850 _ANONYMOUS_STRUCT struct { 3851 ULONG FirstErrorPointer:5; 3852 ULONG ECRCGenerationCapable:1; 3853 ULONG ECRCGenerationEnable:1; 3854 ULONG ECRCCheckCapable:1; 3855 ULONG ECRCCheckEnable:1; 3856 ULONG Reserved:23; 3857 } DUMMYSTRUCTNAME; 3858 ULONG AsULONG; 3859 } PCI_EXPRESS_AER_CAPABILITIES, *PPCI_EXPRESS_AER_CAPABILITIES; 3860 3861 typedef union _PCI_EXPRESS_ROOT_ERROR_COMMAND { 3862 _ANONYMOUS_STRUCT struct { 3863 ULONG CorrectableErrorReportingEnable:1; 3864 ULONG NonFatalErrorReportingEnable:1; 3865 ULONG FatalErrorReportingEnable:1; 3866 ULONG Reserved:29; 3867 } DUMMYSTRUCTNAME; 3868 ULONG AsULONG; 3869 } PCI_EXPRESS_ROOT_ERROR_COMMAND, *PPCI_EXPRESS_ROOT_ERROR_COMMAND; 3870 3871 typedef union _PCI_EXPRESS_ROOT_ERROR_STATUS { 3872 _ANONYMOUS_STRUCT struct { 3873 ULONG CorrectableErrorReceived:1; 3874 ULONG MultipleCorrectableErrorsReceived:1; 3875 ULONG UncorrectableErrorReceived:1; 3876 ULONG MultipleUncorrectableErrorsReceived:1; 3877 ULONG FirstUncorrectableFatal:1; 3878 ULONG NonFatalErrorMessagesReceived:1; 3879 ULONG FatalErrorMessagesReceived:1; 3880 ULONG Reserved:20; 3881 ULONG AdvancedErrorInterruptMessageNumber:5; 3882 } DUMMYSTRUCTNAME; 3883 ULONG AsULONG; 3884 } PCI_EXPRESS_ROOT_ERROR_STATUS, *PPCI_EXPRESS_ROOT_ERROR_STATUS; 3885 3886 typedef union _PCI_EXPRESS_ERROR_SOURCE_ID { 3887 _ANONYMOUS_STRUCT struct { 3888 USHORT CorrectableSourceIdFun:3; 3889 USHORT CorrectableSourceIdDev:5; 3890 USHORT CorrectableSourceIdBus:8; 3891 USHORT UncorrectableSourceIdFun:3; 3892 USHORT UncorrectableSourceIdDev:5; 3893 USHORT UncorrectableSourceIdBus:8; 3894 } DUMMYSTRUCTNAME; 3895 ULONG AsULONG; 3896 } PCI_EXPRESS_ERROR_SOURCE_ID, *PPCI_EXPRESS_ERROR_SOURCE_ID; 3897 3898 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS { 3899 _ANONYMOUS_STRUCT struct { 3900 ULONG TargetAbortOnSplitCompletion:1; 3901 ULONG MasterAbortOnSplitCompletion:1; 3902 ULONG ReceivedTargetAbort:1; 3903 ULONG ReceivedMasterAbort:1; 3904 ULONG RsvdZ:1; 3905 ULONG UnexpectedSplitCompletionError:1; 3906 ULONG UncorrectableSplitCompletion:1; 3907 ULONG UncorrectableDataError:1; 3908 ULONG UncorrectableAttributeError:1; 3909 ULONG UncorrectableAddressError:1; 3910 ULONG DelayedTransactionDiscardTimerExpired:1; 3911 ULONG PERRAsserted:1; 3912 ULONG SERRAsserted:1; 3913 ULONG InternalBridgeError:1; 3914 ULONG Reserved:18; 3915 } DUMMYSTRUCTNAME; 3916 ULONG AsULONG; 3917 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS; 3918 3919 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK { 3920 _ANONYMOUS_STRUCT struct { 3921 ULONG TargetAbortOnSplitCompletion:1; 3922 ULONG MasterAbortOnSplitCompletion:1; 3923 ULONG ReceivedTargetAbort:1; 3924 ULONG ReceivedMasterAbort:1; 3925 ULONG RsvdZ:1; 3926 ULONG UnexpectedSplitCompletionError:1; 3927 ULONG UncorrectableSplitCompletion:1; 3928 ULONG UncorrectableDataError:1; 3929 ULONG UncorrectableAttributeError:1; 3930 ULONG UncorrectableAddressError:1; 3931 ULONG DelayedTransactionDiscardTimerExpired:1; 3932 ULONG PERRAsserted:1; 3933 ULONG SERRAsserted:1; 3934 ULONG InternalBridgeError:1; 3935 ULONG Reserved:18; 3936 } DUMMYSTRUCTNAME; 3937 ULONG AsULONG; 3938 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK; 3939 3940 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY { 3941 _ANONYMOUS_STRUCT struct { 3942 ULONG TargetAbortOnSplitCompletion:1; 3943 ULONG MasterAbortOnSplitCompletion:1; 3944 ULONG ReceivedTargetAbort:1; 3945 ULONG ReceivedMasterAbort:1; 3946 ULONG RsvdZ:1; 3947 ULONG UnexpectedSplitCompletionError:1; 3948 ULONG UncorrectableSplitCompletion:1; 3949 ULONG UncorrectableDataError:1; 3950 ULONG UncorrectableAttributeError:1; 3951 ULONG UncorrectableAddressError:1; 3952 ULONG DelayedTransactionDiscardTimerExpired:1; 3953 ULONG PERRAsserted:1; 3954 ULONG SERRAsserted:1; 3955 ULONG InternalBridgeError:1; 3956 ULONG Reserved:18; 3957 } DUMMYSTRUCTNAME; 3958 ULONG AsULONG; 3959 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY; 3960 3961 typedef union _PCI_EXPRESS_SEC_AER_CAPABILITIES { 3962 _ANONYMOUS_STRUCT struct { 3963 ULONG SecondaryUncorrectableFirstErrorPtr:5; 3964 ULONG Reserved:27; 3965 } DUMMYSTRUCTNAME; 3966 ULONG AsULONG; 3967 } PCI_EXPRESS_SEC_AER_CAPABILITIES, *PPCI_EXPRESS_SEC_AER_CAPABILITIES; 3968 3969 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001 3970 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002 3971 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004 3972 3973 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \ 3974 (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \ 3975 ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \ 3976 ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING) 3977 3978 typedef struct _PCI_EXPRESS_AER_CAPABILITY { 3979 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; 3980 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; 3981 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; 3982 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; 3983 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; 3984 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; 3985 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; 3986 ULONG HeaderLog[4]; 3987 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; 3988 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; 3989 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; 3990 PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; 3991 ULONG SecHeaderLog[4]; 3992 } PCI_EXPRESS_AER_CAPABILITY, *PPCI_EXPRESS_AER_CAPABILITY; 3993 3994 typedef struct _PCI_EXPRESS_ROOTPORT_AER_CAPABILITY { 3995 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; 3996 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; 3997 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; 3998 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; 3999 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; 4000 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; 4001 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; 4002 ULONG HeaderLog[4]; 4003 PCI_EXPRESS_ROOT_ERROR_COMMAND RootErrorCommand; 4004 PCI_EXPRESS_ROOT_ERROR_STATUS RootErrorStatus; 4005 PCI_EXPRESS_ERROR_SOURCE_ID ErrorSourceId; 4006 } PCI_EXPRESS_ROOTPORT_AER_CAPABILITY, *PPCI_EXPRESS_ROOTPORT_AER_CAPABILITY; 4007 4008 typedef struct _PCI_EXPRESS_BRIDGE_AER_CAPABILITY { 4009 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; 4010 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; 4011 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; 4012 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; 4013 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; 4014 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; 4015 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; 4016 ULONG HeaderLog[4]; 4017 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; 4018 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; 4019 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; 4020 PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; 4021 ULONG SecHeaderLog[4]; 4022 } PCI_EXPRESS_BRIDGE_AER_CAPABILITY, *PPCI_EXPRESS_BRIDGE_AER_CAPABILITY; 4023 4024 typedef union _PCI_EXPRESS_SRIOV_CAPS { 4025 _ANONYMOUS_STRUCT struct { 4026 ULONG VFMigrationCapable:1; 4027 ULONG Reserved1:20; 4028 ULONG VFMigrationInterruptNumber:11; 4029 } DUMMYSTRUCTNAME; 4030 ULONG AsULONG; 4031 } PCI_EXPRESS_SRIOV_CAPS, *PPCI_EXPRESS_SRIOV_CAPS; 4032 4033 typedef union _PCI_EXPRESS_SRIOV_CONTROL { 4034 _ANONYMOUS_STRUCT struct { 4035 USHORT VFEnable:1; 4036 USHORT VFMigrationEnable:1; 4037 USHORT VFMigrationInterruptEnable:1; 4038 USHORT VFMemorySpaceEnable:1; 4039 USHORT ARICapableHierarchy:1; 4040 USHORT Reserved1:11; 4041 } DUMMYSTRUCTNAME; 4042 USHORT AsUSHORT; 4043 } PCI_EXPRESS_SRIOV_CONTROL, *PPCI_EXPRESS_SRIOV_CONTROL; 4044 4045 typedef union _PCI_EXPRESS_SRIOV_STATUS { 4046 _ANONYMOUS_STRUCT struct { 4047 USHORT VFMigrationStatus:1; 4048 USHORT Reserved1:15; 4049 } DUMMYSTRUCTNAME; 4050 USHORT AsUSHORT; 4051 } PCI_EXPRESS_SRIOV_STATUS, *PPCI_EXPRESS_SRIOV_STATUS; 4052 4053 typedef union _PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY { 4054 _ANONYMOUS_STRUCT struct { 4055 ULONG VFMigrationStateBIR:3; 4056 ULONG VFMigrationStateOffset:29; 4057 } DUMMYSTRUCTNAME; 4058 ULONG AsULONG; 4059 } PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY, *PPCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY; 4060 4061 typedef struct _PCI_EXPRESS_SRIOV_CAPABILITY { 4062 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; 4063 PCI_EXPRESS_SRIOV_CAPS SRIOVCapabilities; 4064 PCI_EXPRESS_SRIOV_CONTROL SRIOVControl; 4065 PCI_EXPRESS_SRIOV_STATUS SRIOVStatus; 4066 USHORT InitialVFs; 4067 USHORT TotalVFs; 4068 USHORT NumVFs; 4069 UCHAR FunctionDependencyLink; 4070 UCHAR RsvdP1; 4071 USHORT FirstVFOffset; 4072 USHORT VFStride; 4073 USHORT RsvdP2; 4074 USHORT VFDeviceId; 4075 ULONG SupportedPageSizes; 4076 ULONG SystemPageSize; 4077 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; 4078 PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY VFMigrationStateArrayOffset; 4079 } PCI_EXPRESS_SRIOV_CAPABILITY, *PPCI_EXPRESS_SRIOV_CAPABILITY; 4080 4081 /* PCI device classes */ 4082 #define PCI_CLASS_PRE_20 0x00 4083 #define PCI_CLASS_MASS_STORAGE_CTLR 0x01 4084 #define PCI_CLASS_NETWORK_CTLR 0x02 4085 #define PCI_CLASS_DISPLAY_CTLR 0x03 4086 #define PCI_CLASS_MULTIMEDIA_DEV 0x04 4087 #define PCI_CLASS_MEMORY_CTLR 0x05 4088 #define PCI_CLASS_BRIDGE_DEV 0x06 4089 #define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07 4090 #define PCI_CLASS_BASE_SYSTEM_DEV 0x08 4091 #define PCI_CLASS_INPUT_DEV 0x09 4092 #define PCI_CLASS_DOCKING_STATION 0x0a 4093 #define PCI_CLASS_PROCESSOR 0x0b 4094 #define PCI_CLASS_SERIAL_BUS_CTLR 0x0c 4095 #define PCI_CLASS_WIRELESS_CTLR 0x0d 4096 #define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e 4097 #define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f 4098 #define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10 4099 #define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11 4100 #define PCI_CLASS_NOT_DEFINED 0xff 4101 4102 /* PCI device subclasses for class 0 */ 4103 #define PCI_SUBCLASS_PRE_20_NON_VGA 0x00 4104 #define PCI_SUBCLASS_PRE_20_VGA 0x01 4105 4106 /* PCI device subclasses for class 1 (mass storage controllers)*/ 4107 #define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00 4108 #define PCI_SUBCLASS_MSC_IDE_CTLR 0x01 4109 #define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02 4110 #define PCI_SUBCLASS_MSC_IPI_CTLR 0x03 4111 #define PCI_SUBCLASS_MSC_RAID_CTLR 0x04 4112 #define PCI_SUBCLASS_MSC_OTHER 0x80 4113 4114 /* PCI device subclasses for class 2 (network controllers)*/ 4115 #define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00 4116 #define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01 4117 #define PCI_SUBCLASS_NET_FDDI_CTLR 0x02 4118 #define PCI_SUBCLASS_NET_ATM_CTLR 0x03 4119 #define PCI_SUBCLASS_NET_ISDN_CTLR 0x04 4120 #define PCI_SUBCLASS_NET_OTHER 0x80 4121 4122 /* PCI device subclasses for class 3 (display controllers)*/ 4123 #define PCI_SUBCLASS_VID_VGA_CTLR 0x00 4124 #define PCI_SUBCLASS_VID_XGA_CTLR 0x01 4125 #define PCI_SUBCLASS_VID_3D_CTLR 0x02 4126 #define PCI_SUBCLASS_VID_OTHER 0x80 4127 4128 /* PCI device subclasses for class 4 (multimedia device)*/ 4129 #define PCI_SUBCLASS_MM_VIDEO_DEV 0x00 4130 #define PCI_SUBCLASS_MM_AUDIO_DEV 0x01 4131 #define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02 4132 #define PCI_SUBCLASS_MM_OTHER 0x80 4133 4134 /* PCI device subclasses for class 5 (memory controller)*/ 4135 #define PCI_SUBCLASS_MEM_RAM 0x00 4136 #define PCI_SUBCLASS_MEM_FLASH 0x01 4137 #define PCI_SUBCLASS_MEM_OTHER 0x80 4138 4139 /* PCI device subclasses for class 6 (bridge device)*/ 4140 #define PCI_SUBCLASS_BR_HOST 0x00 4141 #define PCI_SUBCLASS_BR_ISA 0x01 4142 #define PCI_SUBCLASS_BR_EISA 0x02 4143 #define PCI_SUBCLASS_BR_MCA 0x03 4144 #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 4145 #define PCI_SUBCLASS_BR_PCMCIA 0x05 4146 #define PCI_SUBCLASS_BR_NUBUS 0x06 4147 #define PCI_SUBCLASS_BR_CARDBUS 0x07 4148 #define PCI_SUBCLASS_BR_RACEWAY 0x08 4149 #define PCI_SUBCLASS_BR_OTHER 0x80 4150 4151 #define PCI_SUBCLASS_COM_SERIAL 0x00 4152 #define PCI_SUBCLASS_COM_PARALLEL 0x01 4153 #define PCI_SUBCLASS_COM_MULTIPORT 0x02 4154 #define PCI_SUBCLASS_COM_MODEM 0x03 4155 #define PCI_SUBCLASS_COM_OTHER 0x80 4156 4157 #define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00 4158 #define PCI_SUBCLASS_SYS_DMA_CTLR 0x01 4159 #define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02 4160 #define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03 4161 #define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04 4162 #define PCI_SUBCLASS_SYS_SDIO_CTRL 0x05 4163 #define PCI_SUBCLASS_SYS_OTHER 0x80 4164 4165 #define PCI_SUBCLASS_INP_KEYBOARD 0x00 4166 #define PCI_SUBCLASS_INP_DIGITIZER 0x01 4167 #define PCI_SUBCLASS_INP_MOUSE 0x02 4168 #define PCI_SUBCLASS_INP_SCANNER 0x03 4169 #define PCI_SUBCLASS_INP_GAMEPORT 0x04 4170 #define PCI_SUBCLASS_INP_OTHER 0x80 4171 4172 #define PCI_SUBCLASS_DOC_GENERIC 0x00 4173 #define PCI_SUBCLASS_DOC_OTHER 0x80 4174 4175 #define PCI_SUBCLASS_PROC_386 0x00 4176 #define PCI_SUBCLASS_PROC_486 0x01 4177 #define PCI_SUBCLASS_PROC_PENTIUM 0x02 4178 #define PCI_SUBCLASS_PROC_ALPHA 0x10 4179 #define PCI_SUBCLASS_PROC_POWERPC 0x20 4180 #define PCI_SUBCLASS_PROC_COPROCESSOR 0x40 4181 4182 /* PCI device subclasses for class C (serial bus controller)*/ 4183 #define PCI_SUBCLASS_SB_IEEE1394 0x00 4184 #define PCI_SUBCLASS_SB_ACCESS 0x01 4185 #define PCI_SUBCLASS_SB_SSA 0x02 4186 #define PCI_SUBCLASS_SB_USB 0x03 4187 #define PCI_SUBCLASS_SB_FIBRE_CHANNEL 0x04 4188 #define PCI_SUBCLASS_SB_SMBUS 0x05 4189 4190 #define PCI_SUBCLASS_WIRELESS_IRDA 0x00 4191 #define PCI_SUBCLASS_WIRELESS_CON_IR 0x01 4192 #define PCI_SUBCLASS_WIRELESS_RF 0x10 4193 #define PCI_SUBCLASS_WIRELESS_OTHER 0x80 4194 4195 #define PCI_SUBCLASS_INTIO_I2O 0x00 4196 4197 #define PCI_SUBCLASS_SAT_TV 0x01 4198 #define PCI_SUBCLASS_SAT_AUDIO 0x02 4199 #define PCI_SUBCLASS_SAT_VOICE 0x03 4200 #define PCI_SUBCLASS_SAT_DATA 0x04 4201 4202 #define PCI_SUBCLASS_CRYPTO_NET_COMP 0x00 4203 #define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10 4204 #define PCI_SUBCLASS_CRYPTO_OTHER 0x80 4205 4206 #define PCI_SUBCLASS_DASP_DPIO 0x00 4207 #define PCI_SUBCLASS_DASP_OTHER 0x80 4208 4209 #define PCI_ADDRESS_IO_SPACE 0x00000001 4210 #define PCI_ADDRESS_MEMORY_TYPE_MASK 0x00000006 4211 #define PCI_ADDRESS_MEMORY_PREFETCHABLE 0x00000008 4212 #define PCI_ADDRESS_IO_ADDRESS_MASK 0xfffffffc 4213 #define PCI_ADDRESS_MEMORY_ADDRESS_MASK 0xfffffff0 4214 #define PCI_ADDRESS_ROM_ADDRESS_MASK 0xfffff800 4215 4216 #define PCI_TYPE_32BIT 0 4217 #define PCI_TYPE_20BIT 2 4218 #define PCI_TYPE_64BIT 4 4219 4220 #define PCI_ROMADDRESS_ENABLED 0x00000001 4221 4222 #endif /* _PCI_X_ */ 4223 4224 #define PCI_EXPRESS_LINK_QUIESCENT_INTERFACE_VERSION 1 4225 4226 _IRQL_requires_max_(PASSIVE_LEVEL) 4227 _Must_inspect_result_ 4228 typedef NTSTATUS 4229 (NTAPI PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE)( 4230 _Inout_ PVOID Context); 4231 typedef PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE *PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE; 4232 4233 _IRQL_requires_max_(PASSIVE_LEVEL) 4234 _Must_inspect_result_ 4235 typedef NTSTATUS 4236 (NTAPI PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE)( 4237 _Inout_ PVOID Context); 4238 typedef PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE *PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE; 4239 4240 typedef struct _PCI_EXPRESS_LINK_QUIESCENT_INTERFACE { 4241 USHORT Size; 4242 USHORT Version; 4243 PVOID Context; 4244 PINTERFACE_REFERENCE InterfaceReference; 4245 PINTERFACE_DEREFERENCE InterfaceDereference; 4246 PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE PciExpressEnterLinkQuiescentMode; 4247 PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE PciExpressExitLinkQuiescentMode; 4248 } PCI_EXPRESS_LINK_QUIESCENT_INTERFACE, *PPCI_EXPRESS_LINK_QUIESCENT_INTERFACE; 4249 4250 #define PCI_EXPRESS_ROOT_PORT_INTERFACE_VERSION 1 4251 4252 typedef ULONG 4253 (NTAPI *PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE)( 4254 _In_ PVOID Context, 4255 _Out_writes_bytes_(Length) PVOID Buffer, 4256 _In_ ULONG Offset, 4257 _In_ ULONG Length); 4258 4259 typedef ULONG 4260 (NTAPI *PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE)( 4261 _In_ PVOID Context, 4262 _In_reads_bytes_(Length) PVOID Buffer, 4263 _In_ ULONG Offset, 4264 _In_ ULONG Length); 4265 4266 typedef struct _PCI_EXPRESS_ROOT_PORT_INTERFACE { 4267 USHORT Size; 4268 USHORT Version; 4269 PVOID Context; 4270 PINTERFACE_REFERENCE InterfaceReference; 4271 PINTERFACE_DEREFERENCE InterfaceDereference; 4272 PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE ReadConfigSpace; 4273 PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE WriteConfigSpace; 4274 } PCI_EXPRESS_ROOT_PORT_INTERFACE, *PPCI_EXPRESS_ROOT_PORT_INTERFACE; 4275 4276 #define PCI_MSIX_TABLE_CONFIG_INTERFACE_VERSION 1 4277 4278 _Must_inspect_result_ 4279 typedef NTSTATUS 4280 (NTAPI PCI_MSIX_SET_ENTRY)( 4281 _In_ PVOID Context, 4282 _In_ ULONG TableEntry, 4283 _In_ ULONG MessageNumber); 4284 typedef PCI_MSIX_SET_ENTRY *PPCI_MSIX_SET_ENTRY; 4285 4286 _Must_inspect_result_ 4287 typedef NTSTATUS 4288 (NTAPI PCI_MSIX_MASKUNMASK_ENTRY)( 4289 _In_ PVOID Context, 4290 _In_ ULONG TableEntry); 4291 typedef PCI_MSIX_MASKUNMASK_ENTRY *PPCI_MSIX_MASKUNMASK_ENTRY; 4292 4293 _Must_inspect_result_ 4294 typedef NTSTATUS 4295 (NTAPI PCI_MSIX_GET_ENTRY)( 4296 _In_ PVOID Context, 4297 _In_ ULONG TableEntry, 4298 _Out_ PULONG MessageNumber, 4299 _Out_ PBOOLEAN Masked); 4300 typedef PCI_MSIX_GET_ENTRY *PPCI_MSIX_GET_ENTRY; 4301 4302 _Must_inspect_result_ 4303 typedef NTSTATUS 4304 (NTAPI PCI_MSIX_GET_TABLE_SIZE)( 4305 _In_ PVOID Context, 4306 _Out_ PULONG TableSize); 4307 typedef PCI_MSIX_GET_TABLE_SIZE *PPCI_MSIX_GET_TABLE_SIZE; 4308 4309 typedef struct _PCI_MSIX_TABLE_CONFIG_INTERFACE { 4310 USHORT Size; 4311 USHORT Version; 4312 PVOID Context; 4313 PINTERFACE_REFERENCE InterfaceReference; 4314 PINTERFACE_DEREFERENCE InterfaceDereference; 4315 PPCI_MSIX_SET_ENTRY SetTableEntry; 4316 PPCI_MSIX_MASKUNMASK_ENTRY MaskTableEntry; 4317 PPCI_MSIX_MASKUNMASK_ENTRY UnmaskTableEntry; 4318 PPCI_MSIX_GET_ENTRY GetTableEntry; 4319 PPCI_MSIX_GET_TABLE_SIZE GetTableSize; 4320 } PCI_MSIX_TABLE_CONFIG_INTERFACE, *PPCI_MSIX_TABLE_CONFIG_INTERFACE; 4321 4322 #define PCI_MSIX_TABLE_CONFIG_MINIMUM_SIZE \ 4323 RTL_SIZEOF_THROUGH_FIELD(PCI_MSIX_TABLE_CONFIG_INTERFACE, UnmaskTableEntry) 4324 4325 $endif (_WDMDDK_) 4326 $if (_NTDDK_) 4327 #ifndef _ARC_DDK_ 4328 #define _ARC_DDK_ 4329 typedef enum _CONFIGURATION_TYPE { 4330 ArcSystem, 4331 CentralProcessor, 4332 FloatingPointProcessor, 4333 PrimaryIcache, 4334 PrimaryDcache, 4335 SecondaryIcache, 4336 SecondaryDcache, 4337 SecondaryCache, 4338 EisaAdapter, 4339 TcAdapter, 4340 ScsiAdapter, 4341 DtiAdapter, 4342 MultiFunctionAdapter, 4343 DiskController, 4344 TapeController, 4345 CdromController, 4346 WormController, 4347 SerialController, 4348 NetworkController, 4349 DisplayController, 4350 ParallelController, 4351 PointerController, 4352 KeyboardController, 4353 AudioController, 4354 OtherController, 4355 DiskPeripheral, 4356 FloppyDiskPeripheral, 4357 TapePeripheral, 4358 ModemPeripheral, 4359 MonitorPeripheral, 4360 PrinterPeripheral, 4361 PointerPeripheral, 4362 KeyboardPeripheral, 4363 TerminalPeripheral, 4364 OtherPeripheral, 4365 LinePeripheral, 4366 NetworkPeripheral, 4367 SystemMemory, 4368 DockingInformation, 4369 RealModeIrqRoutingTable, 4370 RealModePCIEnumeration, 4371 MaximumType 4372 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE; 4373 #endif /* !_ARC_DDK_ */ 4374 4375 /* 4376 ** IRP function codes 4377 */ 4378 4379 #define IRP_MN_QUERY_DIRECTORY 0x01 4380 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 4381 4382 #define IRP_MN_USER_FS_REQUEST 0x00 4383 #define IRP_MN_MOUNT_VOLUME 0x01 4384 #define IRP_MN_VERIFY_VOLUME 0x02 4385 #define IRP_MN_LOAD_FILE_SYSTEM 0x03 4386 #define IRP_MN_TRACK_LINK 0x04 4387 #define IRP_MN_KERNEL_CALL 0x04 4388 4389 #define IRP_MN_LOCK 0x01 4390 #define IRP_MN_UNLOCK_SINGLE 0x02 4391 #define IRP_MN_UNLOCK_ALL 0x03 4392 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 4393 4394 #define IRP_MN_FLUSH_AND_PURGE 0x01 4395 4396 #define IRP_MN_NORMAL 0x00 4397 #define IRP_MN_DPC 0x01 4398 #define IRP_MN_MDL 0x02 4399 #define IRP_MN_COMPLETE 0x04 4400 #define IRP_MN_COMPRESSED 0x08 4401 4402 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) 4403 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) 4404 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) 4405 4406 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 4407 4408 #define IO_CHECK_CREATE_PARAMETERS 0x0200 4409 #define IO_ATTACH_DEVICE 0x0400 4410 #define IO_IGNORE_SHARE_ACCESS_CHECK 0x0800 4411 4412 typedef NTSTATUS 4413 (NTAPI *PIO_QUERY_DEVICE_ROUTINE)( 4414 _In_ PVOID Context, 4415 _In_ PUNICODE_STRING PathName, 4416 _In_ INTERFACE_TYPE BusType, 4417 _In_ ULONG BusNumber, 4418 _In_ PKEY_VALUE_FULL_INFORMATION *BusInformation, 4419 _In_ CONFIGURATION_TYPE ControllerType, 4420 _In_ ULONG ControllerNumber, 4421 _In_ PKEY_VALUE_FULL_INFORMATION *ControllerInformation, 4422 _In_ CONFIGURATION_TYPE PeripheralType, 4423 _In_ ULONG PeripheralNumber, 4424 _In_ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation); 4425 4426 typedef enum _IO_QUERY_DEVICE_DATA_FORMAT { 4427 IoQueryDeviceIdentifier = 0, 4428 IoQueryDeviceConfigurationData, 4429 IoQueryDeviceComponentInformation, 4430 IoQueryDeviceMaxData 4431 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT; 4432 4433 typedef VOID 4434 (NTAPI *PDRIVER_REINITIALIZE)( 4435 _In_ struct _DRIVER_OBJECT *DriverObject, 4436 _In_opt_ PVOID Context, 4437 _In_ ULONG Count); 4438 4439 typedef struct _CONTROLLER_OBJECT { 4440 CSHORT Type; 4441 CSHORT Size; 4442 PVOID ControllerExtension; 4443 KDEVICE_QUEUE DeviceWaitQueue; 4444 ULONG Spare1; 4445 LARGE_INTEGER Spare2; 4446 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; 4447 4448 #define DRVO_REINIT_REGISTERED 0x00000008 4449 #define DRVO_INITIALIZED 0x00000010 4450 #define DRVO_BOOTREINIT_REGISTERED 0x00000020 4451 #define DRVO_LEGACY_RESOURCES 0x00000040 4452 4453 typedef struct _CONFIGURATION_INFORMATION { 4454 ULONG DiskCount; 4455 ULONG FloppyCount; 4456 ULONG CdRomCount; 4457 ULONG TapeCount; 4458 ULONG ScsiPortCount; 4459 ULONG SerialCount; 4460 ULONG ParallelCount; 4461 BOOLEAN AtDiskPrimaryAddressClaimed; 4462 BOOLEAN AtDiskSecondaryAddressClaimed; 4463 ULONG Version; 4464 ULONG MediumChangerCount; 4465 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION; 4466 4467 typedef struct _DISK_SIGNATURE { 4468 ULONG PartitionStyle; 4469 _ANONYMOUS_UNION union { 4470 struct { 4471 ULONG Signature; 4472 ULONG CheckSum; 4473 } Mbr; 4474 struct { 4475 GUID DiskId; 4476 } Gpt; 4477 } DUMMYUNIONNAME; 4478 } DISK_SIGNATURE, *PDISK_SIGNATURE; 4479 4480 typedef struct _TXN_PARAMETER_BLOCK { 4481 USHORT Length; 4482 USHORT TxFsContext; 4483 PVOID TransactionObject; 4484 } TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK; 4485 4486 #define TXF_MINIVERSION_DEFAULT_VIEW (0xFFFE) 4487 4488 typedef struct _IO_DRIVER_CREATE_CONTEXT { 4489 CSHORT Size; 4490 struct _ECP_LIST *ExtraCreateParameter; 4491 PVOID DeviceObjectHint; 4492 PTXN_PARAMETER_BLOCK TxnParameters; 4493 } IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT; 4494 4495 typedef struct _AGP_TARGET_BUS_INTERFACE_STANDARD { 4496 USHORT Size; 4497 USHORT Version; 4498 PVOID Context; 4499 PINTERFACE_REFERENCE InterfaceReference; 4500 PINTERFACE_DEREFERENCE InterfaceDereference; 4501 PGET_SET_DEVICE_DATA SetBusData; 4502 PGET_SET_DEVICE_DATA GetBusData; 4503 UCHAR CapabilityID; 4504 } AGP_TARGET_BUS_INTERFACE_STANDARD, *PAGP_TARGET_BUS_INTERFACE_STANDARD; 4505 4506 _IRQL_requires_max_(PASSIVE_LEVEL) 4507 _Must_inspect_result_ 4508 typedef NTSTATUS 4509 (NTAPI *PGET_LOCATION_STRING)( 4510 _Inout_opt_ PVOID Context, 4511 _Outptr_ 4512 _At_(*LocationStrings, 4513 _When_(return == 0, __drv_allocatesMem(Mem))) 4514 PZZWSTR *LocationStrings); 4515 4516 typedef struct _PNP_LOCATION_INTERFACE { 4517 USHORT Size; 4518 USHORT Version; 4519 PVOID Context; 4520 PINTERFACE_REFERENCE InterfaceReference; 4521 PINTERFACE_DEREFERENCE InterfaceDereference; 4522 PGET_LOCATION_STRING GetLocationString; 4523 } PNP_LOCATION_INTERFACE, *PPNP_LOCATION_INTERFACE; 4524 4525 typedef enum _ARBITER_ACTION { 4526 ArbiterActionTestAllocation, 4527 ArbiterActionRetestAllocation, 4528 ArbiterActionCommitAllocation, 4529 ArbiterActionRollbackAllocation, 4530 ArbiterActionQueryAllocatedResources, 4531 ArbiterActionWriteReservedResources, 4532 ArbiterActionQueryConflict, 4533 ArbiterActionQueryArbitrate, 4534 ArbiterActionAddReserved, 4535 ArbiterActionBootAllocation 4536 } ARBITER_ACTION, *PARBITER_ACTION; 4537 4538 typedef struct _ARBITER_CONFLICT_INFO { 4539 PDEVICE_OBJECT OwningObject; 4540 ULONGLONG Start; 4541 ULONGLONG End; 4542 } ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO; 4543 4544 typedef struct _ARBITER_TEST_ALLOCATION_PARAMETERS { 4545 _Inout_ PLIST_ENTRY ArbitrationList; 4546 _In_ ULONG AllocateFromCount; 4547 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; 4548 } ARBITER_TEST_ALLOCATION_PARAMETERS, *PARBITER_TEST_ALLOCATION_PARAMETERS; 4549 4550 typedef struct _ARBITER_RETEST_ALLOCATION_PARAMETERS { 4551 _Inout_ PLIST_ENTRY ArbitrationList; 4552 _In_ ULONG AllocateFromCount; 4553 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; 4554 } ARBITER_RETEST_ALLOCATION_PARAMETERS, *PARBITER_RETEST_ALLOCATION_PARAMETERS; 4555 4556 typedef struct _ARBITER_BOOT_ALLOCATION_PARAMETERS { 4557 _Inout_ PLIST_ENTRY ArbitrationList; 4558 } ARBITER_BOOT_ALLOCATION_PARAMETERS, *PARBITER_BOOT_ALLOCATION_PARAMETERS; 4559 4560 typedef struct _ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS { 4561 _Out_ PCM_PARTIAL_RESOURCE_LIST *AllocatedResources; 4562 } ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS, *PARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS; 4563 4564 typedef struct _ARBITER_QUERY_CONFLICT_PARAMETERS { 4565 _In_ PDEVICE_OBJECT PhysicalDeviceObject; 4566 _In_ PIO_RESOURCE_DESCRIPTOR ConflictingResource; 4567 _Out_ PULONG ConflictCount; 4568 _Out_ PARBITER_CONFLICT_INFO *Conflicts; 4569 } ARBITER_QUERY_CONFLICT_PARAMETERS, *PARBITER_QUERY_CONFLICT_PARAMETERS; 4570 4571 typedef struct _ARBITER_QUERY_ARBITRATE_PARAMETERS { 4572 _In_ PLIST_ENTRY ArbitrationList; 4573 } ARBITER_QUERY_ARBITRATE_PARAMETERS, *PARBITER_QUERY_ARBITRATE_PARAMETERS; 4574 4575 typedef struct _ARBITER_ADD_RESERVED_PARAMETERS { 4576 _In_ PDEVICE_OBJECT ReserveDevice; 4577 } ARBITER_ADD_RESERVED_PARAMETERS, *PARBITER_ADD_RESERVED_PARAMETERS; 4578 4579 typedef struct _ARBITER_PARAMETERS { 4580 union { 4581 ARBITER_TEST_ALLOCATION_PARAMETERS TestAllocation; 4582 ARBITER_RETEST_ALLOCATION_PARAMETERS RetestAllocation; 4583 ARBITER_BOOT_ALLOCATION_PARAMETERS BootAllocation; 4584 ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS QueryAllocatedResources; 4585 ARBITER_QUERY_CONFLICT_PARAMETERS QueryConflict; 4586 ARBITER_QUERY_ARBITRATE_PARAMETERS QueryArbitrate; 4587 ARBITER_ADD_RESERVED_PARAMETERS AddReserved; 4588 } Parameters; 4589 } ARBITER_PARAMETERS, *PARBITER_PARAMETERS; 4590 4591 typedef enum _ARBITER_REQUEST_SOURCE { 4592 ArbiterRequestUndefined = -1, 4593 ArbiterRequestLegacyReported, 4594 ArbiterRequestHalReported, 4595 ArbiterRequestLegacyAssigned, 4596 ArbiterRequestPnpDetected, 4597 ArbiterRequestPnpEnumerated 4598 } ARBITER_REQUEST_SOURCE; 4599 4600 typedef enum _ARBITER_RESULT { 4601 ArbiterResultUndefined = -1, 4602 ArbiterResultSuccess, 4603 ArbiterResultExternalConflict, 4604 ArbiterResultNullRequest 4605 } ARBITER_RESULT; 4606 4607 #define ARBITER_FLAG_BOOT_CONFIG 0x00000001 4608 4609 typedef struct _ARBITER_LIST_ENTRY { 4610 LIST_ENTRY ListEntry; 4611 ULONG AlternativeCount; 4612 PIO_RESOURCE_DESCRIPTOR Alternatives; 4613 PDEVICE_OBJECT PhysicalDeviceObject; 4614 ARBITER_REQUEST_SOURCE RequestSource; 4615 ULONG Flags; 4616 LONG_PTR WorkSpace; 4617 INTERFACE_TYPE InterfaceType; 4618 ULONG SlotNumber; 4619 ULONG BusNumber; 4620 PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment; 4621 PIO_RESOURCE_DESCRIPTOR SelectedAlternative; 4622 ARBITER_RESULT Result; 4623 } ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY; 4624 4625 typedef NTSTATUS 4626 (NTAPI *PARBITER_HANDLER)( 4627 _Inout_opt_ PVOID Context, 4628 _In_ ARBITER_ACTION Action, 4629 _Inout_ PARBITER_PARAMETERS Parameters); 4630 4631 #define ARBITER_PARTIAL 0x00000001 4632 4633 typedef struct _ARBITER_INTERFACE { 4634 USHORT Size; 4635 USHORT Version; 4636 PVOID Context; 4637 PINTERFACE_REFERENCE InterfaceReference; 4638 PINTERFACE_DEREFERENCE InterfaceDereference; 4639 PARBITER_HANDLER ArbiterHandler; 4640 ULONG Flags; 4641 } ARBITER_INTERFACE, *PARBITER_INTERFACE; 4642 4643 typedef enum _RESOURCE_TRANSLATION_DIRECTION { 4644 TranslateChildToParent, 4645 TranslateParentToChild 4646 } RESOURCE_TRANSLATION_DIRECTION; 4647 4648 typedef NTSTATUS 4649 (NTAPI *PTRANSLATE_RESOURCE_HANDLER)( 4650 _Inout_opt_ PVOID Context, 4651 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Source, 4652 _In_ RESOURCE_TRANSLATION_DIRECTION Direction, 4653 _In_opt_ ULONG AlternativesCount, 4654 _In_reads_opt_(AlternativesCount) IO_RESOURCE_DESCRIPTOR Alternatives[], 4655 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 4656 _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Target); 4657 4658 typedef NTSTATUS 4659 (NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)( 4660 _Inout_opt_ PVOID Context, 4661 _In_ PIO_RESOURCE_DESCRIPTOR Source, 4662 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 4663 _Out_ PULONG TargetCount, 4664 _Out_writes_(*TargetCount) PIO_RESOURCE_DESCRIPTOR *Target); 4665 4666 typedef struct _TRANSLATOR_INTERFACE { 4667 USHORT Size; 4668 USHORT Version; 4669 PVOID Context; 4670 PINTERFACE_REFERENCE InterfaceReference; 4671 PINTERFACE_DEREFERENCE InterfaceDereference; 4672 PTRANSLATE_RESOURCE_HANDLER TranslateResources; 4673 PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements; 4674 } TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE; 4675 4676 typedef struct _PCI_AGP_CAPABILITY { 4677 PCI_CAPABILITIES_HEADER Header; 4678 USHORT Minor:4; 4679 USHORT Major:4; 4680 USHORT Rsvd1:8; 4681 struct _PCI_AGP_STATUS { 4682 ULONG Rate:3; 4683 ULONG Agp3Mode:1; 4684 ULONG FastWrite:1; 4685 ULONG FourGB:1; 4686 ULONG HostTransDisable:1; 4687 ULONG Gart64:1; 4688 ULONG ITA_Coherent:1; 4689 ULONG SideBandAddressing:1; 4690 ULONG CalibrationCycle:3; 4691 ULONG AsyncRequestSize:3; 4692 ULONG Rsvd1:1; 4693 ULONG Isoch:1; 4694 ULONG Rsvd2:6; 4695 ULONG RequestQueueDepthMaximum:8; 4696 } AGPStatus; 4697 struct _PCI_AGP_COMMAND { 4698 ULONG Rate:3; 4699 ULONG Rsvd1:1; 4700 ULONG FastWriteEnable:1; 4701 ULONG FourGBEnable:1; 4702 ULONG Rsvd2:1; 4703 ULONG Gart64:1; 4704 ULONG AGPEnable:1; 4705 ULONG SBAEnable:1; 4706 ULONG CalibrationCycle:3; 4707 ULONG AsyncReqSize:3; 4708 ULONG Rsvd3:8; 4709 ULONG RequestQueueDepth:8; 4710 } AGPCommand; 4711 } PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY; 4712 4713 typedef enum _EXTENDED_AGP_REGISTER { 4714 IsochStatus, 4715 AgpControl, 4716 ApertureSize, 4717 AperturePageSize, 4718 GartLow, 4719 GartHigh, 4720 IsochCommand 4721 } EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER; 4722 4723 typedef struct _PCI_AGP_ISOCH_STATUS { 4724 ULONG ErrorCode:2; 4725 ULONG Rsvd1:1; 4726 ULONG Isoch_L:3; 4727 ULONG Isoch_Y:2; 4728 ULONG Isoch_N:8; 4729 ULONG Rsvd2:16; 4730 } PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS; 4731 4732 typedef struct _PCI_AGP_CONTROL { 4733 ULONG Rsvd1:7; 4734 ULONG GTLB_Enable:1; 4735 ULONG AP_Enable:1; 4736 ULONG CAL_Disable:1; 4737 ULONG Rsvd2:22; 4738 } PCI_AGP_CONTROL, *PPCI_AGP_CONTROL; 4739 4740 typedef struct _PCI_AGP_APERTURE_PAGE_SIZE { 4741 USHORT PageSizeMask:11; 4742 USHORT Rsvd1:1; 4743 USHORT PageSizeSelect:4; 4744 } PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE; 4745 4746 typedef struct _PCI_AGP_ISOCH_COMMAND { 4747 USHORT Rsvd1:6; 4748 USHORT Isoch_Y:2; 4749 USHORT Isoch_N:8; 4750 } PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND; 4751 4752 typedef struct PCI_AGP_EXTENDED_CAPABILITY { 4753 PCI_AGP_ISOCH_STATUS IsochStatus; 4754 PCI_AGP_CONTROL AgpControl; 4755 USHORT ApertureSize; 4756 PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize; 4757 ULONG GartLow; 4758 ULONG GartHigh; 4759 PCI_AGP_ISOCH_COMMAND IsochCommand; 4760 } PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY; 4761 4762 #define PCI_AGP_RATE_1X 0x1 4763 #define PCI_AGP_RATE_2X 0x2 4764 #define PCI_AGP_RATE_4X 0x4 4765 4766 #define PCIX_MODE_CONVENTIONAL_PCI 0x0 4767 #define PCIX_MODE1_66MHZ 0x1 4768 #define PCIX_MODE1_100MHZ 0x2 4769 #define PCIX_MODE1_133MHZ 0x3 4770 #define PCIX_MODE2_266_66MHZ 0x9 4771 #define PCIX_MODE2_266_100MHZ 0xA 4772 #define PCIX_MODE2_266_133MHZ 0xB 4773 #define PCIX_MODE2_533_66MHZ 0xD 4774 #define PCIX_MODE2_533_100MHZ 0xE 4775 #define PCIX_MODE2_533_133MHZ 0xF 4776 4777 #define PCIX_VERSION_MODE1_ONLY 0x0 4778 #define PCIX_VERSION_MODE2_ECC 0x1 4779 #define PCIX_VERSION_DUAL_MODE_ECC 0x2 4780 4781 typedef struct _PCIX_BRIDGE_CAPABILITY { 4782 PCI_CAPABILITIES_HEADER Header; 4783 union { 4784 _ANONYMOUS_STRUCT struct { 4785 USHORT Bus64Bit:1; 4786 USHORT Bus133MHzCapable:1; 4787 USHORT SplitCompletionDiscarded:1; 4788 USHORT UnexpectedSplitCompletion:1; 4789 USHORT SplitCompletionOverrun:1; 4790 USHORT SplitRequestDelayed:1; 4791 USHORT BusModeFrequency:4; 4792 USHORT Rsvd:2; 4793 USHORT Version:2; 4794 USHORT Bus266MHzCapable:1; 4795 USHORT Bus533MHzCapable:1; 4796 } DUMMYSTRUCTNAME; 4797 USHORT AsUSHORT; 4798 } SecondaryStatus; 4799 union { 4800 _ANONYMOUS_STRUCT struct { 4801 ULONG FunctionNumber:3; 4802 ULONG DeviceNumber:5; 4803 ULONG BusNumber:8; 4804 ULONG Device64Bit:1; 4805 ULONG Device133MHzCapable:1; 4806 ULONG SplitCompletionDiscarded:1; 4807 ULONG UnexpectedSplitCompletion:1; 4808 ULONG SplitCompletionOverrun:1; 4809 ULONG SplitRequestDelayed:1; 4810 ULONG Rsvd:7; 4811 ULONG DIMCapable:1; 4812 ULONG Device266MHzCapable:1; 4813 ULONG Device533MHzCapable:1; 4814 } DUMMYSTRUCTNAME; 4815 ULONG AsULONG; 4816 } BridgeStatus; 4817 USHORT UpstreamSplitTransactionCapacity; 4818 USHORT UpstreamSplitTransactionLimit; 4819 USHORT DownstreamSplitTransactionCapacity; 4820 USHORT DownstreamSplitTransactionLimit; 4821 union { 4822 _ANONYMOUS_STRUCT struct { 4823 ULONG SelectSecondaryRegisters:1; 4824 ULONG ErrorPresentInOtherBank:1; 4825 ULONG AdditionalCorrectableError:1; 4826 ULONG AdditionalUncorrectableError:1; 4827 ULONG ErrorPhase:3; 4828 ULONG ErrorCorrected:1; 4829 ULONG Syndrome:8; 4830 ULONG ErrorFirstCommand:4; 4831 ULONG ErrorSecondCommand:4; 4832 ULONG ErrorUpperAttributes:4; 4833 ULONG ControlUpdateEnable:1; 4834 ULONG Rsvd:1; 4835 ULONG DisableSingleBitCorrection:1; 4836 ULONG EccMode:1; 4837 } DUMMYSTRUCTNAME; 4838 ULONG AsULONG; 4839 } EccControlStatus; 4840 ULONG EccFirstAddress; 4841 ULONG EccSecondAddress; 4842 ULONG EccAttribute; 4843 } PCIX_BRIDGE_CAPABILITY, *PPCIX_BRIDGE_CAPABILITY; 4844 4845 typedef struct _PCI_SUBSYSTEM_IDS_CAPABILITY { 4846 PCI_CAPABILITIES_HEADER Header; 4847 USHORT Reserved; 4848 USHORT SubVendorID; 4849 USHORT SubSystemID; 4850 } PCI_SUBSYSTEM_IDS_CAPABILITY, *PPCI_SUBSYSTEM_IDS_CAPABILITY; 4851 4852 #define OSC_FIRMWARE_FAILURE 0x02 4853 #define OSC_UNRECOGNIZED_UUID 0x04 4854 #define OSC_UNRECOGNIZED_REVISION 0x08 4855 #define OSC_CAPABILITIES_MASKED 0x10 4856 4857 #define PCI_ROOT_BUS_OSC_METHOD_CAPABILITY_REVISION 0x01 4858 4859 typedef struct _PCI_ROOT_BUS_OSC_SUPPORT_FIELD { 4860 union { 4861 _ANONYMOUS_STRUCT struct { 4862 ULONG ExtendedConfigOpRegions:1; 4863 ULONG ActiveStatePowerManagement:1; 4864 ULONG ClockPowerManagement:1; 4865 ULONG SegmentGroups:1; 4866 ULONG MessageSignaledInterrupts:1; 4867 ULONG WindowsHardwareErrorArchitecture:1; 4868 ULONG Reserved:26; 4869 } DUMMYSTRUCTNAME; 4870 ULONG AsULONG; 4871 } u; 4872 } PCI_ROOT_BUS_OSC_SUPPORT_FIELD, *PPCI_ROOT_BUS_OSC_SUPPORT_FIELD; 4873 4874 typedef struct _PCI_ROOT_BUS_OSC_CONTROL_FIELD { 4875 union { 4876 _ANONYMOUS_STRUCT struct { 4877 ULONG ExpressNativeHotPlug:1; 4878 ULONG ShpcNativeHotPlug:1; 4879 ULONG ExpressNativePME:1; 4880 ULONG ExpressAdvancedErrorReporting:1; 4881 ULONG ExpressCapabilityStructure:1; 4882 ULONG Reserved:27; 4883 } DUMMYSTRUCTNAME; 4884 ULONG AsULONG; 4885 } u; 4886 } PCI_ROOT_BUS_OSC_CONTROL_FIELD, *PPCI_ROOT_BUS_OSC_CONTROL_FIELD; 4887 4888 typedef enum _PCI_HARDWARE_INTERFACE { 4889 PciConventional, 4890 PciXMode1, 4891 PciXMode2, 4892 PciExpress 4893 } PCI_HARDWARE_INTERFACE, *PPCI_HARDWARE_INTERFACE; 4894 4895 typedef enum { 4896 BusWidth32Bits, 4897 BusWidth64Bits 4898 } PCI_BUS_WIDTH; 4899 4900 typedef struct _PCI_ROOT_BUS_HARDWARE_CAPABILITY { 4901 PCI_HARDWARE_INTERFACE SecondaryInterface; 4902 _ANONYMOUS_STRUCT struct { 4903 BOOLEAN BusCapabilitiesFound; 4904 ULONG CurrentSpeedAndMode; 4905 ULONG SupportedSpeedsAndModes; 4906 BOOLEAN DeviceIDMessagingCapable; 4907 PCI_BUS_WIDTH SecondaryBusWidth; 4908 } DUMMYSTRUCTNAME; 4909 PCI_ROOT_BUS_OSC_SUPPORT_FIELD OscFeatureSupport; 4910 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlRequest; 4911 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlGranted; 4912 } PCI_ROOT_BUS_HARDWARE_CAPABILITY, *PPCI_ROOT_BUS_HARDWARE_CAPABILITY; 4913 4914 typedef union _PCI_EXPRESS_CAPABILITIES_REGISTER { 4915 _ANONYMOUS_STRUCT struct { 4916 USHORT CapabilityVersion:4; 4917 USHORT DeviceType:4; 4918 USHORT SlotImplemented:1; 4919 USHORT InterruptMessageNumber:5; 4920 USHORT Rsvd:2; 4921 } DUMMYSTRUCTNAME; 4922 USHORT AsUSHORT; 4923 } PCI_EXPRESS_CAPABILITIES_REGISTER, *PPCI_EXPRESS_CAPABILITIES_REGISTER; 4924 4925 typedef union _PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER { 4926 _ANONYMOUS_STRUCT struct { 4927 ULONG MaxPayloadSizeSupported:3; 4928 ULONG PhantomFunctionsSupported:2; 4929 ULONG ExtendedTagSupported:1; 4930 ULONG L0sAcceptableLatency:3; 4931 ULONG L1AcceptableLatency:3; 4932 ULONG Undefined:3; 4933 ULONG RoleBasedErrorReporting:1; 4934 ULONG Rsvd1:2; 4935 ULONG CapturedSlotPowerLimit:8; 4936 ULONG CapturedSlotPowerLimitScale:2; 4937 ULONG Rsvd2:4; 4938 } DUMMYSTRUCTNAME; 4939 ULONG AsULONG; 4940 } PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER, *PPCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER; 4941 4942 #define PCI_EXPRESS_AER_DEVICE_CONTROL_MASK 0x07; 4943 4944 typedef union _PCI_EXPRESS_DEVICE_CONTROL_REGISTER { 4945 _ANONYMOUS_STRUCT struct { 4946 USHORT CorrectableErrorEnable:1; 4947 USHORT NonFatalErrorEnable:1; 4948 USHORT FatalErrorEnable:1; 4949 USHORT UnsupportedRequestErrorEnable:1; 4950 USHORT EnableRelaxedOrder:1; 4951 USHORT MaxPayloadSize:3; 4952 USHORT ExtendedTagEnable:1; 4953 USHORT PhantomFunctionsEnable:1; 4954 USHORT AuxPowerEnable:1; 4955 USHORT NoSnoopEnable:1; 4956 USHORT MaxReadRequestSize:3; 4957 USHORT BridgeConfigRetryEnable:1; 4958 } DUMMYSTRUCTNAME; 4959 USHORT AsUSHORT; 4960 } PCI_EXPRESS_DEVICE_CONTROL_REGISTER, *PPCI_EXPRESS_DEVICE_CONTROL_REGISTER; 4961 4962 #define PCI_EXPRESS_AER_DEVICE_STATUS_MASK 0x0F; 4963 4964 typedef union _PCI_EXPRESS_DEVICE_STATUS_REGISTER { 4965 _ANONYMOUS_STRUCT struct { 4966 USHORT CorrectableErrorDetected:1; 4967 USHORT NonFatalErrorDetected:1; 4968 USHORT FatalErrorDetected:1; 4969 USHORT UnsupportedRequestDetected:1; 4970 USHORT AuxPowerDetected:1; 4971 USHORT TransactionsPending:1; 4972 USHORT Rsvd:10; 4973 } DUMMYSTRUCTNAME; 4974 USHORT AsUSHORT; 4975 } PCI_EXPRESS_DEVICE_STATUS_REGISTER, *PPCI_EXPRESS_DEVICE_STATUS_REGISTER; 4976 4977 typedef union _PCI_EXPRESS_LINK_CAPABILITIES_REGISTER { 4978 _ANONYMOUS_STRUCT struct { 4979 ULONG MaximumLinkSpeed:4; 4980 ULONG MaximumLinkWidth:6; 4981 ULONG ActiveStatePMSupport:2; 4982 ULONG L0sExitLatency:3; 4983 ULONG L1ExitLatency:3; 4984 ULONG ClockPowerManagement:1; 4985 ULONG SurpriseDownErrorReportingCapable:1; 4986 ULONG DataLinkLayerActiveReportingCapable:1; 4987 ULONG Rsvd:3; 4988 ULONG PortNumber:8; 4989 } DUMMYSTRUCTNAME; 4990 ULONG AsULONG; 4991 } PCI_EXPRESS_LINK_CAPABILITIES_REGISTER, *PPCI_EXPRESS_LINK_CAPABILITIES_REGISTER; 4992 4993 typedef union _PCI_EXPRESS_LINK_CONTROL_REGISTER { 4994 _ANONYMOUS_STRUCT struct { 4995 USHORT ActiveStatePMControl:2; 4996 USHORT Rsvd1:1; 4997 USHORT ReadCompletionBoundary:1; 4998 USHORT LinkDisable:1; 4999 USHORT RetrainLink:1; 5000 USHORT CommonClockConfig:1; 5001 USHORT ExtendedSynch:1; 5002 USHORT EnableClockPowerManagement:1; 5003 USHORT Rsvd2:7; 5004 } DUMMYSTRUCTNAME; 5005 USHORT AsUSHORT; 5006 } PCI_EXPRESS_LINK_CONTROL_REGISTER, *PPCI_EXPRESS_LINK_CONTROL_REGISTER; 5007 5008 typedef union _PCI_EXPRESS_LINK_STATUS_REGISTER { 5009 _ANONYMOUS_STRUCT struct { 5010 USHORT LinkSpeed:4; 5011 USHORT LinkWidth:6; 5012 USHORT Undefined:1; 5013 USHORT LinkTraining:1; 5014 USHORT SlotClockConfig:1; 5015 USHORT DataLinkLayerActive:1; 5016 USHORT Rsvd:2; 5017 } DUMMYSTRUCTNAME; 5018 USHORT AsUSHORT; 5019 } PCI_EXPRESS_LINK_STATUS_REGISTER, *PPCI_EXPRESS_LINK_STATUS_REGISTER; 5020 5021 typedef union _PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER { 5022 _ANONYMOUS_STRUCT struct { 5023 ULONG AttentionButtonPresent:1; 5024 ULONG PowerControllerPresent:1; 5025 ULONG MRLSensorPresent:1; 5026 ULONG AttentionIndicatorPresent:1; 5027 ULONG PowerIndicatorPresent:1; 5028 ULONG HotPlugSurprise:1; 5029 ULONG HotPlugCapable:1; 5030 ULONG SlotPowerLimit:8; 5031 ULONG SlotPowerLimitScale:2; 5032 ULONG ElectromechanicalLockPresent:1; 5033 ULONG NoCommandCompletedSupport:1; 5034 ULONG PhysicalSlotNumber:13; 5035 } DUMMYSTRUCTNAME; 5036 ULONG AsULONG; 5037 } PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_SLOT_CAPABILITIES_REGISTER; 5038 5039 typedef union _PCI_EXPRESS_SLOT_CONTROL_REGISTER { 5040 _ANONYMOUS_STRUCT struct { 5041 USHORT AttentionButtonEnable:1; 5042 USHORT PowerFaultDetectEnable:1; 5043 USHORT MRLSensorEnable:1; 5044 USHORT PresenceDetectEnable:1; 5045 USHORT CommandCompletedEnable:1; 5046 USHORT HotPlugInterruptEnable:1; 5047 USHORT AttentionIndicatorControl:2; 5048 USHORT PowerIndicatorControl:2; 5049 USHORT PowerControllerControl:1; 5050 USHORT ElectromechanicalLockControl:1; 5051 USHORT DataLinkStateChangeEnable:1; 5052 USHORT Rsvd:3; 5053 } DUMMYSTRUCTNAME; 5054 USHORT AsUSHORT; 5055 } PCI_EXPRESS_SLOT_CONTROL_REGISTER, *PPCI_EXPRESS_SLOT_CONTROL_REGISTER; 5056 5057 typedef union _PCI_EXPRESS_SLOT_STATUS_REGISTER { 5058 _ANONYMOUS_STRUCT struct { 5059 USHORT AttentionButtonPressed:1; 5060 USHORT PowerFaultDetected:1; 5061 USHORT MRLSensorChanged:1; 5062 USHORT PresenceDetectChanged:1; 5063 USHORT CommandCompleted:1; 5064 USHORT MRLSensorState:1; 5065 USHORT PresenceDetectState:1; 5066 USHORT ElectromechanicalLockEngaged:1; 5067 USHORT DataLinkStateChanged:1; 5068 USHORT Rsvd:7; 5069 } DUMMYSTRUCTNAME; 5070 USHORT AsUSHORT; 5071 } PCI_EXPRESS_SLOT_STATUS_REGISTER, *PPCI_EXPRESS_SLOT_STATUS_REGISTER; 5072 5073 typedef union _PCI_EXPRESS_ROOT_CONTROL_REGISTER { 5074 _ANONYMOUS_STRUCT struct { 5075 USHORT CorrectableSerrEnable:1; 5076 USHORT NonFatalSerrEnable:1; 5077 USHORT FatalSerrEnable:1; 5078 USHORT PMEInterruptEnable:1; 5079 USHORT CRSSoftwareVisibilityEnable:1; 5080 USHORT Rsvd:11; 5081 } DUMMYSTRUCTNAME; 5082 USHORT AsUSHORT; 5083 } PCI_EXPRESS_ROOT_CONTROL_REGISTER, *PPCI_EXPRESS_ROOT_CONTROL_REGISTER; 5084 5085 typedef union _PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER { 5086 _ANONYMOUS_STRUCT struct { 5087 USHORT CRSSoftwareVisibility:1; 5088 USHORT Rsvd:15; 5089 } DUMMYSTRUCTNAME; 5090 USHORT AsUSHORT; 5091 } PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_ROOT_CAPABILITIES_REGISTER; 5092 5093 typedef union _PCI_EXPRESS_ROOT_STATUS_REGISTER { 5094 _ANONYMOUS_STRUCT struct { 5095 ULONG PMERequestorId:16; 5096 ULONG PMEStatus:1; 5097 ULONG PMEPending:1; 5098 ULONG Rsvd:14; 5099 } DUMMYSTRUCTNAME; 5100 ULONG AsULONG; 5101 } PCI_EXPRESS_ROOT_STATUS_REGISTER, *PPCI_EXPRESS_ROOT_STATUS_REGISTER; 5102 5103 typedef struct _PCI_EXPRESS_CAPABILITY { 5104 PCI_CAPABILITIES_HEADER Header; 5105 PCI_EXPRESS_CAPABILITIES_REGISTER ExpressCapabilities; 5106 PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER DeviceCapabilities; 5107 PCI_EXPRESS_DEVICE_CONTROL_REGISTER DeviceControl; 5108 PCI_EXPRESS_DEVICE_STATUS_REGISTER DeviceStatus; 5109 PCI_EXPRESS_LINK_CAPABILITIES_REGISTER LinkCapabilities; 5110 PCI_EXPRESS_LINK_CONTROL_REGISTER LinkControl; 5111 PCI_EXPRESS_LINK_STATUS_REGISTER LinkStatus; 5112 PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER SlotCapabilities; 5113 PCI_EXPRESS_SLOT_CONTROL_REGISTER SlotControl; 5114 PCI_EXPRESS_SLOT_STATUS_REGISTER SlotStatus; 5115 PCI_EXPRESS_ROOT_CONTROL_REGISTER RootControl; 5116 PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER RootCapabilities; 5117 PCI_EXPRESS_ROOT_STATUS_REGISTER RootStatus; 5118 } PCI_EXPRESS_CAPABILITY, *PPCI_EXPRESS_CAPABILITY; 5119 5120 typedef enum { 5121 MRLClosed = 0, 5122 MRLOpen 5123 } PCI_EXPRESS_MRL_STATE; 5124 5125 typedef enum { 5126 SlotEmpty = 0, 5127 CardPresent 5128 } PCI_EXPRESS_CARD_PRESENCE; 5129 5130 typedef enum { 5131 IndicatorOn = 1, 5132 IndicatorBlink, 5133 IndicatorOff 5134 } PCI_EXPRESS_INDICATOR_STATE; 5135 5136 typedef enum { 5137 PowerOn = 0, 5138 PowerOff 5139 } PCI_EXPRESS_POWER_STATE; 5140 5141 typedef enum { 5142 L0sEntrySupport = 1, 5143 L0sAndL1EntrySupport = 3 5144 } PCI_EXPRESS_ASPM_SUPPORT; 5145 5146 typedef enum { 5147 L0sAndL1EntryDisabled, 5148 L0sEntryEnabled, 5149 L1EntryEnabled, 5150 L0sAndL1EntryEnabled 5151 } PCI_EXPRESS_ASPM_CONTROL; 5152 5153 typedef enum { 5154 L0s_Below64ns = 0, 5155 L0s_64ns_128ns, 5156 L0s_128ns_256ns, 5157 L0s_256ns_512ns, 5158 L0s_512ns_1us, 5159 L0s_1us_2us, 5160 L0s_2us_4us, 5161 L0s_Above4us 5162 } PCI_EXPRESS_L0s_EXIT_LATENCY; 5163 5164 typedef enum { 5165 L1_Below1us = 0, 5166 L1_1us_2us, 5167 L1_2us_4us, 5168 L1_4us_8us, 5169 L1_8us_16us, 5170 L1_16us_32us, 5171 L1_32us_64us, 5172 L1_Above64us 5173 } PCI_EXPRESS_L1_EXIT_LATENCY; 5174 5175 typedef enum { 5176 PciExpressEndpoint = 0, 5177 PciExpressLegacyEndpoint, 5178 PciExpressRootPort = 4, 5179 PciExpressUpstreamSwitchPort, 5180 PciExpressDownstreamSwitchPort, 5181 PciExpressToPciXBridge, 5182 PciXToExpressBridge, 5183 PciExpressRootComplexIntegratedEndpoint, 5184 PciExpressRootComplexEventCollector 5185 } PCI_EXPRESS_DEVICE_TYPE; 5186 5187 typedef enum { 5188 MaxPayload128Bytes = 0, 5189 MaxPayload256Bytes, 5190 MaxPayload512Bytes, 5191 MaxPayload1024Bytes, 5192 MaxPayload2048Bytes, 5193 MaxPayload4096Bytes 5194 } PCI_EXPRESS_MAX_PAYLOAD_SIZE; 5195 5196 typedef union _PCI_EXPRESS_PME_REQUESTOR_ID { 5197 _ANONYMOUS_STRUCT struct { 5198 USHORT FunctionNumber:3; 5199 USHORT DeviceNumber:5; 5200 USHORT BusNumber:8; 5201 } DUMMYSTRUCTNAME; 5202 USHORT AsUSHORT; 5203 } PCI_EXPRESS_PME_REQUESTOR_ID, *PPCI_EXPRESS_PME_REQUESTOR_ID; 5204 5205 typedef enum _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE { 5206 ResourceTypeSingle = 0, 5207 ResourceTypeRange, 5208 ResourceTypeExtendedCounterConfiguration, 5209 ResourceTypeOverflow, 5210 ResourceTypeMax 5211 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE; 5212 5213 typedef struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR { 5214 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE Type; 5215 ULONG Flags; 5216 union { 5217 ULONG CounterIndex; 5218 ULONG ExtendedRegisterAddress; 5219 struct { 5220 ULONG Begin; 5221 ULONG End; 5222 } Range; 5223 } u; 5224 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR, *PPHYSICAL_COUNTER_RESOURCE_DESCRIPTOR; 5225 5226 typedef struct _PHYSICAL_COUNTER_RESOURCE_LIST { 5227 ULONG Count; 5228 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR Descriptors[ANYSIZE_ARRAY]; 5229 } PHYSICAL_COUNTER_RESOURCE_LIST, *PPHYSICAL_COUNTER_RESOURCE_LIST; 5230 5231 typedef VOID 5232 (NTAPI *PciPin2Line)( 5233 _In_ struct _BUS_HANDLER *BusHandler, 5234 _In_ struct _BUS_HANDLER *RootHandler, 5235 _In_ PCI_SLOT_NUMBER SlotNumber, 5236 _In_ PPCI_COMMON_CONFIG PciData); 5237 5238 typedef VOID 5239 (NTAPI *PciLine2Pin)( 5240 _In_ struct _BUS_HANDLER *BusHandler, 5241 _In_ struct _BUS_HANDLER *RootHandler, 5242 _In_ PCI_SLOT_NUMBER SlotNumber, 5243 _In_ PPCI_COMMON_CONFIG PciNewData, 5244 _In_ PPCI_COMMON_CONFIG PciOldData); 5245 5246 typedef VOID 5247 (NTAPI *PciReadWriteConfig)( 5248 _In_ struct _BUS_HANDLER *BusHandler, 5249 _In_ PCI_SLOT_NUMBER Slot, 5250 _In_reads_bytes_(Length) PVOID Buffer, 5251 _In_ ULONG Offset, 5252 _In_ ULONG Length); 5253 5254 #define PCI_DATA_TAG ' ICP' 5255 #define PCI_DATA_VERSION 1 5256 5257 typedef struct _PCIBUSDATA { 5258 ULONG Tag; 5259 ULONG Version; 5260 PciReadWriteConfig ReadConfig; 5261 PciReadWriteConfig WriteConfig; 5262 PciPin2Line Pin2Line; 5263 PciLine2Pin Line2Pin; 5264 PCI_SLOT_NUMBER ParentSlot; 5265 PVOID Reserved[4]; 5266 } PCIBUSDATA, *PPCIBUSDATA; 5267 5268 #ifndef _PCIINTRF_X_ 5269 #define _PCIINTRF_X_ 5270 5271 typedef ULONG 5272 (NTAPI *PCI_READ_WRITE_CONFIG)( 5273 _In_ PVOID Context, 5274 _In_ ULONG BusOffset, 5275 _In_ ULONG Slot, 5276 _In_reads_bytes_(Length) PVOID Buffer, 5277 _In_ ULONG Offset, 5278 _In_ ULONG Length); 5279 5280 typedef VOID 5281 (NTAPI *PCI_PIN_TO_LINE)( 5282 _In_ PVOID Context, 5283 _In_ PPCI_COMMON_CONFIG PciData); 5284 5285 typedef VOID 5286 (NTAPI *PCI_LINE_TO_PIN)( 5287 _In_ PVOID Context, 5288 _In_ PPCI_COMMON_CONFIG PciNewData, 5289 _In_ PPCI_COMMON_CONFIG PciOldData); 5290 5291 typedef VOID 5292 (NTAPI *PCI_ROOT_BUS_CAPABILITY)( 5293 _In_ PVOID Context, 5294 _Out_ PPCI_ROOT_BUS_HARDWARE_CAPABILITY HardwareCapability); 5295 5296 typedef VOID 5297 (NTAPI *PCI_EXPRESS_WAKE_CONTROL)( 5298 _In_ PVOID Context, 5299 _In_ BOOLEAN EnableWake); 5300 5301 typedef struct _PCI_BUS_INTERFACE_STANDARD { 5302 USHORT Size; 5303 USHORT Version; 5304 PVOID Context; 5305 PINTERFACE_REFERENCE InterfaceReference; 5306 PINTERFACE_DEREFERENCE InterfaceDereference; 5307 PCI_READ_WRITE_CONFIG ReadConfig; 5308 PCI_READ_WRITE_CONFIG WriteConfig; 5309 PCI_PIN_TO_LINE PinToLine; 5310 PCI_LINE_TO_PIN LineToPin; 5311 PCI_ROOT_BUS_CAPABILITY RootBusCapability; 5312 PCI_EXPRESS_WAKE_CONTROL ExpressWakeControl; 5313 } PCI_BUS_INTERFACE_STANDARD, *PPCI_BUS_INTERFACE_STANDARD; 5314 5315 #define PCI_BUS_INTERFACE_STANDARD_VERSION 1 5316 5317 #endif /* _PCIINTRF_X_ */ 5318 5319 #if (NTDDI_VERSION >= NTDDI_WIN7) 5320 5321 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX 0x00004000 5322 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX 0x00008000 5323 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX \ 5324 (FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX | \ 5325 FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX) 5326 5327 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_DEPRECATED 0x00000200 5328 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_DEPRECATED 0x00000300 5329 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_DEPRECATED 0x00000300 5330 5331 #else 5332 5333 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 0x00000200 5334 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 0x00000300 5335 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 0x00000300 5336 5337 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 5338 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 5339 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 5340 5341 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 5342 5343 #define FILE_CHARACTERISTICS_PROPAGATED (FILE_REMOVABLE_MEDIA | \ 5344 FILE_READ_ONLY_DEVICE | \ 5345 FILE_FLOPPY_DISKETTE | \ 5346 FILE_WRITE_ONCE_MEDIA | \ 5347 FILE_DEVICE_SECURE_OPEN) 5348 5349 typedef struct _FILE_ALIGNMENT_INFORMATION { 5350 ULONG AlignmentRequirement; 5351 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; 5352 5353 typedef struct _FILE_NAME_INFORMATION { 5354 ULONG FileNameLength; 5355 WCHAR FileName[1]; 5356 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; 5357 5358 5359 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION { 5360 ULONG FileAttributes; 5361 ULONG ReparseTag; 5362 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; 5363 5364 typedef struct _FILE_DISPOSITION_INFORMATION { 5365 BOOLEAN DeleteFile; 5366 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; 5367 5368 typedef struct _FILE_END_OF_FILE_INFORMATION { 5369 LARGE_INTEGER EndOfFile; 5370 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; 5371 5372 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { 5373 LARGE_INTEGER ValidDataLength; 5374 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; 5375 5376 typedef struct _FILE_FS_LABEL_INFORMATION { 5377 ULONG VolumeLabelLength; 5378 WCHAR VolumeLabel[1]; 5379 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; 5380 5381 typedef struct _FILE_FS_VOLUME_INFORMATION { 5382 LARGE_INTEGER VolumeCreationTime; 5383 ULONG VolumeSerialNumber; 5384 ULONG VolumeLabelLength; 5385 BOOLEAN SupportsObjects; 5386 WCHAR VolumeLabel[1]; 5387 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; 5388 5389 typedef struct _FILE_FS_SIZE_INFORMATION { 5390 LARGE_INTEGER TotalAllocationUnits; 5391 LARGE_INTEGER AvailableAllocationUnits; 5392 ULONG SectorsPerAllocationUnit; 5393 ULONG BytesPerSector; 5394 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; 5395 5396 typedef struct _FILE_FS_FULL_SIZE_INFORMATION { 5397 LARGE_INTEGER TotalAllocationUnits; 5398 LARGE_INTEGER CallerAvailableAllocationUnits; 5399 LARGE_INTEGER ActualAvailableAllocationUnits; 5400 ULONG SectorsPerAllocationUnit; 5401 ULONG BytesPerSector; 5402 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; 5403 5404 typedef struct _FILE_FS_OBJECTID_INFORMATION { 5405 UCHAR ObjectId[16]; 5406 UCHAR ExtendedInfo[48]; 5407 } FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; 5408 5409 typedef union _FILE_SEGMENT_ELEMENT { 5410 PVOID64 Buffer; 5411 ULONGLONG Alignment; 5412 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT; 5413 5414 #define IOCTL_AVIO_ALLOCATE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 5415 #define IOCTL_AVIO_FREE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 5416 #define IOCTL_AVIO_MODIFY_STREAM CTL_CODE(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 5417 5418 typedef enum _BUS_DATA_TYPE { 5419 ConfigurationSpaceUndefined = -1, 5420 Cmos, 5421 EisaConfiguration, 5422 Pos, 5423 CbusConfiguration, 5424 PCIConfiguration, 5425 VMEConfiguration, 5426 NuBusConfiguration, 5427 PCMCIAConfiguration, 5428 MPIConfiguration, 5429 MPSAConfiguration, 5430 PNPISAConfiguration, 5431 SgiInternalConfiguration, 5432 MaximumBusDataType 5433 } BUS_DATA_TYPE, *PBUS_DATA_TYPE; 5434 5435 /* Some Server 2003 DDK definitions */ 5436 #define PCI_INT_ROUTE_INTRF_STANDARD_VER 1 5437 5438 typedef NTSTATUS 5439 (NTAPI *PLEGACY_DEVICE_DETECTION_HANDLER)( 5440 IN PVOID Context, 5441 IN INTERFACE_TYPE LegacyBusType, 5442 IN ULONG BusNumber, 5443 IN ULONG SlotNumber, 5444 OUT PDEVICE_OBJECT *PhysicalDeviceObject); 5445 5446 typedef struct _ROUTING_TOKEN { 5447 PVOID LinkNode; 5448 ULONG StaticVector; 5449 UCHAR Flags; 5450 } ROUTING_TOKEN, *PROUTING_TOKEN; 5451 5452 typedef NTSTATUS 5453 (NTAPI *PGET_INTERRUPT_ROUTING)( 5454 IN PDEVICE_OBJECT Pdo, 5455 OUT ULONG *Bus, 5456 OUT ULONG *PciSlot, 5457 OUT UCHAR *InterruptLine, 5458 OUT UCHAR *InterruptPin, 5459 OUT UCHAR *ClassCode, 5460 OUT UCHAR *SubClassCode, 5461 OUT PDEVICE_OBJECT *ParentPdo, 5462 OUT ROUTING_TOKEN *RoutingToken, 5463 OUT UCHAR *Flags); 5464 5465 typedef NTSTATUS 5466 (NTAPI *PSET_INTERRUPT_ROUTING_TOKEN)( 5467 IN PDEVICE_OBJECT Pdo, 5468 IN PROUTING_TOKEN RoutingToken); 5469 5470 typedef VOID 5471 (NTAPI *PUPDATE_INTERRUPT_LINE)( 5472 IN PDEVICE_OBJECT Pdo, 5473 IN UCHAR LineRegister); 5474 5475 typedef struct _INT_ROUTE_INTERFACE_STANDARD { 5476 USHORT Size; 5477 USHORT Version; 5478 PVOID Context; 5479 PINTERFACE_REFERENCE InterfaceReference; 5480 PINTERFACE_DEREFERENCE InterfaceDereference; 5481 PGET_INTERRUPT_ROUTING GetInterruptRouting; 5482 PSET_INTERRUPT_ROUTING_TOKEN SetInterruptRoutingToken; 5483 PUPDATE_INTERRUPT_LINE UpdateInterruptLine; 5484 } INT_ROUTE_INTERFACE_STANDARD, *PINT_ROUTE_INTERFACE_STANDARD; 5485 5486 typedef struct _LEGACY_DEVICE_DETECTION_INTERFACE { 5487 USHORT Size; 5488 USHORT Version; 5489 PVOID Context; 5490 PINTERFACE_REFERENCE InterfaceReference; 5491 PINTERFACE_DEREFERENCE InterfaceDereference; 5492 PLEGACY_DEVICE_DETECTION_HANDLER LegacyDeviceDetection; 5493 } LEGACY_DEVICE_DETECTION_INTERFACE, *PLEGACY_DEVICE_DETECTION_INTERFACE; 5494 5495 /* FIXME : These definitions don't exist in public headers */ 5496 5497 #define PCI_CB_INTRF_VERSION 1 5498 #define PCI_PME_INTRF_STANDARD_VER 1 5499 #define PNP_LOCATION_INTERFACE_VERSION 1 5500 5501 DEFINE_GUID(GUID_PCI_CARDBUS_INTERFACE_PRIVATE, 0xcca82f31, 0x54d6, 0x11d1, 0x82, 0x24, 0x00, 0xa0, 0xc9, 0x32, 0x43, 0x85); 5502 DEFINE_GUID(GUID_PCI_PME_INTERFACE, 0xaac7e6ac, 0xbb0b, 0x11d2, 0xb4, 0x84, 0x00, 0xc0, 0x4f, 0x72, 0xde, 0x8b); 5503 5504 typedef NTSTATUS 5505 (NTAPI *PCARDBUSADD)( 5506 IN PDEVICE_OBJECT DeviceObject, 5507 IN OUT PVOID *DeviceContext); 5508 5509 typedef NTSTATUS 5510 (NTAPI *PCARDBUSDELETE)( 5511 IN PVOID DeviceContext); 5512 5513 typedef NTSTATUS 5514 (NTAPI *PCARDBUSPCIDISPATCH)( 5515 IN PVOID DeviceContext, 5516 IN PIRP Irp); 5517 5518 typedef VOID 5519 (NTAPI *PPME_SET_PME_ENABLE)( 5520 IN PDEVICE_OBJECT Pdo, 5521 IN BOOLEAN PmeEnable); 5522 5523 typedef VOID 5524 (NTAPI *PPME_CLEAR_PME_STATUS)( 5525 IN PDEVICE_OBJECT Pdo); 5526 5527 typedef VOID 5528 (NTAPI *PPME_GET_INFORMATION)( 5529 IN PDEVICE_OBJECT Pdo, 5530 OUT PBOOLEAN PmeCapable, 5531 OUT PBOOLEAN PmeStatus, 5532 OUT PBOOLEAN PmeEnable); 5533 5534 typedef struct _PCI_CARDBUS_INTERFACE_PRIVATE { 5535 USHORT Size; 5536 USHORT Version; 5537 PVOID Context; 5538 PINTERFACE_REFERENCE InterfaceReference; 5539 PINTERFACE_DEREFERENCE InterfaceDereference; 5540 PDRIVER_OBJECT DriverObject; 5541 PCARDBUSADD AddCardBus; 5542 PCARDBUSDELETE DeleteCardBus; 5543 PCARDBUSPCIDISPATCH DispatchPnp; 5544 } PCI_CARDBUS_INTERFACE_PRIVATE, *PPCI_CARDBUS_INTERFACE_PRIVATE; 5545 5546 typedef struct _PCI_PME_INTERFACE { 5547 USHORT Size; 5548 USHORT Version; 5549 PVOID Context; 5550 PINTERFACE_REFERENCE InterfaceReference; 5551 PINTERFACE_DEREFERENCE InterfaceDereference; 5552 PPME_GET_INFORMATION GetPmeInformation; 5553 PPME_CLEAR_PME_STATUS ClearPmeStatus; 5554 PPME_SET_PME_ENABLE UpdateEnable; 5555 } PCI_PME_INTERFACE, *PPCI_PME_INTERFACE; 5556 5557 $endif (_NTDDK_) 5558 $if (_NTIFS_) 5559 5560 #define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007 5561 #define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008 5562 #define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009 5563 5564 /* also in winnt.h */ 5565 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 5566 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 5567 #define FILE_NOTIFY_CHANGE_NAME 0x00000003 5568 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 5569 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 5570 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 5571 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 5572 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 5573 #define FILE_NOTIFY_CHANGE_EA 0x00000080 5574 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 5575 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 5576 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 5577 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 5578 #define FILE_NOTIFY_VALID_MASK 0x00000fff 5579 5580 #define FILE_ACTION_ADDED 0x00000001 5581 #define FILE_ACTION_REMOVED 0x00000002 5582 #define FILE_ACTION_MODIFIED 0x00000003 5583 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 5584 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 5585 #define FILE_ACTION_ADDED_STREAM 0x00000006 5586 #define FILE_ACTION_REMOVED_STREAM 0x00000007 5587 #define FILE_ACTION_MODIFIED_STREAM 0x00000008 5588 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009 5589 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A 5590 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B 5591 /* end winnt.h */ 5592 5593 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000 5594 #define FILE_PIPE_MESSAGE_TYPE 0x00000001 5595 5596 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000 5597 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002 5598 5599 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000 5600 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002 5601 #define FILE_PIPE_TYPE_VALID_MASK 0x00000003 5602 5603 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000 5604 #define FILE_PIPE_MESSAGE_MODE 0x00000001 5605 5606 #define FILE_PIPE_QUEUE_OPERATION 0x00000000 5607 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001 5608 5609 #define FILE_PIPE_INBOUND 0x00000000 5610 #define FILE_PIPE_OUTBOUND 0x00000001 5611 #define FILE_PIPE_FULL_DUPLEX 0x00000002 5612 5613 #define FILE_PIPE_DISCONNECTED_STATE 0x00000001 5614 #define FILE_PIPE_LISTENING_STATE 0x00000002 5615 #define FILE_PIPE_CONNECTED_STATE 0x00000003 5616 #define FILE_PIPE_CLOSING_STATE 0x00000004 5617 5618 #define FILE_PIPE_CLIENT_END 0x00000000 5619 #define FILE_PIPE_SERVER_END 0x00000001 5620 5621 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 5622 #define FILE_CASE_PRESERVED_NAMES 0x00000002 5623 #define FILE_UNICODE_ON_DISK 0x00000004 5624 #define FILE_PERSISTENT_ACLS 0x00000008 5625 #define FILE_FILE_COMPRESSION 0x00000010 5626 #define FILE_VOLUME_QUOTAS 0x00000020 5627 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 5628 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 5629 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 5630 #define FILE_VOLUME_IS_COMPRESSED 0x00008000 5631 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 5632 #define FILE_SUPPORTS_ENCRYPTION 0x00020000 5633 #define FILE_NAMED_STREAMS 0x00040000 5634 #define FILE_READ_ONLY_VOLUME 0x00080000 5635 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 5636 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000 5637 #define FILE_SUPPORTS_HARD_LINKS 0x00400000 5638 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 5639 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 5640 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000 5641 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000 5642 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000 5643 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000 5644 #define FILE_DAX_VOLUME 0x20000000 5645 5646 #define FILE_NEED_EA 0x00000080 5647 5648 #define FILE_EA_TYPE_BINARY 0xfffe 5649 #define FILE_EA_TYPE_ASCII 0xfffd 5650 #define FILE_EA_TYPE_BITMAP 0xfffb 5651 #define FILE_EA_TYPE_METAFILE 0xfffa 5652 #define FILE_EA_TYPE_ICON 0xfff9 5653 #define FILE_EA_TYPE_EA 0xffee 5654 #define FILE_EA_TYPE_MVMT 0xffdf 5655 #define FILE_EA_TYPE_MVST 0xffde 5656 #define FILE_EA_TYPE_ASN1 0xffdd 5657 #define FILE_EA_TYPE_FAMILY_IDS 0xff01 5658 5659 typedef struct _FILE_NOTIFY_INFORMATION { 5660 ULONG NextEntryOffset; 5661 ULONG Action; 5662 ULONG FileNameLength; 5663 WCHAR FileName[1]; 5664 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION; 5665 5666 typedef struct _FILE_DIRECTORY_INFORMATION { 5667 ULONG NextEntryOffset; 5668 ULONG FileIndex; 5669 LARGE_INTEGER CreationTime; 5670 LARGE_INTEGER LastAccessTime; 5671 LARGE_INTEGER LastWriteTime; 5672 LARGE_INTEGER ChangeTime; 5673 LARGE_INTEGER EndOfFile; 5674 LARGE_INTEGER AllocationSize; 5675 ULONG FileAttributes; 5676 ULONG FileNameLength; 5677 WCHAR FileName[1]; 5678 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; 5679 5680 typedef struct _FILE_FULL_DIR_INFORMATION { 5681 ULONG NextEntryOffset; 5682 ULONG FileIndex; 5683 LARGE_INTEGER CreationTime; 5684 LARGE_INTEGER LastAccessTime; 5685 LARGE_INTEGER LastWriteTime; 5686 LARGE_INTEGER ChangeTime; 5687 LARGE_INTEGER EndOfFile; 5688 LARGE_INTEGER AllocationSize; 5689 ULONG FileAttributes; 5690 ULONG FileNameLength; 5691 ULONG EaSize; 5692 WCHAR FileName[1]; 5693 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; 5694 5695 typedef struct _FILE_ID_FULL_DIR_INFORMATION { 5696 ULONG NextEntryOffset; 5697 ULONG FileIndex; 5698 LARGE_INTEGER CreationTime; 5699 LARGE_INTEGER LastAccessTime; 5700 LARGE_INTEGER LastWriteTime; 5701 LARGE_INTEGER ChangeTime; 5702 LARGE_INTEGER EndOfFile; 5703 LARGE_INTEGER AllocationSize; 5704 ULONG FileAttributes; 5705 ULONG FileNameLength; 5706 ULONG EaSize; 5707 LARGE_INTEGER FileId; 5708 WCHAR FileName[1]; 5709 } FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION; 5710 5711 typedef struct _FILE_BOTH_DIR_INFORMATION { 5712 ULONG NextEntryOffset; 5713 ULONG FileIndex; 5714 LARGE_INTEGER CreationTime; 5715 LARGE_INTEGER LastAccessTime; 5716 LARGE_INTEGER LastWriteTime; 5717 LARGE_INTEGER ChangeTime; 5718 LARGE_INTEGER EndOfFile; 5719 LARGE_INTEGER AllocationSize; 5720 ULONG FileAttributes; 5721 ULONG FileNameLength; 5722 ULONG EaSize; 5723 CCHAR ShortNameLength; 5724 WCHAR ShortName[12]; 5725 WCHAR FileName[1]; 5726 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; 5727 5728 typedef struct _FILE_ID_BOTH_DIR_INFORMATION { 5729 ULONG NextEntryOffset; 5730 ULONG FileIndex; 5731 LARGE_INTEGER CreationTime; 5732 LARGE_INTEGER LastAccessTime; 5733 LARGE_INTEGER LastWriteTime; 5734 LARGE_INTEGER ChangeTime; 5735 LARGE_INTEGER EndOfFile; 5736 LARGE_INTEGER AllocationSize; 5737 ULONG FileAttributes; 5738 ULONG FileNameLength; 5739 ULONG EaSize; 5740 CCHAR ShortNameLength; 5741 WCHAR ShortName[12]; 5742 LARGE_INTEGER FileId; 5743 WCHAR FileName[1]; 5744 } FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; 5745 5746 typedef struct _FILE_NAMES_INFORMATION { 5747 ULONG NextEntryOffset; 5748 ULONG FileIndex; 5749 ULONG FileNameLength; 5750 WCHAR FileName[1]; 5751 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION; 5752 5753 typedef struct _FILE_ID_GLOBAL_TX_DIR_INFORMATION { 5754 ULONG NextEntryOffset; 5755 ULONG FileIndex; 5756 LARGE_INTEGER CreationTime; 5757 LARGE_INTEGER LastAccessTime; 5758 LARGE_INTEGER LastWriteTime; 5759 LARGE_INTEGER ChangeTime; 5760 LARGE_INTEGER EndOfFile; 5761 LARGE_INTEGER AllocationSize; 5762 ULONG FileAttributes; 5763 ULONG FileNameLength; 5764 LARGE_INTEGER FileId; 5765 GUID LockingTransactionId; 5766 ULONG TxInfoFlags; 5767 WCHAR FileName[1]; 5768 } FILE_ID_GLOBAL_TX_DIR_INFORMATION, *PFILE_ID_GLOBAL_TX_DIR_INFORMATION; 5769 5770 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_WRITELOCKED 0x00000001 5771 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_TO_TX 0x00000002 5772 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_OUTSIDE_TX 0x00000004 5773 5774 typedef struct _FILE_OBJECTID_INFORMATION { 5775 LONGLONG FileReference; 5776 UCHAR ObjectId[16]; 5777 _ANONYMOUS_UNION union { 5778 _ANONYMOUS_STRUCT struct { 5779 UCHAR BirthVolumeId[16]; 5780 UCHAR BirthObjectId[16]; 5781 UCHAR DomainId[16]; 5782 } DUMMYSTRUCTNAME; 5783 UCHAR ExtendedInfo[48]; 5784 } DUMMYUNIONNAME; 5785 } FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION; 5786 5787 #define ANSI_DOS_STAR ('<') 5788 #define ANSI_DOS_QM ('>') 5789 #define ANSI_DOS_DOT ('"') 5790 5791 #define DOS_STAR (L'<') 5792 #define DOS_QM (L'>') 5793 #define DOS_DOT (L'"') 5794 5795 typedef struct _FILE_INTERNAL_INFORMATION { 5796 LARGE_INTEGER IndexNumber; 5797 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; 5798 5799 typedef struct _FILE_EA_INFORMATION { 5800 ULONG EaSize; 5801 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; 5802 5803 typedef struct _FILE_ACCESS_INFORMATION { 5804 ACCESS_MASK AccessFlags; 5805 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; 5806 5807 typedef struct _FILE_MODE_INFORMATION { 5808 ULONG Mode; 5809 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION; 5810 5811 typedef struct _FILE_ALL_INFORMATION { 5812 FILE_BASIC_INFORMATION BasicInformation; 5813 FILE_STANDARD_INFORMATION StandardInformation; 5814 FILE_INTERNAL_INFORMATION InternalInformation; 5815 FILE_EA_INFORMATION EaInformation; 5816 FILE_ACCESS_INFORMATION AccessInformation; 5817 FILE_POSITION_INFORMATION PositionInformation; 5818 FILE_MODE_INFORMATION ModeInformation; 5819 FILE_ALIGNMENT_INFORMATION AlignmentInformation; 5820 FILE_NAME_INFORMATION NameInformation; 5821 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; 5822 5823 typedef struct _FILE_ALLOCATION_INFORMATION { 5824 LARGE_INTEGER AllocationSize; 5825 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION; 5826 5827 typedef struct _FILE_COMPRESSION_INFORMATION { 5828 LARGE_INTEGER CompressedFileSize; 5829 USHORT CompressionFormat; 5830 UCHAR CompressionUnitShift; 5831 UCHAR ChunkShift; 5832 UCHAR ClusterShift; 5833 UCHAR Reserved[3]; 5834 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION; 5835 5836 typedef struct _FILE_LINK_INFORMATION { 5837 BOOLEAN ReplaceIfExists; 5838 HANDLE RootDirectory; 5839 ULONG FileNameLength; 5840 WCHAR FileName[1]; 5841 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; 5842 5843 typedef struct _FILE_MOVE_CLUSTER_INFORMATION { 5844 ULONG ClusterCount; 5845 HANDLE RootDirectory; 5846 ULONG FileNameLength; 5847 WCHAR FileName[1]; 5848 } FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION; 5849 5850 typedef struct _FILE_RENAME_INFORMATION { 5851 BOOLEAN ReplaceIfExists; 5852 HANDLE RootDirectory; 5853 ULONG FileNameLength; 5854 WCHAR FileName[1]; 5855 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION; 5856 5857 typedef struct _FILE_STREAM_INFORMATION { 5858 ULONG NextEntryOffset; 5859 ULONG StreamNameLength; 5860 LARGE_INTEGER StreamSize; 5861 LARGE_INTEGER StreamAllocationSize; 5862 WCHAR StreamName[1]; 5863 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION; 5864 5865 typedef struct _FILE_TRACKING_INFORMATION { 5866 HANDLE DestinationFile; 5867 ULONG ObjectInformationLength; 5868 CHAR ObjectInformation[1]; 5869 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION; 5870 5871 typedef struct _FILE_COMPLETION_INFORMATION { 5872 HANDLE Port; 5873 PVOID Key; 5874 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION; 5875 5876 typedef struct _FILE_PIPE_INFORMATION { 5877 ULONG ReadMode; 5878 ULONG CompletionMode; 5879 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; 5880 5881 typedef struct _FILE_PIPE_LOCAL_INFORMATION { 5882 ULONG NamedPipeType; 5883 ULONG NamedPipeConfiguration; 5884 ULONG MaximumInstances; 5885 ULONG CurrentInstances; 5886 ULONG InboundQuota; 5887 ULONG ReadDataAvailable; 5888 ULONG OutboundQuota; 5889 ULONG WriteQuotaAvailable; 5890 ULONG NamedPipeState; 5891 ULONG NamedPipeEnd; 5892 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; 5893 5894 typedef struct _FILE_PIPE_REMOTE_INFORMATION { 5895 LARGE_INTEGER CollectDataTime; 5896 ULONG MaximumCollectionCount; 5897 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION; 5898 5899 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION { 5900 ULONG MaximumMessageSize; 5901 ULONG MailslotQuota; 5902 ULONG NextMessageSize; 5903 ULONG MessagesAvailable; 5904 LARGE_INTEGER ReadTimeout; 5905 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION; 5906 5907 typedef struct _FILE_MAILSLOT_SET_INFORMATION { 5908 PLARGE_INTEGER ReadTimeout; 5909 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION; 5910 5911 typedef struct _FILE_REPARSE_POINT_INFORMATION { 5912 LONGLONG FileReference; 5913 ULONG Tag; 5914 } FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION; 5915 5916 typedef struct _FILE_LINK_ENTRY_INFORMATION { 5917 ULONG NextEntryOffset; 5918 LONGLONG ParentFileId; 5919 ULONG FileNameLength; 5920 WCHAR FileName[1]; 5921 } FILE_LINK_ENTRY_INFORMATION, *PFILE_LINK_ENTRY_INFORMATION; 5922 5923 typedef struct _FILE_LINKS_INFORMATION { 5924 ULONG BytesNeeded; 5925 ULONG EntriesReturned; 5926 FILE_LINK_ENTRY_INFORMATION Entry; 5927 } FILE_LINKS_INFORMATION, *PFILE_LINKS_INFORMATION; 5928 5929 typedef struct _FILE_NETWORK_PHYSICAL_NAME_INFORMATION { 5930 ULONG FileNameLength; 5931 WCHAR FileName[1]; 5932 } FILE_NETWORK_PHYSICAL_NAME_INFORMATION, *PFILE_NETWORK_PHYSICAL_NAME_INFORMATION; 5933 5934 typedef struct _FILE_STANDARD_LINK_INFORMATION { 5935 ULONG NumberOfAccessibleLinks; 5936 ULONG TotalNumberOfLinks; 5937 BOOLEAN DeletePending; 5938 BOOLEAN Directory; 5939 } FILE_STANDARD_LINK_INFORMATION, *PFILE_STANDARD_LINK_INFORMATION; 5940 5941 typedef struct _FILE_GET_EA_INFORMATION { 5942 ULONG NextEntryOffset; 5943 UCHAR EaNameLength; 5944 CHAR EaName[1]; 5945 } FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION; 5946 5947 #define REMOTE_PROTOCOL_FLAG_LOOPBACK 0x00000001 5948 #define REMOTE_PROTOCOL_FLAG_OFFLINE 0x00000002 5949 5950 typedef struct _FILE_REMOTE_PROTOCOL_INFORMATION { 5951 USHORT StructureVersion; 5952 USHORT StructureSize; 5953 ULONG Protocol; 5954 USHORT ProtocolMajorVersion; 5955 USHORT ProtocolMinorVersion; 5956 USHORT ProtocolRevision; 5957 USHORT Reserved; 5958 ULONG Flags; 5959 struct { 5960 ULONG Reserved[8]; 5961 } GenericReserved; 5962 struct { 5963 ULONG Reserved[16]; 5964 } ProtocolSpecificReserved; 5965 } FILE_REMOTE_PROTOCOL_INFORMATION, *PFILE_REMOTE_PROTOCOL_INFORMATION; 5966 5967 typedef struct _FILE_GET_QUOTA_INFORMATION { 5968 ULONG NextEntryOffset; 5969 ULONG SidLength; 5970 SID Sid; 5971 } FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION; 5972 5973 typedef struct _FILE_QUOTA_INFORMATION { 5974 ULONG NextEntryOffset; 5975 ULONG SidLength; 5976 LARGE_INTEGER ChangeTime; 5977 LARGE_INTEGER QuotaUsed; 5978 LARGE_INTEGER QuotaThreshold; 5979 LARGE_INTEGER QuotaLimit; 5980 SID Sid; 5981 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION; 5982 5983 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION { 5984 ULONG FileSystemAttributes; 5985 ULONG MaximumComponentNameLength; 5986 ULONG FileSystemNameLength; 5987 WCHAR FileSystemName[1]; 5988 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION; 5989 5990 typedef struct _FILE_FS_DRIVER_PATH_INFORMATION { 5991 BOOLEAN DriverInPath; 5992 ULONG DriverNameLength; 5993 WCHAR DriverName[1]; 5994 } FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION; 5995 5996 typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION { 5997 ULONG Flags; 5998 } FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION; 5999 6000 #define FILE_VC_QUOTA_NONE 0x00000000 6001 #define FILE_VC_QUOTA_TRACK 0x00000001 6002 #define FILE_VC_QUOTA_ENFORCE 0x00000002 6003 #define FILE_VC_QUOTA_MASK 0x00000003 6004 #define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008 6005 #define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010 6006 #define FILE_VC_LOG_QUOTA_LIMIT 0x00000020 6007 #define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040 6008 #define FILE_VC_LOG_VOLUME_LIMIT 0x00000080 6009 #define FILE_VC_QUOTAS_INCOMPLETE 0x00000100 6010 #define FILE_VC_QUOTAS_REBUILDING 0x00000200 6011 #define FILE_VC_VALID_MASK 0x000003ff 6012 6013 typedef struct _FILE_FS_CONTROL_INFORMATION { 6014 LARGE_INTEGER FreeSpaceStartFiltering; 6015 LARGE_INTEGER FreeSpaceThreshold; 6016 LARGE_INTEGER FreeSpaceStopFiltering; 6017 LARGE_INTEGER DefaultQuotaThreshold; 6018 LARGE_INTEGER DefaultQuotaLimit; 6019 ULONG FileSystemControlFlags; 6020 } FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION; 6021 6022 #ifndef _FILESYSTEMFSCTL_ 6023 #define _FILESYSTEMFSCTL_ 6024 6025 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) 6026 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) 6027 #define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 6028 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS) 6029 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) 6030 #define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS) 6031 #define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) 6032 #define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) 6033 #define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) 6034 #define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) 6035 #define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS) 6036 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 6037 #define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS) 6038 #define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) 6039 #define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) 6040 #define FSCTL_SET_BOOTLOADER_ACCESSED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS) 6041 6042 #define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS) 6043 #define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS) 6044 #define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS) 6045 #define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS) 6046 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) 6047 6048 #if (_WIN32_WINNT >= 0x0400) 6049 6050 #define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS) 6051 #define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS) 6052 #define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS) 6053 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS) 6054 #define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6055 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) 6056 #define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS) 6057 6058 #endif 6059 6060 #if (_WIN32_WINNT >= 0x0500) 6061 6062 #define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS) 6063 #define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6064 #define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS) 6065 #define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6066 #define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6067 #define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) 6068 #define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6069 #define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_ANY_ACCESS) 6070 #define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA) 6071 #define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_ANY_ACCESS) 6072 #define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6073 #define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS) 6074 #define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6075 #define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA) 6076 #define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA) 6077 #define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA) 6078 #define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, FILE_ANY_ACCESS) 6079 #define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS) 6080 #define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_SPECIAL_ACCESS) 6081 #define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_SPECIAL_ACCESS) 6082 #define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_ANY_ACCESS) 6083 #define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_ANY_ACCESS) 6084 #define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_ANY_ACCESS) 6085 #define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS) 6086 #define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS) 6087 #define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS) 6088 #define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS) 6089 #define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS) 6090 #define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) 6091 #define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS) 6092 #define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA) 6093 #define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6094 6095 #endif 6096 6097 #if (_WIN32_WINNT >= 0x0600) 6098 6099 #define FSCTL_MAKE_MEDIA_COMPATIBLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 76, METHOD_BUFFERED, FILE_WRITE_DATA) 6100 #define FSCTL_SET_DEFECT_MANAGEMENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, METHOD_BUFFERED, FILE_WRITE_DATA) 6101 #define FSCTL_QUERY_SPARING_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS) 6102 #define FSCTL_QUERY_ON_DISK_VOLUME_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS) 6103 #define FSCTL_SET_VOLUME_COMPRESSION_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 80, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6104 #define FSCTL_TXFS_MODIFY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, FILE_WRITE_DATA) 6105 #define FSCTL_TXFS_QUERY_RM_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 82, METHOD_BUFFERED, FILE_READ_DATA) 6106 #define FSCTL_TXFS_ROLLFORWARD_REDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 84, METHOD_BUFFERED, FILE_WRITE_DATA) 6107 #define FSCTL_TXFS_ROLLFORWARD_UNDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 85, METHOD_BUFFERED, FILE_WRITE_DATA) 6108 #define FSCTL_TXFS_START_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, FILE_WRITE_DATA) 6109 #define FSCTL_TXFS_SHUTDOWN_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, FILE_WRITE_DATA) 6110 #define FSCTL_TXFS_READ_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 88, METHOD_BUFFERED, FILE_READ_DATA) 6111 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 89, METHOD_BUFFERED, FILE_WRITE_DATA) 6112 #define FSCTL_TXFS_CREATE_SECONDARY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 90, METHOD_BUFFERED, FILE_WRITE_DATA) 6113 #define FSCTL_TXFS_GET_METADATA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 91, METHOD_BUFFERED, FILE_READ_DATA) 6114 #define FSCTL_TXFS_GET_TRANSACTED_VERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 92, METHOD_BUFFERED, FILE_READ_DATA) 6115 #define FSCTL_TXFS_SAVEPOINT_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 94, METHOD_BUFFERED, FILE_WRITE_DATA) 6116 #define FSCTL_TXFS_CREATE_MINIVERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 95, METHOD_BUFFERED, FILE_WRITE_DATA) 6117 #define FSCTL_TXFS_TRANSACTION_ACTIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 99, METHOD_BUFFERED, FILE_READ_DATA) 6118 #define FSCTL_SET_ZERO_ON_DEALLOCATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6119 #define FSCTL_SET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS) 6120 #define FSCTL_GET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS) 6121 #define FSCTL_WAIT_FOR_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS) 6122 #define FSCTL_INITIATE_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS) 6123 #define FSCTL_CSC_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, FILE_ANY_ACCESS) 6124 #define FSCTL_SHRINK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6125 #define FSCTL_SET_SHORT_NAME_BEHAVIOR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS) 6126 #define FSCTL_DFSR_SET_GHOST_HANDLE_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 110, METHOD_BUFFERED, FILE_ANY_ACCESS) 6127 #define FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES \ 6128 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_READ_DATA) 6129 #define FSCTL_TXFS_LIST_TRANSACTIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 121, METHOD_BUFFERED, FILE_READ_DATA) 6130 #define FSCTL_QUERY_PAGEFILE_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 122, METHOD_BUFFERED, FILE_ANY_ACCESS) 6131 #define FSCTL_RESET_VOLUME_ALLOCATION_HINTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 123, METHOD_BUFFERED, FILE_ANY_ACCESS) 6132 #define FSCTL_TXFS_READ_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 126, METHOD_BUFFERED, FILE_ANY_ACCESS) 6133 6134 #endif 6135 6136 #if (_WIN32_WINNT >= 0x0601) 6137 6138 #define FSCTL_QUERY_DEPENDENT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 124, METHOD_BUFFERED, FILE_ANY_ACCESS) 6139 #define FSCTL_SD_GLOBAL_CHANGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 125, METHOD_BUFFERED, FILE_ANY_ACCESS) 6140 #define FSCTL_LOOKUP_STREAM_FROM_CLUSTER CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 127, METHOD_BUFFERED, FILE_ANY_ACCESS) 6141 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 128, METHOD_BUFFERED, FILE_ANY_ACCESS) 6142 #define FSCTL_FILE_TYPE_NOTIFICATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 129, METHOD_BUFFERED, FILE_ANY_ACCESS) 6143 #define FSCTL_GET_BOOT_AREA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 140, METHOD_BUFFERED, FILE_ANY_ACCESS) 6144 #define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 141, METHOD_BUFFERED, FILE_ANY_ACCESS) 6145 #define FSCTL_SET_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS) 6146 #define FSCTL_QUERY_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 143, METHOD_BUFFERED, FILE_ANY_ACCESS) 6147 #define FSCTL_REQUEST_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, FILE_ANY_ACCESS) 6148 #define FSCTL_CSV_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 145, METHOD_BUFFERED, FILE_ANY_ACCESS) 6149 #define FSCTL_IS_CSV_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, FILE_ANY_ACCESS) 6150 #define FSCTL_QUERY_FILE_SYSTEM_RECOGNITION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 147, METHOD_BUFFERED, FILE_ANY_ACCESS) 6151 #define FSCTL_CSV_GET_VOLUME_PATH_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 148, METHOD_BUFFERED, FILE_ANY_ACCESS) 6152 #define FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS) 6153 #define FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS) 6154 #define FSCTL_IS_FILE_ON_CSV_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 151, METHOD_BUFFERED, FILE_ANY_ACCESS) 6155 #define FSCTL_CSV_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 155, METHOD_BUFFERED, FILE_ANY_ACCESS) 6156 6157 typedef struct _CSV_NAMESPACE_INFO { 6158 ULONG Version; 6159 ULONG DeviceNumber; 6160 LARGE_INTEGER StartingOffset; 6161 ULONG SectorSize; 6162 } CSV_NAMESPACE_INFO, *PCSV_NAMESPACE_INFO; 6163 6164 #define CSV_NAMESPACE_INFO_V1 (sizeof(CSV_NAMESPACE_INFO)) 6165 #define CSV_INVALID_DEVICE_NUMBER 0xFFFFFFFF 6166 6167 #endif 6168 6169 #if (_WIN32_WINNT >= 0x0602) 6170 6171 #define FSCTL_FILE_LEVEL_TRIM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 130, METHOD_BUFFERED, FILE_WRITE_DATA) 6172 #define FSCTL_CORRUPTION_HANDLING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 152, METHOD_BUFFERED, FILE_ANY_ACCESS) 6173 #define FSCTL_OFFLOAD_READ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 153, METHOD_BUFFERED, FILE_READ_ACCESS) 6174 #define FSCTL_OFFLOAD_WRITE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 154, METHOD_BUFFERED, FILE_WRITE_ACCESS) 6175 #define FSCTL_SET_PURGE_FAILURE_MODE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 156, METHOD_BUFFERED, FILE_ANY_ACCESS) 6176 #define FSCTL_QUERY_FILE_LAYOUT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 157, METHOD_NEITHER, FILE_ANY_ACCESS) 6177 #define FSCTL_IS_VOLUME_OWNED_BYCSVFS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 158, METHOD_BUFFERED, FILE_ANY_ACCESS) 6178 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS) 6179 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) 6180 #define FSCTL_QUERY_FILE_REGIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 161, METHOD_BUFFERED, FILE_ANY_ACCESS) 6181 #define FSCTL_DEDUP_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 165, METHOD_BUFFERED, FILE_ANY_ACCESS) 6182 #define FSCTL_DEDUP_QUERY_FILE_HASHES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 166, METHOD_NEITHER, FILE_READ_DATA) 6183 #define FSCTL_RKF_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 171, METHOD_NEITHER, FILE_ANY_ACCESS) 6184 #define FSCTL_SCRUB_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 172, METHOD_BUFFERED, FILE_ANY_ACCESS) 6185 #define FSCTL_REPAIR_COPIES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 173, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) 6186 #define FSCTL_DISABLE_LOCAL_BUFFERING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 174, METHOD_BUFFERED, FILE_ANY_ACCESS) 6187 #define FSCTL_CSV_MGMT_LOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 175, METHOD_BUFFERED, FILE_ANY_ACCESS) 6188 #define FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS \ 6189 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 176, METHOD_BUFFERED, FILE_ANY_ACCESS) 6190 #define FSCTL_ADVANCE_FILE_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 177, METHOD_BUFFERED, FILE_ANY_ACCESS) 6191 #define FSCTL_CSV_SYNC_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 178, METHOD_BUFFERED, FILE_ANY_ACCESS) 6192 #define FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 179, METHOD_BUFFERED, FILE_ANY_ACCESS) 6193 #define FSCTL_WRITE_USN_REASON CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 180, METHOD_BUFFERED, FILE_ANY_ACCESS) 6194 #define FSCTL_CSV_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, FILE_ANY_ACCESS) 6195 #define FSCTL_GET_REFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 182, METHOD_BUFFERED, FILE_ANY_ACCESS) 6196 6197 #endif 6198 6199 #if (_WIN32_WINNT >= 0x0603) 6200 6201 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_DATA) 6202 6203 #endif 6204 6205 #define FSCTL_MARK_AS_SYSTEM_HIVE FSCTL_SET_BOOTLOADER_ACCESSED 6206 6207 typedef struct _PATHNAME_BUFFER { 6208 ULONG PathNameLength; 6209 WCHAR Name[1]; 6210 } PATHNAME_BUFFER, *PPATHNAME_BUFFER; 6211 6212 typedef struct _FSCTL_QUERY_FAT_BPB_BUFFER { 6213 UCHAR First0x24BytesOfBootSector[0x24]; 6214 } FSCTL_QUERY_FAT_BPB_BUFFER, *PFSCTL_QUERY_FAT_BPB_BUFFER; 6215 6216 #if (_WIN32_WINNT >= 0x0400) 6217 6218 typedef struct _NTFS_VOLUME_DATA_BUFFER { 6219 LARGE_INTEGER VolumeSerialNumber; 6220 LARGE_INTEGER NumberSectors; 6221 LARGE_INTEGER TotalClusters; 6222 LARGE_INTEGER FreeClusters; 6223 LARGE_INTEGER TotalReserved; 6224 ULONG BytesPerSector; 6225 ULONG BytesPerCluster; 6226 ULONG BytesPerFileRecordSegment; 6227 ULONG ClustersPerFileRecordSegment; 6228 LARGE_INTEGER MftValidDataLength; 6229 LARGE_INTEGER MftStartLcn; 6230 LARGE_INTEGER Mft2StartLcn; 6231 LARGE_INTEGER MftZoneStart; 6232 LARGE_INTEGER MftZoneEnd; 6233 } NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER; 6234 6235 typedef struct _NTFS_EXTENDED_VOLUME_DATA { 6236 ULONG ByteCount; 6237 USHORT MajorVersion; 6238 USHORT MinorVersion; 6239 } NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA; 6240 6241 typedef struct _STARTING_LCN_INPUT_BUFFER { 6242 LARGE_INTEGER StartingLcn; 6243 } STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER; 6244 6245 typedef struct _VOLUME_BITMAP_BUFFER { 6246 LARGE_INTEGER StartingLcn; 6247 LARGE_INTEGER BitmapSize; 6248 UCHAR Buffer[1]; 6249 } VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER; 6250 6251 typedef struct _STARTING_VCN_INPUT_BUFFER { 6252 LARGE_INTEGER StartingVcn; 6253 } STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER; 6254 6255 typedef struct _RETRIEVAL_POINTERS_BUFFER { 6256 ULONG ExtentCount; 6257 LARGE_INTEGER StartingVcn; 6258 struct { 6259 LARGE_INTEGER NextVcn; 6260 LARGE_INTEGER Lcn; 6261 } Extents[1]; 6262 } RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER; 6263 6264 typedef struct _NTFS_FILE_RECORD_INPUT_BUFFER { 6265 LARGE_INTEGER FileReferenceNumber; 6266 } NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER; 6267 6268 typedef struct _NTFS_FILE_RECORD_OUTPUT_BUFFER { 6269 LARGE_INTEGER FileReferenceNumber; 6270 ULONG FileRecordLength; 6271 UCHAR FileRecordBuffer[1]; 6272 } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER; 6273 6274 typedef struct _MOVE_FILE_DATA { 6275 HANDLE FileHandle; 6276 LARGE_INTEGER StartingVcn; 6277 LARGE_INTEGER StartingLcn; 6278 ULONG ClusterCount; 6279 } MOVE_FILE_DATA, *PMOVE_FILE_DATA; 6280 6281 typedef struct _MOVE_FILE_RECORD_DATA { 6282 HANDLE FileHandle; 6283 LARGE_INTEGER SourceFileRecord; 6284 LARGE_INTEGER TargetFileRecord; 6285 } MOVE_FILE_RECORD_DATA, *PMOVE_FILE_RECORD_DATA; 6286 6287 #if defined(_WIN64) 6288 typedef struct _MOVE_FILE_DATA32 { 6289 UINT32 FileHandle; 6290 LARGE_INTEGER StartingVcn; 6291 LARGE_INTEGER StartingLcn; 6292 ULONG ClusterCount; 6293 } MOVE_FILE_DATA32, *PMOVE_FILE_DATA32; 6294 #endif 6295 6296 #endif /* (_WIN32_WINNT >= 0x0400) */ 6297 6298 #if (_WIN32_WINNT >= 0x0500) 6299 6300 typedef struct _FIND_BY_SID_DATA { 6301 ULONG Restart; 6302 SID Sid; 6303 } FIND_BY_SID_DATA, *PFIND_BY_SID_DATA; 6304 6305 typedef struct _FIND_BY_SID_OUTPUT { 6306 ULONG NextEntryOffset; 6307 ULONG FileIndex; 6308 ULONG FileNameLength; 6309 WCHAR FileName[1]; 6310 } FIND_BY_SID_OUTPUT, *PFIND_BY_SID_OUTPUT; 6311 6312 typedef struct _MFT_ENUM_DATA { 6313 ULONGLONG StartFileReferenceNumber; 6314 USN LowUsn; 6315 USN HighUsn; 6316 } MFT_ENUM_DATA, *PMFT_ENUM_DATA; 6317 6318 typedef struct _CREATE_USN_JOURNAL_DATA { 6319 ULONGLONG MaximumSize; 6320 ULONGLONG AllocationDelta; 6321 } CREATE_USN_JOURNAL_DATA, *PCREATE_USN_JOURNAL_DATA; 6322 6323 typedef struct _READ_USN_JOURNAL_DATA { 6324 USN StartUsn; 6325 ULONG ReasonMask; 6326 ULONG ReturnOnlyOnClose; 6327 ULONGLONG Timeout; 6328 ULONGLONG BytesToWaitFor; 6329 ULONGLONG UsnJournalID; 6330 } READ_USN_JOURNAL_DATA, *PREAD_USN_JOURNAL_DATA; 6331 6332 typedef struct _USN_RECORD { 6333 ULONG RecordLength; 6334 USHORT MajorVersion; 6335 USHORT MinorVersion; 6336 ULONGLONG FileReferenceNumber; 6337 ULONGLONG ParentFileReferenceNumber; 6338 USN Usn; 6339 LARGE_INTEGER TimeStamp; 6340 ULONG Reason; 6341 ULONG SourceInfo; 6342 ULONG SecurityId; 6343 ULONG FileAttributes; 6344 USHORT FileNameLength; 6345 USHORT FileNameOffset; 6346 WCHAR FileName[1]; 6347 } USN_RECORD, *PUSN_RECORD; 6348 6349 #define USN_PAGE_SIZE (0x1000) 6350 6351 #define USN_REASON_DATA_OVERWRITE (0x00000001) 6352 #define USN_REASON_DATA_EXTEND (0x00000002) 6353 #define USN_REASON_DATA_TRUNCATION (0x00000004) 6354 #define USN_REASON_NAMED_DATA_OVERWRITE (0x00000010) 6355 #define USN_REASON_NAMED_DATA_EXTEND (0x00000020) 6356 #define USN_REASON_NAMED_DATA_TRUNCATION (0x00000040) 6357 #define USN_REASON_FILE_CREATE (0x00000100) 6358 #define USN_REASON_FILE_DELETE (0x00000200) 6359 #define USN_REASON_EA_CHANGE (0x00000400) 6360 #define USN_REASON_SECURITY_CHANGE (0x00000800) 6361 #define USN_REASON_RENAME_OLD_NAME (0x00001000) 6362 #define USN_REASON_RENAME_NEW_NAME (0x00002000) 6363 #define USN_REASON_INDEXABLE_CHANGE (0x00004000) 6364 #define USN_REASON_BASIC_INFO_CHANGE (0x00008000) 6365 #define USN_REASON_HARD_LINK_CHANGE (0x00010000) 6366 #define USN_REASON_COMPRESSION_CHANGE (0x00020000) 6367 #define USN_REASON_ENCRYPTION_CHANGE (0x00040000) 6368 #define USN_REASON_OBJECT_ID_CHANGE (0x00080000) 6369 #define USN_REASON_REPARSE_POINT_CHANGE (0x00100000) 6370 #define USN_REASON_STREAM_CHANGE (0x00200000) 6371 #define USN_REASON_TRANSACTED_CHANGE (0x00400000) 6372 #define USN_REASON_CLOSE (0x80000000) 6373 6374 typedef struct _USN_JOURNAL_DATA { 6375 ULONGLONG UsnJournalID; 6376 USN FirstUsn; 6377 USN NextUsn; 6378 USN LowestValidUsn; 6379 USN MaxUsn; 6380 ULONGLONG MaximumSize; 6381 ULONGLONG AllocationDelta; 6382 } USN_JOURNAL_DATA, *PUSN_JOURNAL_DATA; 6383 6384 typedef struct _DELETE_USN_JOURNAL_DATA { 6385 ULONGLONG UsnJournalID; 6386 ULONG DeleteFlags; 6387 } DELETE_USN_JOURNAL_DATA, *PDELETE_USN_JOURNAL_DATA; 6388 6389 #define USN_DELETE_FLAG_DELETE (0x00000001) 6390 #define USN_DELETE_FLAG_NOTIFY (0x00000002) 6391 #define USN_DELETE_VALID_FLAGS (0x00000003) 6392 6393 typedef struct _MARK_HANDLE_INFO { 6394 ULONG UsnSourceInfo; 6395 HANDLE VolumeHandle; 6396 ULONG HandleInfo; 6397 } MARK_HANDLE_INFO, *PMARK_HANDLE_INFO; 6398 6399 #if defined(_WIN64) 6400 typedef struct _MARK_HANDLE_INFO32 { 6401 ULONG UsnSourceInfo; 6402 UINT32 VolumeHandle; 6403 ULONG HandleInfo; 6404 } MARK_HANDLE_INFO32, *PMARK_HANDLE_INFO32; 6405 #endif 6406 6407 #define USN_SOURCE_DATA_MANAGEMENT (0x00000001) 6408 #define USN_SOURCE_AUXILIARY_DATA (0x00000002) 6409 #define USN_SOURCE_REPLICATION_MANAGEMENT (0x00000004) 6410 6411 #define MARK_HANDLE_PROTECT_CLUSTERS (0x00000001) 6412 #define MARK_HANDLE_TXF_SYSTEM_LOG (0x00000004) 6413 #define MARK_HANDLE_NOT_TXF_SYSTEM_LOG (0x00000008) 6414 6415 typedef struct _BULK_SECURITY_TEST_DATA { 6416 ACCESS_MASK DesiredAccess; 6417 ULONG SecurityIds[1]; 6418 } BULK_SECURITY_TEST_DATA, *PBULK_SECURITY_TEST_DATA; 6419 6420 #define VOLUME_IS_DIRTY (0x00000001) 6421 #define VOLUME_UPGRADE_SCHEDULED (0x00000002) 6422 #define VOLUME_SESSION_OPEN (0x00000004) 6423 6424 typedef struct _FILE_PREFETCH { 6425 ULONG Type; 6426 ULONG Count; 6427 ULONGLONG Prefetch[1]; 6428 } FILE_PREFETCH, *PFILE_PREFETCH; 6429 6430 typedef struct _FILE_PREFETCH_EX { 6431 ULONG Type; 6432 ULONG Count; 6433 PVOID Context; 6434 ULONGLONG Prefetch[1]; 6435 } FILE_PREFETCH_EX, *PFILE_PREFETCH_EX; 6436 6437 #define FILE_PREFETCH_TYPE_FOR_CREATE 0x1 6438 #define FILE_PREFETCH_TYPE_FOR_DIRENUM 0x2 6439 #define FILE_PREFETCH_TYPE_FOR_CREATE_EX 0x3 6440 #define FILE_PREFETCH_TYPE_FOR_DIRENUM_EX 0x4 6441 6442 #define FILE_PREFETCH_TYPE_MAX 0x4 6443 6444 typedef struct _FILE_OBJECTID_BUFFER { 6445 UCHAR ObjectId[16]; 6446 _ANONYMOUS_UNION union { 6447 _ANONYMOUS_STRUCT struct { 6448 UCHAR BirthVolumeId[16]; 6449 UCHAR BirthObjectId[16]; 6450 UCHAR DomainId[16]; 6451 } DUMMYSTRUCTNAME; 6452 UCHAR ExtendedInfo[48]; 6453 } DUMMYUNIONNAME; 6454 } FILE_OBJECTID_BUFFER, *PFILE_OBJECTID_BUFFER; 6455 6456 typedef struct _FILE_SET_SPARSE_BUFFER { 6457 BOOLEAN SetSparse; 6458 } FILE_SET_SPARSE_BUFFER, *PFILE_SET_SPARSE_BUFFER; 6459 6460 typedef struct _FILE_ZERO_DATA_INFORMATION { 6461 LARGE_INTEGER FileOffset; 6462 LARGE_INTEGER BeyondFinalZero; 6463 } FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION; 6464 6465 typedef struct _FILE_ALLOCATED_RANGE_BUFFER { 6466 LARGE_INTEGER FileOffset; 6467 LARGE_INTEGER Length; 6468 } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER; 6469 6470 typedef struct _ENCRYPTION_BUFFER { 6471 ULONG EncryptionOperation; 6472 UCHAR Private[1]; 6473 } ENCRYPTION_BUFFER, *PENCRYPTION_BUFFER; 6474 6475 #define FILE_SET_ENCRYPTION 0x00000001 6476 #define FILE_CLEAR_ENCRYPTION 0x00000002 6477 #define STREAM_SET_ENCRYPTION 0x00000003 6478 #define STREAM_CLEAR_ENCRYPTION 0x00000004 6479 6480 #define MAXIMUM_ENCRYPTION_VALUE 0x00000004 6481 6482 typedef struct _DECRYPTION_STATUS_BUFFER { 6483 BOOLEAN NoEncryptedStreams; 6484 } DECRYPTION_STATUS_BUFFER, *PDECRYPTION_STATUS_BUFFER; 6485 6486 #define ENCRYPTION_FORMAT_DEFAULT (0x01) 6487 6488 #define COMPRESSION_FORMAT_SPARSE (0x4000) 6489 6490 typedef struct _REQUEST_RAW_ENCRYPTED_DATA { 6491 LONGLONG FileOffset; 6492 ULONG Length; 6493 } REQUEST_RAW_ENCRYPTED_DATA, *PREQUEST_RAW_ENCRYPTED_DATA; 6494 6495 typedef struct _ENCRYPTED_DATA_INFO { 6496 ULONGLONG StartingFileOffset; 6497 ULONG OutputBufferOffset; 6498 ULONG BytesWithinFileSize; 6499 ULONG BytesWithinValidDataLength; 6500 USHORT CompressionFormat; 6501 UCHAR DataUnitShift; 6502 UCHAR ChunkShift; 6503 UCHAR ClusterShift; 6504 UCHAR EncryptionFormat; 6505 USHORT NumberOfDataBlocks; 6506 ULONG DataBlockSize[ANYSIZE_ARRAY]; 6507 } ENCRYPTED_DATA_INFO, *PENCRYPTED_DATA_INFO; 6508 6509 typedef struct _PLEX_READ_DATA_REQUEST { 6510 LARGE_INTEGER ByteOffset; 6511 ULONG ByteLength; 6512 ULONG PlexNumber; 6513 } PLEX_READ_DATA_REQUEST, *PPLEX_READ_DATA_REQUEST; 6514 6515 typedef struct _SI_COPYFILE { 6516 ULONG SourceFileNameLength; 6517 ULONG DestinationFileNameLength; 6518 ULONG Flags; 6519 WCHAR FileNameBuffer[1]; 6520 } SI_COPYFILE, *PSI_COPYFILE; 6521 6522 #define COPYFILE_SIS_LINK 0x0001 6523 #define COPYFILE_SIS_REPLACE 0x0002 6524 #define COPYFILE_SIS_FLAGS 0x0003 6525 6526 #endif /* (_WIN32_WINNT >= 0x0500) */ 6527 6528 #if (_WIN32_WINNT >= 0x0600) 6529 6530 typedef struct _FILE_MAKE_COMPATIBLE_BUFFER { 6531 BOOLEAN CloseDisc; 6532 } FILE_MAKE_COMPATIBLE_BUFFER, *PFILE_MAKE_COMPATIBLE_BUFFER; 6533 6534 typedef struct _FILE_SET_DEFECT_MGMT_BUFFER { 6535 BOOLEAN Disable; 6536 } FILE_SET_DEFECT_MGMT_BUFFER, *PFILE_SET_DEFECT_MGMT_BUFFER; 6537 6538 typedef struct _FILE_QUERY_SPARING_BUFFER { 6539 ULONG SparingUnitBytes; 6540 BOOLEAN SoftwareSparing; 6541 ULONG TotalSpareBlocks; 6542 ULONG FreeSpareBlocks; 6543 } FILE_QUERY_SPARING_BUFFER, *PFILE_QUERY_SPARING_BUFFER; 6544 6545 typedef struct _FILE_QUERY_ON_DISK_VOL_INFO_BUFFER { 6546 LARGE_INTEGER DirectoryCount; 6547 LARGE_INTEGER FileCount; 6548 USHORT FsFormatMajVersion; 6549 USHORT FsFormatMinVersion; 6550 WCHAR FsFormatName[12]; 6551 LARGE_INTEGER FormatTime; 6552 LARGE_INTEGER LastUpdateTime; 6553 WCHAR CopyrightInfo[34]; 6554 WCHAR AbstractInfo[34]; 6555 WCHAR FormattingImplementationInfo[34]; 6556 WCHAR LastModifyingImplementationInfo[34]; 6557 } FILE_QUERY_ON_DISK_VOL_INFO_BUFFER, *PFILE_QUERY_ON_DISK_VOL_INFO_BUFFER; 6558 6559 #define SET_REPAIR_ENABLED (0x00000001) 6560 #define SET_REPAIR_VOLUME_BITMAP_SCAN (0x00000002) 6561 #define SET_REPAIR_DELETE_CROSSLINK (0x00000004) 6562 #define SET_REPAIR_WARN_ABOUT_DATA_LOSS (0x00000008) 6563 #define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT (0x00000010) 6564 #define SET_REPAIR_VALID_MASK (0x0000001F) 6565 6566 typedef enum _SHRINK_VOLUME_REQUEST_TYPES { 6567 ShrinkPrepare = 1, 6568 ShrinkCommit, 6569 ShrinkAbort 6570 } SHRINK_VOLUME_REQUEST_TYPES, *PSHRINK_VOLUME_REQUEST_TYPES; 6571 6572 typedef struct _SHRINK_VOLUME_INFORMATION { 6573 SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType; 6574 ULONGLONG Flags; 6575 LONGLONG NewNumberOfSectors; 6576 } SHRINK_VOLUME_INFORMATION, *PSHRINK_VOLUME_INFORMATION; 6577 6578 #define TXFS_RM_FLAG_LOGGING_MODE 0x00000001 6579 #define TXFS_RM_FLAG_RENAME_RM 0x00000002 6580 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000004 6581 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000008 6582 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000010 6583 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000020 6584 #define TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000040 6585 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000080 6586 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000100 6587 #define TXFS_RM_FLAG_GROW_LOG 0x00000400 6588 #define TXFS_RM_FLAG_SHRINK_LOG 0x00000800 6589 #define TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE 0x00001000 6590 #define TXFS_RM_FLAG_PRESERVE_CHANGES 0x00002000 6591 #define TXFS_RM_FLAG_RESET_RM_AT_NEXT_START 0x00004000 6592 #define TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START 0x00008000 6593 #define TXFS_RM_FLAG_PREFER_CONSISTENCY 0x00010000 6594 #define TXFS_RM_FLAG_PREFER_AVAILABILITY 0x00020000 6595 6596 #define TXFS_LOGGING_MODE_SIMPLE (0x0001) 6597 #define TXFS_LOGGING_MODE_FULL (0x0002) 6598 6599 #define TXFS_TRANSACTION_STATE_NONE 0x00 6600 #define TXFS_TRANSACTION_STATE_ACTIVE 0x01 6601 #define TXFS_TRANSACTION_STATE_PREPARED 0x02 6602 #define TXFS_TRANSACTION_STATE_NOTACTIVE 0x03 6603 6604 #define TXFS_MODIFY_RM_VALID_FLAGS (TXFS_RM_FLAG_LOGGING_MODE | \ 6605 TXFS_RM_FLAG_RENAME_RM | \ 6606 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \ 6607 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \ 6608 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ 6609 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ 6610 TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \ 6611 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ 6612 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \ 6613 TXFS_RM_FLAG_SHRINK_LOG | \ 6614 TXFS_RM_FLAG_GROW_LOG | \ 6615 TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE | \ 6616 TXFS_RM_FLAG_PRESERVE_CHANGES | \ 6617 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \ 6618 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \ 6619 TXFS_RM_FLAG_PREFER_CONSISTENCY | \ 6620 TXFS_RM_FLAG_PREFER_AVAILABILITY) 6621 6622 typedef struct _TXFS_MODIFY_RM { 6623 ULONG Flags; 6624 ULONG LogContainerCountMax; 6625 ULONG LogContainerCountMin; 6626 ULONG LogContainerCount; 6627 ULONG LogGrowthIncrement; 6628 ULONG LogAutoShrinkPercentage; 6629 ULONGLONG Reserved; 6630 USHORT LoggingMode; 6631 } TXFS_MODIFY_RM, *PTXFS_MODIFY_RM; 6632 6633 #define TXFS_RM_STATE_NOT_STARTED 0 6634 #define TXFS_RM_STATE_STARTING 1 6635 #define TXFS_RM_STATE_ACTIVE 2 6636 #define TXFS_RM_STATE_SHUTTING_DOWN 3 6637 6638 #define TXFS_QUERY_RM_INFORMATION_VALID_FLAGS \ 6639 (TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ 6640 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ 6641 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ 6642 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \ 6643 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \ 6644 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \ 6645 TXFS_RM_FLAG_PREFER_CONSISTENCY | \ 6646 TXFS_RM_FLAG_PREFER_AVAILABILITY) 6647 6648 typedef struct _TXFS_QUERY_RM_INFORMATION { 6649 ULONG BytesRequired; 6650 ULONGLONG TailLsn; 6651 ULONGLONG CurrentLsn; 6652 ULONGLONG ArchiveTailLsn; 6653 ULONGLONG LogContainerSize; 6654 LARGE_INTEGER HighestVirtualClock; 6655 ULONG LogContainerCount; 6656 ULONG LogContainerCountMax; 6657 ULONG LogContainerCountMin; 6658 ULONG LogGrowthIncrement; 6659 ULONG LogAutoShrinkPercentage; 6660 ULONG Flags; 6661 USHORT LoggingMode; 6662 USHORT Reserved; 6663 ULONG RmState; 6664 ULONGLONG LogCapacity; 6665 ULONGLONG LogFree; 6666 ULONGLONG TopsSize; 6667 ULONGLONG TopsUsed; 6668 ULONGLONG TransactionCount; 6669 ULONGLONG OnePCCount; 6670 ULONGLONG TwoPCCount; 6671 ULONGLONG NumberLogFileFull; 6672 ULONGLONG OldestTransactionAge; 6673 GUID RMName; 6674 ULONG TmLogPathOffset; 6675 } TXFS_QUERY_RM_INFORMATION, *PTXFS_QUERY_RM_INFORMATION; 6676 6677 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN 0x01 6678 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK 0x02 6679 6680 #define TXFS_ROLLFORWARD_REDO_VALID_FLAGS \ 6681 (TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN | \ 6682 TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK) 6683 6684 typedef struct _TXFS_ROLLFORWARD_REDO_INFORMATION { 6685 LARGE_INTEGER LastVirtualClock; 6686 ULONGLONG LastRedoLsn; 6687 ULONGLONG HighestRecoveryLsn; 6688 ULONG Flags; 6689 } TXFS_ROLLFORWARD_REDO_INFORMATION, *PTXFS_ROLLFORWARD_REDO_INFORMATION; 6690 6691 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000001 6692 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000002 6693 #define TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE 0x00000004 6694 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000008 6695 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000010 6696 #define TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000020 6697 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000040 6698 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000080 6699 6700 #define TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT 0x00000200 6701 #define TXFS_START_RM_FLAG_LOGGING_MODE 0x00000400 6702 #define TXFS_START_RM_FLAG_PRESERVE_CHANGES 0x00000800 6703 6704 #define TXFS_START_RM_FLAG_PREFER_CONSISTENCY 0x00001000 6705 #define TXFS_START_RM_FLAG_PREFER_AVAILABILITY 0x00002000 6706 6707 #define TXFS_START_RM_VALID_FLAGS \ 6708 (TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \ 6709 TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \ 6710 TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE | \ 6711 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ 6712 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ 6713 TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \ 6714 TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT | \ 6715 TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ 6716 TXFS_START_RM_FLAG_LOGGING_MODE | \ 6717 TXFS_START_RM_FLAG_PRESERVE_CHANGES | \ 6718 TXFS_START_RM_FLAG_PREFER_CONSISTENCY | \ 6719 TXFS_START_RM_FLAG_PREFER_AVAILABILITY) 6720 6721 typedef struct _TXFS_START_RM_INFORMATION { 6722 ULONG Flags; 6723 ULONGLONG LogContainerSize; 6724 ULONG LogContainerCountMin; 6725 ULONG LogContainerCountMax; 6726 ULONG LogGrowthIncrement; 6727 ULONG LogAutoShrinkPercentage; 6728 ULONG TmLogPathOffset; 6729 USHORT TmLogPathLength; 6730 USHORT LoggingMode; 6731 USHORT LogPathLength; 6732 USHORT Reserved; 6733 WCHAR LogPath[1]; 6734 } TXFS_START_RM_INFORMATION, *PTXFS_START_RM_INFORMATION; 6735 6736 typedef struct _TXFS_GET_METADATA_INFO_OUT { 6737 struct { 6738 LONGLONG LowPart; 6739 LONGLONG HighPart; 6740 } TxfFileId; 6741 GUID LockingTransaction; 6742 ULONGLONG LastLsn; 6743 ULONG TransactionState; 6744 } TXFS_GET_METADATA_INFO_OUT, *PTXFS_GET_METADATA_INFO_OUT; 6745 6746 #define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_CREATED 0x00000001 6747 #define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_DELETED 0x00000002 6748 6749 typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY { 6750 ULONGLONG Offset; 6751 ULONG NameFlags; 6752 LONGLONG FileId; 6753 ULONG Reserved1; 6754 ULONG Reserved2; 6755 LONGLONG Reserved3; 6756 WCHAR FileName[1]; 6757 } TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY, *PTXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY; 6758 6759 typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES { 6760 GUID KtmTransaction; 6761 ULONGLONG NumberOfFiles; 6762 ULONGLONG BufferSizeRequired; 6763 ULONGLONG Offset; 6764 } TXFS_LIST_TRANSACTION_LOCKED_FILES, *PTXFS_LIST_TRANSACTION_LOCKED_FILES; 6765 6766 typedef struct _TXFS_LIST_TRANSACTIONS_ENTRY { 6767 GUID TransactionId; 6768 ULONG TransactionState; 6769 ULONG Reserved1; 6770 ULONG Reserved2; 6771 LONGLONG Reserved3; 6772 } TXFS_LIST_TRANSACTIONS_ENTRY, *PTXFS_LIST_TRANSACTIONS_ENTRY; 6773 6774 typedef struct _TXFS_LIST_TRANSACTIONS { 6775 ULONGLONG NumberOfTransactions; 6776 ULONGLONG BufferSizeRequired; 6777 } TXFS_LIST_TRANSACTIONS, *PTXFS_LIST_TRANSACTIONS; 6778 6779 typedef struct _TXFS_READ_BACKUP_INFORMATION_OUT { 6780 _ANONYMOUS_UNION union { 6781 ULONG BufferLength; 6782 UCHAR Buffer[1]; 6783 } DUMMYUNIONNAME; 6784 } TXFS_READ_BACKUP_INFORMATION_OUT, *PTXFS_READ_BACKUP_INFORMATION_OUT; 6785 6786 typedef struct _TXFS_WRITE_BACKUP_INFORMATION { 6787 UCHAR Buffer[1]; 6788 } TXFS_WRITE_BACKUP_INFORMATION, *PTXFS_WRITE_BACKUP_INFORMATION; 6789 6790 #define TXFS_TRANSACTED_VERSION_NONTRANSACTED 0xFFFFFFFE 6791 #define TXFS_TRANSACTED_VERSION_UNCOMMITTED 0xFFFFFFFF 6792 6793 typedef struct _TXFS_GET_TRANSACTED_VERSION { 6794 ULONG ThisBaseVersion; 6795 ULONG LatestVersion; 6796 USHORT ThisMiniVersion; 6797 USHORT FirstMiniVersion; 6798 USHORT LatestMiniVersion; 6799 } TXFS_GET_TRANSACTED_VERSION, *PTXFS_GET_TRANSACTED_VERSION; 6800 6801 #define TXFS_SAVEPOINT_SET 0x00000001 6802 #define TXFS_SAVEPOINT_ROLLBACK 0x00000002 6803 #define TXFS_SAVEPOINT_CLEAR 0x00000004 6804 #define TXFS_SAVEPOINT_CLEAR_ALL 0x00000010 6805 6806 typedef struct _TXFS_SAVEPOINT_INFORMATION { 6807 HANDLE KtmTransaction; 6808 ULONG ActionCode; 6809 ULONG SavepointId; 6810 } TXFS_SAVEPOINT_INFORMATION, *PTXFS_SAVEPOINT_INFORMATION; 6811 6812 typedef struct _TXFS_CREATE_MINIVERSION_INFO { 6813 USHORT StructureVersion; 6814 USHORT StructureLength; 6815 ULONG BaseVersion; 6816 USHORT MiniVersion; 6817 } TXFS_CREATE_MINIVERSION_INFO, *PTXFS_CREATE_MINIVERSION_INFO; 6818 6819 typedef struct _TXFS_TRANSACTION_ACTIVE_INFO { 6820 BOOLEAN TransactionsActiveAtSnapshot; 6821 } TXFS_TRANSACTION_ACTIVE_INFO, *PTXFS_TRANSACTION_ACTIVE_INFO; 6822 6823 #endif /* (_WIN32_WINNT >= 0x0600) */ 6824 6825 #if (_WIN32_WINNT >= 0x0601) 6826 6827 #define MARK_HANDLE_REALTIME (0x00000020) 6828 #define MARK_HANDLE_NOT_REALTIME (0x00000040) 6829 6830 #define NO_8DOT3_NAME_PRESENT (0x00000001) 6831 #define REMOVED_8DOT3_NAME (0x00000002) 6832 6833 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED (0x00000001) 6834 6835 typedef struct _BOOT_AREA_INFO { 6836 ULONG BootSectorCount; 6837 struct { 6838 LARGE_INTEGER Offset; 6839 } BootSectors[2]; 6840 } BOOT_AREA_INFO, *PBOOT_AREA_INFO; 6841 6842 typedef struct _RETRIEVAL_POINTER_BASE { 6843 LARGE_INTEGER FileAreaOffset; 6844 } RETRIEVAL_POINTER_BASE, *PRETRIEVAL_POINTER_BASE; 6845 6846 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION { 6847 ULONG VolumeFlags; 6848 ULONG FlagMask; 6849 ULONG Version; 6850 ULONG Reserved; 6851 } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION; 6852 6853 typedef struct _FILE_SYSTEM_RECOGNITION_INFORMATION { 6854 CHAR FileSystem[9]; 6855 } FILE_SYSTEM_RECOGNITION_INFORMATION, *PFILE_SYSTEM_RECOGNITION_INFORMATION; 6856 6857 #define OPLOCK_LEVEL_CACHE_READ (0x00000001) 6858 #define OPLOCK_LEVEL_CACHE_HANDLE (0x00000002) 6859 #define OPLOCK_LEVEL_CACHE_WRITE (0x00000004) 6860 6861 #define REQUEST_OPLOCK_INPUT_FLAG_REQUEST (0x00000001) 6862 #define REQUEST_OPLOCK_INPUT_FLAG_ACK (0x00000002) 6863 #define REQUEST_OPLOCK_INPUT_FLAG_COMPLETE_ACK_ON_CLOSE (0x00000004) 6864 6865 #define REQUEST_OPLOCK_CURRENT_VERSION 1 6866 6867 typedef struct _REQUEST_OPLOCK_INPUT_BUFFER { 6868 USHORT StructureVersion; 6869 USHORT StructureLength; 6870 ULONG RequestedOplockLevel; 6871 ULONG Flags; 6872 } REQUEST_OPLOCK_INPUT_BUFFER, *PREQUEST_OPLOCK_INPUT_BUFFER; 6873 6874 #define REQUEST_OPLOCK_OUTPUT_FLAG_ACK_REQUIRED (0x00000001) 6875 #define REQUEST_OPLOCK_OUTPUT_FLAG_MODES_PROVIDED (0x00000002) 6876 6877 typedef struct _REQUEST_OPLOCK_OUTPUT_BUFFER { 6878 USHORT StructureVersion; 6879 USHORT StructureLength; 6880 ULONG OriginalOplockLevel; 6881 ULONG NewOplockLevel; 6882 ULONG Flags; 6883 ACCESS_MASK AccessMode; 6884 USHORT ShareMode; 6885 } REQUEST_OPLOCK_OUTPUT_BUFFER, *PREQUEST_OPLOCK_OUTPUT_BUFFER; 6886 6887 #define SD_GLOBAL_CHANGE_TYPE_MACHINE_SID 1 6888 6889 typedef struct _SD_CHANGE_MACHINE_SID_INPUT { 6890 USHORT CurrentMachineSIDOffset; 6891 USHORT CurrentMachineSIDLength; 6892 USHORT NewMachineSIDOffset; 6893 USHORT NewMachineSIDLength; 6894 } SD_CHANGE_MACHINE_SID_INPUT, *PSD_CHANGE_MACHINE_SID_INPUT; 6895 6896 typedef struct _SD_CHANGE_MACHINE_SID_OUTPUT { 6897 ULONGLONG NumSDChangedSuccess; 6898 ULONGLONG NumSDChangedFail; 6899 ULONGLONG NumSDUnused; 6900 ULONGLONG NumSDTotal; 6901 ULONGLONG NumMftSDChangedSuccess; 6902 ULONGLONG NumMftSDChangedFail; 6903 ULONGLONG NumMftSDTotal; 6904 } SD_CHANGE_MACHINE_SID_OUTPUT, *PSD_CHANGE_MACHINE_SID_OUTPUT; 6905 6906 typedef struct _SD_GLOBAL_CHANGE_INPUT { 6907 ULONG Flags; 6908 ULONG ChangeType; 6909 _ANONYMOUS_UNION union { 6910 SD_CHANGE_MACHINE_SID_INPUT SdChange; 6911 } DUMMYUNIONNAME; 6912 } SD_GLOBAL_CHANGE_INPUT, *PSD_GLOBAL_CHANGE_INPUT; 6913 6914 typedef struct _SD_GLOBAL_CHANGE_OUTPUT { 6915 ULONG Flags; 6916 ULONG ChangeType; 6917 _ANONYMOUS_UNION union { 6918 SD_CHANGE_MACHINE_SID_OUTPUT SdChange; 6919 } DUMMYUNIONNAME; 6920 } SD_GLOBAL_CHANGE_OUTPUT, *PSD_GLOBAL_CHANGE_OUTPUT; 6921 6922 #define ENCRYPTED_DATA_INFO_SPARSE_FILE 1 6923 6924 typedef struct _EXTENDED_ENCRYPTED_DATA_INFO { 6925 ULONG ExtendedCode; 6926 ULONG Length; 6927 ULONG Flags; 6928 ULONG Reserved; 6929 } EXTENDED_ENCRYPTED_DATA_INFO, *PEXTENDED_ENCRYPTED_DATA_INFO; 6930 6931 typedef struct _LOOKUP_STREAM_FROM_CLUSTER_INPUT { 6932 ULONG Flags; 6933 ULONG NumberOfClusters; 6934 LARGE_INTEGER Cluster[1]; 6935 } LOOKUP_STREAM_FROM_CLUSTER_INPUT, *PLOOKUP_STREAM_FROM_CLUSTER_INPUT; 6936 6937 typedef struct _LOOKUP_STREAM_FROM_CLUSTER_OUTPUT { 6938 ULONG Offset; 6939 ULONG NumberOfMatches; 6940 ULONG BufferSizeRequired; 6941 } LOOKUP_STREAM_FROM_CLUSTER_OUTPUT, *PLOOKUP_STREAM_FROM_CLUSTER_OUTPUT; 6942 6943 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_PAGE_FILE 0x00000001 6944 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_DENY_DEFRAG_SET 0x00000002 6945 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_FS_SYSTEM_FILE 0x00000004 6946 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_TXF_SYSTEM_FILE 0x00000008 6947 6948 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_MASK 0xff000000 6949 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_DATA 0x01000000 6950 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_INDEX 0x02000000 6951 #define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_SYSTEM 0x03000000 6952 6953 typedef struct _LOOKUP_STREAM_FROM_CLUSTER_ENTRY { 6954 ULONG OffsetToNext; 6955 ULONG Flags; 6956 LARGE_INTEGER Reserved; 6957 LARGE_INTEGER Cluster; 6958 WCHAR FileName[1]; 6959 } LOOKUP_STREAM_FROM_CLUSTER_ENTRY, *PLOOKUP_STREAM_FROM_CLUSTER_ENTRY; 6960 6961 typedef struct _FILE_TYPE_NOTIFICATION_INPUT { 6962 ULONG Flags; 6963 ULONG NumFileTypeIDs; 6964 GUID FileTypeID[1]; 6965 } FILE_TYPE_NOTIFICATION_INPUT, *PFILE_TYPE_NOTIFICATION_INPUT; 6966 6967 #define FILE_TYPE_NOTIFICATION_FLAG_USAGE_BEGIN 0x00000001 6968 #define FILE_TYPE_NOTIFICATION_FLAG_USAGE_END 0x00000002 6969 6970 DEFINE_GUID(FILE_TYPE_NOTIFICATION_GUID_PAGE_FILE, 0x0d0a64a1, 0x38fc, 0x4db8, 0x9f, 0xe7, 0x3f, 0x43, 0x52, 0xcd, 0x7c, 0x5c); 6971 DEFINE_GUID(FILE_TYPE_NOTIFICATION_GUID_HIBERNATION_FILE, 0xb7624d64, 0xb9a3, 0x4cf8, 0x80, 0x11, 0x5b, 0x86, 0xc9, 0x40, 0xe7, 0xb7); 6972 DEFINE_GUID(FILE_TYPE_NOTIFICATION_GUID_CRASHDUMP_FILE, 0x9d453eb7, 0xd2a6, 0x4dbd, 0xa2, 0xe3, 0xfb, 0xd0, 0xed, 0x91, 0x09, 0xa9); 6973 6974 #ifndef _VIRTUAL_STORAGE_TYPE_DEFINED 6975 #define _VIRTUAL_STORAGE_TYPE_DEFINED 6976 typedef struct _VIRTUAL_STORAGE_TYPE { 6977 ULONG DeviceId; 6978 GUID VendorId; 6979 } VIRTUAL_STORAGE_TYPE, *PVIRTUAL_STORAGE_TYPE; 6980 #endif 6981 6982 typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_REQUEST { 6983 ULONG RequestLevel; 6984 ULONG RequestFlags; 6985 } STORAGE_QUERY_DEPENDENT_VOLUME_REQUEST, *PSTORAGE_QUERY_DEPENDENT_VOLUME_REQUEST; 6986 6987 #define QUERY_DEPENDENT_VOLUME_REQUEST_FLAG_HOST_VOLUMES 0x1 6988 #define QUERY_DEPENDENT_VOLUME_REQUEST_FLAG_GUEST_VOLUMES 0x2 6989 6990 typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY { 6991 ULONG EntryLength; 6992 ULONG DependencyTypeFlags; 6993 ULONG ProviderSpecificFlags; 6994 VIRTUAL_STORAGE_TYPE VirtualStorageType; 6995 } STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY, *PSTORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY; 6996 6997 typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY { 6998 ULONG EntryLength; 6999 ULONG DependencyTypeFlags; 7000 ULONG ProviderSpecificFlags; 7001 VIRTUAL_STORAGE_TYPE VirtualStorageType; 7002 ULONG AncestorLevel; 7003 ULONG HostVolumeNameOffset; 7004 ULONG HostVolumeNameSize; 7005 ULONG DependentVolumeNameOffset; 7006 ULONG DependentVolumeNameSize; 7007 ULONG RelativePathOffset; 7008 ULONG RelativePathSize; 7009 ULONG DependentDeviceNameOffset; 7010 ULONG DependentDeviceNameSize; 7011 } STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY, *PSTORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY; 7012 7013 typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE { 7014 ULONG ResponseLevel; 7015 ULONG NumberEntries; 7016 _ANONYMOUS_UNION union { 7017 STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY Lev1Depends[0]; 7018 STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY Lev2Depends[0]; 7019 } DUMMYUNIONNAME; 7020 } STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE, *PSTORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE; 7021 7022 #endif /* (_WIN32_WINNT >= 0x0601) */ 7023 7024 typedef struct _FILESYSTEM_STATISTICS { 7025 USHORT FileSystemType; 7026 USHORT Version; 7027 ULONG SizeOfCompleteStructure; 7028 ULONG UserFileReads; 7029 ULONG UserFileReadBytes; 7030 ULONG UserDiskReads; 7031 ULONG UserFileWrites; 7032 ULONG UserFileWriteBytes; 7033 ULONG UserDiskWrites; 7034 ULONG MetaDataReads; 7035 ULONG MetaDataReadBytes; 7036 ULONG MetaDataDiskReads; 7037 ULONG MetaDataWrites; 7038 ULONG MetaDataWriteBytes; 7039 ULONG MetaDataDiskWrites; 7040 } FILESYSTEM_STATISTICS, *PFILESYSTEM_STATISTICS; 7041 7042 #define FILESYSTEM_STATISTICS_TYPE_NTFS 1 7043 #define FILESYSTEM_STATISTICS_TYPE_FAT 2 7044 #define FILESYSTEM_STATISTICS_TYPE_EXFAT 3 7045 7046 typedef struct _FAT_STATISTICS { 7047 ULONG CreateHits; 7048 ULONG SuccessfulCreates; 7049 ULONG FailedCreates; 7050 ULONG NonCachedReads; 7051 ULONG NonCachedReadBytes; 7052 ULONG NonCachedWrites; 7053 ULONG NonCachedWriteBytes; 7054 ULONG NonCachedDiskReads; 7055 ULONG NonCachedDiskWrites; 7056 } FAT_STATISTICS, *PFAT_STATISTICS; 7057 7058 typedef struct _EXFAT_STATISTICS { 7059 ULONG CreateHits; 7060 ULONG SuccessfulCreates; 7061 ULONG FailedCreates; 7062 ULONG NonCachedReads; 7063 ULONG NonCachedReadBytes; 7064 ULONG NonCachedWrites; 7065 ULONG NonCachedWriteBytes; 7066 ULONG NonCachedDiskReads; 7067 ULONG NonCachedDiskWrites; 7068 } EXFAT_STATISTICS, *PEXFAT_STATISTICS; 7069 7070 typedef struct _NTFS_STATISTICS { 7071 ULONG LogFileFullExceptions; 7072 ULONG OtherExceptions; 7073 ULONG MftReads; 7074 ULONG MftReadBytes; 7075 ULONG MftWrites; 7076 ULONG MftWriteBytes; 7077 struct { 7078 USHORT Write; 7079 USHORT Create; 7080 USHORT SetInfo; 7081 USHORT Flush; 7082 } MftWritesUserLevel; 7083 USHORT MftWritesFlushForLogFileFull; 7084 USHORT MftWritesLazyWriter; 7085 USHORT MftWritesUserRequest; 7086 ULONG Mft2Writes; 7087 ULONG Mft2WriteBytes; 7088 struct { 7089 USHORT Write; 7090 USHORT Create; 7091 USHORT SetInfo; 7092 USHORT Flush; 7093 } Mft2WritesUserLevel; 7094 USHORT Mft2WritesFlushForLogFileFull; 7095 USHORT Mft2WritesLazyWriter; 7096 USHORT Mft2WritesUserRequest; 7097 ULONG RootIndexReads; 7098 ULONG RootIndexReadBytes; 7099 ULONG RootIndexWrites; 7100 ULONG RootIndexWriteBytes; 7101 ULONG BitmapReads; 7102 ULONG BitmapReadBytes; 7103 ULONG BitmapWrites; 7104 ULONG BitmapWriteBytes; 7105 USHORT BitmapWritesFlushForLogFileFull; 7106 USHORT BitmapWritesLazyWriter; 7107 USHORT BitmapWritesUserRequest; 7108 struct { 7109 USHORT Write; 7110 USHORT Create; 7111 USHORT SetInfo; 7112 } BitmapWritesUserLevel; 7113 ULONG MftBitmapReads; 7114 ULONG MftBitmapReadBytes; 7115 ULONG MftBitmapWrites; 7116 ULONG MftBitmapWriteBytes; 7117 USHORT MftBitmapWritesFlushForLogFileFull; 7118 USHORT MftBitmapWritesLazyWriter; 7119 USHORT MftBitmapWritesUserRequest; 7120 struct { 7121 USHORT Write; 7122 USHORT Create; 7123 USHORT SetInfo; 7124 USHORT Flush; 7125 } MftBitmapWritesUserLevel; 7126 ULONG UserIndexReads; 7127 ULONG UserIndexReadBytes; 7128 ULONG UserIndexWrites; 7129 ULONG UserIndexWriteBytes; 7130 ULONG LogFileReads; 7131 ULONG LogFileReadBytes; 7132 ULONG LogFileWrites; 7133 ULONG LogFileWriteBytes; 7134 struct { 7135 ULONG Calls; 7136 ULONG Clusters; 7137 ULONG Hints; 7138 ULONG RunsReturned; 7139 ULONG HintsHonored; 7140 ULONG HintsClusters; 7141 ULONG Cache; 7142 ULONG CacheClusters; 7143 ULONG CacheMiss; 7144 ULONG CacheMissClusters; 7145 } Allocate; 7146 } NTFS_STATISTICS, *PNTFS_STATISTICS; 7147 7148 #endif /* _FILESYSTEMFSCTL_ */ 7149 7150 #define SYMLINK_FLAG_RELATIVE 1 7151 7152 typedef struct _REPARSE_DATA_BUFFER { 7153 ULONG ReparseTag; 7154 USHORT ReparseDataLength; 7155 USHORT Reserved; 7156 _ANONYMOUS_UNION union { 7157 struct { 7158 USHORT SubstituteNameOffset; 7159 USHORT SubstituteNameLength; 7160 USHORT PrintNameOffset; 7161 USHORT PrintNameLength; 7162 ULONG Flags; 7163 WCHAR PathBuffer[1]; 7164 } SymbolicLinkReparseBuffer; 7165 struct { 7166 USHORT SubstituteNameOffset; 7167 USHORT SubstituteNameLength; 7168 USHORT PrintNameOffset; 7169 USHORT PrintNameLength; 7170 WCHAR PathBuffer[1]; 7171 } MountPointReparseBuffer; 7172 struct { 7173 UCHAR DataBuffer[1]; 7174 } GenericReparseBuffer; 7175 } DUMMYUNIONNAME; 7176 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; 7177 7178 #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) 7179 7180 typedef struct _REPARSE_GUID_DATA_BUFFER { 7181 ULONG ReparseTag; 7182 USHORT ReparseDataLength; 7183 USHORT Reserved; 7184 GUID ReparseGuid; 7185 struct { 7186 UCHAR DataBuffer[1]; 7187 } GenericReparseBuffer; 7188 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER; 7189 7190 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer) 7191 7192 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) 7193 7194 /* Reserved reparse tags */ 7195 #define IO_REPARSE_TAG_RESERVED_ZERO (0) 7196 #define IO_REPARSE_TAG_RESERVED_ONE (1) 7197 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE 7198 7199 #define IsReparseTagMicrosoft(_tag) (((_tag) & 0x80000000)) 7200 #define IsReparseTagNameSurrogate(_tag) (((_tag) & 0x20000000)) 7201 7202 #define IO_REPARSE_TAG_VALID_VALUES (0xF000FFFF) 7203 7204 #define IsReparseTagValid(tag) ( \ 7205 !((tag) & ~IO_REPARSE_TAG_VALID_VALUES) && \ 7206 ((tag) > IO_REPARSE_TAG_RESERVED_RANGE) \ 7207 ) 7208 7209 /* MicroSoft reparse point tags */ 7210 #define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) 7211 #define IO_REPARSE_TAG_HSM (0xC0000004L) 7212 #define IO_REPARSE_TAG_DRIVE_EXTENDER (0x80000005L) 7213 #define IO_REPARSE_TAG_HSM2 (0x80000006L) 7214 #define IO_REPARSE_TAG_SIS (0x80000007L) 7215 #define IO_REPARSE_TAG_WIM (0x80000008L) 7216 #define IO_REPARSE_TAG_CSV (0x80000009L) 7217 #define IO_REPARSE_TAG_DFS (0x8000000AL) 7218 #define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL) 7219 #define IO_REPARSE_TAG_SYMLINK (0xA000000CL) 7220 #define IO_REPARSE_TAG_IIS_CACHE (0xA0000010L) 7221 #define IO_REPARSE_TAG_DFSR (0x80000012L) 7222 7223 #pragma pack(4) 7224 typedef struct _REPARSE_INDEX_KEY { 7225 ULONG FileReparseTag; 7226 LARGE_INTEGER FileId; 7227 } REPARSE_INDEX_KEY, *PREPARSE_INDEX_KEY; 7228 #pragma pack() 7229 7230 #define FSCTL_LMR_GET_LINK_TRACKING_INFORMATION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,58,METHOD_BUFFERED,FILE_ANY_ACCESS) 7231 #define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,59,METHOD_BUFFERED,FILE_ANY_ACCESS) 7232 #define IOCTL_LMR_ARE_FILE_OBJECTS_ON_SAME_SERVER CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,60,METHOD_BUFFERED,FILE_ANY_ACCESS) 7233 7234 #define FSCTL_PIPE_ASSIGN_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) 7235 #define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) 7236 #define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 7237 #define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA) 7238 #define FSCTL_PIPE_QUERY_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) 7239 #define FSCTL_PIPE_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) 7240 #define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) 7241 #define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) 7242 #define FSCTL_PIPE_SET_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) 7243 #define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) 7244 #define FSCTL_PIPE_GET_PIPE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) 7245 #define FSCTL_PIPE_SET_PIPE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 11, METHOD_BUFFERED, FILE_ANY_ACCESS) 7246 #define FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 7247 #define FSCTL_PIPE_SET_CONNECTION_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) 7248 #define FSCTL_PIPE_GET_HANDLE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) 7249 #define FSCTL_PIPE_SET_HANDLE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) 7250 #define FSCTL_PIPE_FLUSH CTL_CODE(FILE_DEVICE_NAMED_PIPE, 16, METHOD_BUFFERED, FILE_WRITE_DATA) 7251 7252 #define FSCTL_PIPE_INTERNAL_READ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA) 7253 #define FSCTL_PIPE_INTERNAL_WRITE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA) 7254 #define FSCTL_PIPE_INTERNAL_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) 7255 #define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA) 7256 7257 #define FILE_PIPE_READ_DATA 0x00000000 7258 #define FILE_PIPE_WRITE_SPACE 0x00000001 7259 7260 typedef struct _FILE_PIPE_ASSIGN_EVENT_BUFFER { 7261 HANDLE EventHandle; 7262 ULONG KeyValue; 7263 } FILE_PIPE_ASSIGN_EVENT_BUFFER, *PFILE_PIPE_ASSIGN_EVENT_BUFFER; 7264 7265 typedef struct _FILE_PIPE_EVENT_BUFFER { 7266 ULONG NamedPipeState; 7267 ULONG EntryType; 7268 ULONG ByteCount; 7269 ULONG KeyValue; 7270 ULONG NumberRequests; 7271 } FILE_PIPE_EVENT_BUFFER, *PFILE_PIPE_EVENT_BUFFER; 7272 7273 typedef struct _FILE_PIPE_PEEK_BUFFER { 7274 ULONG NamedPipeState; 7275 ULONG ReadDataAvailable; 7276 ULONG NumberOfMessages; 7277 ULONG MessageLength; 7278 CHAR Data[1]; 7279 } FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER; 7280 7281 typedef struct _FILE_PIPE_WAIT_FOR_BUFFER { 7282 LARGE_INTEGER Timeout; 7283 ULONG NameLength; 7284 BOOLEAN TimeoutSpecified; 7285 WCHAR Name[1]; 7286 } FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER; 7287 7288 typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER { 7289 #if !defined(BUILD_WOW6432) 7290 PVOID ClientSession; 7291 PVOID ClientProcess; 7292 #else 7293 ULONGLONG ClientSession; 7294 ULONGLONG ClientProcess; 7295 #endif 7296 } FILE_PIPE_CLIENT_PROCESS_BUFFER, *PFILE_PIPE_CLIENT_PROCESS_BUFFER; 7297 7298 #define FILE_PIPE_COMPUTER_NAME_LENGTH 15 7299 7300 typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER_EX { 7301 #if !defined(BUILD_WOW6432) 7302 PVOID ClientSession; 7303 PVOID ClientProcess; 7304 #else 7305 ULONGLONG ClientSession; 7306 ULONGLONG ClientProcess; 7307 #endif 7308 USHORT ClientComputerNameLength; 7309 WCHAR ClientComputerBuffer[FILE_PIPE_COMPUTER_NAME_LENGTH+1]; 7310 } FILE_PIPE_CLIENT_PROCESS_BUFFER_EX, *PFILE_PIPE_CLIENT_PROCESS_BUFFER_EX; 7311 7312 #define FSCTL_MAILSLOT_PEEK CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA) 7313 7314 typedef enum _LINK_TRACKING_INFORMATION_TYPE { 7315 NtfsLinkTrackingInformation, 7316 DfsLinkTrackingInformation 7317 } LINK_TRACKING_INFORMATION_TYPE, *PLINK_TRACKING_INFORMATION_TYPE; 7318 7319 typedef struct _LINK_TRACKING_INFORMATION { 7320 LINK_TRACKING_INFORMATION_TYPE Type; 7321 UCHAR VolumeId[16]; 7322 } LINK_TRACKING_INFORMATION, *PLINK_TRACKING_INFORMATION; 7323 7324 typedef struct _REMOTE_LINK_TRACKING_INFORMATION { 7325 PVOID TargetFileObject; 7326 ULONG TargetLinkTrackingInformationLength; 7327 UCHAR TargetLinkTrackingInformationBuffer[1]; 7328 } REMOTE_LINK_TRACKING_INFORMATION, *PREMOTE_LINK_TRACKING_INFORMATION; 7329 7330 #define IO_OPEN_PAGING_FILE 0x0002 7331 #define IO_OPEN_TARGET_DIRECTORY 0x0004 7332 #define IO_STOP_ON_SYMLINK 0x0008 7333 #define IO_MM_PAGING_FILE 0x0010 7334 7335 _Function_class_(DRIVER_FS_NOTIFICATION) 7336 typedef VOID 7337 (NTAPI DRIVER_FS_NOTIFICATION)( 7338 _In_ PDEVICE_OBJECT DeviceObject, 7339 _In_ BOOLEAN FsActive); 7340 typedef DRIVER_FS_NOTIFICATION *PDRIVER_FS_NOTIFICATION; 7341 7342 typedef enum _FS_FILTER_SECTION_SYNC_TYPE { 7343 SyncTypeOther = 0, 7344 SyncTypeCreateSection 7345 } FS_FILTER_SECTION_SYNC_TYPE, *PFS_FILTER_SECTION_SYNC_TYPE; 7346 7347 typedef enum _FS_FILTER_STREAM_FO_NOTIFICATION_TYPE { 7348 NotifyTypeCreate = 0, 7349 NotifyTypeRetired 7350 } FS_FILTER_STREAM_FO_NOTIFICATION_TYPE, *PFS_FILTER_STREAM_FO_NOTIFICATION_TYPE; 7351 7352 typedef union _FS_FILTER_PARAMETERS { 7353 struct { 7354 PLARGE_INTEGER EndingOffset; 7355 PERESOURCE *ResourceToRelease; 7356 } AcquireForModifiedPageWriter; 7357 struct { 7358 PERESOURCE ResourceToRelease; 7359 } ReleaseForModifiedPageWriter; 7360 struct { 7361 FS_FILTER_SECTION_SYNC_TYPE SyncType; 7362 ULONG PageProtection; 7363 } AcquireForSectionSynchronization; 7364 struct { 7365 FS_FILTER_STREAM_FO_NOTIFICATION_TYPE NotificationType; 7366 BOOLEAN POINTER_ALIGNMENT SafeToRecurse; 7367 } NotifyStreamFileObject; 7368 struct { 7369 PVOID Argument1; 7370 PVOID Argument2; 7371 PVOID Argument3; 7372 PVOID Argument4; 7373 PVOID Argument5; 7374 } Others; 7375 } FS_FILTER_PARAMETERS, *PFS_FILTER_PARAMETERS; 7376 7377 #define FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION (UCHAR)-1 7378 #define FS_FILTER_RELEASE_FOR_SECTION_SYNCHRONIZATION (UCHAR)-2 7379 #define FS_FILTER_ACQUIRE_FOR_MOD_WRITE (UCHAR)-3 7380 #define FS_FILTER_RELEASE_FOR_MOD_WRITE (UCHAR)-4 7381 #define FS_FILTER_ACQUIRE_FOR_CC_FLUSH (UCHAR)-5 7382 #define FS_FILTER_RELEASE_FOR_CC_FLUSH (UCHAR)-6 7383 7384 typedef struct _FS_FILTER_CALLBACK_DATA { 7385 ULONG SizeOfFsFilterCallbackData; 7386 UCHAR Operation; 7387 UCHAR Reserved; 7388 struct _DEVICE_OBJECT *DeviceObject; 7389 struct _FILE_OBJECT *FileObject; 7390 FS_FILTER_PARAMETERS Parameters; 7391 } FS_FILTER_CALLBACK_DATA, *PFS_FILTER_CALLBACK_DATA; 7392 7393 typedef NTSTATUS 7394 (NTAPI *PFS_FILTER_CALLBACK) ( 7395 _In_ PFS_FILTER_CALLBACK_DATA Data, 7396 _Out_ PVOID *CompletionContext); 7397 7398 typedef VOID 7399 (NTAPI *PFS_FILTER_COMPLETION_CALLBACK) ( 7400 _In_ PFS_FILTER_CALLBACK_DATA Data, 7401 _In_ NTSTATUS OperationStatus, 7402 _In_ PVOID CompletionContext); 7403 7404 typedef struct _FS_FILTER_CALLBACKS { 7405 ULONG SizeOfFsFilterCallbacks; 7406 ULONG Reserved; 7407 PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization; 7408 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForSectionSynchronization; 7409 PFS_FILTER_CALLBACK PreReleaseForSectionSynchronization; 7410 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForSectionSynchronization; 7411 PFS_FILTER_CALLBACK PreAcquireForCcFlush; 7412 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForCcFlush; 7413 PFS_FILTER_CALLBACK PreReleaseForCcFlush; 7414 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForCcFlush; 7415 PFS_FILTER_CALLBACK PreAcquireForModifiedPageWriter; 7416 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForModifiedPageWriter; 7417 PFS_FILTER_CALLBACK PreReleaseForModifiedPageWriter; 7418 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForModifiedPageWriter; 7419 } FS_FILTER_CALLBACKS, *PFS_FILTER_CALLBACKS; 7420 7421 extern NTKERNELAPI KSPIN_LOCK IoStatisticsLock; 7422 extern NTKERNELAPI ULONG IoReadOperationCount; 7423 extern NTKERNELAPI ULONG IoWriteOperationCount; 7424 extern NTKERNELAPI ULONG IoOtherOperationCount; 7425 extern NTKERNELAPI LARGE_INTEGER IoReadTransferCount; 7426 extern NTKERNELAPI LARGE_INTEGER IoWriteTransferCount; 7427 extern NTKERNELAPI LARGE_INTEGER IoOtherTransferCount; 7428 7429 #define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64 7430 #define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024 7431 7432 #if (NTDDI_VERSION >= NTDDI_VISTA) 7433 typedef struct _IO_PRIORITY_INFO { 7434 ULONG Size; 7435 ULONG ThreadPriority; 7436 ULONG PagePriority; 7437 IO_PRIORITY_HINT IoPriority; 7438 } IO_PRIORITY_INFO, *PIO_PRIORITY_INFO; 7439 #endif 7440 $endif (_NTIFS_) 7441 7442 $if (_WDMDDK_) 7443 7444 #define D3COLD_SUPPORT_INTERFACE_VERSION 1 7445 7446 typedef 7447 _Function_class_(SET_D3COLD_SUPPORT) 7448 _IRQL_requires_(PASSIVE_LEVEL) 7449 VOID 7450 SET_D3COLD_SUPPORT( 7451 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7452 _In_ BOOLEAN D3ColdSupport); 7453 7454 typedef SET_D3COLD_SUPPORT *PSET_D3COLD_SUPPORT; 7455 7456 typedef enum _DEVICE_WAKE_DEPTH 7457 { 7458 DeviceWakeDepthNotWakeable = 0, 7459 DeviceWakeDepthD0, 7460 DeviceWakeDepthD1, 7461 DeviceWakeDepthD2, 7462 DeviceWakeDepthD3hot, 7463 DeviceWakeDepthD3cold, 7464 DeviceWakeDepthMaximum 7465 } DEVICE_WAKE_DEPTH, *PDEVICE_WAKE_DEPTH; 7466 7467 FORCEINLINE 7468 DEVICE_POWER_STATE 7469 MapWakeDepthToDstate( 7470 _In_ DEVICE_WAKE_DEPTH WakeDepth) 7471 { 7472 const DEVICE_POWER_STATE dstateMap[DeviceWakeDepthMaximum] = 7473 { 7474 PowerDeviceD0, 7475 PowerDeviceD0, 7476 PowerDeviceD1, 7477 PowerDeviceD2, 7478 PowerDeviceD3, 7479 PowerDeviceD3 7480 }; 7481 7482 if (WakeDepth < 0 || WakeDepth >= DeviceWakeDepthMaximum) 7483 { 7484 return PowerDeviceUnspecified; 7485 } 7486 else 7487 { 7488 return dstateMap[WakeDepth]; 7489 } 7490 } 7491 7492 typedef 7493 _Function_class_(GET_IDLE_WAKE_INFO) 7494 _IRQL_requires_(PASSIVE_LEVEL) 7495 NTSTATUS 7496 GET_IDLE_WAKE_INFO( 7497 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7498 _In_ SYSTEM_POWER_STATE SystemPowerState, 7499 _Out_ PDEVICE_WAKE_DEPTH DeepestWakeableDstate); 7500 7501 typedef GET_IDLE_WAKE_INFO *PGET_IDLE_WAKE_INFO; 7502 7503 typedef 7504 _Function_class_(GET_D3COLD_CAPABILITY) 7505 _IRQL_requires_(PASSIVE_LEVEL) 7506 NTSTATUS 7507 GET_D3COLD_CAPABILITY( 7508 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7509 _Out_ PBOOLEAN D3ColdSupported); 7510 7511 typedef GET_D3COLD_CAPABILITY *PGET_D3COLD_CAPABILITY; 7512 7513 typedef enum _D3COLD_LAST_TRANSITION_STATUS 7514 { 7515 LastDStateTransitionStatusUnknown = 0, 7516 LastDStateTransitionD3hot, 7517 LastDStateTransitionD3cold 7518 } D3COLD_LAST_TRANSITION_STATUS, *PD3COLD_LAST_TRANSITION_STATUS; 7519 7520 typedef 7521 _Function_class_(GET_D3COLD_LAST_TRANSITION_STATUS) 7522 _IRQL_requires_max_(DISPATCH_LEVEL) 7523 VOID 7524 GET_D3COLD_LAST_TRANSITION_STATUS( 7525 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7526 _Out_ PD3COLD_LAST_TRANSITION_STATUS LastTransitionStatus); 7527 7528 typedef GET_D3COLD_LAST_TRANSITION_STATUS *PGET_D3COLD_LAST_TRANSITION_STATUS; 7529 7530 typedef struct _D3COLD_SUPPORT_INTERFACE 7531 { 7532 USHORT Size; 7533 USHORT Version; 7534 PVOID Context; 7535 PINTERFACE_REFERENCE InterfaceReference; 7536 PINTERFACE_DEREFERENCE InterfaceDereference; 7537 PSET_D3COLD_SUPPORT SetD3ColdSupport; 7538 PGET_IDLE_WAKE_INFO GetIdleWakeInfo; 7539 PGET_D3COLD_CAPABILITY GetD3ColdCapability; 7540 PGET_D3COLD_CAPABILITY GetBusDriverD3ColdSupport; 7541 PGET_D3COLD_LAST_TRANSITION_STATUS GetLastTransitionStatus; 7542 } D3COLD_SUPPORT_INTERFACE, *PD3COLD_SUPPORT_INTERFACE; 7543 7544 typedef 7545 _Function_class_(D3COLD_REQUEST_CORE_POWER_RAIL) 7546 _IRQL_requires_(PASSIVE_LEVEL) 7547 VOID 7548 D3COLD_REQUEST_CORE_POWER_RAIL( 7549 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7550 _In_ BOOLEAN CorePowerRailNeeded); 7551 7552 typedef D3COLD_REQUEST_CORE_POWER_RAIL *PD3COLD_REQUEST_CORE_POWER_RAIL; 7553 7554 typedef 7555 _Function_class_(D3COLD_REQUEST_AUX_POWER) 7556 _IRQL_requires_(PASSIVE_LEVEL) 7557 NTSTATUS 7558 D3COLD_REQUEST_AUX_POWER( 7559 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7560 _In_ ULONG AuxPowerInMilliWatts, 7561 _Out_ PULONG RetryInSeconds); 7562 7563 typedef D3COLD_REQUEST_AUX_POWER *PD3COLD_REQUEST_AUX_POWER; 7564 7565 typedef 7566 _Function_class_(D3COLD_REQUEST_PERST_DELAY) 7567 _IRQL_requires_(PASSIVE_LEVEL) 7568 NTSTATUS 7569 D3COLD_REQUEST_PERST_DELAY( 7570 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context, 7571 _In_ ULONG DelayInMicroSeconds); 7572 7573 typedef D3COLD_REQUEST_PERST_DELAY *PD3COLD_REQUEST_PERST_DELAY; 7574 7575 typedef struct _D3COLD_AUX_POWER_AND_TIMING_INTERFACE 7576 { 7577 USHORT Size; 7578 USHORT Version; 7579 PVOID Context; 7580 PINTERFACE_REFERENCE InterfaceReference; 7581 PINTERFACE_DEREFERENCE InterfaceDereference; 7582 PD3COLD_REQUEST_CORE_POWER_RAIL RequestCorePowerRail; 7583 PD3COLD_REQUEST_AUX_POWER RequestAuxPower; 7584 PD3COLD_REQUEST_PERST_DELAY RequestPerstDelay; 7585 } D3COLD_AUX_POWER_AND_TIMING_INTERFACE, *PD3COLD_AUX_POWER_AND_TIMING_INTERFACE; 7586 $endif(_WDMDDK_) 7587