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