1 /* 2 * ntddk.h 3 * 4 * Windows NT Device Driver Kit 5 * 6 * This file is part of the ReactOS DDK package. 7 * 8 * Contributors: 9 * Amine Khaldi 10 * Timo Kreuzer (timo.kreuzer (at) reactos.org) 11 * 12 * THIS SOFTWARE IS NOT COPYRIGHTED 13 * 14 * This source code is offered for use in the public domain. You may 15 * use, modify or distribute it freely. 16 * 17 * This code is distributed in the hope that it will be useful but 18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 19 * DISCLAIMED. This includes but is not limited to warranties of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 21 * 22 */ 23 24 #pragma once 25 26 #define _NTDDK_ 27 28 #if !defined(_NTHAL_) && !defined(_NTIFS_) 29 #define _NTDDK_INCLUDED_ 30 #define _DDK_DRIVER_ 31 #endif 32 33 /* Dependencies */ 34 35 #define NT_INCLUDED 36 #define _CTYPE_DISABLE_MACROS 37 38 #include <wdm.h> 39 #include <excpt.h> 40 #include <ntdef.h> 41 #include <ntstatus.h> 42 #include <mce.h> 43 #include <bugcodes.h> 44 #include <ntiologc.h> 45 46 #include <stdarg.h> // FIXME 47 #include <basetyps.h> // FIXME 48 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 /* GUID and UUID */ 55 #ifndef _NTLSA_IFS_ 56 #ifndef _NTLSA_AUDIT_ 57 #define _NTLSA_AUDIT_ 58 59 #ifndef GUID_DEFINED 60 #include <guiddef.h> 61 #endif 62 63 #endif /* _NTLSA_AUDIT_ */ 64 #endif /* _NTLSA_IFS_ */ 65 66 typedef GUID UUID; 67 68 struct _LOADER_PARAMETER_BLOCK; 69 struct _CREATE_DISK; 70 struct _DRIVE_LAYOUT_INFORMATION_EX; 71 struct _SET_PARTITION_INFORMATION_EX; 72 73 typedef struct _BUS_HANDLER *PBUS_HANDLER; 74 typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT; 75 #if defined(_NTHAL_INCLUDED_) 76 typedef struct _KAFFINITY_EX *PKAFFINITY_EX; 77 #endif 78 typedef struct _PEB *PPEB; 79 80 #ifndef _NTIMAGE_ 81 82 typedef struct _IMAGE_NT_HEADERS *PIMAGE_NT_HEADERS32; 83 typedef struct _IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64; 84 85 #ifdef _WIN64 86 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; 87 #else 88 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; 89 #endif 90 91 #endif /* _NTIMAGE_ */ 92 93 /****************************************************************************** 94 * Executive Types * 95 ******************************************************************************/ 96 typedef struct _ZONE_SEGMENT_HEADER { 97 SINGLE_LIST_ENTRY SegmentList; 98 PVOID Reserved; 99 } ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER; 100 101 typedef struct _ZONE_HEADER { 102 SINGLE_LIST_ENTRY FreeList; 103 SINGLE_LIST_ENTRY SegmentList; 104 ULONG BlockSize; 105 ULONG TotalSegmentSize; 106 } ZONE_HEADER, *PZONE_HEADER; 107 108 #define PROTECTED_POOL 0x80000000 109 110 /****************************************************************************** 111 * I/O Manager Types * 112 ******************************************************************************/ 113 114 /* DEVICE_OBJECT.Flags */ 115 #define DO_DEVICE_HAS_NAME 0x00000040 116 #define DO_SYSTEM_BOOT_PARTITION 0x00000100 117 #define DO_LONG_TERM_REQUESTS 0x00000200 118 #define DO_NEVER_LAST_DEVICE 0x00000400 119 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 120 #define DO_SUPPORTS_TRANSACTIONS 0x00040000 121 #define DO_FORCE_NEITHER_IO 0x00080000 122 #define DO_VOLUME_DEVICE_OBJECT 0x00100000 123 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000 124 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000 125 #define DO_DISALLOW_EXECUTE 0x00800000 126 127 #ifndef _ARC_DDK_ 128 #define _ARC_DDK_ 129 typedef enum _CONFIGURATION_TYPE { 130 ArcSystem, 131 CentralProcessor, 132 FloatingPointProcessor, 133 PrimaryIcache, 134 PrimaryDcache, 135 SecondaryIcache, 136 SecondaryDcache, 137 SecondaryCache, 138 EisaAdapter, 139 TcAdapter, 140 ScsiAdapter, 141 DtiAdapter, 142 MultiFunctionAdapter, 143 DiskController, 144 TapeController, 145 CdromController, 146 WormController, 147 SerialController, 148 NetworkController, 149 DisplayController, 150 ParallelController, 151 PointerController, 152 KeyboardController, 153 AudioController, 154 OtherController, 155 DiskPeripheral, 156 FloppyDiskPeripheral, 157 TapePeripheral, 158 ModemPeripheral, 159 MonitorPeripheral, 160 PrinterPeripheral, 161 PointerPeripheral, 162 KeyboardPeripheral, 163 TerminalPeripheral, 164 OtherPeripheral, 165 LinePeripheral, 166 NetworkPeripheral, 167 SystemMemory, 168 DockingInformation, 169 RealModeIrqRoutingTable, 170 RealModePCIEnumeration, 171 MaximumType 172 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE; 173 #endif /* !_ARC_DDK_ */ 174 175 /* 176 ** IRP function codes 177 */ 178 179 #define IRP_MN_QUERY_DIRECTORY 0x01 180 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 181 182 #define IRP_MN_USER_FS_REQUEST 0x00 183 #define IRP_MN_MOUNT_VOLUME 0x01 184 #define IRP_MN_VERIFY_VOLUME 0x02 185 #define IRP_MN_LOAD_FILE_SYSTEM 0x03 186 #define IRP_MN_TRACK_LINK 0x04 187 #define IRP_MN_KERNEL_CALL 0x04 188 189 #define IRP_MN_LOCK 0x01 190 #define IRP_MN_UNLOCK_SINGLE 0x02 191 #define IRP_MN_UNLOCK_ALL 0x03 192 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 193 194 #define IRP_MN_FLUSH_AND_PURGE 0x01 195 196 #define IRP_MN_NORMAL 0x00 197 #define IRP_MN_DPC 0x01 198 #define IRP_MN_MDL 0x02 199 #define IRP_MN_COMPLETE 0x04 200 #define IRP_MN_COMPRESSED 0x08 201 202 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) 203 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) 204 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) 205 206 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 207 208 #define IO_CHECK_CREATE_PARAMETERS 0x0200 209 #define IO_ATTACH_DEVICE 0x0400 210 #define IO_IGNORE_SHARE_ACCESS_CHECK 0x0800 211 212 typedef NTSTATUS 213 (NTAPI *PIO_QUERY_DEVICE_ROUTINE)( 214 IN PVOID Context, 215 IN PUNICODE_STRING PathName, 216 IN INTERFACE_TYPE BusType, 217 IN ULONG BusNumber, 218 IN PKEY_VALUE_FULL_INFORMATION *BusInformation, 219 IN CONFIGURATION_TYPE ControllerType, 220 IN ULONG ControllerNumber, 221 IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation, 222 IN CONFIGURATION_TYPE PeripheralType, 223 IN ULONG PeripheralNumber, 224 IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation); 225 226 typedef enum _IO_QUERY_DEVICE_DATA_FORMAT { 227 IoQueryDeviceIdentifier = 0, 228 IoQueryDeviceConfigurationData, 229 IoQueryDeviceComponentInformation, 230 IoQueryDeviceMaxData 231 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT; 232 233 typedef VOID 234 (NTAPI *PDRIVER_REINITIALIZE)( 235 IN struct _DRIVER_OBJECT *DriverObject, 236 IN PVOID Context OPTIONAL, 237 IN ULONG Count); 238 239 typedef struct _CONTROLLER_OBJECT { 240 CSHORT Type; 241 CSHORT Size; 242 PVOID ControllerExtension; 243 KDEVICE_QUEUE DeviceWaitQueue; 244 ULONG Spare1; 245 LARGE_INTEGER Spare2; 246 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; 247 248 #define DRVO_REINIT_REGISTERED 0x00000008 249 #define DRVO_INITIALIZED 0x00000010 250 #define DRVO_BOOTREINIT_REGISTERED 0x00000020 251 #define DRVO_LEGACY_RESOURCES 0x00000040 252 253 typedef struct _CONFIGURATION_INFORMATION { 254 ULONG DiskCount; 255 ULONG FloppyCount; 256 ULONG CdRomCount; 257 ULONG TapeCount; 258 ULONG ScsiPortCount; 259 ULONG SerialCount; 260 ULONG ParallelCount; 261 BOOLEAN AtDiskPrimaryAddressClaimed; 262 BOOLEAN AtDiskSecondaryAddressClaimed; 263 ULONG Version; 264 ULONG MediumChangerCount; 265 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION; 266 267 typedef struct _DISK_SIGNATURE { 268 ULONG PartitionStyle; 269 _ANONYMOUS_UNION union { 270 struct { 271 ULONG Signature; 272 ULONG CheckSum; 273 } Mbr; 274 struct { 275 GUID DiskId; 276 } Gpt; 277 } DUMMYUNIONNAME; 278 } DISK_SIGNATURE, *PDISK_SIGNATURE; 279 280 typedef struct _TXN_PARAMETER_BLOCK { 281 USHORT Length; 282 USHORT TxFsContext; 283 PVOID TransactionObject; 284 } TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK; 285 286 #define TXF_MINIVERSION_DEFAULT_VIEW (0xFFFE) 287 288 typedef struct _IO_DRIVER_CREATE_CONTEXT { 289 CSHORT Size; 290 struct _ECP_LIST *ExtraCreateParameter; 291 PVOID DeviceObjectHint; 292 PTXN_PARAMETER_BLOCK TxnParameters; 293 } IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT; 294 295 typedef struct _AGP_TARGET_BUS_INTERFACE_STANDARD { 296 USHORT Size; 297 USHORT Version; 298 PVOID Context; 299 PINTERFACE_REFERENCE InterfaceReference; 300 PINTERFACE_DEREFERENCE InterfaceDereference; 301 PGET_SET_DEVICE_DATA SetBusData; 302 PGET_SET_DEVICE_DATA GetBusData; 303 UCHAR CapabilityID; 304 } AGP_TARGET_BUS_INTERFACE_STANDARD, *PAGP_TARGET_BUS_INTERFACE_STANDARD; 305 306 typedef NTSTATUS 307 (NTAPI *PGET_LOCATION_STRING)( 308 IN OUT PVOID Context OPTIONAL, 309 OUT PWCHAR *LocationStrings); 310 311 typedef struct _PNP_LOCATION_INTERFACE { 312 USHORT Size; 313 USHORT Version; 314 PVOID Context; 315 PINTERFACE_REFERENCE InterfaceReference; 316 PINTERFACE_DEREFERENCE InterfaceDereference; 317 PGET_LOCATION_STRING GetLocationString; 318 } PNP_LOCATION_INTERFACE, *PPNP_LOCATION_INTERFACE; 319 320 typedef enum _ARBITER_ACTION { 321 ArbiterActionTestAllocation, 322 ArbiterActionRetestAllocation, 323 ArbiterActionCommitAllocation, 324 ArbiterActionRollbackAllocation, 325 ArbiterActionQueryAllocatedResources, 326 ArbiterActionWriteReservedResources, 327 ArbiterActionQueryConflict, 328 ArbiterActionQueryArbitrate, 329 ArbiterActionAddReserved, 330 ArbiterActionBootAllocation 331 } ARBITER_ACTION, *PARBITER_ACTION; 332 333 typedef struct _ARBITER_CONFLICT_INFO { 334 PDEVICE_OBJECT OwningObject; 335 ULONGLONG Start; 336 ULONGLONG End; 337 } ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO; 338 339 typedef struct _ARBITER_TEST_ALLOCATION_PARAMETERS { 340 IN OUT PLIST_ENTRY ArbitrationList; 341 IN ULONG AllocateFromCount; 342 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; 343 } ARBITER_TEST_ALLOCATION_PARAMETERS, *PARBITER_TEST_ALLOCATION_PARAMETERS; 344 345 typedef struct _ARBITER_RETEST_ALLOCATION_PARAMETERS { 346 IN OUT PLIST_ENTRY ArbitrationList; 347 IN ULONG AllocateFromCount; 348 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; 349 } ARBITER_RETEST_ALLOCATION_PARAMETERS, *PARBITER_RETEST_ALLOCATION_PARAMETERS; 350 351 typedef struct _ARBITER_BOOT_ALLOCATION_PARAMETERS { 352 IN OUT PLIST_ENTRY ArbitrationList; 353 } ARBITER_BOOT_ALLOCATION_PARAMETERS, *PARBITER_BOOT_ALLOCATION_PARAMETERS; 354 355 typedef struct _ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS { 356 OUT PCM_PARTIAL_RESOURCE_LIST *AllocatedResources; 357 } ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS, *PARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS; 358 359 typedef struct _ARBITER_QUERY_CONFLICT_PARAMETERS { 360 IN PDEVICE_OBJECT PhysicalDeviceObject; 361 IN PIO_RESOURCE_DESCRIPTOR ConflictingResource; 362 OUT PULONG ConflictCount; 363 OUT PARBITER_CONFLICT_INFO *Conflicts; 364 } ARBITER_QUERY_CONFLICT_PARAMETERS, *PARBITER_QUERY_CONFLICT_PARAMETERS; 365 366 typedef struct _ARBITER_QUERY_ARBITRATE_PARAMETERS { 367 IN PLIST_ENTRY ArbitrationList; 368 } ARBITER_QUERY_ARBITRATE_PARAMETERS, *PARBITER_QUERY_ARBITRATE_PARAMETERS; 369 370 typedef struct _ARBITER_ADD_RESERVED_PARAMETERS { 371 IN PDEVICE_OBJECT ReserveDevice; 372 } ARBITER_ADD_RESERVED_PARAMETERS, *PARBITER_ADD_RESERVED_PARAMETERS; 373 374 typedef struct _ARBITER_PARAMETERS { 375 union { 376 ARBITER_TEST_ALLOCATION_PARAMETERS TestAllocation; 377 ARBITER_RETEST_ALLOCATION_PARAMETERS RetestAllocation; 378 ARBITER_BOOT_ALLOCATION_PARAMETERS BootAllocation; 379 ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS QueryAllocatedResources; 380 ARBITER_QUERY_CONFLICT_PARAMETERS QueryConflict; 381 ARBITER_QUERY_ARBITRATE_PARAMETERS QueryArbitrate; 382 ARBITER_ADD_RESERVED_PARAMETERS AddReserved; 383 } Parameters; 384 } ARBITER_PARAMETERS, *PARBITER_PARAMETERS; 385 386 typedef enum _ARBITER_REQUEST_SOURCE { 387 ArbiterRequestUndefined = -1, 388 ArbiterRequestLegacyReported, 389 ArbiterRequestHalReported, 390 ArbiterRequestLegacyAssigned, 391 ArbiterRequestPnpDetected, 392 ArbiterRequestPnpEnumerated 393 } ARBITER_REQUEST_SOURCE; 394 395 typedef enum _ARBITER_RESULT { 396 ArbiterResultUndefined = -1, 397 ArbiterResultSuccess, 398 ArbiterResultExternalConflict, 399 ArbiterResultNullRequest 400 } ARBITER_RESULT; 401 402 #define ARBITER_FLAG_BOOT_CONFIG 0x00000001 403 404 typedef struct _ARBITER_LIST_ENTRY { 405 LIST_ENTRY ListEntry; 406 ULONG AlternativeCount; 407 PIO_RESOURCE_DESCRIPTOR Alternatives; 408 PDEVICE_OBJECT PhysicalDeviceObject; 409 ARBITER_REQUEST_SOURCE RequestSource; 410 ULONG Flags; 411 LONG_PTR WorkSpace; 412 INTERFACE_TYPE InterfaceType; 413 ULONG SlotNumber; 414 ULONG BusNumber; 415 PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment; 416 PIO_RESOURCE_DESCRIPTOR SelectedAlternative; 417 ARBITER_RESULT Result; 418 } ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY; 419 420 typedef NTSTATUS 421 (NTAPI *PARBITER_HANDLER)( 422 IN OUT PVOID Context, 423 IN ARBITER_ACTION Action, 424 IN OUT PARBITER_PARAMETERS Parameters); 425 426 #define ARBITER_PARTIAL 0x00000001 427 428 typedef struct _ARBITER_INTERFACE { 429 USHORT Size; 430 USHORT Version; 431 PVOID Context; 432 PINTERFACE_REFERENCE InterfaceReference; 433 PINTERFACE_DEREFERENCE InterfaceDereference; 434 PARBITER_HANDLER ArbiterHandler; 435 ULONG Flags; 436 } ARBITER_INTERFACE, *PARBITER_INTERFACE; 437 438 typedef enum _RESOURCE_TRANSLATION_DIRECTION { 439 TranslateChildToParent, 440 TranslateParentToChild 441 } RESOURCE_TRANSLATION_DIRECTION; 442 443 typedef NTSTATUS 444 (NTAPI *PTRANSLATE_RESOURCE_HANDLER)( 445 IN OUT PVOID Context OPTIONAL, 446 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Source, 447 IN RESOURCE_TRANSLATION_DIRECTION Direction, 448 IN ULONG AlternativesCount OPTIONAL, 449 IN IO_RESOURCE_DESCRIPTOR Alternatives[], 450 IN PDEVICE_OBJECT PhysicalDeviceObject, 451 OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target); 452 453 typedef NTSTATUS 454 (NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)( 455 IN OUT PVOID Context OPTIONAL, 456 IN PIO_RESOURCE_DESCRIPTOR Source, 457 IN PDEVICE_OBJECT PhysicalDeviceObject, 458 OUT PULONG TargetCount, 459 OUT PIO_RESOURCE_DESCRIPTOR *Target); 460 461 typedef struct _TRANSLATOR_INTERFACE { 462 USHORT Size; 463 USHORT Version; 464 PVOID Context; 465 PINTERFACE_REFERENCE InterfaceReference; 466 PINTERFACE_DEREFERENCE InterfaceDereference; 467 PTRANSLATE_RESOURCE_HANDLER TranslateResources; 468 PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements; 469 } TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE; 470 471 typedef struct _PCI_AGP_CAPABILITY { 472 PCI_CAPABILITIES_HEADER Header; 473 USHORT Minor:4; 474 USHORT Major:4; 475 USHORT Rsvd1:8; 476 struct _PCI_AGP_STATUS { 477 ULONG Rate:3; 478 ULONG Agp3Mode:1; 479 ULONG FastWrite:1; 480 ULONG FourGB:1; 481 ULONG HostTransDisable:1; 482 ULONG Gart64:1; 483 ULONG ITA_Coherent:1; 484 ULONG SideBandAddressing:1; 485 ULONG CalibrationCycle:3; 486 ULONG AsyncRequestSize:3; 487 ULONG Rsvd1:1; 488 ULONG Isoch:1; 489 ULONG Rsvd2:6; 490 ULONG RequestQueueDepthMaximum:8; 491 } AGPStatus; 492 struct _PCI_AGP_COMMAND { 493 ULONG Rate:3; 494 ULONG Rsvd1:1; 495 ULONG FastWriteEnable:1; 496 ULONG FourGBEnable:1; 497 ULONG Rsvd2:1; 498 ULONG Gart64:1; 499 ULONG AGPEnable:1; 500 ULONG SBAEnable:1; 501 ULONG CalibrationCycle:3; 502 ULONG AsyncReqSize:3; 503 ULONG Rsvd3:8; 504 ULONG RequestQueueDepth:8; 505 } AGPCommand; 506 } PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY; 507 508 typedef enum _EXTENDED_AGP_REGISTER { 509 IsochStatus, 510 AgpControl, 511 ApertureSize, 512 AperturePageSize, 513 GartLow, 514 GartHigh, 515 IsochCommand 516 } EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER; 517 518 typedef struct _PCI_AGP_ISOCH_STATUS { 519 ULONG ErrorCode:2; 520 ULONG Rsvd1:1; 521 ULONG Isoch_L:3; 522 ULONG Isoch_Y:2; 523 ULONG Isoch_N:8; 524 ULONG Rsvd2:16; 525 } PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS; 526 527 typedef struct _PCI_AGP_CONTROL { 528 ULONG Rsvd1:7; 529 ULONG GTLB_Enable:1; 530 ULONG AP_Enable:1; 531 ULONG CAL_Disable:1; 532 ULONG Rsvd2:22; 533 } PCI_AGP_CONTROL, *PPCI_AGP_CONTROL; 534 535 typedef struct _PCI_AGP_APERTURE_PAGE_SIZE { 536 USHORT PageSizeMask:11; 537 USHORT Rsvd1:1; 538 USHORT PageSizeSelect:4; 539 } PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE; 540 541 typedef struct _PCI_AGP_ISOCH_COMMAND { 542 USHORT Rsvd1:6; 543 USHORT Isoch_Y:2; 544 USHORT Isoch_N:8; 545 } PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND; 546 547 typedef struct PCI_AGP_EXTENDED_CAPABILITY { 548 PCI_AGP_ISOCH_STATUS IsochStatus; 549 PCI_AGP_CONTROL AgpControl; 550 USHORT ApertureSize; 551 PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize; 552 ULONG GartLow; 553 ULONG GartHigh; 554 PCI_AGP_ISOCH_COMMAND IsochCommand; 555 } PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY; 556 557 #define PCI_AGP_RATE_1X 0x1 558 #define PCI_AGP_RATE_2X 0x2 559 #define PCI_AGP_RATE_4X 0x4 560 561 #define PCIX_MODE_CONVENTIONAL_PCI 0x0 562 #define PCIX_MODE1_66MHZ 0x1 563 #define PCIX_MODE1_100MHZ 0x2 564 #define PCIX_MODE1_133MHZ 0x3 565 #define PCIX_MODE2_266_66MHZ 0x9 566 #define PCIX_MODE2_266_100MHZ 0xA 567 #define PCIX_MODE2_266_133MHZ 0xB 568 #define PCIX_MODE2_533_66MHZ 0xD 569 #define PCIX_MODE2_533_100MHZ 0xE 570 #define PCIX_MODE2_533_133MHZ 0xF 571 572 #define PCIX_VERSION_MODE1_ONLY 0x0 573 #define PCIX_VERSION_MODE2_ECC 0x1 574 #define PCIX_VERSION_DUAL_MODE_ECC 0x2 575 576 typedef struct _PCIX_BRIDGE_CAPABILITY { 577 PCI_CAPABILITIES_HEADER Header; 578 union { 579 _ANONYMOUS_STRUCT struct { 580 USHORT Bus64Bit:1; 581 USHORT Bus133MHzCapable:1; 582 USHORT SplitCompletionDiscarded:1; 583 USHORT UnexpectedSplitCompletion:1; 584 USHORT SplitCompletionOverrun:1; 585 USHORT SplitRequestDelayed:1; 586 USHORT BusModeFrequency:4; 587 USHORT Rsvd:2; 588 USHORT Version:2; 589 USHORT Bus266MHzCapable:1; 590 USHORT Bus533MHzCapable:1; 591 } DUMMYSTRUCTNAME; 592 USHORT AsUSHORT; 593 } SecondaryStatus; 594 union { 595 _ANONYMOUS_STRUCT struct { 596 ULONG FunctionNumber:3; 597 ULONG DeviceNumber:5; 598 ULONG BusNumber:8; 599 ULONG Device64Bit:1; 600 ULONG Device133MHzCapable:1; 601 ULONG SplitCompletionDiscarded:1; 602 ULONG UnexpectedSplitCompletion:1; 603 ULONG SplitCompletionOverrun:1; 604 ULONG SplitRequestDelayed:1; 605 ULONG Rsvd:7; 606 ULONG DIMCapable:1; 607 ULONG Device266MHzCapable:1; 608 ULONG Device533MHzCapable:1; 609 } DUMMYSTRUCTNAME; 610 ULONG AsULONG; 611 } BridgeStatus; 612 USHORT UpstreamSplitTransactionCapacity; 613 USHORT UpstreamSplitTransactionLimit; 614 USHORT DownstreamSplitTransactionCapacity; 615 USHORT DownstreamSplitTransactionLimit; 616 union { 617 _ANONYMOUS_STRUCT struct { 618 ULONG SelectSecondaryRegisters:1; 619 ULONG ErrorPresentInOtherBank:1; 620 ULONG AdditionalCorrectableError:1; 621 ULONG AdditionalUncorrectableError:1; 622 ULONG ErrorPhase:3; 623 ULONG ErrorCorrected:1; 624 ULONG Syndrome:8; 625 ULONG ErrorFirstCommand:4; 626 ULONG ErrorSecondCommand:4; 627 ULONG ErrorUpperAttributes:4; 628 ULONG ControlUpdateEnable:1; 629 ULONG Rsvd:1; 630 ULONG DisableSingleBitCorrection:1; 631 ULONG EccMode:1; 632 } DUMMYSTRUCTNAME; 633 ULONG AsULONG; 634 } EccControlStatus; 635 ULONG EccFirstAddress; 636 ULONG EccSecondAddress; 637 ULONG EccAttribute; 638 } PCIX_BRIDGE_CAPABILITY, *PPCIX_BRIDGE_CAPABILITY; 639 640 typedef struct _PCI_SUBSYSTEM_IDS_CAPABILITY { 641 PCI_CAPABILITIES_HEADER Header; 642 USHORT Reserved; 643 USHORT SubVendorID; 644 USHORT SubSystemID; 645 } PCI_SUBSYSTEM_IDS_CAPABILITY, *PPCI_SUBSYSTEM_IDS_CAPABILITY; 646 647 #define OSC_FIRMWARE_FAILURE 0x02 648 #define OSC_UNRECOGNIZED_UUID 0x04 649 #define OSC_UNRECOGNIZED_REVISION 0x08 650 #define OSC_CAPABILITIES_MASKED 0x10 651 652 #define PCI_ROOT_BUS_OSC_METHOD_CAPABILITY_REVISION 0x01 653 654 typedef struct _PCI_ROOT_BUS_OSC_SUPPORT_FIELD { 655 union { 656 _ANONYMOUS_STRUCT struct { 657 ULONG ExtendedConfigOpRegions:1; 658 ULONG ActiveStatePowerManagement:1; 659 ULONG ClockPowerManagement:1; 660 ULONG SegmentGroups:1; 661 ULONG MessageSignaledInterrupts:1; 662 ULONG WindowsHardwareErrorArchitecture:1; 663 ULONG Reserved:26; 664 } DUMMYSTRUCTNAME; 665 ULONG AsULONG; 666 } u; 667 } PCI_ROOT_BUS_OSC_SUPPORT_FIELD, *PPCI_ROOT_BUS_OSC_SUPPORT_FIELD; 668 669 typedef struct _PCI_ROOT_BUS_OSC_CONTROL_FIELD { 670 union { 671 _ANONYMOUS_STRUCT struct { 672 ULONG ExpressNativeHotPlug:1; 673 ULONG ShpcNativeHotPlug:1; 674 ULONG ExpressNativePME:1; 675 ULONG ExpressAdvancedErrorReporting:1; 676 ULONG ExpressCapabilityStructure:1; 677 ULONG Reserved:27; 678 } DUMMYSTRUCTNAME; 679 ULONG AsULONG; 680 } u; 681 } PCI_ROOT_BUS_OSC_CONTROL_FIELD, *PPCI_ROOT_BUS_OSC_CONTROL_FIELD; 682 683 typedef enum _PCI_HARDWARE_INTERFACE { 684 PciConventional, 685 PciXMode1, 686 PciXMode2, 687 PciExpress 688 } PCI_HARDWARE_INTERFACE, *PPCI_HARDWARE_INTERFACE; 689 690 typedef enum { 691 BusWidth32Bits, 692 BusWidth64Bits 693 } PCI_BUS_WIDTH; 694 695 typedef struct _PCI_ROOT_BUS_HARDWARE_CAPABILITY { 696 PCI_HARDWARE_INTERFACE SecondaryInterface; 697 _ANONYMOUS_STRUCT struct { 698 BOOLEAN BusCapabilitiesFound; 699 ULONG CurrentSpeedAndMode; 700 ULONG SupportedSpeedsAndModes; 701 BOOLEAN DeviceIDMessagingCapable; 702 PCI_BUS_WIDTH SecondaryBusWidth; 703 } DUMMYSTRUCTNAME; 704 PCI_ROOT_BUS_OSC_SUPPORT_FIELD OscFeatureSupport; 705 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlRequest; 706 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlGranted; 707 } PCI_ROOT_BUS_HARDWARE_CAPABILITY, *PPCI_ROOT_BUS_HARDWARE_CAPABILITY; 708 709 typedef union _PCI_EXPRESS_CAPABILITIES_REGISTER { 710 _ANONYMOUS_STRUCT struct { 711 USHORT CapabilityVersion:4; 712 USHORT DeviceType:4; 713 USHORT SlotImplemented:1; 714 USHORT InterruptMessageNumber:5; 715 USHORT Rsvd:2; 716 } DUMMYSTRUCTNAME; 717 USHORT AsUSHORT; 718 } PCI_EXPRESS_CAPABILITIES_REGISTER, *PPCI_EXPRESS_CAPABILITIES_REGISTER; 719 720 typedef union _PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER { 721 _ANONYMOUS_STRUCT struct { 722 ULONG MaxPayloadSizeSupported:3; 723 ULONG PhantomFunctionsSupported:2; 724 ULONG ExtendedTagSupported:1; 725 ULONG L0sAcceptableLatency:3; 726 ULONG L1AcceptableLatency:3; 727 ULONG Undefined:3; 728 ULONG RoleBasedErrorReporting:1; 729 ULONG Rsvd1:2; 730 ULONG CapturedSlotPowerLimit:8; 731 ULONG CapturedSlotPowerLimitScale:2; 732 ULONG Rsvd2:4; 733 } DUMMYSTRUCTNAME; 734 ULONG AsULONG; 735 } PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER, *PPCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER; 736 737 #define PCI_EXPRESS_AER_DEVICE_CONTROL_MASK 0x07; 738 739 typedef union _PCI_EXPRESS_DEVICE_CONTROL_REGISTER { 740 _ANONYMOUS_STRUCT struct { 741 USHORT CorrectableErrorEnable:1; 742 USHORT NonFatalErrorEnable:1; 743 USHORT FatalErrorEnable:1; 744 USHORT UnsupportedRequestErrorEnable:1; 745 USHORT EnableRelaxedOrder:1; 746 USHORT MaxPayloadSize:3; 747 USHORT ExtendedTagEnable:1; 748 USHORT PhantomFunctionsEnable:1; 749 USHORT AuxPowerEnable:1; 750 USHORT NoSnoopEnable:1; 751 USHORT MaxReadRequestSize:3; 752 USHORT BridgeConfigRetryEnable:1; 753 } DUMMYSTRUCTNAME; 754 USHORT AsUSHORT; 755 } PCI_EXPRESS_DEVICE_CONTROL_REGISTER, *PPCI_EXPRESS_DEVICE_CONTROL_REGISTER; 756 757 #define PCI_EXPRESS_AER_DEVICE_STATUS_MASK 0x0F; 758 759 typedef union _PCI_EXPRESS_DEVICE_STATUS_REGISTER { 760 _ANONYMOUS_STRUCT struct { 761 USHORT CorrectableErrorDetected:1; 762 USHORT NonFatalErrorDetected:1; 763 USHORT FatalErrorDetected:1; 764 USHORT UnsupportedRequestDetected:1; 765 USHORT AuxPowerDetected:1; 766 USHORT TransactionsPending:1; 767 USHORT Rsvd:10; 768 } DUMMYSTRUCTNAME; 769 USHORT AsUSHORT; 770 } PCI_EXPRESS_DEVICE_STATUS_REGISTER, *PPCI_EXPRESS_DEVICE_STATUS_REGISTER; 771 772 typedef union _PCI_EXPRESS_LINK_CAPABILITIES_REGISTER { 773 _ANONYMOUS_STRUCT struct { 774 ULONG MaximumLinkSpeed:4; 775 ULONG MaximumLinkWidth:6; 776 ULONG ActiveStatePMSupport:2; 777 ULONG L0sExitLatency:3; 778 ULONG L1ExitLatency:3; 779 ULONG ClockPowerManagement:1; 780 ULONG SurpriseDownErrorReportingCapable:1; 781 ULONG DataLinkLayerActiveReportingCapable:1; 782 ULONG Rsvd:3; 783 ULONG PortNumber:8; 784 } DUMMYSTRUCTNAME; 785 ULONG AsULONG; 786 } PCI_EXPRESS_LINK_CAPABILITIES_REGISTER, *PPCI_EXPRESS_LINK_CAPABILITIES_REGISTER; 787 788 typedef union _PCI_EXPRESS_LINK_CONTROL_REGISTER { 789 _ANONYMOUS_STRUCT struct { 790 USHORT ActiveStatePMControl:2; 791 USHORT Rsvd1:1; 792 USHORT ReadCompletionBoundary:1; 793 USHORT LinkDisable:1; 794 USHORT RetrainLink:1; 795 USHORT CommonClockConfig:1; 796 USHORT ExtendedSynch:1; 797 USHORT EnableClockPowerManagement:1; 798 USHORT Rsvd2:7; 799 } DUMMYSTRUCTNAME; 800 USHORT AsUSHORT; 801 } PCI_EXPRESS_LINK_CONTROL_REGISTER, *PPCI_EXPRESS_LINK_CONTROL_REGISTER; 802 803 typedef union _PCI_EXPRESS_LINK_STATUS_REGISTER { 804 _ANONYMOUS_STRUCT struct { 805 USHORT LinkSpeed:4; 806 USHORT LinkWidth:6; 807 USHORT Undefined:1; 808 USHORT LinkTraining:1; 809 USHORT SlotClockConfig:1; 810 USHORT DataLinkLayerActive:1; 811 USHORT Rsvd:2; 812 } DUMMYSTRUCTNAME; 813 USHORT AsUSHORT; 814 } PCI_EXPRESS_LINK_STATUS_REGISTER, *PPCI_EXPRESS_LINK_STATUS_REGISTER; 815 816 typedef union _PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER { 817 _ANONYMOUS_STRUCT struct { 818 ULONG AttentionButtonPresent:1; 819 ULONG PowerControllerPresent:1; 820 ULONG MRLSensorPresent:1; 821 ULONG AttentionIndicatorPresent:1; 822 ULONG PowerIndicatorPresent:1; 823 ULONG HotPlugSurprise:1; 824 ULONG HotPlugCapable:1; 825 ULONG SlotPowerLimit:8; 826 ULONG SlotPowerLimitScale:2; 827 ULONG ElectromechanicalLockPresent:1; 828 ULONG NoCommandCompletedSupport:1; 829 ULONG PhysicalSlotNumber:13; 830 } DUMMYSTRUCTNAME; 831 ULONG AsULONG; 832 } PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_SLOT_CAPABILITIES_REGISTER; 833 834 typedef union _PCI_EXPRESS_SLOT_CONTROL_REGISTER { 835 _ANONYMOUS_STRUCT struct { 836 USHORT AttentionButtonEnable:1; 837 USHORT PowerFaultDetectEnable:1; 838 USHORT MRLSensorEnable:1; 839 USHORT PresenceDetectEnable:1; 840 USHORT CommandCompletedEnable:1; 841 USHORT HotPlugInterruptEnable:1; 842 USHORT AttentionIndicatorControl:2; 843 USHORT PowerIndicatorControl:2; 844 USHORT PowerControllerControl:1; 845 USHORT ElectromechanicalLockControl:1; 846 USHORT DataLinkStateChangeEnable:1; 847 USHORT Rsvd:3; 848 } DUMMYSTRUCTNAME; 849 USHORT AsUSHORT; 850 } PCI_EXPRESS_SLOT_CONTROL_REGISTER, *PPCI_EXPRESS_SLOT_CONTROL_REGISTER; 851 852 typedef union _PCI_EXPRESS_SLOT_STATUS_REGISTER { 853 _ANONYMOUS_STRUCT struct { 854 USHORT AttentionButtonPressed:1; 855 USHORT PowerFaultDetected:1; 856 USHORT MRLSensorChanged:1; 857 USHORT PresenceDetectChanged:1; 858 USHORT CommandCompleted:1; 859 USHORT MRLSensorState:1; 860 USHORT PresenceDetectState:1; 861 USHORT ElectromechanicalLockEngaged:1; 862 USHORT DataLinkStateChanged:1; 863 USHORT Rsvd:7; 864 } DUMMYSTRUCTNAME; 865 USHORT AsUSHORT; 866 } PCI_EXPRESS_SLOT_STATUS_REGISTER, *PPCI_EXPRESS_SLOT_STATUS_REGISTER; 867 868 typedef union _PCI_EXPRESS_ROOT_CONTROL_REGISTER { 869 _ANONYMOUS_STRUCT struct { 870 USHORT CorrectableSerrEnable:1; 871 USHORT NonFatalSerrEnable:1; 872 USHORT FatalSerrEnable:1; 873 USHORT PMEInterruptEnable:1; 874 USHORT CRSSoftwareVisibilityEnable:1; 875 USHORT Rsvd:11; 876 } DUMMYSTRUCTNAME; 877 USHORT AsUSHORT; 878 } PCI_EXPRESS_ROOT_CONTROL_REGISTER, *PPCI_EXPRESS_ROOT_CONTROL_REGISTER; 879 880 typedef union _PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER { 881 _ANONYMOUS_STRUCT struct { 882 USHORT CRSSoftwareVisibility:1; 883 USHORT Rsvd:15; 884 } DUMMYSTRUCTNAME; 885 USHORT AsUSHORT; 886 } PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_ROOT_CAPABILITIES_REGISTER; 887 888 typedef union _PCI_EXPRESS_ROOT_STATUS_REGISTER { 889 _ANONYMOUS_STRUCT struct { 890 ULONG PMERequestorId:16; 891 ULONG PMEStatus:1; 892 ULONG PMEPending:1; 893 ULONG Rsvd:14; 894 } DUMMYSTRUCTNAME; 895 ULONG AsULONG; 896 } PCI_EXPRESS_ROOT_STATUS_REGISTER, *PPCI_EXPRESS_ROOT_STATUS_REGISTER; 897 898 typedef struct _PCI_EXPRESS_CAPABILITY { 899 PCI_CAPABILITIES_HEADER Header; 900 PCI_EXPRESS_CAPABILITIES_REGISTER ExpressCapabilities; 901 PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER DeviceCapabilities; 902 PCI_EXPRESS_DEVICE_CONTROL_REGISTER DeviceControl; 903 PCI_EXPRESS_DEVICE_STATUS_REGISTER DeviceStatus; 904 PCI_EXPRESS_LINK_CAPABILITIES_REGISTER LinkCapabilities; 905 PCI_EXPRESS_LINK_CONTROL_REGISTER LinkControl; 906 PCI_EXPRESS_LINK_STATUS_REGISTER LinkStatus; 907 PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER SlotCapabilities; 908 PCI_EXPRESS_SLOT_CONTROL_REGISTER SlotControl; 909 PCI_EXPRESS_SLOT_STATUS_REGISTER SlotStatus; 910 PCI_EXPRESS_ROOT_CONTROL_REGISTER RootControl; 911 PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER RootCapabilities; 912 PCI_EXPRESS_ROOT_STATUS_REGISTER RootStatus; 913 } PCI_EXPRESS_CAPABILITY, *PPCI_EXPRESS_CAPABILITY; 914 915 typedef enum { 916 MRLClosed = 0, 917 MRLOpen 918 } PCI_EXPRESS_MRL_STATE; 919 920 typedef enum { 921 SlotEmpty = 0, 922 CardPresent 923 } PCI_EXPRESS_CARD_PRESENCE; 924 925 typedef enum { 926 IndicatorOn = 1, 927 IndicatorBlink, 928 IndicatorOff 929 } PCI_EXPRESS_INDICATOR_STATE; 930 931 typedef enum { 932 PowerOn = 0, 933 PowerOff 934 } PCI_EXPRESS_POWER_STATE; 935 936 typedef enum { 937 L0sEntrySupport = 1, 938 L0sAndL1EntrySupport = 3 939 } PCI_EXPRESS_ASPM_SUPPORT; 940 941 typedef enum { 942 L0sAndL1EntryDisabled, 943 L0sEntryEnabled, 944 L1EntryEnabled, 945 L0sAndL1EntryEnabled 946 } PCI_EXPRESS_ASPM_CONTROL; 947 948 typedef enum { 949 L0s_Below64ns = 0, 950 L0s_64ns_128ns, 951 L0s_128ns_256ns, 952 L0s_256ns_512ns, 953 L0s_512ns_1us, 954 L0s_1us_2us, 955 L0s_2us_4us, 956 L0s_Above4us 957 } PCI_EXPRESS_L0s_EXIT_LATENCY; 958 959 typedef enum { 960 L1_Below1us = 0, 961 L1_1us_2us, 962 L1_2us_4us, 963 L1_4us_8us, 964 L1_8us_16us, 965 L1_16us_32us, 966 L1_32us_64us, 967 L1_Above64us 968 } PCI_EXPRESS_L1_EXIT_LATENCY; 969 970 typedef enum { 971 PciExpressEndpoint = 0, 972 PciExpressLegacyEndpoint, 973 PciExpressRootPort = 4, 974 PciExpressUpstreamSwitchPort, 975 PciExpressDownstreamSwitchPort, 976 PciExpressToPciXBridge, 977 PciXToExpressBridge, 978 PciExpressRootComplexIntegratedEndpoint, 979 PciExpressRootComplexEventCollector 980 } PCI_EXPRESS_DEVICE_TYPE; 981 982 typedef enum { 983 MaxPayload128Bytes = 0, 984 MaxPayload256Bytes, 985 MaxPayload512Bytes, 986 MaxPayload1024Bytes, 987 MaxPayload2048Bytes, 988 MaxPayload4096Bytes 989 } PCI_EXPRESS_MAX_PAYLOAD_SIZE; 990 991 typedef union _PCI_EXPRESS_PME_REQUESTOR_ID { 992 _ANONYMOUS_STRUCT struct { 993 USHORT FunctionNumber:3; 994 USHORT DeviceNumber:5; 995 USHORT BusNumber:8; 996 } DUMMYSTRUCTNAME; 997 USHORT AsUSHORT; 998 } PCI_EXPRESS_PME_REQUESTOR_ID, *PPCI_EXPRESS_PME_REQUESTOR_ID; 999 1000 typedef enum _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE { 1001 ResourceTypeSingle = 0, 1002 ResourceTypeRange, 1003 ResourceTypeExtendedCounterConfiguration, 1004 ResourceTypeOverflow, 1005 ResourceTypeMax 1006 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE; 1007 1008 typedef struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR { 1009 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE Type; 1010 ULONG Flags; 1011 union { 1012 ULONG CounterIndex; 1013 ULONG ExtendedRegisterAddress; 1014 struct { 1015 ULONG Begin; 1016 ULONG End; 1017 } Range; 1018 } u; 1019 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR, *PPHYSICAL_COUNTER_RESOURCE_DESCRIPTOR; 1020 1021 typedef struct _PHYSICAL_COUNTER_RESOURCE_LIST { 1022 ULONG Count; 1023 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR Descriptors[ANYSIZE_ARRAY]; 1024 } PHYSICAL_COUNTER_RESOURCE_LIST, *PPHYSICAL_COUNTER_RESOURCE_LIST; 1025 1026 typedef VOID 1027 (NTAPI *PciPin2Line)( 1028 IN struct _BUS_HANDLER *BusHandler, 1029 IN struct _BUS_HANDLER *RootHandler, 1030 IN PCI_SLOT_NUMBER SlotNumber, 1031 IN PPCI_COMMON_CONFIG PciData); 1032 1033 typedef VOID 1034 (NTAPI *PciLine2Pin)( 1035 IN struct _BUS_HANDLER *BusHandler, 1036 IN struct _BUS_HANDLER *RootHandler, 1037 IN PCI_SLOT_NUMBER SlotNumber, 1038 IN PPCI_COMMON_CONFIG PciNewData, 1039 IN PPCI_COMMON_CONFIG PciOldData); 1040 1041 typedef VOID 1042 (NTAPI *PciReadWriteConfig)( 1043 IN struct _BUS_HANDLER *BusHandler, 1044 IN PCI_SLOT_NUMBER Slot, 1045 IN PVOID Buffer, 1046 IN ULONG Offset, 1047 IN ULONG Length); 1048 1049 #define PCI_DATA_TAG ' ICP' 1050 #define PCI_DATA_VERSION 1 1051 1052 typedef struct _PCIBUSDATA { 1053 ULONG Tag; 1054 ULONG Version; 1055 PciReadWriteConfig ReadConfig; 1056 PciReadWriteConfig WriteConfig; 1057 PciPin2Line Pin2Line; 1058 PciLine2Pin Line2Pin; 1059 PCI_SLOT_NUMBER ParentSlot; 1060 PVOID Reserved[4]; 1061 } PCIBUSDATA, *PPCIBUSDATA; 1062 1063 #ifndef _PCIINTRF_X_ 1064 #define _PCIINTRF_X_ 1065 1066 typedef ULONG 1067 (NTAPI *PCI_READ_WRITE_CONFIG)( 1068 IN PVOID Context, 1069 IN ULONG BusOffset, 1070 IN ULONG Slot, 1071 IN PVOID Buffer, 1072 IN ULONG Offset, 1073 IN ULONG Length); 1074 1075 typedef VOID 1076 (NTAPI *PCI_PIN_TO_LINE)( 1077 IN PVOID Context, 1078 IN PPCI_COMMON_CONFIG PciData); 1079 1080 typedef VOID 1081 (NTAPI *PCI_LINE_TO_PIN)( 1082 IN PVOID Context, 1083 IN PPCI_COMMON_CONFIG PciNewData, 1084 IN PPCI_COMMON_CONFIG PciOldData); 1085 1086 typedef VOID 1087 (NTAPI *PCI_ROOT_BUS_CAPABILITY)( 1088 IN PVOID Context, 1089 OUT PPCI_ROOT_BUS_HARDWARE_CAPABILITY HardwareCapability); 1090 1091 typedef VOID 1092 (NTAPI *PCI_EXPRESS_WAKE_CONTROL)( 1093 IN PVOID Context, 1094 IN BOOLEAN EnableWake); 1095 1096 typedef struct _PCI_BUS_INTERFACE_STANDARD { 1097 USHORT Size; 1098 USHORT Version; 1099 PVOID Context; 1100 PINTERFACE_REFERENCE InterfaceReference; 1101 PINTERFACE_DEREFERENCE InterfaceDereference; 1102 PCI_READ_WRITE_CONFIG ReadConfig; 1103 PCI_READ_WRITE_CONFIG WriteConfig; 1104 PCI_PIN_TO_LINE PinToLine; 1105 PCI_LINE_TO_PIN LineToPin; 1106 PCI_ROOT_BUS_CAPABILITY RootBusCapability; 1107 PCI_EXPRESS_WAKE_CONTROL ExpressWakeControl; 1108 } PCI_BUS_INTERFACE_STANDARD, *PPCI_BUS_INTERFACE_STANDARD; 1109 1110 #define PCI_BUS_INTERFACE_STANDARD_VERSION 1 1111 1112 #endif /* _PCIINTRF_X_ */ 1113 1114 #if (NTDDI_VERSION >= NTDDI_WIN7) 1115 1116 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX 0x00004000 1117 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX 0x00008000 1118 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX \ 1119 (FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX | \ 1120 FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX) 1121 1122 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_DEPRECATED 0x00000200 1123 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_DEPRECATED 0x00000300 1124 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_DEPRECATED 0x00000300 1125 1126 #else 1127 1128 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 0x00000200 1129 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 0x00000300 1130 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 0x00000300 1131 1132 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 1133 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 1134 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 1135 1136 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 1137 1138 #define FILE_CHARACTERISTICS_PROPAGATED (FILE_REMOVABLE_MEDIA | \ 1139 FILE_READ_ONLY_DEVICE | \ 1140 FILE_FLOPPY_DISKETTE | \ 1141 FILE_WRITE_ONCE_MEDIA | \ 1142 FILE_DEVICE_SECURE_OPEN) 1143 1144 typedef struct _FILE_ALIGNMENT_INFORMATION { 1145 ULONG AlignmentRequirement; 1146 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; 1147 1148 typedef struct _FILE_NAME_INFORMATION { 1149 ULONG FileNameLength; 1150 WCHAR FileName[1]; 1151 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; 1152 1153 1154 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION { 1155 ULONG FileAttributes; 1156 ULONG ReparseTag; 1157 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; 1158 1159 typedef struct _FILE_DISPOSITION_INFORMATION { 1160 BOOLEAN DeleteFile; 1161 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; 1162 1163 typedef struct _FILE_END_OF_FILE_INFORMATION { 1164 LARGE_INTEGER EndOfFile; 1165 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; 1166 1167 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { 1168 LARGE_INTEGER ValidDataLength; 1169 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; 1170 1171 typedef struct _FILE_FS_LABEL_INFORMATION { 1172 ULONG VolumeLabelLength; 1173 WCHAR VolumeLabel[1]; 1174 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; 1175 1176 typedef struct _FILE_FS_VOLUME_INFORMATION { 1177 LARGE_INTEGER VolumeCreationTime; 1178 ULONG VolumeSerialNumber; 1179 ULONG VolumeLabelLength; 1180 BOOLEAN SupportsObjects; 1181 WCHAR VolumeLabel[1]; 1182 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; 1183 1184 typedef struct _FILE_FS_SIZE_INFORMATION { 1185 LARGE_INTEGER TotalAllocationUnits; 1186 LARGE_INTEGER AvailableAllocationUnits; 1187 ULONG SectorsPerAllocationUnit; 1188 ULONG BytesPerSector; 1189 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; 1190 1191 typedef struct _FILE_FS_FULL_SIZE_INFORMATION { 1192 LARGE_INTEGER TotalAllocationUnits; 1193 LARGE_INTEGER CallerAvailableAllocationUnits; 1194 LARGE_INTEGER ActualAvailableAllocationUnits; 1195 ULONG SectorsPerAllocationUnit; 1196 ULONG BytesPerSector; 1197 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; 1198 1199 typedef struct _FILE_FS_OBJECTID_INFORMATION { 1200 UCHAR ObjectId[16]; 1201 UCHAR ExtendedInfo[48]; 1202 } FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; 1203 1204 typedef union _FILE_SEGMENT_ELEMENT { 1205 PVOID64 Buffer; 1206 ULONGLONG Alignment; 1207 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT; 1208 1209 #define IOCTL_AVIO_ALLOCATE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 1210 #define IOCTL_AVIO_FREE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 1211 #define IOCTL_AVIO_MODIFY_STREAM CTL_CODE(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 1212 1213 typedef enum _BUS_DATA_TYPE { 1214 ConfigurationSpaceUndefined = -1, 1215 Cmos, 1216 EisaConfiguration, 1217 Pos, 1218 CbusConfiguration, 1219 PCIConfiguration, 1220 VMEConfiguration, 1221 NuBusConfiguration, 1222 PCMCIAConfiguration, 1223 MPIConfiguration, 1224 MPSAConfiguration, 1225 PNPISAConfiguration, 1226 SgiInternalConfiguration, 1227 MaximumBusDataType 1228 } BUS_DATA_TYPE, *PBUS_DATA_TYPE; 1229 1230 /* Some Server 2003 DDK definitions */ 1231 #define PCI_INT_ROUTE_INTRF_STANDARD_VER 1 1232 1233 typedef NTSTATUS 1234 (NTAPI *PLEGACY_DEVICE_DETECTION_HANDLER)( 1235 IN PVOID Context, 1236 IN INTERFACE_TYPE LegacyBusType, 1237 IN ULONG BusNumber, 1238 IN ULONG SlotNumber, 1239 OUT PDEVICE_OBJECT *PhysicalDeviceObject); 1240 1241 typedef struct _ROUTING_TOKEN { 1242 PVOID LinkNode; 1243 ULONG StaticVector; 1244 UCHAR Flags; 1245 } ROUTING_TOKEN, *PROUTING_TOKEN; 1246 1247 typedef NTSTATUS 1248 (NTAPI *PGET_INTERRUPT_ROUTING)( 1249 IN PDEVICE_OBJECT Pdo, 1250 OUT ULONG *Bus, 1251 OUT ULONG *PciSlot, 1252 OUT UCHAR *InterruptLine, 1253 OUT UCHAR *InterruptPin, 1254 OUT UCHAR *ClassCode, 1255 OUT UCHAR *SubClassCode, 1256 OUT PDEVICE_OBJECT *ParentPdo, 1257 OUT ROUTING_TOKEN *RoutingToken, 1258 OUT UCHAR *Flags); 1259 1260 typedef NTSTATUS 1261 (NTAPI *PSET_INTERRUPT_ROUTING_TOKEN)( 1262 IN PDEVICE_OBJECT Pdo, 1263 IN PROUTING_TOKEN RoutingToken); 1264 1265 typedef VOID 1266 (NTAPI *PUPDATE_INTERRUPT_LINE)( 1267 IN PDEVICE_OBJECT Pdo, 1268 IN UCHAR LineRegister); 1269 1270 typedef struct _INT_ROUTE_INTERFACE_STANDARD { 1271 USHORT Size; 1272 USHORT Version; 1273 PVOID Context; 1274 PINTERFACE_REFERENCE InterfaceReference; 1275 PINTERFACE_DEREFERENCE InterfaceDereference; 1276 PGET_INTERRUPT_ROUTING GetInterruptRouting; 1277 PSET_INTERRUPT_ROUTING_TOKEN SetInterruptRoutingToken; 1278 PUPDATE_INTERRUPT_LINE UpdateInterruptLine; 1279 } INT_ROUTE_INTERFACE_STANDARD, *PINT_ROUTE_INTERFACE_STANDARD; 1280 1281 typedef struct _LEGACY_DEVICE_DETECTION_INTERFACE { 1282 USHORT Size; 1283 USHORT Version; 1284 PVOID Context; 1285 PINTERFACE_REFERENCE InterfaceReference; 1286 PINTERFACE_DEREFERENCE InterfaceDereference; 1287 PLEGACY_DEVICE_DETECTION_HANDLER LegacyDeviceDetection; 1288 } LEGACY_DEVICE_DETECTION_INTERFACE, *PLEGACY_DEVICE_DETECTION_INTERFACE; 1289 1290 /* FIXME : These definitions don't exist in public headers */ 1291 1292 #define PCI_CB_INTRF_VERSION 1 1293 #define PCI_PME_INTRF_STANDARD_VER 1 1294 #define PNP_LOCATION_INTERFACE_VERSION 1 1295 1296 DEFINE_GUID(GUID_PCI_CARDBUS_INTERFACE_PRIVATE, 0xcca82f31, 0x54d6, 0x11d1, 0x82, 0x24, 0x00, 0xa0, 0xc9, 0x32, 0x43, 0x85); 1297 DEFINE_GUID(GUID_PCI_PME_INTERFACE, 0xaac7e6ac, 0xbb0b, 0x11d2, 0xb4, 0x84, 0x00, 0xc0, 0x4f, 0x72, 0xde, 0x8b); 1298 1299 typedef NTSTATUS 1300 (NTAPI *PCARDBUSADD)( 1301 IN PDEVICE_OBJECT DeviceObject, 1302 IN OUT PVOID *DeviceContext); 1303 1304 typedef NTSTATUS 1305 (NTAPI *PCARDBUSDELETE)( 1306 IN PVOID DeviceContext); 1307 1308 typedef NTSTATUS 1309 (NTAPI *PCARDBUSPCIDISPATCH)( 1310 IN PVOID DeviceContext, 1311 IN PIRP Irp); 1312 1313 typedef VOID 1314 (NTAPI *PPME_SET_PME_ENABLE)( 1315 IN PDEVICE_OBJECT Pdo, 1316 IN BOOLEAN PmeEnable); 1317 1318 typedef VOID 1319 (NTAPI *PPME_CLEAR_PME_STATUS)( 1320 IN PDEVICE_OBJECT Pdo); 1321 1322 typedef VOID 1323 (NTAPI *PPME_GET_INFORMATION)( 1324 IN PDEVICE_OBJECT Pdo, 1325 OUT PBOOLEAN PmeCapable, 1326 OUT PBOOLEAN PmeStatus, 1327 OUT PBOOLEAN PmeEnable); 1328 1329 typedef struct _PCI_CARDBUS_INTERFACE_PRIVATE { 1330 USHORT Size; 1331 USHORT Version; 1332 PVOID Context; 1333 PINTERFACE_REFERENCE InterfaceReference; 1334 PINTERFACE_DEREFERENCE InterfaceDereference; 1335 PDRIVER_OBJECT DriverObject; 1336 PCARDBUSADD AddCardBus; 1337 PCARDBUSDELETE DeleteCardBus; 1338 PCARDBUSPCIDISPATCH DispatchPnp; 1339 } PCI_CARDBUS_INTERFACE_PRIVATE, *PPCI_CARDBUS_INTERFACE_PRIVATE; 1340 1341 typedef struct _PCI_PME_INTERFACE { 1342 USHORT Size; 1343 USHORT Version; 1344 PVOID Context; 1345 PINTERFACE_REFERENCE InterfaceReference; 1346 PINTERFACE_DEREFERENCE InterfaceDereference; 1347 PPME_GET_INFORMATION GetPmeInformation; 1348 PPME_CLEAR_PME_STATUS ClearPmeStatus; 1349 PPME_SET_PME_ENABLE UpdateEnable; 1350 } PCI_PME_INTERFACE, *PPCI_PME_INTERFACE; 1351 1352 /* Hardware Abstraction Layer Types */ 1353 1354 typedef BOOLEAN 1355 (NTAPI *PHAL_RESET_DISPLAY_PARAMETERS)( 1356 IN ULONG Columns, 1357 IN ULONG Rows); 1358 1359 typedef PBUS_HANDLER 1360 (FASTCALL *pHalHandlerForBus)( 1361 IN INTERFACE_TYPE InterfaceType, 1362 IN ULONG BusNumber); 1363 1364 typedef VOID 1365 (FASTCALL *pHalReferenceBusHandler)( 1366 IN PBUS_HANDLER BusHandler); 1367 1368 typedef enum _HAL_QUERY_INFORMATION_CLASS { 1369 HalInstalledBusInformation, 1370 HalProfileSourceInformation, 1371 HalInformationClassUnused1, 1372 HalPowerInformation, 1373 HalProcessorSpeedInformation, 1374 HalCallbackInformation, 1375 HalMapRegisterInformation, 1376 HalMcaLogInformation, 1377 HalFrameBufferCachingInformation, 1378 HalDisplayBiosInformation, 1379 HalProcessorFeatureInformation, 1380 HalNumaTopologyInterface, 1381 HalErrorInformation, 1382 HalCmcLogInformation, 1383 HalCpeLogInformation, 1384 HalQueryMcaInterface, 1385 HalQueryAMLIIllegalIOPortAddresses, 1386 HalQueryMaxHotPlugMemoryAddress, 1387 HalPartitionIpiInterface, 1388 HalPlatformInformation, 1389 HalQueryProfileSourceList, 1390 HalInitLogInformation, 1391 HalFrequencyInformation, 1392 HalProcessorBrandString, 1393 HalHypervisorInformation, 1394 HalPlatformTimerInformation, 1395 HalAcpiAuditInformation 1396 } HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS; 1397 1398 typedef enum _HAL_SET_INFORMATION_CLASS { 1399 HalProfileSourceInterval, 1400 HalProfileSourceInterruptHandler, 1401 HalMcaRegisterDriver, 1402 HalKernelErrorHandler, 1403 HalCmcRegisterDriver, 1404 HalCpeRegisterDriver, 1405 HalMcaLog, 1406 HalCmcLog, 1407 HalCpeLog, 1408 HalGenerateCmcInterrupt, 1409 HalProfileSourceTimerHandler, 1410 HalEnlightenment, 1411 HalProfileDpgoSourceInterruptHandler 1412 } HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS; 1413 1414 typedef NTSTATUS 1415 (NTAPI *pHalQuerySystemInformation)( 1416 IN HAL_QUERY_INFORMATION_CLASS InformationClass, 1417 IN ULONG BufferSize, 1418 IN OUT PVOID Buffer, 1419 OUT PULONG ReturnedLength); 1420 1421 typedef NTSTATUS 1422 (NTAPI *pHalSetSystemInformation)( 1423 IN HAL_SET_INFORMATION_CLASS InformationClass, 1424 IN ULONG BufferSize, 1425 IN PVOID Buffer); 1426 1427 typedef VOID 1428 (FASTCALL *pHalExamineMBR)( 1429 IN PDEVICE_OBJECT DeviceObject, 1430 IN ULONG SectorSize, 1431 IN ULONG MBRTypeIdentifier, 1432 OUT PVOID *Buffer); 1433 1434 typedef NTSTATUS 1435 (FASTCALL *pHalIoReadPartitionTable)( 1436 IN PDEVICE_OBJECT DeviceObject, 1437 IN ULONG SectorSize, 1438 IN BOOLEAN ReturnRecognizedPartitions, 1439 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer); 1440 1441 typedef NTSTATUS 1442 (FASTCALL *pHalIoSetPartitionInformation)( 1443 IN PDEVICE_OBJECT DeviceObject, 1444 IN ULONG SectorSize, 1445 IN ULONG PartitionNumber, 1446 IN ULONG PartitionType); 1447 1448 typedef NTSTATUS 1449 (FASTCALL *pHalIoWritePartitionTable)( 1450 IN PDEVICE_OBJECT DeviceObject, 1451 IN ULONG SectorSize, 1452 IN ULONG SectorsPerTrack, 1453 IN ULONG NumberOfHeads, 1454 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer); 1455 1456 typedef NTSTATUS 1457 (NTAPI *pHalQueryBusSlots)( 1458 IN PBUS_HANDLER BusHandler, 1459 IN ULONG BufferSize, 1460 OUT PULONG SlotNumbers, 1461 OUT PULONG ReturnedLength); 1462 1463 typedef NTSTATUS 1464 (NTAPI *pHalInitPnpDriver)( 1465 VOID); 1466 1467 typedef struct _PM_DISPATCH_TABLE { 1468 ULONG Signature; 1469 ULONG Version; 1470 PVOID Function[1]; 1471 } PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE; 1472 1473 typedef NTSTATUS 1474 (NTAPI *pHalInitPowerManagement)( 1475 IN PPM_DISPATCH_TABLE PmDriverDispatchTable, 1476 OUT PPM_DISPATCH_TABLE *PmHalDispatchTable); 1477 1478 typedef struct _DMA_ADAPTER* 1479 (NTAPI *pHalGetDmaAdapter)( 1480 IN PVOID Context, 1481 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor, 1482 OUT PULONG NumberOfMapRegisters); 1483 1484 typedef NTSTATUS 1485 (NTAPI *pHalGetInterruptTranslator)( 1486 IN INTERFACE_TYPE ParentInterfaceType, 1487 IN ULONG ParentBusNumber, 1488 IN INTERFACE_TYPE BridgeInterfaceType, 1489 IN USHORT Size, 1490 IN USHORT Version, 1491 OUT PTRANSLATOR_INTERFACE Translator, 1492 OUT PULONG BridgeBusNumber); 1493 1494 typedef NTSTATUS 1495 (NTAPI *pHalStartMirroring)( 1496 VOID); 1497 1498 typedef NTSTATUS 1499 (NTAPI *pHalEndMirroring)( 1500 IN ULONG PassNumber); 1501 1502 typedef NTSTATUS 1503 (NTAPI *pHalMirrorPhysicalMemory)( 1504 IN PHYSICAL_ADDRESS PhysicalAddress, 1505 IN LARGE_INTEGER NumberOfBytes); 1506 1507 typedef NTSTATUS 1508 (NTAPI *pHalMirrorVerify)( 1509 IN PHYSICAL_ADDRESS PhysicalAddress, 1510 IN LARGE_INTEGER NumberOfBytes); 1511 1512 typedef BOOLEAN 1513 (NTAPI *pHalTranslateBusAddress)( 1514 IN INTERFACE_TYPE InterfaceType, 1515 IN ULONG BusNumber, 1516 IN PHYSICAL_ADDRESS BusAddress, 1517 IN OUT PULONG AddressSpace, 1518 OUT PPHYSICAL_ADDRESS TranslatedAddress); 1519 1520 typedef NTSTATUS 1521 (NTAPI *pHalAssignSlotResources)( 1522 IN PUNICODE_STRING RegistryPath, 1523 IN PUNICODE_STRING DriverClassName OPTIONAL, 1524 IN PDRIVER_OBJECT DriverObject, 1525 IN PDEVICE_OBJECT DeviceObject, 1526 IN INTERFACE_TYPE BusType, 1527 IN ULONG BusNumber, 1528 IN ULONG SlotNumber, 1529 IN OUT PCM_RESOURCE_LIST *AllocatedResources); 1530 1531 typedef VOID 1532 (NTAPI *pHalHaltSystem)( 1533 VOID); 1534 1535 typedef BOOLEAN 1536 (NTAPI *pHalResetDisplay)( 1537 VOID); 1538 1539 typedef struct _MAP_REGISTER_ENTRY { 1540 PVOID MapRegister; 1541 BOOLEAN WriteToDevice; 1542 } MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY; 1543 1544 typedef UCHAR 1545 (NTAPI *pHalVectorToIDTEntry)( 1546 ULONG Vector); 1547 1548 typedef BOOLEAN 1549 (NTAPI *pHalFindBusAddressTranslation)( 1550 IN PHYSICAL_ADDRESS BusAddress, 1551 IN OUT PULONG AddressSpace, 1552 OUT PPHYSICAL_ADDRESS TranslatedAddress, 1553 IN OUT PULONG_PTR Context, 1554 IN BOOLEAN NextBus); 1555 1556 typedef VOID 1557 (NTAPI *pHalEndOfBoot)( 1558 VOID); 1559 1560 typedef PVOID 1561 (NTAPI *pHalGetAcpiTable)( 1562 IN ULONG Signature, 1563 IN PCSTR OemId OPTIONAL, 1564 IN PCSTR OemTableId OPTIONAL); 1565 1566 #if defined(_IA64_) 1567 typedef NTSTATUS 1568 (*pHalGetErrorCapList)( 1569 IN OUT PULONG CapsListLength, 1570 IN OUT PUCHAR ErrorCapList); 1571 1572 typedef NTSTATUS 1573 (*pHalInjectError)( 1574 IN ULONG BufferLength, 1575 IN PUCHAR Buffer); 1576 #endif 1577 1578 typedef VOID 1579 (NTAPI *PCI_ERROR_HANDLER_CALLBACK)( 1580 VOID); 1581 1582 typedef VOID 1583 (NTAPI *pHalSetPciErrorHandlerCallback)( 1584 IN PCI_ERROR_HANDLER_CALLBACK Callback); 1585 1586 #if 1 /* Not present in WDK 7600 */ 1587 typedef VOID 1588 (FASTCALL *pHalIoAssignDriveLetters)( 1589 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, 1590 IN PSTRING NtDeviceName, 1591 OUT PUCHAR NtSystemPath, 1592 OUT PSTRING NtSystemPathString); 1593 #endif 1594 1595 typedef struct { 1596 ULONG Version; 1597 pHalQuerySystemInformation HalQuerySystemInformation; 1598 pHalSetSystemInformation HalSetSystemInformation; 1599 pHalQueryBusSlots HalQueryBusSlots; 1600 ULONG Spare1; 1601 pHalExamineMBR HalExamineMBR; 1602 #if 1 /* Not present in WDK 7600 */ 1603 pHalIoAssignDriveLetters HalIoAssignDriveLetters; 1604 #endif 1605 pHalIoReadPartitionTable HalIoReadPartitionTable; 1606 pHalIoSetPartitionInformation HalIoSetPartitionInformation; 1607 pHalIoWritePartitionTable HalIoWritePartitionTable; 1608 pHalHandlerForBus HalReferenceHandlerForBus; 1609 pHalReferenceBusHandler HalReferenceBusHandler; 1610 pHalReferenceBusHandler HalDereferenceBusHandler; 1611 pHalInitPnpDriver HalInitPnpDriver; 1612 pHalInitPowerManagement HalInitPowerManagement; 1613 pHalGetDmaAdapter HalGetDmaAdapter; 1614 pHalGetInterruptTranslator HalGetInterruptTranslator; 1615 pHalStartMirroring HalStartMirroring; 1616 pHalEndMirroring HalEndMirroring; 1617 pHalMirrorPhysicalMemory HalMirrorPhysicalMemory; 1618 pHalEndOfBoot HalEndOfBoot; 1619 pHalMirrorVerify HalMirrorVerify; 1620 pHalGetAcpiTable HalGetCachedAcpiTable; 1621 pHalSetPciErrorHandlerCallback HalSetPciErrorHandlerCallback; 1622 #if defined(_IA64_) 1623 pHalGetErrorCapList HalGetErrorCapList; 1624 pHalInjectError HalInjectError; 1625 #endif 1626 } HAL_DISPATCH, *PHAL_DISPATCH; 1627 1628 /* GCC/MSVC and WDK compatible declaration */ 1629 extern NTKERNELAPI HAL_DISPATCH HalDispatchTable; 1630 1631 #if defined(_NTOSKRNL_) || defined(_BLDR_) 1632 #define HALDISPATCH (&HalDispatchTable) 1633 #else 1634 /* This is a WDK compatibility definition */ 1635 #define HalDispatchTable (&HalDispatchTable) 1636 #define HALDISPATCH HalDispatchTable 1637 #endif 1638 1639 #define HAL_DISPATCH_VERSION 3 /* FIXME: when to use 4? */ 1640 #define HalDispatchTableVersion HALDISPATCH->Version 1641 #define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation 1642 #define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation 1643 #define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots 1644 #define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus 1645 #define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler 1646 #define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler 1647 #define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver 1648 #define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement 1649 #define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter 1650 #define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator 1651 #define HalStartMirroring HALDISPATCH->HalStartMirroring 1652 #define HalEndMirroring HALDISPATCH->HalEndMirroring 1653 #define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory 1654 #define HalEndOfBoot HALDISPATCH->HalEndOfBoot 1655 #define HalMirrorVerify HALDISPATCH->HalMirrorVerify 1656 #define HalGetCachedAcpiTable HALDISPATCH->HalGetCachedAcpiTable 1657 #define HalSetPciErrorHandlerCallback HALDISPATCH->HalSetPciErrorHandlerCallback 1658 #if defined(_IA64_) 1659 #define HalGetErrorCapList HALDISPATCH->HalGetErrorCapList 1660 #define HalInjectError HALDISPATCH->HalInjectError 1661 #endif 1662 1663 typedef struct _HAL_BUS_INFORMATION { 1664 INTERFACE_TYPE BusType; 1665 BUS_DATA_TYPE ConfigurationType; 1666 ULONG BusNumber; 1667 ULONG Reserved; 1668 } HAL_BUS_INFORMATION, *PHAL_BUS_INFORMATION; 1669 1670 typedef struct _HAL_PROFILE_SOURCE_INFORMATION { 1671 KPROFILE_SOURCE Source; 1672 BOOLEAN Supported; 1673 ULONG Interval; 1674 } HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION; 1675 1676 typedef struct _HAL_PROFILE_SOURCE_INFORMATION_EX { 1677 KPROFILE_SOURCE Source; 1678 BOOLEAN Supported; 1679 ULONG_PTR Interval; 1680 ULONG_PTR DefInterval; 1681 ULONG_PTR MaxInterval; 1682 ULONG_PTR MinInterval; 1683 } HAL_PROFILE_SOURCE_INFORMATION_EX, *PHAL_PROFILE_SOURCE_INFORMATION_EX; 1684 1685 typedef struct _HAL_PROFILE_SOURCE_INTERVAL { 1686 KPROFILE_SOURCE Source; 1687 ULONG_PTR Interval; 1688 } HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL; 1689 1690 typedef struct _HAL_PROFILE_SOURCE_LIST { 1691 KPROFILE_SOURCE Source; 1692 PWSTR Description; 1693 } HAL_PROFILE_SOURCE_LIST, *PHAL_PROFILE_SOURCE_LIST; 1694 1695 typedef enum _HAL_DISPLAY_BIOS_INFORMATION { 1696 HalDisplayInt10Bios, 1697 HalDisplayEmulatedBios, 1698 HalDisplayNoBios 1699 } HAL_DISPLAY_BIOS_INFORMATION, *PHAL_DISPLAY_BIOS_INFORMATION; 1700 1701 typedef struct _HAL_POWER_INFORMATION { 1702 ULONG TBD; 1703 } HAL_POWER_INFORMATION, *PHAL_POWER_INFORMATION; 1704 1705 typedef struct _HAL_PROCESSOR_SPEED_INFO { 1706 ULONG ProcessorSpeed; 1707 } HAL_PROCESSOR_SPEED_INFORMATION, *PHAL_PROCESSOR_SPEED_INFORMATION; 1708 1709 typedef struct _HAL_CALLBACKS { 1710 PCALLBACK_OBJECT SetSystemInformation; 1711 PCALLBACK_OBJECT BusCheck; 1712 } HAL_CALLBACKS, *PHAL_CALLBACKS; 1713 1714 typedef struct _HAL_PROCESSOR_FEATURE { 1715 ULONG UsableFeatureBits; 1716 } HAL_PROCESSOR_FEATURE; 1717 1718 typedef NTSTATUS 1719 (NTAPI *PHALIOREADWRITEHANDLER)( 1720 IN BOOLEAN fRead, 1721 IN ULONG dwAddr, 1722 IN ULONG dwSize, 1723 IN OUT PULONG pdwData); 1724 1725 typedef struct _HAL_AMLI_BAD_IO_ADDRESS_LIST { 1726 ULONG BadAddrBegin; 1727 ULONG BadAddrSize; 1728 ULONG OSVersionTrigger; 1729 PHALIOREADWRITEHANDLER IOHandler; 1730 } HAL_AMLI_BAD_IO_ADDRESS_LIST, *PHAL_AMLI_BAD_IO_ADDRESS_LIST; 1731 1732 #if defined(_X86_) || defined(_IA64_) || defined(_AMD64_) 1733 1734 typedef VOID 1735 (NTAPI *PHALMCAINTERFACELOCK)( 1736 VOID); 1737 1738 typedef VOID 1739 (NTAPI *PHALMCAINTERFACEUNLOCK)( 1740 VOID); 1741 1742 typedef NTSTATUS 1743 (NTAPI *PHALMCAINTERFACEREADREGISTER)( 1744 IN UCHAR BankNumber, 1745 IN OUT PVOID Exception); 1746 1747 typedef struct _HAL_MCA_INTERFACE { 1748 PHALMCAINTERFACELOCK Lock; 1749 PHALMCAINTERFACEUNLOCK Unlock; 1750 PHALMCAINTERFACEREADREGISTER ReadRegister; 1751 } HAL_MCA_INTERFACE; 1752 1753 typedef enum { 1754 ApicDestinationModePhysical = 1, 1755 ApicDestinationModeLogicalFlat, 1756 ApicDestinationModeLogicalClustered, 1757 ApicDestinationModeUnknown 1758 } HAL_APIC_DESTINATION_MODE, *PHAL_APIC_DESTINATION_MODE; 1759 1760 #if defined(_AMD64_) 1761 1762 struct _KTRAP_FRAME; 1763 struct _KEXCEPTION_FRAME; 1764 1765 typedef ERROR_SEVERITY 1766 (NTAPI *PDRIVER_EXCPTN_CALLBACK)( 1767 IN PVOID Context, 1768 IN struct _KTRAP_FRAME *TrapFrame, 1769 IN struct _KEXCEPTION_FRAME *ExceptionFrame, 1770 IN PMCA_EXCEPTION Exception); 1771 1772 #endif 1773 1774 #if defined(_X86_) || defined(_IA64_) 1775 typedef 1776 #if defined(_IA64_) 1777 ERROR_SEVERITY 1778 #else 1779 VOID 1780 #endif 1781 (NTAPI *PDRIVER_EXCPTN_CALLBACK)( 1782 IN PVOID Context, 1783 IN PMCA_EXCEPTION BankLog); 1784 #endif 1785 1786 typedef PDRIVER_EXCPTN_CALLBACK PDRIVER_MCA_EXCEPTION_CALLBACK; 1787 1788 typedef struct _MCA_DRIVER_INFO { 1789 PDRIVER_MCA_EXCEPTION_CALLBACK ExceptionCallback; 1790 PKDEFERRED_ROUTINE DpcCallback; 1791 PVOID DeviceContext; 1792 } MCA_DRIVER_INFO, *PMCA_DRIVER_INFO; 1793 1794 typedef struct _HAL_ERROR_INFO { 1795 ULONG Version; 1796 ULONG InitMaxSize; 1797 ULONG McaMaxSize; 1798 ULONG McaPreviousEventsCount; 1799 ULONG McaCorrectedEventsCount; 1800 ULONG McaKernelDeliveryFails; 1801 ULONG McaDriverDpcQueueFails; 1802 ULONG McaReserved; 1803 ULONG CmcMaxSize; 1804 ULONG CmcPollingInterval; 1805 ULONG CmcInterruptsCount; 1806 ULONG CmcKernelDeliveryFails; 1807 ULONG CmcDriverDpcQueueFails; 1808 ULONG CmcGetStateFails; 1809 ULONG CmcClearStateFails; 1810 ULONG CmcReserved; 1811 ULONGLONG CmcLogId; 1812 ULONG CpeMaxSize; 1813 ULONG CpePollingInterval; 1814 ULONG CpeInterruptsCount; 1815 ULONG CpeKernelDeliveryFails; 1816 ULONG CpeDriverDpcQueueFails; 1817 ULONG CpeGetStateFails; 1818 ULONG CpeClearStateFails; 1819 ULONG CpeInterruptSources; 1820 ULONGLONG CpeLogId; 1821 ULONGLONG KernelReserved[4]; 1822 } HAL_ERROR_INFO, *PHAL_ERROR_INFO; 1823 1824 #define HAL_MCE_INTERRUPTS_BASED ((ULONG)-1) 1825 #define HAL_MCE_DISABLED ((ULONG)0) 1826 1827 #define HAL_CMC_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED 1828 #define HAL_CMC_DISABLED HAL_MCE_DISABLED 1829 1830 #define HAL_CPE_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED 1831 #define HAL_CPE_DISABLED HAL_MCE_DISABLED 1832 1833 #define HAL_MCA_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED 1834 #define HAL_MCA_DISABLED HAL_MCE_DISABLED 1835 1836 typedef VOID 1837 (NTAPI *PDRIVER_CMC_EXCEPTION_CALLBACK)( 1838 IN PVOID Context, 1839 IN PCMC_EXCEPTION CmcLog); 1840 1841 typedef VOID 1842 (NTAPI *PDRIVER_CPE_EXCEPTION_CALLBACK)( 1843 IN PVOID Context, 1844 IN PCPE_EXCEPTION CmcLog); 1845 1846 typedef struct _CMC_DRIVER_INFO { 1847 PDRIVER_CMC_EXCEPTION_CALLBACK ExceptionCallback; 1848 PKDEFERRED_ROUTINE DpcCallback; 1849 PVOID DeviceContext; 1850 } CMC_DRIVER_INFO, *PCMC_DRIVER_INFO; 1851 1852 typedef struct _CPE_DRIVER_INFO { 1853 PDRIVER_CPE_EXCEPTION_CALLBACK ExceptionCallback; 1854 PKDEFERRED_ROUTINE DpcCallback; 1855 PVOID DeviceContext; 1856 } CPE_DRIVER_INFO, *PCPE_DRIVER_INFO; 1857 1858 #endif // defined(_X86_) || defined(_IA64_) || defined(_AMD64_) 1859 1860 #if defined(_IA64_) 1861 1862 typedef NTSTATUS 1863 (*HALSENDCROSSPARTITIONIPI)( 1864 IN USHORT ProcessorID, 1865 IN UCHAR HardwareVector); 1866 1867 typedef NTSTATUS 1868 (*HALRESERVECROSSPARTITIONINTERRUPTVECTOR)( 1869 OUT PULONG Vector, 1870 OUT PKIRQL Irql, 1871 IN OUT PGROUP_AFFINITY Affinity, 1872 OUT PUCHAR HardwareVector); 1873 1874 typedef VOID 1875 (*HALFREECROSSPARTITIONINTERRUPTVECTOR)( 1876 IN ULONG Vector, 1877 IN PGROUP_AFFINITY Affinity); 1878 1879 typedef struct _HAL_CROSS_PARTITION_IPI_INTERFACE { 1880 HALSENDCROSSPARTITIONIPI HalSendCrossPartitionIpi; 1881 HALRESERVECROSSPARTITIONINTERRUPTVECTOR HalReserveCrossPartitionInterruptVector; 1882 HALFREECROSSPARTITIONINTERRUPTVECTOR HalFreeCrossPartitionInterruptVector; 1883 } HAL_CROSS_PARTITION_IPI_INTERFACE; 1884 1885 #define HAL_CROSS_PARTITION_IPI_INTERFACE_MINIMUM_SIZE \ 1886 FIELD_OFFSET(HAL_CROSS_PARTITION_IPI_INTERFACE, \ 1887 HalFreeCrossPartitionInterruptVector) 1888 1889 #endif /* defined(_IA64_) */ 1890 1891 typedef struct _HAL_PLATFORM_INFORMATION { 1892 ULONG PlatformFlags; 1893 } HAL_PLATFORM_INFORMATION, *PHAL_PLATFORM_INFORMATION; 1894 1895 #define HAL_PLATFORM_DISABLE_WRITE_COMBINING 0x01L 1896 #define HAL_PLATFORM_DISABLE_PTCG 0x04L 1897 #define HAL_PLATFORM_DISABLE_UC_MAIN_MEMORY 0x08L 1898 #define HAL_PLATFORM_ENABLE_WRITE_COMBINING_MMIO 0x10L 1899 #define HAL_PLATFORM_ACPI_TABLES_CACHED 0x20L 1900 1901 /****************************************************************************** 1902 * Kernel Types * 1903 ******************************************************************************/ 1904 1905 #define NX_SUPPORT_POLICY_ALWAYSOFF 0 1906 #define NX_SUPPORT_POLICY_ALWAYSON 1 1907 #define NX_SUPPORT_POLICY_OPTIN 2 1908 #define NX_SUPPORT_POLICY_OPTOUT 3 1909 1910 typedef VOID 1911 (NTAPI *PEXPAND_STACK_CALLOUT)( 1912 IN PVOID Parameter OPTIONAL); 1913 1914 typedef VOID 1915 (NTAPI *PTIMER_APC_ROUTINE)( 1916 IN PVOID TimerContext, 1917 IN ULONG TimerLowValue, 1918 IN LONG TimerHighValue); 1919 1920 typedef enum _TIMER_SET_INFORMATION_CLASS { 1921 TimerSetCoalescableTimer, 1922 MaxTimerInfoClass 1923 } TIMER_SET_INFORMATION_CLASS; 1924 1925 #if (NTDDI_VERSION >= NTDDI_WIN7) 1926 typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO { 1927 IN LARGE_INTEGER DueTime; 1928 IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL; 1929 IN PVOID TimerContext OPTIONAL; 1930 IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL; 1931 IN ULONG Period OPTIONAL; 1932 IN ULONG TolerableDelay; 1933 OUT PBOOLEAN PreviousState OPTIONAL; 1934 } TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO; 1935 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 1936 1937 #define XSTATE_LEGACY_FLOATING_POINT 0 1938 #define XSTATE_LEGACY_SSE 1 1939 #define XSTATE_GSSE 2 1940 1941 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT)) 1942 #define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE)) 1943 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE) 1944 #define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE)) 1945 1946 #define MAXIMUM_XSTATE_FEATURES 64 1947 1948 typedef struct _XSTATE_FEATURE { 1949 ULONG Offset; 1950 ULONG Size; 1951 } XSTATE_FEATURE, *PXSTATE_FEATURE; 1952 1953 typedef struct _XSTATE_CONFIGURATION { 1954 ULONG64 EnabledFeatures; 1955 ULONG Size; 1956 ULONG OptimizedSave:1; 1957 XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES]; 1958 } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION; 1959 1960 #define MAX_WOW64_SHARED_ENTRIES 16 1961 1962 typedef struct _KUSER_SHARED_DATA { 1963 ULONG TickCountLowDeprecated; 1964 ULONG TickCountMultiplier; 1965 volatile KSYSTEM_TIME InterruptTime; 1966 volatile KSYSTEM_TIME SystemTime; 1967 volatile KSYSTEM_TIME TimeZoneBias; 1968 USHORT ImageNumberLow; 1969 USHORT ImageNumberHigh; 1970 WCHAR NtSystemRoot[260]; 1971 ULONG MaxStackTraceDepth; 1972 ULONG CryptoExponent; 1973 ULONG TimeZoneId; 1974 ULONG LargePageMinimum; 1975 ULONG Reserved2[7]; 1976 NT_PRODUCT_TYPE NtProductType; 1977 BOOLEAN ProductTypeIsValid; 1978 ULONG NtMajorVersion; 1979 ULONG NtMinorVersion; 1980 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX]; 1981 ULONG Reserved1; 1982 ULONG Reserved3; 1983 volatile ULONG TimeSlip; 1984 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture; 1985 ULONG AltArchitecturePad[1]; 1986 LARGE_INTEGER SystemExpirationDate; 1987 ULONG SuiteMask; 1988 BOOLEAN KdDebuggerEnabled; 1989 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) 1990 UCHAR NXSupportPolicy; 1991 #endif 1992 volatile ULONG ActiveConsoleId; 1993 volatile ULONG DismountCount; 1994 ULONG ComPlusPackage; 1995 ULONG LastSystemRITEventTickCount; 1996 ULONG NumberOfPhysicalPages; 1997 BOOLEAN SafeBootMode; 1998 #if (NTDDI_VERSION >= NTDDI_WIN7) 1999 _ANONYMOUS_UNION union { 2000 UCHAR TscQpcData; 2001 _ANONYMOUS_STRUCT struct { 2002 UCHAR TscQpcEnabled:1; 2003 UCHAR TscQpcSpareFlag:1; 2004 UCHAR TscQpcShift:6; 2005 } DUMMYSTRUCTNAME; 2006 } DUMMYUNIONNAME; 2007 UCHAR TscQpcPad[2]; 2008 #endif 2009 #if (NTDDI_VERSION >= NTDDI_VISTA) 2010 _ANONYMOUS_UNION union { 2011 ULONG SharedDataFlags; 2012 _ANONYMOUS_STRUCT struct { 2013 ULONG DbgErrorPortPresent:1; 2014 ULONG DbgElevationEnabled:1; 2015 ULONG DbgVirtEnabled:1; 2016 ULONG DbgInstallerDetectEnabled:1; 2017 ULONG DbgSystemDllRelocated:1; 2018 ULONG DbgDynProcessorEnabled:1; 2019 ULONG DbgSEHValidationEnabled:1; 2020 ULONG SpareBits:25; 2021 } DUMMYSTRUCTNAME2; 2022 } DUMMYUNIONNAME2; 2023 #else 2024 ULONG TraceLogging; 2025 #endif 2026 ULONG DataFlagsPad[1]; 2027 ULONGLONG TestRetInstruction; 2028 ULONG SystemCall; 2029 ULONG SystemCallReturn; 2030 ULONGLONG SystemCallPad[3]; 2031 _ANONYMOUS_UNION union { 2032 volatile KSYSTEM_TIME TickCount; 2033 volatile ULONG64 TickCountQuad; 2034 _ANONYMOUS_STRUCT struct { 2035 ULONG ReservedTickCountOverlay[3]; 2036 ULONG TickCountPad[1]; 2037 } DUMMYSTRUCTNAME; 2038 } DUMMYUNIONNAME3; 2039 ULONG Cookie; 2040 ULONG CookiePad[1]; 2041 #if (NTDDI_VERSION >= NTDDI_WS03) 2042 LONGLONG ConsoleSessionForegroundProcessId; 2043 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES]; 2044 #endif 2045 #if (NTDDI_VERSION >= NTDDI_VISTA) 2046 #if (NTDDI_VERSION >= NTDDI_WIN7) 2047 USHORT UserModeGlobalLogger[16]; 2048 #else 2049 USHORT UserModeGlobalLogger[8]; 2050 ULONG HeapTracingPid[2]; 2051 ULONG CritSecTracingPid[2]; 2052 #endif 2053 ULONG ImageFileExecutionOptions; 2054 #if (NTDDI_VERSION >= NTDDI_VISTASP1) 2055 ULONG LangGenerationCount; 2056 #else 2057 /* 4 bytes padding */ 2058 #endif 2059 ULONGLONG Reserved5; 2060 volatile ULONG64 InterruptTimeBias; 2061 #endif 2062 #if (NTDDI_VERSION >= NTDDI_WIN7) 2063 volatile ULONG64 TscQpcBias; 2064 volatile ULONG ActiveProcessorCount; 2065 volatile USHORT ActiveGroupCount; 2066 USHORT Reserved4; 2067 volatile ULONG AitSamplingValue; 2068 volatile ULONG AppCompatFlag; 2069 ULONGLONG SystemDllNativeRelocation; 2070 ULONG SystemDllWowRelocation; 2071 ULONG XStatePad[1]; 2072 XSTATE_CONFIGURATION XState; 2073 #endif 2074 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; 2075 2076 #if (NTDDI_VERSION >= NTDDI_VISTA) 2077 extern NTSYSAPI volatile CCHAR KeNumberProcessors; 2078 #elif (NTDDI_VERSION >= NTDDI_WINXP) 2079 extern NTSYSAPI CCHAR KeNumberProcessors; 2080 #else 2081 extern PCCHAR KeNumberProcessors; 2082 #endif 2083 2084 2085 /****************************************************************************** 2086 * Kernel Debugger Types * 2087 ******************************************************************************/ 2088 typedef struct _DEBUG_DEVICE_ADDRESS { 2089 UCHAR Type; 2090 BOOLEAN Valid; 2091 UCHAR Reserved[2]; 2092 PUCHAR TranslatedAddress; 2093 ULONG Length; 2094 } DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS; 2095 2096 typedef struct _DEBUG_MEMORY_REQUIREMENTS { 2097 PHYSICAL_ADDRESS Start; 2098 PHYSICAL_ADDRESS MaxEnd; 2099 PVOID VirtualAddress; 2100 ULONG Length; 2101 BOOLEAN Cached; 2102 BOOLEAN Aligned; 2103 } DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS; 2104 2105 typedef struct _DEBUG_DEVICE_DESCRIPTOR { 2106 ULONG Bus; 2107 ULONG Slot; 2108 USHORT Segment; 2109 USHORT VendorID; 2110 USHORT DeviceID; 2111 UCHAR BaseClass; 2112 UCHAR SubClass; 2113 UCHAR ProgIf; 2114 BOOLEAN Initialized; 2115 BOOLEAN Configured; 2116 DEBUG_DEVICE_ADDRESS BaseAddress[6]; 2117 DEBUG_MEMORY_REQUIREMENTS Memory; 2118 } DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR; 2119 2120 typedef NTSTATUS 2121 (NTAPI *pKdSetupPciDeviceForDebugging)( 2122 IN PVOID LoaderBlock OPTIONAL, 2123 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice); 2124 2125 typedef NTSTATUS 2126 (NTAPI *pKdReleasePciDeviceForDebugging)( 2127 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice); 2128 2129 typedef PVOID 2130 (NTAPI *pKdGetAcpiTablePhase0)( 2131 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, 2132 IN ULONG Signature); 2133 2134 typedef VOID 2135 (NTAPI *pKdCheckPowerButton)( 2136 VOID); 2137 2138 #if (NTDDI_VERSION >= NTDDI_VISTA) 2139 typedef PVOID 2140 (NTAPI *pKdMapPhysicalMemory64)( 2141 IN PHYSICAL_ADDRESS PhysicalAddress, 2142 IN ULONG NumberPages, 2143 IN BOOLEAN FlushCurrentTLB); 2144 2145 typedef VOID 2146 (NTAPI *pKdUnmapVirtualAddress)( 2147 IN PVOID VirtualAddress, 2148 IN ULONG NumberPages, 2149 IN BOOLEAN FlushCurrentTLB); 2150 #else 2151 typedef PVOID 2152 (NTAPI *pKdMapPhysicalMemory64)( 2153 IN PHYSICAL_ADDRESS PhysicalAddress, 2154 IN ULONG NumberPages); 2155 2156 typedef VOID 2157 (NTAPI *pKdUnmapVirtualAddress)( 2158 IN PVOID VirtualAddress, 2159 IN ULONG NumberPages); 2160 #endif 2161 2162 typedef ULONG 2163 (NTAPI *pKdGetPciDataByOffset)( 2164 IN ULONG BusNumber, 2165 IN ULONG SlotNumber, 2166 OUT PVOID Buffer, 2167 IN ULONG Offset, 2168 IN ULONG Length); 2169 2170 typedef ULONG 2171 (NTAPI *pKdSetPciDataByOffset)( 2172 IN ULONG BusNumber, 2173 IN ULONG SlotNumber, 2174 IN PVOID Buffer, 2175 IN ULONG Offset, 2176 IN ULONG Length); 2177 /****************************************************************************** 2178 * Memory manager Types * 2179 ******************************************************************************/ 2180 2181 typedef struct _PHYSICAL_MEMORY_RANGE { 2182 PHYSICAL_ADDRESS BaseAddress; 2183 LARGE_INTEGER NumberOfBytes; 2184 } PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE; 2185 2186 typedef NTSTATUS 2187 (NTAPI *PMM_ROTATE_COPY_CALLBACK_FUNCTION)( 2188 IN PMDL DestinationMdl, 2189 IN PMDL SourceMdl, 2190 IN PVOID Context); 2191 2192 typedef enum _MM_ROTATE_DIRECTION { 2193 MmToFrameBuffer, 2194 MmToFrameBufferNoCopy, 2195 MmToRegularMemory, 2196 MmToRegularMemoryNoCopy, 2197 MmMaximumRotateDirection 2198 } MM_ROTATE_DIRECTION, *PMM_ROTATE_DIRECTION; 2199 2200 2201 /****************************************************************************** 2202 * Process Manager Types * 2203 ******************************************************************************/ 2204 2205 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 2206 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 2207 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 2208 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 2209 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010 2210 2211 typedef struct _QUOTA_LIMITS { 2212 SIZE_T PagedPoolLimit; 2213 SIZE_T NonPagedPoolLimit; 2214 SIZE_T MinimumWorkingSetSize; 2215 SIZE_T MaximumWorkingSetSize; 2216 SIZE_T PagefileLimit; 2217 LARGE_INTEGER TimeLimit; 2218 } QUOTA_LIMITS, *PQUOTA_LIMITS; 2219 2220 typedef union _RATE_QUOTA_LIMIT { 2221 ULONG RateData; 2222 _ANONYMOUS_STRUCT struct { 2223 ULONG RatePercent:7; 2224 ULONG Reserved0:25; 2225 } DUMMYSTRUCTNAME; 2226 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT; 2227 2228 typedef struct _QUOTA_LIMITS_EX { 2229 SIZE_T PagedPoolLimit; 2230 SIZE_T NonPagedPoolLimit; 2231 SIZE_T MinimumWorkingSetSize; 2232 SIZE_T MaximumWorkingSetSize; 2233 SIZE_T PagefileLimit; 2234 LARGE_INTEGER TimeLimit; 2235 SIZE_T WorkingSetLimit; 2236 SIZE_T Reserved2; 2237 SIZE_T Reserved3; 2238 SIZE_T Reserved4; 2239 ULONG Flags; 2240 RATE_QUOTA_LIMIT CpuRateLimit; 2241 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX; 2242 2243 typedef struct _IO_COUNTERS { 2244 ULONGLONG ReadOperationCount; 2245 ULONGLONG WriteOperationCount; 2246 ULONGLONG OtherOperationCount; 2247 ULONGLONG ReadTransferCount; 2248 ULONGLONG WriteTransferCount; 2249 ULONGLONG OtherTransferCount; 2250 } IO_COUNTERS, *PIO_COUNTERS; 2251 2252 typedef struct _VM_COUNTERS { 2253 SIZE_T PeakVirtualSize; 2254 SIZE_T VirtualSize; 2255 ULONG PageFaultCount; 2256 SIZE_T PeakWorkingSetSize; 2257 SIZE_T WorkingSetSize; 2258 SIZE_T QuotaPeakPagedPoolUsage; 2259 SIZE_T QuotaPagedPoolUsage; 2260 SIZE_T QuotaPeakNonPagedPoolUsage; 2261 SIZE_T QuotaNonPagedPoolUsage; 2262 SIZE_T PagefileUsage; 2263 SIZE_T PeakPagefileUsage; 2264 } VM_COUNTERS, *PVM_COUNTERS; 2265 2266 typedef struct _VM_COUNTERS_EX { 2267 SIZE_T PeakVirtualSize; 2268 SIZE_T VirtualSize; 2269 ULONG PageFaultCount; 2270 SIZE_T PeakWorkingSetSize; 2271 SIZE_T WorkingSetSize; 2272 SIZE_T QuotaPeakPagedPoolUsage; 2273 SIZE_T QuotaPagedPoolUsage; 2274 SIZE_T QuotaPeakNonPagedPoolUsage; 2275 SIZE_T QuotaNonPagedPoolUsage; 2276 SIZE_T PagefileUsage; 2277 SIZE_T PeakPagefileUsage; 2278 SIZE_T PrivateUsage; 2279 } VM_COUNTERS_EX, *PVM_COUNTERS_EX; 2280 2281 #define MAX_HW_COUNTERS 16 2282 #define THREAD_PROFILING_FLAG_DISPATCH 0x00000001 2283 2284 typedef enum _HARDWARE_COUNTER_TYPE { 2285 PMCCounter, 2286 MaxHardwareCounterType 2287 } HARDWARE_COUNTER_TYPE, *PHARDWARE_COUNTER_TYPE; 2288 2289 typedef struct _HARDWARE_COUNTER { 2290 HARDWARE_COUNTER_TYPE Type; 2291 ULONG Reserved; 2292 ULONG64 Index; 2293 } HARDWARE_COUNTER, *PHARDWARE_COUNTER; 2294 2295 typedef struct _POOLED_USAGE_AND_LIMITS { 2296 SIZE_T PeakPagedPoolUsage; 2297 SIZE_T PagedPoolUsage; 2298 SIZE_T PagedPoolLimit; 2299 SIZE_T PeakNonPagedPoolUsage; 2300 SIZE_T NonPagedPoolUsage; 2301 SIZE_T NonPagedPoolLimit; 2302 SIZE_T PeakPagefileUsage; 2303 SIZE_T PagefileUsage; 2304 SIZE_T PagefileLimit; 2305 } POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS; 2306 2307 typedef struct _PROCESS_ACCESS_TOKEN { 2308 HANDLE Token; 2309 HANDLE Thread; 2310 } PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN; 2311 2312 #define PROCESS_EXCEPTION_PORT_ALL_STATE_BITS 0x00000003UL 2313 #define PROCESS_EXCEPTION_PORT_ALL_STATE_FLAGS ((ULONG_PTR)((1UL << PROCESS_EXCEPTION_PORT_ALL_STATE_BITS) - 1)) 2314 2315 typedef struct _PROCESS_EXCEPTION_PORT { 2316 IN HANDLE ExceptionPortHandle; 2317 IN OUT ULONG StateFlags; 2318 } PROCESS_EXCEPTION_PORT, *PPROCESS_EXCEPTION_PORT; 2319 2320 typedef VOID 2321 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)( 2322 IN HANDLE ParentId, 2323 IN HANDLE ProcessId, 2324 IN BOOLEAN Create); 2325 2326 typedef struct _PS_CREATE_NOTIFY_INFO { 2327 IN SIZE_T Size; 2328 _ANONYMOUS_UNION union { 2329 IN ULONG Flags; 2330 _ANONYMOUS_STRUCT struct { 2331 IN ULONG FileOpenNameAvailable:1; 2332 IN ULONG Reserved:31; 2333 } DUMMYSTRUCTNAME; 2334 } DUMMYUNIONNAME; 2335 IN HANDLE ParentProcessId; 2336 IN CLIENT_ID CreatingThreadId; 2337 IN OUT struct _FILE_OBJECT *FileObject; 2338 IN PCUNICODE_STRING ImageFileName; 2339 IN PCUNICODE_STRING CommandLine OPTIONAL; 2340 IN OUT NTSTATUS CreationStatus; 2341 } PS_CREATE_NOTIFY_INFO, *PPS_CREATE_NOTIFY_INFO; 2342 2343 typedef VOID 2344 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE_EX)( 2345 IN OUT PEPROCESS Process, 2346 IN HANDLE ProcessId, 2347 IN PPS_CREATE_NOTIFY_INFO CreateInfo OPTIONAL); 2348 2349 typedef VOID 2350 (NTAPI *PCREATE_THREAD_NOTIFY_ROUTINE)( 2351 IN HANDLE ProcessId, 2352 IN HANDLE ThreadId, 2353 IN BOOLEAN Create); 2354 2355 #define IMAGE_ADDRESSING_MODE_32BIT 3 2356 2357 typedef struct _IMAGE_INFO { 2358 _ANONYMOUS_UNION union { 2359 ULONG Properties; 2360 _ANONYMOUS_STRUCT struct { 2361 ULONG ImageAddressingMode:8; 2362 ULONG SystemModeImage:1; 2363 ULONG ImageMappedToAllPids:1; 2364 ULONG ExtendedInfoPresent:1; 2365 ULONG Reserved:21; 2366 } DUMMYSTRUCTNAME; 2367 } DUMMYUNIONNAME; 2368 PVOID ImageBase; 2369 ULONG ImageSelector; 2370 SIZE_T ImageSize; 2371 ULONG ImageSectionNumber; 2372 } IMAGE_INFO, *PIMAGE_INFO; 2373 2374 typedef struct _IMAGE_INFO_EX { 2375 SIZE_T Size; 2376 IMAGE_INFO ImageInfo; 2377 struct _FILE_OBJECT *FileObject; 2378 } IMAGE_INFO_EX, *PIMAGE_INFO_EX; 2379 2380 typedef VOID 2381 (NTAPI *PLOAD_IMAGE_NOTIFY_ROUTINE)( 2382 IN PUNICODE_STRING FullImageName, 2383 IN HANDLE ProcessId, 2384 IN PIMAGE_INFO ImageInfo); 2385 2386 #define THREAD_CSWITCH_PMU_DISABLE FALSE 2387 #define THREAD_CSWITCH_PMU_ENABLE TRUE 2388 2389 #define PROCESS_LUID_DOSDEVICES_ONLY 0x00000001 2390 2391 #define PROCESS_HANDLE_TRACING_MAX_STACKS 16 2392 2393 typedef struct _NT_TIB { 2394 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; 2395 PVOID StackBase; 2396 PVOID StackLimit; 2397 PVOID SubSystemTib; 2398 _ANONYMOUS_UNION union { 2399 PVOID FiberData; 2400 ULONG Version; 2401 } DUMMYUNIONNAME; 2402 PVOID ArbitraryUserPointer; 2403 struct _NT_TIB *Self; 2404 } NT_TIB, *PNT_TIB; 2405 2406 typedef struct _NT_TIB32 { 2407 ULONG ExceptionList; 2408 ULONG StackBase; 2409 ULONG StackLimit; 2410 ULONG SubSystemTib; 2411 _ANONYMOUS_UNION union { 2412 ULONG FiberData; 2413 ULONG Version; 2414 } DUMMYUNIONNAME; 2415 ULONG ArbitraryUserPointer; 2416 ULONG Self; 2417 } NT_TIB32,*PNT_TIB32; 2418 2419 typedef struct _NT_TIB64 { 2420 ULONG64 ExceptionList; 2421 ULONG64 StackBase; 2422 ULONG64 StackLimit; 2423 ULONG64 SubSystemTib; 2424 _ANONYMOUS_UNION union { 2425 ULONG64 FiberData; 2426 ULONG Version; 2427 } DUMMYUNIONNAME; 2428 ULONG64 ArbitraryUserPointer; 2429 ULONG64 Self; 2430 } NT_TIB64,*PNT_TIB64; 2431 2432 typedef enum _PROCESSINFOCLASS { 2433 ProcessBasicInformation, 2434 ProcessQuotaLimits, 2435 ProcessIoCounters, 2436 ProcessVmCounters, 2437 ProcessTimes, 2438 ProcessBasePriority, 2439 ProcessRaisePriority, 2440 ProcessDebugPort, 2441 ProcessExceptionPort, 2442 ProcessAccessToken, 2443 ProcessLdtInformation, 2444 ProcessLdtSize, 2445 ProcessDefaultHardErrorMode, 2446 ProcessIoPortHandlers, 2447 ProcessPooledUsageAndLimits, 2448 ProcessWorkingSetWatch, 2449 ProcessUserModeIOPL, 2450 ProcessEnableAlignmentFaultFixup, 2451 ProcessPriorityClass, 2452 ProcessWx86Information, 2453 ProcessHandleCount, 2454 ProcessAffinityMask, 2455 ProcessPriorityBoost, 2456 ProcessDeviceMap, 2457 ProcessSessionInformation, 2458 ProcessForegroundInformation, 2459 ProcessWow64Information, 2460 ProcessImageFileName, 2461 ProcessLUIDDeviceMapsEnabled, 2462 ProcessBreakOnTermination, 2463 ProcessDebugObjectHandle, 2464 ProcessDebugFlags, 2465 ProcessHandleTracing, 2466 ProcessIoPriority, 2467 ProcessExecuteFlags, 2468 ProcessTlsInformation, 2469 ProcessCookie, 2470 ProcessImageInformation, 2471 ProcessCycleTime, 2472 ProcessPagePriority, 2473 ProcessInstrumentationCallback, 2474 ProcessThreadStackAllocation, 2475 ProcessWorkingSetWatchEx, 2476 ProcessImageFileNameWin32, 2477 ProcessImageFileMapping, 2478 ProcessAffinityUpdateMode, 2479 ProcessMemoryAllocationMode, 2480 ProcessGroupInformation, 2481 ProcessTokenVirtualizationEnabled, 2482 ProcessConsoleHostProcess, 2483 ProcessWindowInformation, 2484 MaxProcessInfoClass 2485 } PROCESSINFOCLASS; 2486 2487 typedef enum _THREADINFOCLASS { 2488 ThreadBasicInformation, 2489 ThreadTimes, 2490 ThreadPriority, 2491 ThreadBasePriority, 2492 ThreadAffinityMask, 2493 ThreadImpersonationToken, 2494 ThreadDescriptorTableEntry, 2495 ThreadEnableAlignmentFaultFixup, 2496 ThreadEventPair_Reusable, 2497 ThreadQuerySetWin32StartAddress, 2498 ThreadZeroTlsCell, 2499 ThreadPerformanceCount, 2500 ThreadAmILastThread, 2501 ThreadIdealProcessor, 2502 ThreadPriorityBoost, 2503 ThreadSetTlsArrayAddress, 2504 ThreadIsIoPending, 2505 ThreadHideFromDebugger, 2506 ThreadBreakOnTermination, 2507 ThreadSwitchLegacyState, 2508 ThreadIsTerminated, 2509 ThreadLastSystemCall, 2510 ThreadIoPriority, 2511 ThreadCycleTime, 2512 ThreadPagePriority, 2513 ThreadActualBasePriority, 2514 ThreadTebInformation, 2515 ThreadCSwitchMon, 2516 ThreadCSwitchPmu, 2517 ThreadWow64Context, 2518 ThreadGroupInformation, 2519 ThreadUmsInformation, 2520 ThreadCounterProfiling, 2521 ThreadIdealProcessorEx, 2522 MaxThreadInfoClass 2523 } THREADINFOCLASS; 2524 2525 typedef struct _PAGE_PRIORITY_INFORMATION { 2526 ULONG PagePriority; 2527 } PAGE_PRIORITY_INFORMATION, *PPAGE_PRIORITY_INFORMATION; 2528 2529 typedef struct _PROCESS_WS_WATCH_INFORMATION { 2530 PVOID FaultingPc; 2531 PVOID FaultingVa; 2532 } PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION; 2533 2534 typedef struct _PROCESS_BASIC_INFORMATION { 2535 NTSTATUS ExitStatus; 2536 struct _PEB *PebBaseAddress; 2537 ULONG_PTR AffinityMask; 2538 KPRIORITY BasePriority; 2539 ULONG_PTR UniqueProcessId; 2540 ULONG_PTR InheritedFromUniqueProcessId; 2541 } PROCESS_BASIC_INFORMATION,*PPROCESS_BASIC_INFORMATION; 2542 2543 typedef struct _PROCESS_EXTENDED_BASIC_INFORMATION { 2544 SIZE_T Size; 2545 PROCESS_BASIC_INFORMATION BasicInfo; 2546 _ANONYMOUS_UNION union { 2547 ULONG Flags; 2548 _ANONYMOUS_STRUCT struct { 2549 ULONG IsProtectedProcess:1; 2550 ULONG IsWow64Process:1; 2551 ULONG IsProcessDeleting:1; 2552 ULONG IsCrossSessionCreate:1; 2553 ULONG SpareBits:28; 2554 } DUMMYSTRUCTNAME; 2555 } DUMMYUNIONNAME; 2556 } PROCESS_EXTENDED_BASIC_INFORMATION, *PPROCESS_EXTENDED_BASIC_INFORMATION; 2557 2558 typedef struct _PROCESS_DEVICEMAP_INFORMATION { 2559 _ANONYMOUS_UNION union { 2560 struct { 2561 HANDLE DirectoryHandle; 2562 } Set; 2563 struct { 2564 ULONG DriveMap; 2565 UCHAR DriveType[32]; 2566 } Query; 2567 } DUMMYUNIONNAME; 2568 } PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION; 2569 2570 typedef struct _PROCESS_DEVICEMAP_INFORMATION_EX { 2571 _ANONYMOUS_UNION union { 2572 struct { 2573 HANDLE DirectoryHandle; 2574 } Set; 2575 struct { 2576 ULONG DriveMap; 2577 UCHAR DriveType[32]; 2578 } Query; 2579 } DUMMYUNIONNAME; 2580 ULONG Flags; 2581 } PROCESS_DEVICEMAP_INFORMATION_EX, *PPROCESS_DEVICEMAP_INFORMATION_EX; 2582 2583 typedef struct _PROCESS_SESSION_INFORMATION { 2584 ULONG SessionId; 2585 } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION; 2586 2587 typedef struct _PROCESS_HANDLE_TRACING_ENABLE { 2588 ULONG Flags; 2589 } PROCESS_HANDLE_TRACING_ENABLE, *PPROCESS_HANDLE_TRACING_ENABLE; 2590 2591 typedef struct _PROCESS_HANDLE_TRACING_ENABLE_EX { 2592 ULONG Flags; 2593 ULONG TotalSlots; 2594 } PROCESS_HANDLE_TRACING_ENABLE_EX, *PPROCESS_HANDLE_TRACING_ENABLE_EX; 2595 2596 typedef struct _PROCESS_HANDLE_TRACING_ENTRY { 2597 HANDLE Handle; 2598 CLIENT_ID ClientId; 2599 ULONG Type; 2600 PVOID Stacks[PROCESS_HANDLE_TRACING_MAX_STACKS]; 2601 } PROCESS_HANDLE_TRACING_ENTRY, *PPROCESS_HANDLE_TRACING_ENTRY; 2602 2603 typedef struct _PROCESS_HANDLE_TRACING_QUERY { 2604 HANDLE Handle; 2605 ULONG TotalTraces; 2606 PROCESS_HANDLE_TRACING_ENTRY HandleTrace[1]; 2607 } PROCESS_HANDLE_TRACING_QUERY, *PPROCESS_HANDLE_TRACING_QUERY; 2608 2609 extern NTKERNELAPI PEPROCESS PsInitialSystemProcess; 2610 2611 2612 /****************************************************************************** 2613 * Runtime Library Types * 2614 ******************************************************************************/ 2615 2616 #ifndef _RTL_RUN_ONCE_DEF 2617 #define _RTL_RUN_ONCE_DEF 2618 2619 #define RTL_RUN_ONCE_INIT {0} 2620 2621 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL 2622 #define RTL_RUN_ONCE_ASYNC 0x00000002UL 2623 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL 2624 2625 #define RTL_RUN_ONCE_CTX_RESERVED_BITS 2 2626 2627 #define RTL_HASH_ALLOCATED_HEADER 0x00000001 2628 2629 #define RTL_HASH_RESERVED_SIGNATURE 0 2630 2631 /* RtlVerifyVersionInfo() ComparisonType */ 2632 2633 #define VER_EQUAL 1 2634 #define VER_GREATER 2 2635 #define VER_GREATER_EQUAL 3 2636 #define VER_LESS 4 2637 #define VER_LESS_EQUAL 5 2638 #define VER_AND 6 2639 #define VER_OR 7 2640 2641 #define VER_CONDITION_MASK 7 2642 #define VER_NUM_BITS_PER_CONDITION_MASK 3 2643 2644 /* RtlVerifyVersionInfo() TypeMask */ 2645 2646 #define VER_MINORVERSION 0x0000001 2647 #define VER_MAJORVERSION 0x0000002 2648 #define VER_BUILDNUMBER 0x0000004 2649 #define VER_PLATFORMID 0x0000008 2650 #define VER_SERVICEPACKMINOR 0x0000010 2651 #define VER_SERVICEPACKMAJOR 0x0000020 2652 #define VER_SUITENAME 0x0000040 2653 #define VER_PRODUCT_TYPE 0x0000080 2654 2655 #define VER_NT_WORKSTATION 0x0000001 2656 #define VER_NT_DOMAIN_CONTROLLER 0x0000002 2657 #define VER_NT_SERVER 0x0000003 2658 2659 #define VER_PLATFORM_WIN32s 0 2660 #define VER_PLATFORM_WIN32_WINDOWS 1 2661 #define VER_PLATFORM_WIN32_NT 2 2662 2663 typedef union _RTL_RUN_ONCE { 2664 PVOID Ptr; 2665 } RTL_RUN_ONCE, *PRTL_RUN_ONCE; 2666 2667 typedef ULONG /* LOGICAL */ 2668 (NTAPI *PRTL_RUN_ONCE_INIT_FN) ( 2669 IN OUT PRTL_RUN_ONCE RunOnce, 2670 IN OUT PVOID Parameter OPTIONAL, 2671 IN OUT PVOID *Context OPTIONAL); 2672 2673 #endif /* _RTL_RUN_ONCE_DEF */ 2674 2675 typedef enum _TABLE_SEARCH_RESULT { 2676 TableEmptyTree, 2677 TableFoundNode, 2678 TableInsertAsLeft, 2679 TableInsertAsRight 2680 } TABLE_SEARCH_RESULT; 2681 2682 typedef enum _RTL_GENERIC_COMPARE_RESULTS { 2683 GenericLessThan, 2684 GenericGreaterThan, 2685 GenericEqual 2686 } RTL_GENERIC_COMPARE_RESULTS; 2687 2688 // Forwarder 2689 struct _RTL_AVL_TABLE; 2690 2691 typedef RTL_GENERIC_COMPARE_RESULTS 2692 (NTAPI *PRTL_AVL_COMPARE_ROUTINE) ( 2693 IN struct _RTL_AVL_TABLE *Table, 2694 IN PVOID FirstStruct, 2695 IN PVOID SecondStruct); 2696 2697 typedef PVOID 2698 (NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) ( 2699 IN struct _RTL_AVL_TABLE *Table, 2700 IN CLONG ByteSize); 2701 2702 typedef VOID 2703 (NTAPI *PRTL_AVL_FREE_ROUTINE) ( 2704 IN struct _RTL_AVL_TABLE *Table, 2705 IN PVOID Buffer); 2706 2707 typedef NTSTATUS 2708 (NTAPI *PRTL_AVL_MATCH_FUNCTION) ( 2709 IN struct _RTL_AVL_TABLE *Table, 2710 IN PVOID UserData, 2711 IN PVOID MatchData); 2712 2713 typedef struct _RTL_BALANCED_LINKS { 2714 struct _RTL_BALANCED_LINKS *Parent; 2715 struct _RTL_BALANCED_LINKS *LeftChild; 2716 struct _RTL_BALANCED_LINKS *RightChild; 2717 CHAR Balance; 2718 UCHAR Reserved[3]; 2719 } RTL_BALANCED_LINKS, *PRTL_BALANCED_LINKS; 2720 2721 typedef struct _RTL_AVL_TABLE { 2722 RTL_BALANCED_LINKS BalancedRoot; 2723 PVOID OrderedPointer; 2724 ULONG WhichOrderedElement; 2725 ULONG NumberGenericTableElements; 2726 ULONG DepthOfTree; 2727 PRTL_BALANCED_LINKS RestartKey; 2728 ULONG DeleteCount; 2729 PRTL_AVL_COMPARE_ROUTINE CompareRoutine; 2730 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine; 2731 PRTL_AVL_FREE_ROUTINE FreeRoutine; 2732 PVOID TableContext; 2733 } RTL_AVL_TABLE, *PRTL_AVL_TABLE; 2734 2735 #ifndef RTL_USE_AVL_TABLES 2736 2737 struct _RTL_GENERIC_TABLE; 2738 2739 typedef RTL_GENERIC_COMPARE_RESULTS 2740 (NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) ( 2741 IN struct _RTL_GENERIC_TABLE *Table, 2742 IN PVOID FirstStruct, 2743 IN PVOID SecondStruct); 2744 2745 typedef PVOID 2746 (NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) ( 2747 IN struct _RTL_GENERIC_TABLE *Table, 2748 IN CLONG ByteSize); 2749 2750 typedef VOID 2751 (NTAPI *PRTL_GENERIC_FREE_ROUTINE) ( 2752 IN struct _RTL_GENERIC_TABLE *Table, 2753 IN PVOID Buffer); 2754 2755 typedef struct _RTL_SPLAY_LINKS { 2756 struct _RTL_SPLAY_LINKS *Parent; 2757 struct _RTL_SPLAY_LINKS *LeftChild; 2758 struct _RTL_SPLAY_LINKS *RightChild; 2759 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS; 2760 2761 typedef struct _RTL_GENERIC_TABLE { 2762 PRTL_SPLAY_LINKS TableRoot; 2763 LIST_ENTRY InsertOrderList; 2764 PLIST_ENTRY OrderedPointer; 2765 ULONG WhichOrderedElement; 2766 ULONG NumberGenericTableElements; 2767 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine; 2768 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine; 2769 PRTL_GENERIC_FREE_ROUTINE FreeRoutine; 2770 PVOID TableContext; 2771 } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE; 2772 2773 #endif /* !RTL_USE_AVL_TABLES */ 2774 2775 #ifdef RTL_USE_AVL_TABLES 2776 2777 #undef PRTL_GENERIC_COMPARE_ROUTINE 2778 #undef RTL_GENERIC_COMPARE_ROUTINE 2779 #undef PRTL_GENERIC_ALLOCATE_ROUTINE 2780 #undef RTL_GENERIC_ALLOCATE_ROUTINE 2781 #undef PRTL_GENERIC_FREE_ROUTINE 2782 #undef RTL_GENERIC_FREE_ROUTINE 2783 #undef RTL_GENERIC_TABLE 2784 #undef PRTL_GENERIC_TABLE 2785 2786 #define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE 2787 #define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE 2788 #define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE 2789 #define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE 2790 #define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE 2791 #define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE 2792 #define RTL_GENERIC_TABLE RTL_AVL_TABLE 2793 #define PRTL_GENERIC_TABLE PRTL_AVL_TABLE 2794 2795 #endif /* RTL_USE_AVL_TABLES */ 2796 2797 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENTRY { 2798 LIST_ENTRY Linkage; 2799 ULONG_PTR Signature; 2800 } RTL_DYNAMIC_HASH_TABLE_ENTRY, *PRTL_DYNAMIC_HASH_TABLE_ENTRY; 2801 2802 typedef struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT { 2803 PLIST_ENTRY ChainHead; 2804 PLIST_ENTRY PrevLinkage; 2805 ULONG_PTR Signature; 2806 } RTL_DYNAMIC_HASH_TABLE_CONTEXT, *PRTL_DYNAMIC_HASH_TABLE_CONTEXT; 2807 2808 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR { 2809 RTL_DYNAMIC_HASH_TABLE_ENTRY HashEntry; 2810 PLIST_ENTRY ChainHead; 2811 ULONG BucketIndex; 2812 } RTL_DYNAMIC_HASH_TABLE_ENUMERATOR, *PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR; 2813 2814 typedef struct _RTL_DYNAMIC_HASH_TABLE { 2815 ULONG Flags; 2816 ULONG Shift; 2817 ULONG TableSize; 2818 ULONG Pivot; 2819 ULONG DivisorMask; 2820 ULONG NumEntries; 2821 ULONG NonEmptyBuckets; 2822 ULONG NumEnumerators; 2823 PVOID Directory; 2824 } RTL_DYNAMIC_HASH_TABLE, *PRTL_DYNAMIC_HASH_TABLE; 2825 2826 typedef struct _OSVERSIONINFOA { 2827 ULONG dwOSVersionInfoSize; 2828 ULONG dwMajorVersion; 2829 ULONG dwMinorVersion; 2830 ULONG dwBuildNumber; 2831 ULONG dwPlatformId; 2832 CHAR szCSDVersion[128]; 2833 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA; 2834 2835 typedef struct _OSVERSIONINFOW { 2836 ULONG dwOSVersionInfoSize; 2837 ULONG dwMajorVersion; 2838 ULONG dwMinorVersion; 2839 ULONG dwBuildNumber; 2840 ULONG dwPlatformId; 2841 WCHAR szCSDVersion[128]; 2842 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; 2843 2844 typedef struct _OSVERSIONINFOEXA { 2845 ULONG dwOSVersionInfoSize; 2846 ULONG dwMajorVersion; 2847 ULONG dwMinorVersion; 2848 ULONG dwBuildNumber; 2849 ULONG dwPlatformId; 2850 CHAR szCSDVersion[128]; 2851 USHORT wServicePackMajor; 2852 USHORT wServicePackMinor; 2853 USHORT wSuiteMask; 2854 UCHAR wProductType; 2855 UCHAR wReserved; 2856 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; 2857 2858 typedef struct _OSVERSIONINFOEXW { 2859 ULONG dwOSVersionInfoSize; 2860 ULONG dwMajorVersion; 2861 ULONG dwMinorVersion; 2862 ULONG dwBuildNumber; 2863 ULONG dwPlatformId; 2864 WCHAR szCSDVersion[128]; 2865 USHORT wServicePackMajor; 2866 USHORT wServicePackMinor; 2867 USHORT wSuiteMask; 2868 UCHAR wProductType; 2869 UCHAR wReserved; 2870 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; 2871 2872 #ifdef UNICODE 2873 typedef OSVERSIONINFOEXW OSVERSIONINFOEX; 2874 typedef POSVERSIONINFOEXW POSVERSIONINFOEX; 2875 typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; 2876 typedef OSVERSIONINFOW OSVERSIONINFO; 2877 typedef POSVERSIONINFOW POSVERSIONINFO; 2878 typedef LPOSVERSIONINFOW LPOSVERSIONINFO; 2879 #else 2880 typedef OSVERSIONINFOEXA OSVERSIONINFOEX; 2881 typedef POSVERSIONINFOEXA POSVERSIONINFOEX; 2882 typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; 2883 typedef OSVERSIONINFOA OSVERSIONINFO; 2884 typedef POSVERSIONINFOA POSVERSIONINFO; 2885 typedef LPOSVERSIONINFOA LPOSVERSIONINFO; 2886 #endif /* UNICODE */ 2887 2888 #define HASH_ENTRY_KEY(x) ((x)->Signature) 2889 2890 /****************************************************************************** 2891 * Security Manager Types * 2892 ******************************************************************************/ 2893 #define SE_UNSOLICITED_INPUT_PRIVILEGE 6 2894 2895 typedef enum _WELL_KNOWN_SID_TYPE { 2896 WinNullSid = 0, 2897 WinWorldSid = 1, 2898 WinLocalSid = 2, 2899 WinCreatorOwnerSid = 3, 2900 WinCreatorGroupSid = 4, 2901 WinCreatorOwnerServerSid = 5, 2902 WinCreatorGroupServerSid = 6, 2903 WinNtAuthoritySid = 7, 2904 WinDialupSid = 8, 2905 WinNetworkSid = 9, 2906 WinBatchSid = 10, 2907 WinInteractiveSid = 11, 2908 WinServiceSid = 12, 2909 WinAnonymousSid = 13, 2910 WinProxySid = 14, 2911 WinEnterpriseControllersSid = 15, 2912 WinSelfSid = 16, 2913 WinAuthenticatedUserSid = 17, 2914 WinRestrictedCodeSid = 18, 2915 WinTerminalServerSid = 19, 2916 WinRemoteLogonIdSid = 20, 2917 WinLogonIdsSid = 21, 2918 WinLocalSystemSid = 22, 2919 WinLocalServiceSid = 23, 2920 WinNetworkServiceSid = 24, 2921 WinBuiltinDomainSid = 25, 2922 WinBuiltinAdministratorsSid = 26, 2923 WinBuiltinUsersSid = 27, 2924 WinBuiltinGuestsSid = 28, 2925 WinBuiltinPowerUsersSid = 29, 2926 WinBuiltinAccountOperatorsSid = 30, 2927 WinBuiltinSystemOperatorsSid = 31, 2928 WinBuiltinPrintOperatorsSid = 32, 2929 WinBuiltinBackupOperatorsSid = 33, 2930 WinBuiltinReplicatorSid = 34, 2931 WinBuiltinPreWindows2000CompatibleAccessSid = 35, 2932 WinBuiltinRemoteDesktopUsersSid = 36, 2933 WinBuiltinNetworkConfigurationOperatorsSid = 37, 2934 WinAccountAdministratorSid = 38, 2935 WinAccountGuestSid = 39, 2936 WinAccountKrbtgtSid = 40, 2937 WinAccountDomainAdminsSid = 41, 2938 WinAccountDomainUsersSid = 42, 2939 WinAccountDomainGuestsSid = 43, 2940 WinAccountComputersSid = 44, 2941 WinAccountControllersSid = 45, 2942 WinAccountCertAdminsSid = 46, 2943 WinAccountSchemaAdminsSid = 47, 2944 WinAccountEnterpriseAdminsSid = 48, 2945 WinAccountPolicyAdminsSid = 49, 2946 WinAccountRasAndIasServersSid = 50, 2947 WinNTLMAuthenticationSid = 51, 2948 WinDigestAuthenticationSid = 52, 2949 WinSChannelAuthenticationSid = 53, 2950 WinThisOrganizationSid = 54, 2951 WinOtherOrganizationSid = 55, 2952 WinBuiltinIncomingForestTrustBuildersSid = 56, 2953 WinBuiltinPerfMonitoringUsersSid = 57, 2954 WinBuiltinPerfLoggingUsersSid = 58, 2955 WinBuiltinAuthorizationAccessSid = 59, 2956 WinBuiltinTerminalServerLicenseServersSid = 60, 2957 WinBuiltinDCOMUsersSid = 61, 2958 WinBuiltinIUsersSid = 62, 2959 WinIUserSid = 63, 2960 WinBuiltinCryptoOperatorsSid = 64, 2961 WinUntrustedLabelSid = 65, 2962 WinLowLabelSid = 66, 2963 WinMediumLabelSid = 67, 2964 WinHighLabelSid = 68, 2965 WinSystemLabelSid = 69, 2966 WinWriteRestrictedCodeSid = 70, 2967 WinCreatorOwnerRightsSid = 71, 2968 WinCacheablePrincipalsGroupSid = 72, 2969 WinNonCacheablePrincipalsGroupSid = 73, 2970 WinEnterpriseReadonlyControllersSid = 74, 2971 WinAccountReadonlyControllersSid = 75, 2972 WinBuiltinEventLogReadersGroup = 76, 2973 WinNewEnterpriseReadonlyControllersSid = 77, 2974 WinBuiltinCertSvcDComAccessGroup = 78, 2975 WinMediumPlusLabelSid = 79, 2976 WinLocalLogonSid = 80, 2977 WinConsoleLogonSid = 81, 2978 WinThisOrganizationCertificateSid = 82, 2979 } WELL_KNOWN_SID_TYPE; 2980 2981 #if defined(_M_IX86) 2982 2983 #define PAUSE_PROCESSOR YieldProcessor(); 2984 2985 #define KERNEL_STACK_SIZE 12288 2986 #define KERNEL_LARGE_STACK_SIZE 61440 2987 #define KERNEL_LARGE_STACK_COMMIT 12288 2988 2989 #define SIZE_OF_80387_REGISTERS 80 2990 2991 #if !defined(RC_INVOKED) 2992 2993 #define CONTEXT_i386 0x10000 2994 #define CONTEXT_i486 0x10000 2995 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L) 2996 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L) 2997 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L) 2998 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L) 2999 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L) 3000 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L) 3001 3002 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS) 3003 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \ 3004 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \ 3005 CONTEXT_EXTENDED_REGISTERS) 3006 3007 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L) 3008 3009 #endif /* !defined(RC_INVOKED) */ 3010 3011 typedef struct _FLOATING_SAVE_AREA { 3012 ULONG ControlWord; 3013 ULONG StatusWord; 3014 ULONG TagWord; 3015 ULONG ErrorOffset; 3016 ULONG ErrorSelector; 3017 ULONG DataOffset; 3018 ULONG DataSelector; 3019 UCHAR RegisterArea[SIZE_OF_80387_REGISTERS]; 3020 ULONG Cr0NpxState; 3021 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA; 3022 3023 #include "pshpack4.h" 3024 typedef struct _CONTEXT { 3025 ULONG ContextFlags; 3026 ULONG Dr0; 3027 ULONG Dr1; 3028 ULONG Dr2; 3029 ULONG Dr3; 3030 ULONG Dr6; 3031 ULONG Dr7; 3032 FLOATING_SAVE_AREA FloatSave; 3033 ULONG SegGs; 3034 ULONG SegFs; 3035 ULONG SegEs; 3036 ULONG SegDs; 3037 ULONG Edi; 3038 ULONG Esi; 3039 ULONG Ebx; 3040 ULONG Edx; 3041 ULONG Ecx; 3042 ULONG Eax; 3043 ULONG Ebp; 3044 ULONG Eip; 3045 ULONG SegCs; 3046 ULONG EFlags; 3047 ULONG Esp; 3048 ULONG SegSs; 3049 UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; 3050 } CONTEXT; 3051 #include "poppack.h" 3052 3053 #define KeGetPcr() PCR 3054 3055 #define PCR_MINOR_VERSION 1 3056 #define PCR_MAJOR_VERSION 1 3057 3058 typedef struct _KPCR { 3059 union { 3060 NT_TIB NtTib; 3061 struct { 3062 struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList; 3063 PVOID Used_StackBase; 3064 PVOID Spare2; 3065 PVOID TssCopy; 3066 ULONG ContextSwitches; 3067 KAFFINITY SetMemberCopy; 3068 PVOID Used_Self; 3069 }; 3070 }; 3071 struct _KPCR *SelfPcr; 3072 struct _KPRCB *Prcb; 3073 KIRQL Irql; 3074 ULONG IRR; 3075 ULONG IrrActive; 3076 ULONG IDR; 3077 PVOID KdVersionBlock; 3078 struct _KIDTENTRY *IDT; 3079 struct _KGDTENTRY *GDT; 3080 struct _KTSS *TSS; 3081 USHORT MajorVersion; 3082 USHORT MinorVersion; 3083 KAFFINITY SetMember; 3084 ULONG StallScaleFactor; 3085 UCHAR SpareUnused; 3086 UCHAR Number; 3087 UCHAR Spare0; 3088 UCHAR SecondLevelCacheAssociativity; 3089 ULONG VdmAlert; 3090 ULONG KernelReserved[14]; 3091 ULONG SecondLevelCacheSize; 3092 ULONG HalReserved[16]; 3093 } KPCR, *PKPCR; 3094 3095 FORCEINLINE 3096 ULONG 3097 KeGetCurrentProcessorNumber(VOID) 3098 { 3099 return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number)); 3100 } 3101 3102 3103 extern NTKERNELAPI PVOID MmHighestUserAddress; 3104 extern NTKERNELAPI PVOID MmSystemRangeStart; 3105 extern NTKERNELAPI ULONG MmUserProbeAddress; 3106 3107 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress 3108 #define MM_SYSTEM_RANGE_START MmSystemRangeStart 3109 #if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_) 3110 #define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_ 3111 extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_; 3112 #else 3113 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress 3114 #endif 3115 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000 3116 #define MM_KSEG0_BASE MM_SYSTEM_RANGE_START 3117 #define MM_SYSTEM_SPACE_END 0xFFFFFFFF 3118 #if !defined (_X86PAE_) 3119 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000 3120 #else 3121 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000 3122 #endif 3123 3124 #elif defined(_M_AMD64) 3125 3126 #define PAUSE_PROCESSOR YieldProcessor(); 3127 3128 #define KERNEL_STACK_SIZE 0x6000 3129 #define KERNEL_LARGE_STACK_SIZE 0x12000 3130 #define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE 3131 3132 #define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000 3133 3134 #define EXCEPTION_READ_FAULT 0 3135 #define EXCEPTION_WRITE_FAULT 1 3136 #define EXCEPTION_EXECUTE_FAULT 8 3137 3138 #if !defined(RC_INVOKED) 3139 3140 #define CONTEXT_AMD64 0x100000 3141 3142 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) 3143 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) 3144 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) 3145 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) 3146 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) 3147 3148 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) 3149 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) 3150 3151 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L) 3152 3153 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000 3154 #define CONTEXT_SERVICE_ACTIVE 0x10000000 3155 #define CONTEXT_EXCEPTION_REQUEST 0x40000000 3156 #define CONTEXT_EXCEPTION_REPORTING 0x80000000 3157 3158 #endif /* !defined(RC_INVOKED) */ 3159 3160 #define INITIAL_MXCSR 0x1f80 3161 #define INITIAL_FPCSR 0x027f 3162 3163 typedef struct DECLSPEC_ALIGN(16) _CONTEXT { 3164 ULONG64 P1Home; 3165 ULONG64 P2Home; 3166 ULONG64 P3Home; 3167 ULONG64 P4Home; 3168 ULONG64 P5Home; 3169 ULONG64 P6Home; 3170 ULONG ContextFlags; 3171 ULONG MxCsr; 3172 USHORT SegCs; 3173 USHORT SegDs; 3174 USHORT SegEs; 3175 USHORT SegFs; 3176 USHORT SegGs; 3177 USHORT SegSs; 3178 ULONG EFlags; 3179 ULONG64 Dr0; 3180 ULONG64 Dr1; 3181 ULONG64 Dr2; 3182 ULONG64 Dr3; 3183 ULONG64 Dr6; 3184 ULONG64 Dr7; 3185 ULONG64 Rax; 3186 ULONG64 Rcx; 3187 ULONG64 Rdx; 3188 ULONG64 Rbx; 3189 ULONG64 Rsp; 3190 ULONG64 Rbp; 3191 ULONG64 Rsi; 3192 ULONG64 Rdi; 3193 ULONG64 R8; 3194 ULONG64 R9; 3195 ULONG64 R10; 3196 ULONG64 R11; 3197 ULONG64 R12; 3198 ULONG64 R13; 3199 ULONG64 R14; 3200 ULONG64 R15; 3201 ULONG64 Rip; 3202 _ANONYMOUS_UNION union { 3203 XMM_SAVE_AREA32 FltSave; 3204 _ANONYMOUS_STRUCT struct { 3205 M128A Header[2]; 3206 M128A Legacy[8]; 3207 M128A Xmm0; 3208 M128A Xmm1; 3209 M128A Xmm2; 3210 M128A Xmm3; 3211 M128A Xmm4; 3212 M128A Xmm5; 3213 M128A Xmm6; 3214 M128A Xmm7; 3215 M128A Xmm8; 3216 M128A Xmm9; 3217 M128A Xmm10; 3218 M128A Xmm11; 3219 M128A Xmm12; 3220 M128A Xmm13; 3221 M128A Xmm14; 3222 M128A Xmm15; 3223 } DUMMYSTRUCTNAME; 3224 } DUMMYUNIONNAME; 3225 M128A VectorRegister[26]; 3226 ULONG64 VectorControl; 3227 ULONG64 DebugControl; 3228 ULONG64 LastBranchToRip; 3229 ULONG64 LastBranchFromRip; 3230 ULONG64 LastExceptionToRip; 3231 ULONG64 LastExceptionFromRip; 3232 } CONTEXT; 3233 3234 #define PCR_MINOR_VERSION 1 3235 #define PCR_MAJOR_VERSION 1 3236 3237 typedef struct _KPCR { 3238 _ANONYMOUS_UNION union { 3239 NT_TIB NtTib; 3240 _ANONYMOUS_STRUCT struct { 3241 union _KGDTENTRY64 *GdtBase; 3242 struct _KTSS64 *TssBase; 3243 ULONG64 UserRsp; 3244 struct _KPCR *Self; 3245 struct _KPRCB *CurrentPrcb; 3246 PKSPIN_LOCK_QUEUE LockArray; 3247 PVOID Used_Self; 3248 }; 3249 }; 3250 union _KIDTENTRY64 *IdtBase; 3251 ULONG64 Unused[2]; 3252 KIRQL Irql; 3253 UCHAR SecondLevelCacheAssociativity; 3254 UCHAR ObsoleteNumber; 3255 UCHAR Fill0; 3256 ULONG Unused0[3]; 3257 USHORT MajorVersion; 3258 USHORT MinorVersion; 3259 ULONG StallScaleFactor; 3260 PVOID Unused1[3]; 3261 ULONG KernelReserved[15]; 3262 ULONG SecondLevelCacheSize; 3263 ULONG HalReserved[16]; 3264 ULONG Unused2; 3265 PVOID KdVersionBlock; 3266 PVOID Unused3; 3267 ULONG PcrAlign1[24]; 3268 } KPCR, *PKPCR; 3269 3270 FORCEINLINE 3271 PKPCR 3272 KeGetPcr(VOID) 3273 { 3274 return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self)); 3275 } 3276 3277 FORCEINLINE 3278 ULONG 3279 KeGetCurrentProcessorNumber(VOID) 3280 { 3281 return (ULONG)__readgsword(0x184); 3282 } 3283 3284 3285 #define PTI_SHIFT 12L 3286 #define PDI_SHIFT 21L 3287 #define PPI_SHIFT 30L 3288 #define PXI_SHIFT 39L 3289 #define PTE_PER_PAGE 512 3290 #define PDE_PER_PAGE 512 3291 #define PPE_PER_PAGE 512 3292 #define PXE_PER_PAGE 512 3293 #define PTI_MASK_AMD64 (PTE_PER_PAGE - 1) 3294 #define PDI_MASK_AMD64 (PDE_PER_PAGE - 1) 3295 #define PPI_MASK (PPE_PER_PAGE - 1) 3296 #define PXI_MASK (PXE_PER_PAGE - 1) 3297 3298 #define PXE_BASE 0xFFFFF6FB7DBED000ULL 3299 #define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL 3300 #define PPE_BASE 0xFFFFF6FB7DA00000ULL 3301 #define PDE_BASE 0xFFFFF6FB40000000ULL 3302 #define PTE_BASE 0xFFFFF68000000000ULL 3303 #define PXE_TOP 0xFFFFF6FB7DBEDFFFULL 3304 #define PPE_TOP 0xFFFFF6FB7DBFFFFFULL 3305 #define PDE_TOP 0xFFFFF6FB7FFFFFFFULL 3306 #define PTE_TOP 0xFFFFF6FFFFFFFFFFULL 3307 3308 extern NTKERNELAPI PVOID MmHighestUserAddress; 3309 extern NTKERNELAPI PVOID MmSystemRangeStart; 3310 extern NTKERNELAPI ULONG64 MmUserProbeAddress; 3311 3312 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress 3313 #define MM_SYSTEM_RANGE_START MmSystemRangeStart 3314 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress 3315 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000 3316 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL 3317 3318 3319 #elif defined(_M_IA64) 3320 3321 #elif defined(_M_PPC) 3322 3323 3324 #elif defined(_M_MIPS) 3325 3326 #elif defined(_M_ARM) 3327 #else 3328 #error Unknown Architecture 3329 #endif 3330 3331 /****************************************************************************** 3332 * Executive Functions * 3333 ******************************************************************************/ 3334 3335 static __inline PVOID 3336 ExAllocateFromZone( 3337 IN PZONE_HEADER Zone) 3338 { 3339 if (Zone->FreeList.Next) 3340 Zone->FreeList.Next = Zone->FreeList.Next->Next; 3341 return (PVOID) Zone->FreeList.Next; 3342 } 3343 3344 static __inline PVOID 3345 ExFreeToZone( 3346 IN PZONE_HEADER Zone, 3347 IN PVOID Block) 3348 { 3349 ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next; 3350 Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block); 3351 return ((PSINGLE_LIST_ENTRY) Block)->Next; 3352 } 3353 3354 /* 3355 * PVOID 3356 * ExInterlockedAllocateFromZone( 3357 * IN PZONE_HEADER Zone, 3358 * IN PKSPIN_LOCK Lock) 3359 */ 3360 #define ExInterlockedAllocateFromZone(Zone, Lock) \ 3361 ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock)) 3362 3363 /* PVOID 3364 * ExInterlockedFreeToZone( 3365 * IN PZONE_HEADER Zone, 3366 * IN PVOID Block, 3367 * IN PKSPIN_LOCK Lock); 3368 */ 3369 #define ExInterlockedFreeToZone(Zone, Block, Lock) \ 3370 ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block), Lock) 3371 3372 /* 3373 * BOOLEAN 3374 * ExIsFullZone( 3375 * IN PZONE_HEADER Zone) 3376 */ 3377 #define ExIsFullZone(Zone) \ 3378 ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL) 3379 3380 /* BOOLEAN 3381 * ExIsObjectInFirstZoneSegment( 3382 * IN PZONE_HEADER Zone, 3383 * IN PVOID Object); 3384 */ 3385 #define ExIsObjectInFirstZoneSegment(Zone,Object) \ 3386 ((BOOLEAN)( ((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) && \ 3387 ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \ 3388 (Zone)->TotalSegmentSize)) ) 3389 3390 #define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite 3391 #define ExAcquireResourceShared ExAcquireResourceSharedLite 3392 #define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite 3393 #define ExDeleteResource ExDeleteResourceLite 3394 #define ExInitializeResource ExInitializeResourceLite 3395 #define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite 3396 #define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite 3397 #define ExIsResourceAcquired ExIsResourceAcquiredSharedLite 3398 #define ExReleaseResourceForThread ExReleaseResourceForThreadLite 3399 3400 #ifndef _M_IX86 3401 #define RESULT_ZERO 0 3402 #define RESULT_NEGATIVE 1 3403 #define RESULT_POSITIVE 2 3404 #endif 3405 3406 typedef enum _INTERLOCKED_RESULT { 3407 ResultNegative = RESULT_NEGATIVE, 3408 ResultZero = RESULT_ZERO, 3409 ResultPositive = RESULT_POSITIVE 3410 } INTERLOCKED_RESULT; 3411 3412 #ifdef _X86_ 3413 3414 NTKERNELAPI 3415 INTERLOCKED_RESULT 3416 FASTCALL 3417 Exfi386InterlockedIncrementLong( 3418 IN OUT LONG volatile *Addend); 3419 3420 NTKERNELAPI 3421 INTERLOCKED_RESULT 3422 FASTCALL 3423 Exfi386InterlockedDecrementLong( 3424 IN PLONG Addend); 3425 3426 NTKERNELAPI 3427 ULONG 3428 FASTCALL 3429 Exfi386InterlockedExchangeUlong( 3430 IN PULONG Target, 3431 IN ULONG Value); 3432 3433 #endif 3434 3435 3436 #if (NTDDI_VERSION >= NTDDI_WIN2K) 3437 NTKERNELAPI 3438 NTSTATUS 3439 NTAPI 3440 ExExtendZone( 3441 IN OUT PZONE_HEADER Zone, 3442 IN OUT PVOID Segment, 3443 IN ULONG SegmentSize); 3444 3445 NTKERNELAPI 3446 NTSTATUS 3447 NTAPI 3448 ExInitializeZone( 3449 OUT PZONE_HEADER Zone, 3450 IN ULONG BlockSize, 3451 IN OUT PVOID InitialSegment, 3452 IN ULONG InitialSegmentSize); 3453 3454 NTKERNELAPI 3455 NTSTATUS 3456 NTAPI 3457 ExInterlockedExtendZone( 3458 IN OUT PZONE_HEADER Zone, 3459 IN OUT PVOID Segment, 3460 IN ULONG SegmentSize, 3461 IN OUT PKSPIN_LOCK Lock); 3462 3463 NTKERNELAPI 3464 NTSTATUS 3465 NTAPI 3466 ExUuidCreate( 3467 OUT UUID *Uuid); 3468 3469 NTKERNELAPI 3470 DECLSPEC_NORETURN 3471 VOID 3472 NTAPI 3473 ExRaiseAccessViolation(VOID); 3474 3475 NTKERNELAPI 3476 DECLSPEC_NORETURN 3477 VOID 3478 NTAPI 3479 ExRaiseDatatypeMisalignment(VOID); 3480 3481 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 3482 3483 3484 /* Hardware Abstraction Layer Functions */ 3485 3486 #if (NTDDI_VERSION >= NTDDI_WIN2K) 3487 3488 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_) 3489 3490 /* Nothing here */ 3491 3492 #else /* USE_DMA_MACROS ... */ 3493 3494 //DECLSPEC_DEPRECATED_DDK 3495 NTHALAPI 3496 VOID 3497 NTAPI 3498 IoFreeAdapterChannel( 3499 IN PADAPTER_OBJECT AdapterObject); 3500 3501 //DECLSPEC_DEPRECATED_DDK 3502 NTHALAPI 3503 BOOLEAN 3504 NTAPI 3505 IoFlushAdapterBuffers( 3506 IN PADAPTER_OBJECT AdapterObject, 3507 IN PMDL Mdl, 3508 IN PVOID MapRegisterBase, 3509 IN PVOID CurrentVa, 3510 IN ULONG Length, 3511 IN BOOLEAN WriteToDevice); 3512 3513 //DECLSPEC_DEPRECATED_DDK 3514 NTHALAPI 3515 VOID 3516 NTAPI 3517 IoFreeMapRegisters( 3518 IN PADAPTER_OBJECT AdapterObject, 3519 IN PVOID MapRegisterBase, 3520 IN ULONG NumberOfMapRegisters); 3521 3522 //DECLSPEC_DEPRECATED_DDK 3523 NTHALAPI 3524 PVOID 3525 NTAPI 3526 HalAllocateCommonBuffer( 3527 IN PADAPTER_OBJECT AdapterObject, 3528 IN ULONG Length, 3529 OUT PPHYSICAL_ADDRESS LogicalAddress, 3530 IN BOOLEAN CacheEnabled); 3531 3532 //DECLSPEC_DEPRECATED_DDK 3533 NTHALAPI 3534 VOID 3535 NTAPI 3536 HalFreeCommonBuffer( 3537 IN PADAPTER_OBJECT AdapterObject, 3538 IN ULONG Length, 3539 IN PHYSICAL_ADDRESS LogicalAddress, 3540 IN PVOID VirtualAddress, 3541 IN BOOLEAN CacheEnabled); 3542 3543 //DECLSPEC_DEPRECATED_DDK 3544 NTHALAPI 3545 ULONG 3546 NTAPI 3547 HalReadDmaCounter( 3548 IN PADAPTER_OBJECT AdapterObject); 3549 3550 NTHALAPI 3551 NTSTATUS 3552 NTAPI 3553 HalAllocateAdapterChannel( 3554 IN PADAPTER_OBJECT AdapterObject, 3555 IN PWAIT_CONTEXT_BLOCK Wcb, 3556 IN ULONG NumberOfMapRegisters, 3557 IN PDRIVER_CONTROL ExecutionRoutine); 3558 3559 #endif /* USE_DMA_MACROS ... */ 3560 3561 #if !defined(NO_LEGACY_DRIVERS) 3562 NTHALAPI 3563 NTSTATUS 3564 NTAPI 3565 HalAssignSlotResources( 3566 IN PUNICODE_STRING RegistryPath, 3567 IN PUNICODE_STRING DriverClassName, 3568 IN PDRIVER_OBJECT DriverObject, 3569 IN PDEVICE_OBJECT DeviceObject, 3570 IN INTERFACE_TYPE BusType, 3571 IN ULONG BusNumber, 3572 IN ULONG SlotNumber, 3573 IN OUT PCM_RESOURCE_LIST *AllocatedResources); 3574 3575 NTHALAPI 3576 ULONG 3577 NTAPI 3578 HalGetInterruptVector( 3579 IN INTERFACE_TYPE InterfaceType, 3580 IN ULONG BusNumber, 3581 IN ULONG BusInterruptLevel, 3582 IN ULONG BusInterruptVector, 3583 OUT PKIRQL Irql, 3584 OUT PKAFFINITY Affinity); 3585 3586 NTHALAPI 3587 ULONG 3588 NTAPI 3589 HalSetBusData( 3590 IN BUS_DATA_TYPE BusDataType, 3591 IN ULONG BusNumber, 3592 IN ULONG SlotNumber, 3593 IN PVOID Buffer, 3594 IN ULONG Length); 3595 3596 NTHALAPI 3597 ULONG 3598 NTAPI 3599 HalGetBusData( 3600 IN BUS_DATA_TYPE BusDataType, 3601 IN ULONG BusNumber, 3602 IN ULONG SlotNumber, 3603 OUT PVOID Buffer, 3604 IN ULONG Length); 3605 3606 NTHALAPI 3607 BOOLEAN 3608 NTAPI 3609 HalMakeBeep( 3610 IN ULONG Frequency); 3611 #endif /* !defined(NO_LEGACY_DRIVERS) */ 3612 3613 NTHALAPI 3614 PADAPTER_OBJECT 3615 NTAPI 3616 HalGetAdapter( 3617 IN PDEVICE_DESCRIPTION DeviceDescription, 3618 OUT PULONG NumberOfMapRegisters); 3619 3620 VOID 3621 NTAPI 3622 HalPutDmaAdapter( 3623 IN PADAPTER_OBJECT DmaAdapter); 3624 3625 NTHALAPI 3626 VOID 3627 NTAPI 3628 HalAcquireDisplayOwnership( 3629 IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters); 3630 3631 NTHALAPI 3632 ULONG 3633 NTAPI 3634 HalGetBusDataByOffset( 3635 IN BUS_DATA_TYPE BusDataType, 3636 IN ULONG BusNumber, 3637 IN ULONG SlotNumber, 3638 OUT PVOID Buffer, 3639 IN ULONG Offset, 3640 IN ULONG Length); 3641 3642 NTHALAPI 3643 ULONG 3644 NTAPI 3645 HalSetBusDataByOffset( 3646 IN BUS_DATA_TYPE BusDataType, 3647 IN ULONG BusNumber, 3648 IN ULONG SlotNumber, 3649 IN PVOID Buffer, 3650 IN ULONG Offset, 3651 IN ULONG Length); 3652 3653 NTHALAPI 3654 BOOLEAN 3655 NTAPI 3656 HalTranslateBusAddress( 3657 IN INTERFACE_TYPE InterfaceType, 3658 IN ULONG BusNumber, 3659 IN PHYSICAL_ADDRESS BusAddress, 3660 IN OUT PULONG AddressSpace, 3661 OUT PPHYSICAL_ADDRESS TranslatedAddress); 3662 3663 NTHALAPI 3664 PVOID 3665 NTAPI 3666 HalAllocateCrashDumpRegisters( 3667 IN PADAPTER_OBJECT AdapterObject, 3668 IN OUT PULONG NumberOfMapRegisters); 3669 3670 NTSTATUS 3671 NTAPI 3672 HalGetScatterGatherList( 3673 IN PADAPTER_OBJECT DmaAdapter, 3674 IN PDEVICE_OBJECT DeviceObject, 3675 IN PMDL Mdl, 3676 IN PVOID CurrentVa, 3677 IN ULONG Length, 3678 IN PDRIVER_LIST_CONTROL ExecutionRoutine, 3679 IN PVOID Context, 3680 IN BOOLEAN WriteToDevice); 3681 3682 VOID 3683 NTAPI 3684 HalPutScatterGatherList( 3685 IN PADAPTER_OBJECT DmaAdapter, 3686 IN PSCATTER_GATHER_LIST ScatterGather, 3687 IN BOOLEAN WriteToDevice); 3688 3689 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 3690 3691 #if (NTDDI_VERSION >= NTDDI_WINXP) 3692 NTKERNELAPI 3693 VOID 3694 FASTCALL 3695 HalExamineMBR( 3696 IN PDEVICE_OBJECT DeviceObject, 3697 IN ULONG SectorSize, 3698 IN ULONG MBRTypeIdentifier, 3699 OUT PVOID *Buffer); 3700 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 3701 3702 #if (NTDDI_VERSION >= NTDDI_WIN7) 3703 3704 NTSTATUS 3705 NTAPI 3706 HalAllocateHardwareCounters( 3707 IN PGROUP_AFFINITY GroupAffinty, 3708 IN ULONG GroupCount, 3709 IN PPHYSICAL_COUNTER_RESOURCE_LIST ResourceList, 3710 OUT PHANDLE CounterSetHandle); 3711 3712 NTSTATUS 3713 NTAPI 3714 HalFreeHardwareCounters( 3715 IN HANDLE CounterSetHandle); 3716 3717 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 3718 3719 #if defined(_IA64_) 3720 #if (NTDDI_VERSION >= NTDDI_WIN2K) 3721 NTHALAPI 3722 ULONG 3723 NTAPI 3724 HalGetDmaAlignmentRequirement(VOID); 3725 #endif 3726 #endif /* defined(_IA64_) */ 3727 3728 #if defined(_M_IX86) || defined(_M_AMD64) 3729 #define HalGetDmaAlignmentRequirement() 1L 3730 #endif 3731 3732 #if (NTDDI_VERSION >= NTDDI_WIN7) 3733 3734 typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR *PWHEA_ERROR_SOURCE_DESCRIPTOR; 3735 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD; 3736 3737 NTHALAPI 3738 VOID 3739 NTAPI 3740 HalBugCheckSystem( 3741 IN PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, 3742 IN PWHEA_ERROR_RECORD ErrorRecord); 3743 3744 #else 3745 3746 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD; 3747 3748 NTHALAPI 3749 VOID 3750 NTAPI 3751 HalBugCheckSystem( 3752 IN PWHEA_ERROR_RECORD ErrorRecord); 3753 3754 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 3755 3756 /****************************************************************************** 3757 * I/O Manager Functions * 3758 ******************************************************************************/ 3759 3760 /* 3761 * VOID IoAssignArcName( 3762 * IN PUNICODE_STRING ArcName, 3763 * IN PUNICODE_STRING DeviceName); 3764 */ 3765 #define IoAssignArcName(_ArcName, _DeviceName) ( \ 3766 IoCreateSymbolicLink((_ArcName), (_DeviceName))) 3767 3768 /* 3769 * VOID 3770 * IoDeassignArcName( 3771 * IN PUNICODE_STRING ArcName) 3772 */ 3773 #define IoDeassignArcName IoDeleteSymbolicLink 3774 3775 FORCEINLINE 3776 VOID 3777 NTAPI 3778 IoInitializeDriverCreateContext( 3779 PIO_DRIVER_CREATE_CONTEXT DriverContext) 3780 { 3781 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT)); 3782 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT); 3783 } 3784 3785 #if (NTDDI_VERSION >= NTDDI_WIN2K) 3786 3787 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)) 3788 NTKERNELAPI 3789 NTSTATUS 3790 NTAPI 3791 IoAllocateAdapterChannel( 3792 IN PADAPTER_OBJECT AdapterObject, 3793 IN PDEVICE_OBJECT DeviceObject, 3794 IN ULONG NumberOfMapRegisters, 3795 IN PDRIVER_CONTROL ExecutionRoutine, 3796 IN PVOID Context); 3797 #endif 3798 3799 #if !defined(DMA_MACROS_DEFINED) 3800 //DECLSPEC_DEPRECATED_DDK 3801 NTHALAPI 3802 PHYSICAL_ADDRESS 3803 NTAPI 3804 IoMapTransfer( 3805 IN PADAPTER_OBJECT AdapterObject, 3806 IN PMDL Mdl, 3807 IN PVOID MapRegisterBase, 3808 IN PVOID CurrentVa, 3809 IN OUT PULONG Length, 3810 IN BOOLEAN WriteToDevice); 3811 #endif 3812 3813 NTKERNELAPI 3814 VOID 3815 NTAPI 3816 IoAllocateController( 3817 IN PCONTROLLER_OBJECT ControllerObject, 3818 IN PDEVICE_OBJECT DeviceObject, 3819 IN PDRIVER_CONTROL ExecutionRoutine, 3820 IN PVOID Context OPTIONAL); 3821 3822 NTKERNELAPI 3823 PCONTROLLER_OBJECT 3824 NTAPI 3825 IoCreateController( 3826 IN ULONG Size); 3827 3828 NTKERNELAPI 3829 VOID 3830 NTAPI 3831 IoDeleteController( 3832 IN PCONTROLLER_OBJECT ControllerObject); 3833 3834 NTKERNELAPI 3835 VOID 3836 NTAPI 3837 IoFreeController( 3838 IN PCONTROLLER_OBJECT ControllerObject); 3839 3840 NTKERNELAPI 3841 PCONFIGURATION_INFORMATION 3842 NTAPI 3843 IoGetConfigurationInformation(VOID); 3844 3845 NTKERNELAPI 3846 PDEVICE_OBJECT 3847 NTAPI 3848 IoGetDeviceToVerify( 3849 IN PETHREAD Thread); 3850 3851 NTKERNELAPI 3852 VOID 3853 NTAPI 3854 IoCancelFileOpen( 3855 IN PDEVICE_OBJECT DeviceObject, 3856 IN PFILE_OBJECT FileObject); 3857 3858 NTKERNELAPI 3859 PGENERIC_MAPPING 3860 NTAPI 3861 IoGetFileObjectGenericMapping(VOID); 3862 3863 NTKERNELAPI 3864 PIRP 3865 NTAPI 3866 IoMakeAssociatedIrp( 3867 IN PIRP Irp, 3868 IN CCHAR StackSize); 3869 3870 NTKERNELAPI 3871 NTSTATUS 3872 NTAPI 3873 IoQueryDeviceDescription( 3874 IN PINTERFACE_TYPE BusType OPTIONAL, 3875 IN PULONG BusNumber OPTIONAL, 3876 IN PCONFIGURATION_TYPE ControllerType OPTIONAL, 3877 IN PULONG ControllerNumber OPTIONAL, 3878 IN PCONFIGURATION_TYPE PeripheralType OPTIONAL, 3879 IN PULONG PeripheralNumber OPTIONAL, 3880 IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, 3881 IN OUT PVOID Context OPTIONAL); 3882 3883 NTKERNELAPI 3884 VOID 3885 NTAPI 3886 IoRaiseHardError( 3887 IN PIRP Irp, 3888 IN PVPB Vpb OPTIONAL, 3889 IN PDEVICE_OBJECT RealDeviceObject); 3890 3891 NTKERNELAPI 3892 BOOLEAN 3893 NTAPI 3894 IoRaiseInformationalHardError( 3895 IN NTSTATUS ErrorStatus, 3896 IN PUNICODE_STRING String OPTIONAL, 3897 IN PKTHREAD Thread OPTIONAL); 3898 3899 NTKERNELAPI 3900 VOID 3901 NTAPI 3902 IoRegisterBootDriverReinitialization( 3903 IN PDRIVER_OBJECT DriverObject, 3904 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, 3905 IN PVOID Context OPTIONAL); 3906 3907 NTKERNELAPI 3908 VOID 3909 NTAPI 3910 IoRegisterDriverReinitialization( 3911 IN PDRIVER_OBJECT DriverObject, 3912 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, 3913 IN PVOID Context OPTIONAL); 3914 3915 NTKERNELAPI 3916 NTSTATUS 3917 NTAPI 3918 IoAttachDeviceByPointer( 3919 IN PDEVICE_OBJECT SourceDevice, 3920 IN PDEVICE_OBJECT TargetDevice); 3921 3922 NTKERNELAPI 3923 NTSTATUS 3924 NTAPI 3925 IoReportDetectedDevice( 3926 IN PDRIVER_OBJECT DriverObject, 3927 IN INTERFACE_TYPE LegacyBusType, 3928 IN ULONG BusNumber, 3929 IN ULONG SlotNumber, 3930 IN PCM_RESOURCE_LIST ResourceList OPTIONAL, 3931 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL, 3932 IN BOOLEAN ResourceAssigned, 3933 IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL); 3934 3935 NTKERNELAPI 3936 NTSTATUS 3937 NTAPI 3938 IoReportResourceForDetection( 3939 IN PDRIVER_OBJECT DriverObject, 3940 IN PCM_RESOURCE_LIST DriverList OPTIONAL, 3941 IN ULONG DriverListSize OPTIONAL, 3942 IN PDEVICE_OBJECT DeviceObject OPTIONAL, 3943 IN PCM_RESOURCE_LIST DeviceList OPTIONAL, 3944 IN ULONG DeviceListSize OPTIONAL, 3945 OUT PBOOLEAN ConflictDetected); 3946 3947 NTKERNELAPI 3948 NTSTATUS 3949 NTAPI 3950 IoReportResourceUsage( 3951 IN PUNICODE_STRING DriverClassName OPTIONAL, 3952 IN PDRIVER_OBJECT DriverObject, 3953 IN PCM_RESOURCE_LIST DriverList OPTIONAL, 3954 IN ULONG DriverListSize OPTIONAL, 3955 IN PDEVICE_OBJECT DeviceObject, 3956 IN PCM_RESOURCE_LIST DeviceList OPTIONAL, 3957 IN ULONG DeviceListSize OPTIONAL, 3958 IN BOOLEAN OverrideConflict, 3959 OUT PBOOLEAN ConflictDetected); 3960 3961 NTKERNELAPI 3962 VOID 3963 NTAPI 3964 IoSetHardErrorOrVerifyDevice( 3965 IN PIRP Irp, 3966 IN PDEVICE_OBJECT DeviceObject); 3967 3968 NTKERNELAPI 3969 NTSTATUS 3970 NTAPI 3971 IoAssignResources( 3972 IN PUNICODE_STRING RegistryPath, 3973 IN PUNICODE_STRING DriverClassName OPTIONAL, 3974 IN PDRIVER_OBJECT DriverObject, 3975 IN PDEVICE_OBJECT DeviceObject OPTIONAL, 3976 IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources OPTIONAL, 3977 IN OUT PCM_RESOURCE_LIST *AllocatedResources); 3978 3979 NTKERNELAPI 3980 BOOLEAN 3981 NTAPI 3982 IoSetThreadHardErrorMode( 3983 IN BOOLEAN EnableHardErrors); 3984 3985 3986 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 3987 3988 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3) 3989 3990 NTKERNELAPI 3991 BOOLEAN 3992 NTAPI 3993 IoIsFileOriginRemote( 3994 IN PFILE_OBJECT FileObject); 3995 3996 NTKERNELAPI 3997 NTSTATUS 3998 NTAPI 3999 IoSetFileOrigin( 4000 IN PFILE_OBJECT FileObject, 4001 IN BOOLEAN Remote); 4002 4003 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP3) */ 4004 4005 #if (NTDDI_VERSION >= NTDDI_WINXP) 4006 4007 NTKERNELAPI 4008 NTSTATUS 4009 FASTCALL 4010 IoReadPartitionTable( 4011 IN PDEVICE_OBJECT DeviceObject, 4012 IN ULONG SectorSize, 4013 IN BOOLEAN ReturnRecognizedPartitions, 4014 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer); 4015 4016 NTKERNELAPI 4017 NTSTATUS 4018 FASTCALL 4019 IoSetPartitionInformation( 4020 IN PDEVICE_OBJECT DeviceObject, 4021 IN ULONG SectorSize, 4022 IN ULONG PartitionNumber, 4023 IN ULONG PartitionType); 4024 4025 NTKERNELAPI 4026 NTSTATUS 4027 FASTCALL 4028 IoWritePartitionTable( 4029 IN PDEVICE_OBJECT DeviceObject, 4030 IN ULONG SectorSize, 4031 IN ULONG SectorsPerTrack, 4032 IN ULONG NumberOfHeads, 4033 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer); 4034 4035 NTKERNELAPI 4036 NTSTATUS 4037 NTAPI 4038 IoCreateDisk( 4039 IN PDEVICE_OBJECT DeviceObject, 4040 IN struct _CREATE_DISK* Disk OPTIONAL); 4041 4042 NTKERNELAPI 4043 NTSTATUS 4044 NTAPI 4045 IoReadDiskSignature( 4046 IN PDEVICE_OBJECT DeviceObject, 4047 IN ULONG BytesPerSector, 4048 OUT PDISK_SIGNATURE Signature); 4049 4050 NTKERNELAPI 4051 NTSTATUS 4052 NTAPI 4053 IoReadPartitionTableEx( 4054 IN PDEVICE_OBJECT DeviceObject, 4055 OUT struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer); 4056 4057 NTKERNELAPI 4058 NTSTATUS 4059 NTAPI 4060 IoSetPartitionInformationEx( 4061 IN PDEVICE_OBJECT DeviceObject, 4062 IN ULONG PartitionNumber, 4063 IN struct _SET_PARTITION_INFORMATION_EX *PartitionInfo); 4064 4065 NTKERNELAPI 4066 NTSTATUS 4067 NTAPI 4068 IoSetSystemPartition( 4069 IN PUNICODE_STRING VolumeNameString); 4070 4071 NTKERNELAPI 4072 NTSTATUS 4073 NTAPI 4074 IoVerifyPartitionTable( 4075 IN PDEVICE_OBJECT DeviceObject, 4076 IN BOOLEAN FixErrors); 4077 4078 NTKERNELAPI 4079 NTSTATUS 4080 NTAPI 4081 IoVolumeDeviceToDosName( 4082 IN PVOID VolumeDeviceObject, 4083 OUT PUNICODE_STRING DosName); 4084 4085 NTKERNELAPI 4086 NTSTATUS 4087 NTAPI 4088 IoWritePartitionTableEx( 4089 IN PDEVICE_OBJECT DeviceObject, 4090 IN struct _DRIVE_LAYOUT_INFORMATION_EX *DriveLayout); 4091 4092 NTKERNELAPI 4093 NTSTATUS 4094 NTAPI 4095 IoCreateFileSpecifyDeviceObjectHint( 4096 OUT PHANDLE FileHandle, 4097 IN ACCESS_MASK DesiredAccess, 4098 IN POBJECT_ATTRIBUTES ObjectAttributes, 4099 OUT PIO_STATUS_BLOCK IoStatusBlock, 4100 IN PLARGE_INTEGER AllocationSize OPTIONAL, 4101 IN ULONG FileAttributes, 4102 IN ULONG ShareAccess, 4103 IN ULONG Disposition, 4104 IN ULONG CreateOptions, 4105 IN PVOID EaBuffer OPTIONAL, 4106 IN ULONG EaLength, 4107 IN CREATE_FILE_TYPE CreateFileType, 4108 IN PVOID InternalParameters OPTIONAL, 4109 IN ULONG Options, 4110 IN PVOID DeviceObject OPTIONAL); 4111 4112 NTKERNELAPI 4113 NTSTATUS 4114 NTAPI 4115 IoAttachDeviceToDeviceStackSafe( 4116 IN PDEVICE_OBJECT SourceDevice, 4117 IN PDEVICE_OBJECT TargetDevice, 4118 OUT PDEVICE_OBJECT *AttachedToDeviceObject); 4119 4120 4121 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 4122 4123 #if (NTDDI_VERSION >= NTDDI_WS03) 4124 NTKERNELAPI 4125 IO_PAGING_PRIORITY 4126 FASTCALL 4127 IoGetPagingIoPriority( 4128 IN PIRP Irp); 4129 4130 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 4131 #if (NTDDI_VERSION >= NTDDI_WS03SP1) 4132 4133 BOOLEAN 4134 NTAPI 4135 IoTranslateBusAddress( 4136 IN INTERFACE_TYPE InterfaceType, 4137 IN ULONG BusNumber, 4138 IN PHYSICAL_ADDRESS BusAddress, 4139 IN OUT PULONG AddressSpace, 4140 OUT PPHYSICAL_ADDRESS TranslatedAddress); 4141 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */ 4142 4143 #if (NTDDI_VERSION >= NTDDI_VISTA) 4144 NTKERNELAPI 4145 NTSTATUS 4146 NTAPI 4147 IoUpdateDiskGeometry( 4148 IN PDEVICE_OBJECT DeviceObject, 4149 IN struct _DISK_GEOMETRY_EX* OldDiskGeometry, 4150 IN struct _DISK_GEOMETRY_EX* NewDiskGeometry); 4151 4152 PTXN_PARAMETER_BLOCK 4153 NTAPI 4154 IoGetTransactionParameterBlock( 4155 IN PFILE_OBJECT FileObject); 4156 4157 NTKERNELAPI 4158 NTSTATUS 4159 NTAPI 4160 IoCreateFileEx( 4161 OUT PHANDLE FileHandle, 4162 IN ACCESS_MASK DesiredAccess, 4163 IN POBJECT_ATTRIBUTES ObjectAttributes, 4164 OUT PIO_STATUS_BLOCK IoStatusBlock, 4165 IN PLARGE_INTEGER AllocationSize OPTIONAL, 4166 IN ULONG FileAttributes, 4167 IN ULONG ShareAccess, 4168 IN ULONG Disposition, 4169 IN ULONG CreateOptions, 4170 IN PVOID EaBuffer OPTIONAL, 4171 IN ULONG EaLength, 4172 IN CREATE_FILE_TYPE CreateFileType, 4173 IN PVOID InternalParameters OPTIONAL, 4174 IN ULONG Options, 4175 IN PIO_DRIVER_CREATE_CONTEXT DriverContext OPTIONAL); 4176 4177 NTSTATUS 4178 NTAPI 4179 IoSetIrpExtraCreateParameter( 4180 IN OUT PIRP Irp, 4181 IN struct _ECP_LIST *ExtraCreateParameter); 4182 4183 VOID 4184 NTAPI 4185 IoClearIrpExtraCreateParameter( 4186 IN OUT PIRP Irp); 4187 4188 NTSTATUS 4189 NTAPI 4190 IoGetIrpExtraCreateParameter( 4191 IN PIRP Irp, 4192 OUT struct _ECP_LIST **ExtraCreateParameter OPTIONAL); 4193 4194 BOOLEAN 4195 NTAPI 4196 IoIsFileObjectIgnoringSharing( 4197 IN PFILE_OBJECT FileObject); 4198 4199 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 4200 4201 #if (NTDDI_VERSION >= NTDDI_WIN7) 4202 4203 NTSTATUS 4204 NTAPI 4205 IoSetFileObjectIgnoreSharing( 4206 IN PFILE_OBJECT FileObject); 4207 4208 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 4209 4210 /****************************************************************************** 4211 * Kernel Debugger Functions * 4212 ******************************************************************************/ 4213 NTSYSAPI 4214 ULONG 4215 NTAPI 4216 DbgPrompt( 4217 IN PCCH Prompt, 4218 OUT PCH Response, 4219 IN ULONG MaximumResponseLength); 4220 4221 /****************************************************************************** 4222 * Kernel Functions * 4223 ******************************************************************************/ 4224 4225 NTKERNELAPI 4226 VOID 4227 FASTCALL 4228 KeInvalidateRangeAllCaches( 4229 IN PVOID BaseAddress, 4230 IN ULONG Length); 4231 4232 #if (NTDDI_VERSION >= NTDDI_WIN2K) 4233 4234 NTKERNELAPI 4235 VOID 4236 NTAPI 4237 KeSetImportanceDpc( 4238 IN OUT PRKDPC Dpc, 4239 IN KDPC_IMPORTANCE Importance); 4240 4241 NTKERNELAPI 4242 LONG 4243 NTAPI 4244 KePulseEvent( 4245 IN OUT PRKEVENT Event, 4246 IN KPRIORITY Increment, 4247 IN BOOLEAN Wait); 4248 4249 NTKERNELAPI 4250 LONG 4251 NTAPI 4252 KeSetBasePriorityThread( 4253 IN OUT PRKTHREAD Thread, 4254 IN LONG Increment); 4255 4256 NTKERNELAPI 4257 VOID 4258 NTAPI 4259 KeEnterCriticalRegion(VOID); 4260 4261 NTKERNELAPI 4262 VOID 4263 NTAPI 4264 KeLeaveCriticalRegion(VOID); 4265 4266 NTKERNELAPI 4267 DECLSPEC_NORETURN 4268 VOID 4269 NTAPI 4270 KeBugCheck( 4271 IN ULONG BugCheckCode); 4272 #if defined(SINGLE_GROUP_LEGACY_API) 4273 4274 4275 NTKERNELAPI 4276 VOID 4277 NTAPI 4278 KeSetTargetProcessorDpc( 4279 IN OUT PRKDPC Dpc, 4280 IN CCHAR Number); 4281 4282 NTKERNELAPI 4283 KAFFINITY 4284 NTAPI 4285 KeQueryActiveProcessors(VOID); 4286 #endif /* defined(SINGLE_GROUP_LEGACY_API) */ 4287 4288 4289 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 4290 4291 #if (NTDDI_VERSION >= NTDDI_WINXP) 4292 4293 NTKERNELAPI 4294 BOOLEAN 4295 NTAPI 4296 KeAreApcsDisabled(VOID); 4297 4298 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 4299 4300 #if (NTDDI_VERSION >= NTDDI_WS03) 4301 4302 4303 NTKERNELAPI 4304 BOOLEAN 4305 NTAPI 4306 KeInvalidateAllCaches(VOID); 4307 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 4308 #if (NTDDI_VERSION >= NTDDI_WS03SP1) 4309 4310 NTKERNELAPI 4311 NTSTATUS 4312 NTAPI 4313 KeExpandKernelStackAndCallout( 4314 IN PEXPAND_STACK_CALLOUT Callout, 4315 IN PVOID Parameter OPTIONAL, 4316 IN SIZE_T Size); 4317 4318 NTKERNELAPI 4319 VOID 4320 NTAPI 4321 KeEnterGuardedRegion(VOID); 4322 4323 NTKERNELAPI 4324 VOID 4325 NTAPI 4326 KeLeaveGuardedRegion(VOID); 4327 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */ 4328 4329 #if (NTDDI_VERSION >= NTDDI_VISTA) 4330 #if defined(SINGLE_GROUP_LEGACY_API) 4331 4332 NTKERNELAPI 4333 ULONG 4334 NTAPI 4335 KeQueryActiveProcessorCount( 4336 OUT PKAFFINITY ActiveProcessors OPTIONAL); 4337 4338 NTKERNELAPI 4339 ULONG 4340 NTAPI 4341 KeQueryMaximumProcessorCount(VOID); 4342 #endif /* SINGLE_GROUP_LEGACY_API */ 4343 4344 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 4345 4346 #if (NTDDI_VERSION >= NTDDI_WIN7) 4347 4348 NTKERNELAPI 4349 ULONG 4350 NTAPI 4351 KeQueryActiveProcessorCountEx( 4352 IN USHORT GroupNumber); 4353 4354 NTKERNELAPI 4355 ULONG 4356 NTAPI 4357 KeQueryMaximumProcessorCountEx( 4358 IN USHORT GroupNumber); 4359 4360 NTKERNELAPI 4361 USHORT 4362 NTAPI 4363 KeQueryActiveGroupCount(VOID); 4364 4365 NTKERNELAPI 4366 USHORT 4367 NTAPI 4368 KeQueryMaximumGroupCount(VOID); 4369 4370 NTKERNELAPI 4371 KAFFINITY 4372 NTAPI 4373 KeQueryGroupAffinity( 4374 IN USHORT GroupNumber); 4375 4376 NTKERNELAPI 4377 ULONG 4378 NTAPI 4379 KeGetCurrentProcessorNumberEx( 4380 OUT PPROCESSOR_NUMBER ProcNumber OPTIONAL); 4381 4382 NTKERNELAPI 4383 VOID 4384 NTAPI 4385 KeQueryNodeActiveAffinity( 4386 IN USHORT NodeNumber, 4387 OUT PGROUP_AFFINITY Affinity OPTIONAL, 4388 OUT PUSHORT Count OPTIONAL); 4389 4390 NTKERNELAPI 4391 USHORT 4392 NTAPI 4393 KeQueryNodeMaximumProcessorCount( 4394 IN USHORT NodeNumber); 4395 4396 NTKERNELAPI 4397 USHORT 4398 NTAPI 4399 KeQueryHighestNodeNumber(VOID); 4400 4401 NTKERNELAPI 4402 USHORT 4403 NTAPI 4404 KeGetCurrentNodeNumber(VOID); 4405 4406 NTKERNELAPI 4407 NTSTATUS 4408 NTAPI 4409 KeQueryLogicalProcessorRelationship( 4410 IN PPROCESSOR_NUMBER ProcessorNumber OPTIONAL, 4411 IN LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, 4412 OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information OPTIONAL, 4413 IN OUT PULONG Length); 4414 4415 NTKERNELAPI 4416 NTSTATUS 4417 NTAPI 4418 KeSetHardwareCounterConfiguration( 4419 IN PHARDWARE_COUNTER CounterArray, 4420 IN ULONG Count); 4421 4422 NTKERNELAPI 4423 NTSTATUS 4424 NTAPI 4425 KeQueryHardwareCounterConfiguration( 4426 OUT PHARDWARE_COUNTER CounterArray, 4427 IN ULONG MaximumCount, 4428 OUT PULONG Count); 4429 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 4430 4431 /****************************************************************************** 4432 * Memory manager Functions * 4433 ******************************************************************************/ 4434 4435 #if (NTDDI_VERSION >= NTDDI_WIN2K) 4436 4437 NTKERNELAPI 4438 PPHYSICAL_MEMORY_RANGE 4439 NTAPI 4440 MmGetPhysicalMemoryRanges(VOID); 4441 4442 NTKERNELAPI 4443 PHYSICAL_ADDRESS 4444 NTAPI 4445 MmGetPhysicalAddress( 4446 IN PVOID BaseAddress); 4447 4448 NTKERNELAPI 4449 BOOLEAN 4450 NTAPI 4451 MmIsNonPagedSystemAddressValid( 4452 IN PVOID VirtualAddress); 4453 4454 NTKERNELAPI 4455 PVOID 4456 NTAPI 4457 MmAllocateNonCachedMemory( 4458 IN SIZE_T NumberOfBytes); 4459 4460 NTKERNELAPI 4461 VOID 4462 NTAPI 4463 MmFreeNonCachedMemory( 4464 IN PVOID BaseAddress, 4465 IN SIZE_T NumberOfBytes); 4466 4467 NTKERNELAPI 4468 PVOID 4469 NTAPI 4470 MmGetVirtualForPhysical( 4471 IN PHYSICAL_ADDRESS PhysicalAddress); 4472 4473 NTKERNELAPI 4474 NTSTATUS 4475 NTAPI 4476 MmMapUserAddressesToPage( 4477 IN PVOID BaseAddress, 4478 IN SIZE_T NumberOfBytes, 4479 IN PVOID PageAddress); 4480 4481 NTKERNELAPI 4482 PVOID 4483 NTAPI 4484 MmMapVideoDisplay( 4485 IN PHYSICAL_ADDRESS PhysicalAddress, 4486 IN SIZE_T NumberOfBytes, 4487 IN MEMORY_CACHING_TYPE CacheType); 4488 4489 NTKERNELAPI 4490 NTSTATUS 4491 NTAPI 4492 MmMapViewInSessionSpace( 4493 IN PVOID Section, 4494 OUT PVOID *MappedBase, 4495 IN OUT PSIZE_T ViewSize); 4496 4497 NTKERNELAPI 4498 NTSTATUS 4499 NTAPI 4500 MmMapViewInSystemSpace( 4501 IN PVOID Section, 4502 OUT PVOID *MappedBase, 4503 IN OUT PSIZE_T ViewSize); 4504 4505 NTKERNELAPI 4506 BOOLEAN 4507 NTAPI 4508 MmIsAddressValid( 4509 IN PVOID VirtualAddress); 4510 4511 NTKERNELAPI 4512 BOOLEAN 4513 NTAPI 4514 MmIsThisAnNtAsSystem(VOID); 4515 4516 NTKERNELAPI 4517 VOID 4518 NTAPI 4519 MmLockPagableSectionByHandle( 4520 IN PVOID ImageSectionHandle); 4521 4522 NTKERNELAPI 4523 NTSTATUS 4524 NTAPI 4525 MmUnmapViewInSessionSpace( 4526 IN PVOID MappedBase); 4527 4528 NTKERNELAPI 4529 NTSTATUS 4530 NTAPI 4531 MmUnmapViewInSystemSpace( 4532 IN PVOID MappedBase); 4533 4534 NTKERNELAPI 4535 VOID 4536 NTAPI 4537 MmUnsecureVirtualMemory( 4538 IN HANDLE SecureHandle); 4539 4540 NTKERNELAPI 4541 NTSTATUS 4542 NTAPI 4543 MmRemovePhysicalMemory( 4544 IN PPHYSICAL_ADDRESS StartAddress, 4545 IN OUT PLARGE_INTEGER NumberOfBytes); 4546 4547 NTKERNELAPI 4548 HANDLE 4549 NTAPI 4550 MmSecureVirtualMemory( 4551 IN PVOID Address, 4552 IN SIZE_T Size, 4553 IN ULONG ProbeMode); 4554 4555 NTKERNELAPI 4556 VOID 4557 NTAPI 4558 MmUnmapVideoDisplay( 4559 IN PVOID BaseAddress, 4560 IN SIZE_T NumberOfBytes); 4561 4562 NTKERNELAPI 4563 NTSTATUS 4564 NTAPI 4565 MmAddPhysicalMemory( 4566 IN PPHYSICAL_ADDRESS StartAddress, 4567 IN OUT PLARGE_INTEGER NumberOfBytes); 4568 4569 NTKERNELAPI 4570 PVOID 4571 NTAPI 4572 MmAllocateContiguousMemory( 4573 IN SIZE_T NumberOfBytes, 4574 IN PHYSICAL_ADDRESS HighestAcceptableAddress); 4575 4576 NTKERNELAPI 4577 PVOID 4578 NTAPI 4579 MmAllocateContiguousMemorySpecifyCache( 4580 IN SIZE_T NumberOfBytes, 4581 IN PHYSICAL_ADDRESS LowestAcceptableAddress, 4582 IN PHYSICAL_ADDRESS HighestAcceptableAddress, 4583 IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, 4584 IN MEMORY_CACHING_TYPE CacheType); 4585 4586 NTKERNELAPI 4587 PVOID 4588 NTAPI 4589 MmAllocateContiguousMemorySpecifyCacheNode( 4590 IN SIZE_T NumberOfBytes, 4591 IN PHYSICAL_ADDRESS LowestAcceptableAddress, 4592 IN PHYSICAL_ADDRESS HighestAcceptableAddress, 4593 IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, 4594 IN MEMORY_CACHING_TYPE CacheType, 4595 IN NODE_REQUIREMENT PreferredNode); 4596 4597 NTKERNELAPI 4598 VOID 4599 NTAPI 4600 MmFreeContiguousMemory( 4601 IN PVOID BaseAddress); 4602 4603 NTKERNELAPI 4604 VOID 4605 NTAPI 4606 MmFreeContiguousMemorySpecifyCache( 4607 IN PVOID BaseAddress, 4608 IN SIZE_T NumberOfBytes, 4609 IN MEMORY_CACHING_TYPE CacheType); 4610 4611 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 4612 4613 4614 4615 #if (NTDDI_VERSION >= NTDDI_WS03) 4616 4617 NTKERNELAPI 4618 NTSTATUS 4619 NTAPI 4620 MmCreateMirror(VOID); 4621 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 4622 4623 #if (NTDDI_VERSION >= NTDDI_VISTA) 4624 NTSTATUS 4625 NTAPI 4626 MmRotatePhysicalView( 4627 IN PVOID VirtualAddress, 4628 IN OUT PSIZE_T NumberOfBytes, 4629 IN PMDLX NewMdl OPTIONAL, 4630 IN MM_ROTATE_DIRECTION Direction, 4631 IN PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction, 4632 IN PVOID Context OPTIONAL); 4633 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 4634 4635 /****************************************************************************** 4636 * Process Manager Functions * 4637 ******************************************************************************/ 4638 4639 NTSYSCALLAPI 4640 NTSTATUS 4641 NTAPI 4642 NtOpenProcess( 4643 OUT PHANDLE ProcessHandle, 4644 IN ACCESS_MASK DesiredAccess, 4645 IN POBJECT_ATTRIBUTES ObjectAttributes, 4646 IN PCLIENT_ID ClientId OPTIONAL); 4647 4648 NTSYSCALLAPI 4649 NTSTATUS 4650 NTAPI 4651 NtQueryInformationProcess( 4652 IN HANDLE ProcessHandle, 4653 IN PROCESSINFOCLASS ProcessInformationClass, 4654 OUT PVOID ProcessInformation OPTIONAL, 4655 IN ULONG ProcessInformationLength, 4656 OUT PULONG ReturnLength OPTIONAL); 4657 4658 #if (NTDDI_VERSION >= NTDDI_WIN2K) 4659 4660 4661 NTKERNELAPI 4662 NTSTATUS 4663 NTAPI 4664 PsSetCreateProcessNotifyRoutine( 4665 IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, 4666 IN BOOLEAN Remove); 4667 4668 NTKERNELAPI 4669 NTSTATUS 4670 NTAPI 4671 PsSetCreateThreadNotifyRoutine( 4672 IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine); 4673 4674 NTKERNELAPI 4675 NTSTATUS 4676 NTAPI 4677 PsSetLoadImageNotifyRoutine( 4678 IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine); 4679 4680 NTKERNELAPI 4681 HANDLE 4682 NTAPI 4683 PsGetCurrentProcessId(VOID); 4684 4685 NTKERNELAPI 4686 HANDLE 4687 NTAPI 4688 PsGetCurrentThreadId(VOID); 4689 4690 NTKERNELAPI 4691 BOOLEAN 4692 NTAPI 4693 PsGetVersion( 4694 OUT PULONG MajorVersion OPTIONAL, 4695 OUT PULONG MinorVersion OPTIONAL, 4696 OUT PULONG BuildNumber OPTIONAL, 4697 OUT PUNICODE_STRING CSDVersion OPTIONAL); 4698 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 4699 #if (NTDDI_VERSION >= NTDDI_WINXP) 4700 4701 NTKERNELAPI 4702 HANDLE 4703 NTAPI 4704 PsGetProcessId( 4705 IN PEPROCESS Process); 4706 4707 NTKERNELAPI 4708 HANDLE 4709 NTAPI 4710 PsGetThreadId( 4711 IN PETHREAD Thread); 4712 4713 NTKERNELAPI 4714 NTSTATUS 4715 NTAPI 4716 PsRemoveCreateThreadNotifyRoutine( 4717 IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine); 4718 4719 NTKERNELAPI 4720 NTSTATUS 4721 NTAPI 4722 PsRemoveLoadImageNotifyRoutine( 4723 IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine); 4724 4725 NTKERNELAPI 4726 LONGLONG 4727 NTAPI 4728 PsGetProcessCreateTimeQuadPart( 4729 IN PEPROCESS Process); 4730 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 4731 4732 #if (NTDDI_VERSION >= NTDDI_WS03) 4733 NTKERNELAPI 4734 HANDLE 4735 NTAPI 4736 PsGetThreadProcessId( 4737 IN PETHREAD Thread); 4738 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 4739 4740 #if (NTDDI_VERSION >= NTDDI_VISTA) 4741 4742 NTKERNELAPI 4743 BOOLEAN 4744 NTAPI 4745 PsSetCurrentThreadPrefetching( 4746 IN BOOLEAN Prefetching); 4747 4748 NTKERNELAPI 4749 BOOLEAN 4750 NTAPI 4751 PsIsCurrentThreadPrefetching(VOID); 4752 4753 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 4754 4755 #if (NTDDI_VERSION >= NTDDI_VISTASP1) 4756 NTKERNELAPI 4757 NTSTATUS 4758 NTAPI 4759 PsSetCreateProcessNotifyRoutineEx( 4760 IN PCREATE_PROCESS_NOTIFY_ROUTINE_EX NotifyRoutine, 4761 IN BOOLEAN Remove); 4762 #endif /* (NTDDI_VERSION >= NTDDI_VISTASP1) */ 4763 4764 4765 /****************************************************************************** 4766 * Runtime Library Functions * 4767 ******************************************************************************/ 4768 4769 4770 #if (NTDDI_VERSION >= NTDDI_WIN2K) 4771 4772 4773 #ifndef RTL_USE_AVL_TABLES 4774 4775 NTSYSAPI 4776 VOID 4777 NTAPI 4778 RtlInitializeGenericTable( 4779 OUT PRTL_GENERIC_TABLE Table, 4780 IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, 4781 IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, 4782 IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine, 4783 IN PVOID TableContext OPTIONAL); 4784 4785 NTSYSAPI 4786 PVOID 4787 NTAPI 4788 RtlInsertElementGenericTable( 4789 IN PRTL_GENERIC_TABLE Table, 4790 IN PVOID Buffer, 4791 IN CLONG BufferSize, 4792 OUT PBOOLEAN NewElement OPTIONAL); 4793 4794 NTSYSAPI 4795 PVOID 4796 NTAPI 4797 RtlInsertElementGenericTableFull( 4798 IN PRTL_GENERIC_TABLE Table, 4799 IN PVOID Buffer, 4800 IN CLONG BufferSize, 4801 OUT PBOOLEAN NewElement OPTIONAL, 4802 IN PVOID NodeOrParent, 4803 IN TABLE_SEARCH_RESULT SearchResult); 4804 4805 NTSYSAPI 4806 BOOLEAN 4807 NTAPI 4808 RtlDeleteElementGenericTable( 4809 IN PRTL_GENERIC_TABLE Table, 4810 IN PVOID Buffer); 4811 4812 NTSYSAPI 4813 PVOID 4814 NTAPI 4815 RtlLookupElementGenericTable( 4816 IN PRTL_GENERIC_TABLE Table, 4817 IN PVOID Buffer); 4818 4819 NTSYSAPI 4820 PVOID 4821 NTAPI 4822 RtlLookupElementGenericTableFull( 4823 IN PRTL_GENERIC_TABLE Table, 4824 IN PVOID Buffer, 4825 OUT PVOID *NodeOrParent, 4826 OUT TABLE_SEARCH_RESULT *SearchResult); 4827 4828 NTSYSAPI 4829 PVOID 4830 NTAPI 4831 RtlEnumerateGenericTable( 4832 IN PRTL_GENERIC_TABLE Table, 4833 IN BOOLEAN Restart); 4834 4835 NTSYSAPI 4836 PVOID 4837 NTAPI 4838 RtlEnumerateGenericTableWithoutSplaying( 4839 IN PRTL_GENERIC_TABLE Table, 4840 IN OUT PVOID *RestartKey); 4841 4842 NTSYSAPI 4843 PVOID 4844 NTAPI 4845 RtlGetElementGenericTable( 4846 IN PRTL_GENERIC_TABLE Table, 4847 IN ULONG I); 4848 4849 NTSYSAPI 4850 ULONG 4851 NTAPI 4852 RtlNumberGenericTableElements( 4853 IN PRTL_GENERIC_TABLE Table); 4854 4855 NTSYSAPI 4856 BOOLEAN 4857 NTAPI 4858 RtlIsGenericTableEmpty( 4859 IN PRTL_GENERIC_TABLE Table); 4860 4861 #endif /* !RTL_USE_AVL_TABLES */ 4862 4863 #define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8 4864 4865 NTSYSAPI 4866 PRTL_SPLAY_LINKS 4867 NTAPI 4868 RtlSplay( 4869 IN OUT PRTL_SPLAY_LINKS Links); 4870 4871 NTSYSAPI 4872 PRTL_SPLAY_LINKS 4873 NTAPI 4874 RtlDelete( 4875 IN PRTL_SPLAY_LINKS Links); 4876 4877 NTSYSAPI 4878 VOID 4879 NTAPI 4880 RtlDeleteNoSplay( 4881 IN PRTL_SPLAY_LINKS Links, 4882 IN OUT PRTL_SPLAY_LINKS *Root); 4883 4884 NTSYSAPI 4885 PRTL_SPLAY_LINKS 4886 NTAPI 4887 RtlSubtreeSuccessor( 4888 IN PRTL_SPLAY_LINKS Links); 4889 4890 NTSYSAPI 4891 PRTL_SPLAY_LINKS 4892 NTAPI 4893 RtlSubtreePredecessor( 4894 IN PRTL_SPLAY_LINKS Links); 4895 4896 NTSYSAPI 4897 PRTL_SPLAY_LINKS 4898 NTAPI 4899 RtlRealSuccessor( 4900 IN PRTL_SPLAY_LINKS Links); 4901 4902 NTSYSAPI 4903 PRTL_SPLAY_LINKS 4904 NTAPI 4905 RtlRealPredecessor( 4906 IN PRTL_SPLAY_LINKS Links); 4907 4908 NTSYSAPI 4909 BOOLEAN 4910 NTAPI 4911 RtlPrefixUnicodeString( 4912 IN PCUNICODE_STRING String1, 4913 IN PCUNICODE_STRING String2, 4914 IN BOOLEAN CaseInSensitive); 4915 4916 NTSYSAPI 4917 VOID 4918 NTAPI 4919 RtlUpperString( 4920 IN OUT PSTRING DestinationString, 4921 IN const PSTRING SourceString); 4922 4923 NTSYSAPI 4924 NTSTATUS 4925 NTAPI 4926 RtlUpcaseUnicodeString( 4927 IN OUT PUNICODE_STRING DestinationString, 4928 IN PCUNICODE_STRING SourceString, 4929 IN BOOLEAN AllocateDestinationString); 4930 4931 NTSYSAPI 4932 VOID 4933 NTAPI 4934 RtlMapGenericMask( 4935 IN OUT PACCESS_MASK AccessMask, 4936 IN PGENERIC_MAPPING GenericMapping); 4937 4938 NTSYSAPI 4939 NTSTATUS 4940 NTAPI 4941 RtlVolumeDeviceToDosName( 4942 IN PVOID VolumeDeviceObject, 4943 OUT PUNICODE_STRING DosName); 4944 4945 NTSYSAPI 4946 NTSTATUS 4947 NTAPI 4948 RtlGetVersion( 4949 IN OUT PRTL_OSVERSIONINFOW lpVersionInformation); 4950 4951 NTSYSAPI 4952 NTSTATUS 4953 NTAPI 4954 RtlVerifyVersionInfo( 4955 IN PRTL_OSVERSIONINFOEXW VersionInfo, 4956 IN ULONG TypeMask, 4957 IN ULONGLONG ConditionMask); 4958 4959 NTSYSAPI 4960 LONG 4961 NTAPI 4962 RtlCompareString( 4963 IN const PSTRING String1, 4964 IN const PSTRING String2, 4965 IN BOOLEAN CaseInSensitive); 4966 4967 NTSYSAPI 4968 VOID 4969 NTAPI 4970 RtlCopyString( 4971 OUT PSTRING DestinationString, 4972 IN const PSTRING SourceString OPTIONAL); 4973 4974 NTSYSAPI 4975 BOOLEAN 4976 NTAPI 4977 RtlEqualString( 4978 IN const PSTRING String1, 4979 IN const PSTRING String2, 4980 IN BOOLEAN CaseInSensitive); 4981 4982 NTSYSAPI 4983 NTSTATUS 4984 NTAPI 4985 RtlCharToInteger( 4986 IN PCSZ String, 4987 IN ULONG Base OPTIONAL, 4988 OUT PULONG Value); 4989 4990 NTSYSAPI 4991 CHAR 4992 NTAPI 4993 RtlUpperChar( 4994 IN CHAR Character); 4995 4996 NTSYSAPI 4997 ULONG 4998 NTAPI 4999 RtlWalkFrameChain( 5000 OUT PVOID *Callers, 5001 IN ULONG Count, 5002 IN ULONG Flags); 5003 5004 5005 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 5006 5007 5008 #if (NTDDI_VERSION >= NTDDI_WINXP) 5009 5010 5011 5012 NTSYSAPI 5013 VOID 5014 NTAPI 5015 RtlInitializeGenericTableAvl( 5016 OUT PRTL_AVL_TABLE Table, 5017 IN PRTL_AVL_COMPARE_ROUTINE CompareRoutine, 5018 IN PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine, 5019 IN PRTL_AVL_FREE_ROUTINE FreeRoutine, 5020 IN PVOID TableContext OPTIONAL); 5021 5022 NTSYSAPI 5023 PVOID 5024 NTAPI 5025 RtlInsertElementGenericTableAvl( 5026 IN PRTL_AVL_TABLE Table, 5027 IN PVOID Buffer, 5028 IN CLONG BufferSize, 5029 OUT PBOOLEAN NewElement OPTIONAL); 5030 5031 NTSYSAPI 5032 PVOID 5033 NTAPI 5034 RtlInsertElementGenericTableFullAvl( 5035 IN PRTL_AVL_TABLE Table, 5036 IN PVOID Buffer, 5037 IN CLONG BufferSize, 5038 OUT PBOOLEAN NewElement OPTIONAL, 5039 IN PVOID NodeOrParent, 5040 IN TABLE_SEARCH_RESULT SearchResult); 5041 5042 NTSYSAPI 5043 BOOLEAN 5044 NTAPI 5045 RtlDeleteElementGenericTableAvl( 5046 IN PRTL_AVL_TABLE Table, 5047 IN PVOID Buffer); 5048 5049 NTSYSAPI 5050 PVOID 5051 NTAPI 5052 RtlLookupElementGenericTableAvl( 5053 IN PRTL_AVL_TABLE Table, 5054 IN PVOID Buffer); 5055 5056 NTSYSAPI 5057 PVOID 5058 NTAPI 5059 RtlLookupElementGenericTableFullAvl( 5060 IN PRTL_AVL_TABLE Table, 5061 IN PVOID Buffer, 5062 OUT PVOID *NodeOrParent, 5063 OUT TABLE_SEARCH_RESULT *SearchResult); 5064 5065 NTSYSAPI 5066 PVOID 5067 NTAPI 5068 RtlEnumerateGenericTableAvl( 5069 IN PRTL_AVL_TABLE Table, 5070 IN BOOLEAN Restart); 5071 5072 NTSYSAPI 5073 PVOID 5074 NTAPI 5075 RtlEnumerateGenericTableWithoutSplayingAvl( 5076 IN PRTL_AVL_TABLE Table, 5077 IN OUT PVOID *RestartKey); 5078 5079 NTSYSAPI 5080 PVOID 5081 NTAPI 5082 RtlLookupFirstMatchingElementGenericTableAvl( 5083 IN PRTL_AVL_TABLE Table, 5084 IN PVOID Buffer, 5085 OUT PVOID *RestartKey); 5086 5087 NTSYSAPI 5088 PVOID 5089 NTAPI 5090 RtlEnumerateGenericTableLikeADirectory( 5091 IN PRTL_AVL_TABLE Table, 5092 IN PRTL_AVL_MATCH_FUNCTION MatchFunction OPTIONAL, 5093 IN PVOID MatchData OPTIONAL, 5094 IN ULONG NextFlag, 5095 IN OUT PVOID *RestartKey, 5096 IN OUT PULONG DeleteCount, 5097 IN PVOID Buffer); 5098 5099 NTSYSAPI 5100 PVOID 5101 NTAPI 5102 RtlGetElementGenericTableAvl( 5103 IN PRTL_AVL_TABLE Table, 5104 IN ULONG I); 5105 5106 NTSYSAPI 5107 ULONG 5108 NTAPI 5109 RtlNumberGenericTableElementsAvl( 5110 IN PRTL_AVL_TABLE Table); 5111 5112 NTSYSAPI 5113 BOOLEAN 5114 NTAPI 5115 RtlIsGenericTableEmptyAvl( 5116 IN PRTL_AVL_TABLE Table); 5117 5118 5119 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 5120 5121 5122 #if (NTDDI_VERSION >= NTDDI_VISTA) 5123 5124 5125 NTSYSAPI 5126 VOID 5127 NTAPI 5128 RtlRunOnceInitialize( 5129 OUT PRTL_RUN_ONCE RunOnce); 5130 5131 NTSYSAPI 5132 NTSTATUS 5133 NTAPI 5134 RtlRunOnceExecuteOnce( 5135 IN OUT PRTL_RUN_ONCE RunOnce, 5136 IN PRTL_RUN_ONCE_INIT_FN InitFn, 5137 IN OUT PVOID Parameter OPTIONAL, 5138 OUT PVOID *Context OPTIONAL); 5139 5140 NTSYSAPI 5141 NTSTATUS 5142 NTAPI 5143 RtlRunOnceBeginInitialize( 5144 IN OUT PRTL_RUN_ONCE RunOnce, 5145 IN ULONG Flags, 5146 OUT PVOID *Context OPTIONAL); 5147 5148 NTSYSAPI 5149 NTSTATUS 5150 NTAPI 5151 RtlRunOnceComplete( 5152 IN OUT PRTL_RUN_ONCE RunOnce, 5153 IN ULONG Flags, 5154 IN PVOID Context OPTIONAL); 5155 5156 NTSYSAPI 5157 BOOLEAN 5158 NTAPI 5159 RtlGetProductInfo( 5160 IN ULONG OSMajorVersion, 5161 IN ULONG OSMinorVersion, 5162 IN ULONG SpMajorVersion, 5163 IN ULONG SpMinorVersion, 5164 OUT PULONG ReturnedProductType); 5165 5166 5167 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 5168 5169 #if (NTDDI_VERSION >= NTDDI_WIN7) 5170 5171 5172 NTSYSAPI 5173 BOOLEAN 5174 NTAPI 5175 RtlCreateHashTable( 5176 IN OUT PRTL_DYNAMIC_HASH_TABLE *HashTable OPTIONAL, 5177 IN ULONG Shift, 5178 IN ULONG Flags); 5179 5180 NTSYSAPI 5181 VOID 5182 NTAPI 5183 RtlDeleteHashTable( 5184 IN PRTL_DYNAMIC_HASH_TABLE HashTable); 5185 5186 NTSYSAPI 5187 BOOLEAN 5188 NTAPI 5189 RtlInsertEntryHashTable( 5190 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5191 IN PRTL_DYNAMIC_HASH_TABLE_ENTRY Entry, 5192 IN ULONG_PTR Signature, 5193 IN OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context OPTIONAL); 5194 5195 NTSYSAPI 5196 BOOLEAN 5197 NTAPI 5198 RtlRemoveEntryHashTable( 5199 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5200 IN PRTL_DYNAMIC_HASH_TABLE_ENTRY Entry, 5201 IN OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context OPTIONAL); 5202 5203 NTSYSAPI 5204 PRTL_DYNAMIC_HASH_TABLE_ENTRY 5205 NTAPI 5206 RtlLookupEntryHashTable( 5207 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5208 IN ULONG_PTR Signature, 5209 OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context OPTIONAL); 5210 5211 NTSYSAPI 5212 PRTL_DYNAMIC_HASH_TABLE_ENTRY 5213 NTAPI 5214 RtlGetNextEntryHashTable( 5215 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5216 IN PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context); 5217 5218 NTSYSAPI 5219 BOOLEAN 5220 NTAPI 5221 RtlInitEnumerationHashTable( 5222 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5223 OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5224 5225 NTSYSAPI 5226 PRTL_DYNAMIC_HASH_TABLE_ENTRY 5227 NTAPI 5228 RtlEnumerateEntryHashTable( 5229 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5230 IN OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5231 5232 NTSYSAPI 5233 VOID 5234 NTAPI 5235 RtlEndEnumerationHashTable( 5236 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5237 IN OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5238 5239 NTSYSAPI 5240 BOOLEAN 5241 NTAPI 5242 RtlInitWeakEnumerationHashTable( 5243 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5244 OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5245 5246 NTSYSAPI 5247 PRTL_DYNAMIC_HASH_TABLE_ENTRY 5248 NTAPI 5249 RtlWeaklyEnumerateEntryHashTable( 5250 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5251 IN OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5252 5253 NTSYSAPI 5254 VOID 5255 NTAPI 5256 RtlEndWeakEnumerationHashTable( 5257 IN PRTL_DYNAMIC_HASH_TABLE HashTable, 5258 IN OUT PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator); 5259 5260 NTSYSAPI 5261 BOOLEAN 5262 NTAPI 5263 RtlExpandHashTable( 5264 IN PRTL_DYNAMIC_HASH_TABLE HashTable); 5265 5266 NTSYSAPI 5267 BOOLEAN 5268 NTAPI 5269 RtlContractHashTable( 5270 IN PRTL_DYNAMIC_HASH_TABLE HashTable); 5271 5272 5273 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 5274 5275 5276 #if defined(_AMD64_) || defined(_IA64_) 5277 5278 5279 5280 //DECLSPEC_DEPRECATED_DDK_WINXP 5281 FORCEINLINE 5282 LARGE_INTEGER 5283 NTAPI_INLINE 5284 RtlLargeIntegerDivide( 5285 IN LARGE_INTEGER Dividend, 5286 IN LARGE_INTEGER Divisor, 5287 OUT PLARGE_INTEGER Remainder OPTIONAL) 5288 { 5289 LARGE_INTEGER ret; 5290 ret.QuadPart = Dividend.QuadPart / Divisor.QuadPart; 5291 if (Remainder) 5292 Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; 5293 return ret; 5294 } 5295 5296 #else 5297 5298 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5299 NTSYSAPI 5300 LARGE_INTEGER 5301 NTAPI 5302 RtlLargeIntegerDivide( 5303 IN LARGE_INTEGER Dividend, 5304 IN LARGE_INTEGER Divisor, 5305 OUT PLARGE_INTEGER Remainder OPTIONAL); 5306 #endif 5307 5308 5309 #endif /* defined(_AMD64_) || defined(_IA64_) */ 5310 5311 5312 5313 #ifdef RTL_USE_AVL_TABLES 5314 5315 #define RtlInitializeGenericTable RtlInitializeGenericTableAvl 5316 #define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl 5317 #define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl 5318 #define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl 5319 #define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl 5320 #define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl 5321 #define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl 5322 #define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl 5323 #define RtlGetElementGenericTable RtlGetElementGenericTableAvl 5324 #define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl 5325 #define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl 5326 5327 #endif /* RTL_USE_AVL_TABLES */ 5328 5329 #define RtlInitializeSplayLinks(Links) { \ 5330 PRTL_SPLAY_LINKS _SplayLinks; \ 5331 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \ 5332 _SplayLinks->Parent = _SplayLinks; \ 5333 _SplayLinks->LeftChild = NULL; \ 5334 _SplayLinks->RightChild = NULL; \ 5335 } 5336 5337 #define RtlIsLeftChild(Links) \ 5338 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) 5339 5340 #define RtlIsRightChild(Links) \ 5341 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) 5342 5343 #define RtlRightChild(Links) \ 5344 ((PRTL_SPLAY_LINKS)(Links))->RightChild 5345 5346 #define RtlIsRoot(Links) \ 5347 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links)) 5348 5349 #define RtlLeftChild(Links) \ 5350 ((PRTL_SPLAY_LINKS)(Links))->LeftChild 5351 5352 #define RtlParent(Links) \ 5353 ((PRTL_SPLAY_LINKS)(Links))->Parent 5354 5355 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \ 5356 { \ 5357 PRTL_SPLAY_LINKS _SplayParent; \ 5358 PRTL_SPLAY_LINKS _SplayChild; \ 5359 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \ 5360 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \ 5361 _SplayParent->LeftChild = _SplayChild; \ 5362 _SplayChild->Parent = _SplayParent; \ 5363 } 5364 5365 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \ 5366 { \ 5367 PRTL_SPLAY_LINKS _SplayParent; \ 5368 PRTL_SPLAY_LINKS _SplayChild; \ 5369 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \ 5370 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \ 5371 _SplayParent->RightChild = _SplayChild; \ 5372 _SplayChild->Parent = _SplayParent; \ 5373 } 5374 5375 #if !defined(MIDL_PASS) 5376 5377 FORCEINLINE 5378 LUID 5379 NTAPI_INLINE 5380 RtlConvertLongToLuid( 5381 IN LONG Val) 5382 { 5383 LUID Luid; 5384 LARGE_INTEGER Temp; 5385 5386 Temp.QuadPart = Val; 5387 Luid.LowPart = Temp.u.LowPart; 5388 Luid.HighPart = Temp.u.HighPart; 5389 return Luid; 5390 } 5391 5392 FORCEINLINE 5393 LUID 5394 NTAPI_INLINE 5395 RtlConvertUlongToLuid( 5396 IN ULONG Val) 5397 { 5398 LUID Luid; 5399 5400 Luid.LowPart = Val; 5401 Luid.HighPart = 0; 5402 return Luid; 5403 } 5404 5405 #endif /* !defined(MIDL_PASS) */ 5406 5407 #if (defined(_M_AMD64) || defined(_M_IA64)) && !defined(_REALLY_GET_CALLERS_CALLER_) 5408 #define RtlGetCallersAddress(CallersAddress, CallersCaller) \ 5409 *CallersAddress = (PVOID)_ReturnAddress(); \ 5410 *CallersCaller = NULL; 5411 #else 5412 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5413 NTSYSAPI 5414 VOID 5415 NTAPI 5416 RtlGetCallersAddress( 5417 OUT PVOID *CallersAddress, 5418 OUT PVOID *CallersCaller); 5419 #endif 5420 #endif 5421 5422 #if !defined(MIDL_PASS) && !defined(SORTPP_PASS) 5423 5424 #if (NTDDI_VERSION >= NTDDI_WIN7) 5425 5426 FORCEINLINE 5427 VOID 5428 NTAPI 5429 RtlInitHashTableContext( 5430 IN OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context) 5431 { 5432 Context->ChainHead = NULL; 5433 Context->PrevLinkage = NULL; 5434 } 5435 5436 FORCEINLINE 5437 VOID 5438 NTAPI 5439 RtlInitHashTableContextFromEnumerator( 5440 IN OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context, 5441 IN PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator) 5442 { 5443 Context->ChainHead = Enumerator->ChainHead; 5444 Context->PrevLinkage = Enumerator->HashEntry.Linkage.Blink; 5445 } 5446 5447 FORCEINLINE 5448 VOID 5449 NTAPI 5450 RtlReleaseHashTableContext( 5451 IN OUT PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context) 5452 { 5453 UNREFERENCED_PARAMETER(Context); 5454 return; 5455 } 5456 5457 FORCEINLINE 5458 ULONG 5459 NTAPI 5460 RtlTotalBucketsHashTable( 5461 IN PRTL_DYNAMIC_HASH_TABLE HashTable) 5462 { 5463 return HashTable->TableSize; 5464 } 5465 5466 FORCEINLINE 5467 ULONG 5468 NTAPI 5469 RtlNonEmptyBucketsHashTable( 5470 IN PRTL_DYNAMIC_HASH_TABLE HashTable) 5471 { 5472 return HashTable->NonEmptyBuckets; 5473 } 5474 5475 FORCEINLINE 5476 ULONG 5477 NTAPI 5478 RtlEmptyBucketsHashTable( 5479 IN PRTL_DYNAMIC_HASH_TABLE HashTable) 5480 { 5481 return HashTable->TableSize - HashTable->NonEmptyBuckets; 5482 } 5483 5484 FORCEINLINE 5485 ULONG 5486 NTAPI 5487 RtlTotalEntriesHashTable( 5488 IN PRTL_DYNAMIC_HASH_TABLE HashTable) 5489 { 5490 return HashTable->NumEntries; 5491 } 5492 5493 FORCEINLINE 5494 ULONG 5495 NTAPI 5496 RtlActiveEnumeratorsHashTable( 5497 IN PRTL_DYNAMIC_HASH_TABLE HashTable) 5498 { 5499 return HashTable->NumEnumerators; 5500 } 5501 5502 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 5503 5504 #endif /* !defined(MIDL_PASS) && !defined(SORTPP_PASS) */ 5505 5506 /****************************************************************************** 5507 * Security Manager Functions * 5508 ******************************************************************************/ 5509 5510 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5511 5512 NTKERNELAPI 5513 BOOLEAN 5514 NTAPI 5515 SeSinglePrivilegeCheck( 5516 IN LUID PrivilegeValue, 5517 IN KPROCESSOR_MODE PreviousMode); 5518 5519 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 5520 5521 5522 /****************************************************************************** 5523 * ZwXxx Functions * 5524 ******************************************************************************/ 5525 5526 5527 NTSYSAPI 5528 NTSTATUS 5529 NTAPI 5530 ZwAllocateLocallyUniqueId( 5531 OUT PLUID Luid); 5532 5533 NTSYSAPI 5534 NTSTATUS 5535 NTAPI 5536 ZwTerminateProcess( 5537 IN HANDLE ProcessHandle OPTIONAL, 5538 IN NTSTATUS ExitStatus); 5539 5540 NTSYSAPI 5541 NTSTATUS 5542 NTAPI 5543 ZwOpenProcess( 5544 OUT PHANDLE ProcessHandle, 5545 IN ACCESS_MASK DesiredAccess, 5546 IN POBJECT_ATTRIBUTES ObjectAttributes, 5547 IN PCLIENT_ID ClientId OPTIONAL); 5548 5549 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5550 5551 NTSTATUS 5552 NTAPI 5553 ZwCancelTimer( 5554 IN HANDLE TimerHandle, 5555 OUT PBOOLEAN CurrentState OPTIONAL); 5556 5557 NTSTATUS 5558 NTAPI 5559 ZwCreateTimer( 5560 OUT PHANDLE TimerHandle, 5561 IN ACCESS_MASK DesiredAccess, 5562 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, 5563 IN TIMER_TYPE TimerType); 5564 5565 NTSTATUS 5566 NTAPI 5567 ZwOpenTimer( 5568 OUT PHANDLE TimerHandle, 5569 IN ACCESS_MASK DesiredAccess, 5570 IN POBJECT_ATTRIBUTES ObjectAttributes); 5571 5572 NTSYSAPI 5573 NTSTATUS 5574 NTAPI 5575 ZwSetInformationThread( 5576 IN HANDLE ThreadHandle, 5577 IN THREADINFOCLASS ThreadInformationClass, 5578 IN PVOID ThreadInformation, 5579 IN ULONG ThreadInformationLength); 5580 5581 NTSTATUS 5582 NTAPI 5583 ZwSetTimer( 5584 IN HANDLE TimerHandle, 5585 IN PLARGE_INTEGER DueTime, 5586 IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL, 5587 IN PVOID TimerContext OPTIONAL, 5588 IN BOOLEAN ResumeTimer, 5589 IN LONG Period OPTIONAL, 5590 OUT PBOOLEAN PreviousState OPTIONAL); 5591 5592 NTSYSAPI 5593 NTSTATUS 5594 NTAPI 5595 ZwDisplayString( 5596 IN PUNICODE_STRING String); 5597 5598 NTSYSAPI 5599 NTSTATUS 5600 NTAPI 5601 ZwPowerInformation( 5602 IN POWER_INFORMATION_LEVEL PowerInformationLevel, 5603 IN PVOID InputBuffer OPTIONAL, 5604 IN ULONG InputBufferLength, 5605 OUT PVOID OutputBuffer OPTIONAL, 5606 IN ULONG OutputBufferLength); 5607 5608 NTSYSAPI 5609 NTSTATUS 5610 NTAPI 5611 ZwQueryVolumeInformationFile( 5612 IN HANDLE FileHandle, 5613 OUT PIO_STATUS_BLOCK IoStatusBlock, 5614 OUT PVOID FsInformation, 5615 IN ULONG Length, 5616 IN FS_INFORMATION_CLASS FsInformationClass); 5617 5618 NTSYSAPI 5619 NTSTATUS 5620 NTAPI 5621 ZwDeviceIoControlFile( 5622 IN HANDLE FileHandle, 5623 IN HANDLE Event OPTIONAL, 5624 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, 5625 IN PVOID ApcContext OPTIONAL, 5626 OUT PIO_STATUS_BLOCK IoStatusBlock, 5627 IN ULONG IoControlCode, 5628 IN PVOID InputBuffer OPTIONAL, 5629 IN ULONG InputBufferLength, 5630 OUT PVOID OutputBuffer OPTIONAL, 5631 IN ULONG OutputBufferLength); 5632 5633 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 5634 5635 5636 #if (NTDDI_VERSION >= NTDDI_WIN7) 5637 5638 NTSTATUS 5639 NTAPI 5640 ZwSetTimerEx( 5641 IN HANDLE TimerHandle, 5642 IN TIMER_SET_INFORMATION_CLASS TimerSetInformationClass, 5643 IN OUT PVOID TimerSetInformation, 5644 IN ULONG TimerSetInformationLength); 5645 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 5646 5647 5648 5649 /* UNSORTED */ 5650 5651 #define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \ 5652 ((ConditionMask) = VerSetConditionMask((ConditionMask), \ 5653 (TypeBitMask), (ComparisonType))) 5654 5655 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5656 NTSYSAPI 5657 ULONGLONG 5658 NTAPI 5659 VerSetConditionMask( 5660 IN ULONGLONG ConditionMask, 5661 IN ULONG TypeMask, 5662 IN UCHAR Condition); 5663 #endif 5664 5665 typedef struct _KERNEL_USER_TIMES { 5666 LARGE_INTEGER CreateTime; 5667 LARGE_INTEGER ExitTime; 5668 LARGE_INTEGER KernelTime; 5669 LARGE_INTEGER UserTime; 5670 } KERNEL_USER_TIMES, *PKERNEL_USER_TIMES; 5671 5672 /* NtXxx Functions */ 5673 5674 typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION { 5675 SystemFirmwareTable_Enumerate, 5676 SystemFirmwareTable_Get 5677 } SYSTEM_FIRMWARE_TABLE_ACTION; 5678 5679 typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION { 5680 ULONG ProviderSignature; 5681 SYSTEM_FIRMWARE_TABLE_ACTION Action; 5682 ULONG TableID; 5683 ULONG TableBufferLength; 5684 UCHAR TableBuffer[ANYSIZE_ARRAY]; 5685 } SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION; 5686 5687 typedef NTSTATUS 5688 (__cdecl *PFNFTH)( 5689 IN OUT PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo); 5690 5691 typedef struct _SYSTEM_FIRMWARE_TABLE_HANDLER { 5692 ULONG ProviderSignature; 5693 BOOLEAN Register; 5694 PFNFTH FirmwareTableHandler; 5695 PVOID DriverObject; 5696 } SYSTEM_FIRMWARE_TABLE_HANDLER, *PSYSTEM_FIRMWARE_TABLE_HANDLER; 5697 5698 typedef ULONG_PTR 5699 (NTAPI *PDRIVER_VERIFIER_THUNK_ROUTINE)( 5700 IN PVOID Context); 5701 5702 typedef struct _DRIVER_VERIFIER_THUNK_PAIRS { 5703 PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine; 5704 PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine; 5705 } DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS; 5706 5707 #define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001 5708 #define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002 5709 #define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004 5710 #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008 5711 #define DRIVER_VERIFIER_IO_CHECKING 0x0010 5712 5713 #define SHARED_GLOBAL_FLAGS_ERROR_PORT_V 0x0 5714 #define SHARED_GLOBAL_FLAGS_ERROR_PORT (1UL << SHARED_GLOBAL_FLAGS_ERROR_PORT_V) 5715 5716 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V 0x1 5717 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED (1UL << SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V) 5718 5719 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V 0x2 5720 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED (1UL << SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V) 5721 5722 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V 0x3 5723 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED \ 5724 (1UL << SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V) 5725 5726 #define SHARED_GLOBAL_FLAGS_SPARE_V 0x4 5727 #define SHARED_GLOBAL_FLAGS_SPARE \ 5728 (1UL << SHARED_GLOBAL_FLAGS_SPARE_V) 5729 5730 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V 0x5 5731 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED \ 5732 (1UL << SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V) 5733 5734 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V 0x6 5735 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED \ 5736 (1UL << SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V) 5737 5738 #define EX_INIT_BITS(Flags, Bit) \ 5739 *((Flags)) |= (Bit) // Safe to use before concurrently accessible 5740 5741 #define EX_TEST_SET_BIT(Flags, Bit) \ 5742 InterlockedBitTestAndSet ((PLONG)(Flags), (Bit)) 5743 5744 #define EX_TEST_CLEAR_BIT(Flags, Bit) \ 5745 InterlockedBitTestAndReset ((PLONG)(Flags), (Bit)) 5746 5747 #define PCCARD_MAP_ERROR 0x01 5748 #define PCCARD_DEVICE_PCI 0x10 5749 5750 #define PCCARD_SCAN_DISABLED 0x01 5751 #define PCCARD_MAP_ZERO 0x02 5752 #define PCCARD_NO_TIMER 0x03 5753 #define PCCARD_NO_PIC 0x04 5754 #define PCCARD_NO_LEGACY_BASE 0x05 5755 #define PCCARD_DUP_LEGACY_BASE 0x06 5756 #define PCCARD_NO_CONTROLLERS 0x07 5757 5758 #define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2)) 5759 5760 /* Filesystem runtime library routines */ 5761 5762 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5763 NTKERNELAPI 5764 BOOLEAN 5765 NTAPI 5766 FsRtlIsTotalDeviceFailure( 5767 IN NTSTATUS Status); 5768 #endif 5769 5770 #ifdef __cplusplus 5771 } 5772 #endif 5773