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