1 /****************************************************************************** 2 * Kernel Types * 3 ******************************************************************************/ 4 $if (_WDMDDK_) 5 6 typedef UCHAR KIRQL, *PKIRQL; 7 typedef CCHAR KPROCESSOR_MODE; 8 typedef LONG KPRIORITY; 9 10 typedef enum _MODE { 11 KernelMode, 12 UserMode, 13 MaximumMode 14 } MODE; 15 16 #define CACHE_FULLY_ASSOCIATIVE 0xFF 17 #define MAXIMUM_SUSPEND_COUNT MAXCHAR 18 19 #define EVENT_QUERY_STATE (0x0001) 20 #define EVENT_MODIFY_STATE (0x0002) 21 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3) 22 23 #define LTP_PC_SMT 0x1 24 25 #if (NTDDI_VERSION < NTDDI_WIN7) || defined(_X86_) || !defined(NT_PROCESSOR_GROUPS) 26 #define SINGLE_GROUP_LEGACY_API 1 27 #endif 28 29 #define SEMAPHORE_QUERY_STATE (0x0001) 30 #define SEMAPHORE_MODIFY_STATE (0x0002) 31 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3) 32 33 $endif(_WDMDDK_) 34 $if(_WDMDDK_ || _WINNT_) 35 36 typedef struct _PROCESSOR_GROUP_INFO { 37 UCHAR MaximumProcessorCount; 38 UCHAR ActiveProcessorCount; 39 UCHAR Reserved[38]; 40 KAFFINITY ActiveProcessorMask; 41 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO; 42 43 typedef enum _PROCESSOR_CACHE_TYPE { 44 CacheUnified, 45 CacheInstruction, 46 CacheData, 47 CacheTrace 48 } PROCESSOR_CACHE_TYPE; 49 50 typedef struct _CACHE_DESCRIPTOR { 51 UCHAR Level; 52 UCHAR Associativity; 53 USHORT LineSize; 54 ULONG Size; 55 PROCESSOR_CACHE_TYPE Type; 56 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR; 57 58 typedef struct _NUMA_NODE_RELATIONSHIP { 59 ULONG NodeNumber; 60 UCHAR Reserved[20]; 61 GROUP_AFFINITY GroupMask; 62 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP; 63 64 typedef struct _CACHE_RELATIONSHIP { 65 UCHAR Level; 66 UCHAR Associativity; 67 USHORT LineSize; 68 ULONG CacheSize; 69 PROCESSOR_CACHE_TYPE Type; 70 UCHAR Reserved[20]; 71 GROUP_AFFINITY GroupMask; 72 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP; 73 74 typedef struct _GROUP_RELATIONSHIP { 75 USHORT MaximumGroupCount; 76 USHORT ActiveGroupCount; 77 UCHAR Reserved[20]; 78 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY]; 79 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP; 80 81 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { 82 RelationProcessorCore, 83 RelationNumaNode, 84 RelationCache, 85 RelationProcessorPackage, 86 RelationGroup, 87 RelationAll = 0xffff 88 } LOGICAL_PROCESSOR_RELATIONSHIP; 89 90 typedef struct _PROCESSOR_RELATIONSHIP { 91 UCHAR Flags; 92 UCHAR Reserved[21]; 93 USHORT GroupCount; 94 _Field_size_(GroupCount) GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY]; 95 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP; 96 97 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { 98 ULONG_PTR ProcessorMask; 99 LOGICAL_PROCESSOR_RELATIONSHIP Relationship; 100 _ANONYMOUS_UNION union { 101 struct { 102 UCHAR Flags; 103 } ProcessorCore; 104 struct { 105 ULONG NodeNumber; 106 } NumaNode; 107 CACHE_DESCRIPTOR Cache; 108 ULONGLONG Reserved[2]; 109 } DUMMYUNIONNAME; 110 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; 111 112 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX { 113 LOGICAL_PROCESSOR_RELATIONSHIP Relationship; 114 ULONG Size; 115 _ANONYMOUS_UNION union { 116 PROCESSOR_RELATIONSHIP Processor; 117 NUMA_NODE_RELATIONSHIP NumaNode; 118 CACHE_RELATIONSHIP Cache; 119 GROUP_RELATIONSHIP Group; 120 } DUMMYUNIONNAME; 121 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; 122 123 $endif(_WDMDDK_ || _WINNT_) 124 $if(_WDMDDK_) 125 126 /* Processor features */ 127 #define PF_FLOATING_POINT_PRECISION_ERRATA 0 128 #define PF_FLOATING_POINT_EMULATED 1 129 #define PF_COMPARE_EXCHANGE_DOUBLE 2 130 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3 131 #define PF_PPC_MOVEMEM_64BIT_OK 4 132 #define PF_ALPHA_BYTE_INSTRUCTIONS 5 133 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 134 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 135 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8 136 #define PF_PAE_ENABLED 9 137 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 138 #define PF_SSE_DAZ_MODE_AVAILABLE 11 139 #define PF_NX_ENABLED 12 140 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 141 #define PF_COMPARE_EXCHANGE128 14 142 #define PF_COMPARE64_EXCHANGE128 15 143 #define PF_CHANNELS_ENABLED 16 144 #define PF_XSAVE_ENABLED 17 145 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 146 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 147 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 148 #define PF_VIRT_FIRMWARE_ENABLED 21 149 #define PF_RDWRFSGSBASE_AVAILABLE 22 150 #define PF_FASTFAIL_AVAILABLE 23 151 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 152 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 153 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 154 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 155 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28 156 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 157 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 158 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 159 160 #define MAXIMUM_WAIT_OBJECTS 64 161 162 #define ASSERT_APC(Object) \ 163 NT_ASSERT((Object)->Type == ApcObject) 164 165 #define ASSERT_DPC(Object) \ 166 NT_ASSERT(((Object)->Type == 0) || \ 167 ((Object)->Type == DpcObject) || \ 168 ((Object)->Type == ThreadedDpcObject)) 169 170 #define ASSERT_GATE(Object) \ 171 NT_ASSERT((((Object)->Header.Type & KOBJECT_TYPE_MASK) == GateObject) || \ 172 (((Object)->Header.Type & KOBJECT_TYPE_MASK) == EventSynchronizationObject)) 173 174 #define ASSERT_DEVICE_QUEUE(Object) \ 175 NT_ASSERT((Object)->Type == DeviceQueueObject) 176 177 #define ASSERT_TIMER(Object) \ 178 NT_ASSERT(((Object)->Header.Type == TimerNotificationObject) || \ 179 ((Object)->Header.Type == TimerSynchronizationObject)) 180 181 #define ASSERT_MUTANT(Object) \ 182 NT_ASSERT((Object)->Header.Type == MutantObject) 183 184 #define ASSERT_SEMAPHORE(Object) \ 185 NT_ASSERT((Object)->Header.Type == SemaphoreObject) 186 187 #define ASSERT_EVENT(Object) \ 188 NT_ASSERT(((Object)->Header.Type == NotificationEvent) || \ 189 ((Object)->Header.Type == SynchronizationEvent)) 190 191 #define DPC_NORMAL 0 192 #define DPC_THREADED 1 193 194 #define GM_LOCK_BIT 0x1 195 #define GM_LOCK_BIT_V 0x0 196 #define GM_LOCK_WAITER_WOKEN 0x2 197 #define GM_LOCK_WAITER_INC 0x4 198 199 #define LOCK_QUEUE_WAIT_BIT 0 200 #define LOCK_QUEUE_OWNER_BIT 1 201 202 #define LOCK_QUEUE_WAIT 1 203 #define LOCK_QUEUE_OWNER 2 204 #define LOCK_QUEUE_TIMER_LOCK_SHIFT 4 205 #define LOCK_QUEUE_TIMER_TABLE_LOCKS (1 << (8 - LOCK_QUEUE_TIMER_LOCK_SHIFT)) 206 207 #define PROCESSOR_FEATURE_MAX 64 208 209 #define DBG_STATUS_CONTROL_C 1 210 #define DBG_STATUS_SYSRQ 2 211 #define DBG_STATUS_BUGCHECK_FIRST 3 212 #define DBG_STATUS_BUGCHECK_SECOND 4 213 #define DBG_STATUS_FATAL 5 214 #define DBG_STATUS_DEBUG_CONTROL 6 215 #define DBG_STATUS_WORKER 7 216 217 #if defined(_WIN64) 218 #define MAXIMUM_PROC_PER_GROUP 64 219 #else 220 #define MAXIMUM_PROC_PER_GROUP 32 221 #endif 222 #define MAXIMUM_PROCESSORS MAXIMUM_PROC_PER_GROUP 223 224 #define EXCEPTION_DIVIDED_BY_ZERO 0 225 #define EXCEPTION_DEBUG 1 226 #define EXCEPTION_NMI 2 227 #define EXCEPTION_INT3 3 228 #define EXCEPTION_BOUND_CHECK 5 229 #define EXCEPTION_INVALID_OPCODE 6 230 #define EXCEPTION_NPX_NOT_AVAILABLE 7 231 #define EXCEPTION_DOUBLE_FAULT 8 232 #define EXCEPTION_NPX_OVERRUN 9 233 #define EXCEPTION_INVALID_TSS 0x0A 234 #define EXCEPTION_SEGMENT_NOT_PRESENT 0x0B 235 #define EXCEPTION_STACK_FAULT 0x0C 236 #define EXCEPTION_GP_FAULT 0x0D 237 #define EXCEPTION_RESERVED_TRAP 0x0F 238 #define EXCEPTION_NPX_ERROR 0x010 239 #define EXCEPTION_ALIGNMENT_CHECK 0x011 240 241 typedef enum _KBUGCHECK_CALLBACK_REASON { 242 KbCallbackInvalid, 243 KbCallbackReserved1, 244 KbCallbackSecondaryDumpData, 245 KbCallbackDumpIo, 246 KbCallbackAddPages 247 } KBUGCHECK_CALLBACK_REASON; 248 249 struct _KBUGCHECK_REASON_CALLBACK_RECORD; 250 251 _Function_class_(KBUGCHECK_REASON_CALLBACK_ROUTINE) 252 _IRQL_requires_same_ 253 typedef VOID 254 (NTAPI KBUGCHECK_REASON_CALLBACK_ROUTINE)( 255 _In_ KBUGCHECK_CALLBACK_REASON Reason, 256 _In_ struct _KBUGCHECK_REASON_CALLBACK_RECORD *Record, 257 _Inout_ PVOID ReasonSpecificData, 258 _In_ ULONG ReasonSpecificDataLength); 259 typedef KBUGCHECK_REASON_CALLBACK_ROUTINE *PKBUGCHECK_REASON_CALLBACK_ROUTINE; 260 261 typedef struct _KBUGCHECK_ADD_PAGES { 262 _Inout_ PVOID Context; 263 _Inout_ ULONG Flags; 264 _In_ ULONG BugCheckCode; 265 _Out_ ULONG_PTR Address; 266 _Out_ ULONG_PTR Count; 267 } KBUGCHECK_ADD_PAGES, *PKBUGCHECK_ADD_PAGES; 268 269 typedef struct _KBUGCHECK_SECONDARY_DUMP_DATA { 270 _In_ PVOID InBuffer; 271 _In_ ULONG InBufferLength; 272 _In_ ULONG MaximumAllowed; 273 _Out_ GUID Guid; 274 _Out_ PVOID OutBuffer; 275 _Out_ ULONG OutBufferLength; 276 } KBUGCHECK_SECONDARY_DUMP_DATA, *PKBUGCHECK_SECONDARY_DUMP_DATA; 277 278 typedef enum _KBUGCHECK_DUMP_IO_TYPE { 279 KbDumpIoInvalid, 280 KbDumpIoHeader, 281 KbDumpIoBody, 282 KbDumpIoSecondaryData, 283 KbDumpIoComplete 284 } KBUGCHECK_DUMP_IO_TYPE; 285 286 typedef struct _KBUGCHECK_DUMP_IO { 287 _In_ ULONG64 Offset; 288 _In_ PVOID Buffer; 289 _In_ ULONG BufferLength; 290 _In_ KBUGCHECK_DUMP_IO_TYPE Type; 291 } KBUGCHECK_DUMP_IO, *PKBUGCHECK_DUMP_IO; 292 293 #define KB_ADD_PAGES_FLAG_VIRTUAL_ADDRESS 0x00000001UL 294 #define KB_ADD_PAGES_FLAG_PHYSICAL_ADDRESS 0x00000002UL 295 #define KB_ADD_PAGES_FLAG_ADDITIONAL_RANGES_EXIST 0x80000000UL 296 297 typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD { 298 LIST_ENTRY Entry; 299 PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine; 300 PUCHAR Component; 301 ULONG_PTR Checksum; 302 KBUGCHECK_CALLBACK_REASON Reason; 303 UCHAR State; 304 } KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD; 305 306 typedef enum _KBUGCHECK_BUFFER_DUMP_STATE { 307 BufferEmpty, 308 BufferInserted, 309 BufferStarted, 310 BufferFinished, 311 BufferIncomplete 312 } KBUGCHECK_BUFFER_DUMP_STATE; 313 314 _Function_class_(KBUGCHECK_CALLBACK_ROUTINE) 315 _IRQL_requires_same_ 316 typedef VOID 317 (NTAPI KBUGCHECK_CALLBACK_ROUTINE)( 318 IN PVOID Buffer, 319 IN ULONG Length); 320 typedef KBUGCHECK_CALLBACK_ROUTINE *PKBUGCHECK_CALLBACK_ROUTINE; 321 322 typedef struct _KBUGCHECK_CALLBACK_RECORD { 323 LIST_ENTRY Entry; 324 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine; 325 _Field_size_bytes_opt_(Length) PVOID Buffer; 326 ULONG Length; 327 PUCHAR Component; 328 ULONG_PTR Checksum; 329 UCHAR State; 330 } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD; 331 332 _Function_class_(NMI_CALLBACK) 333 _IRQL_requires_same_ 334 typedef BOOLEAN 335 (NTAPI NMI_CALLBACK)( 336 _In_opt_ PVOID Context, 337 _In_ BOOLEAN Handled); 338 typedef NMI_CALLBACK *PNMI_CALLBACK; 339 340 typedef enum _KE_PROCESSOR_CHANGE_NOTIFY_STATE { 341 KeProcessorAddStartNotify = 0, 342 KeProcessorAddCompleteNotify, 343 KeProcessorAddFailureNotify 344 } KE_PROCESSOR_CHANGE_NOTIFY_STATE; 345 346 typedef struct _KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT { 347 KE_PROCESSOR_CHANGE_NOTIFY_STATE State; 348 ULONG NtNumber; 349 NTSTATUS Status; 350 #if (NTDDI_VERSION >= NTDDI_WIN7) 351 PROCESSOR_NUMBER ProcNumber; 352 #endif 353 } KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT, *PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT; 354 355 _IRQL_requires_same_ 356 _Function_class_(PROCESSOR_CALLBACK_FUNCTION) 357 typedef VOID 358 (NTAPI PROCESSOR_CALLBACK_FUNCTION)( 359 _In_ PVOID CallbackContext, 360 _In_ PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT ChangeContext, 361 _Inout_ PNTSTATUS OperationStatus); 362 typedef PROCESSOR_CALLBACK_FUNCTION *PPROCESSOR_CALLBACK_FUNCTION; 363 364 #define KE_PROCESSOR_CHANGE_ADD_EXISTING 1 365 366 #define INVALID_PROCESSOR_INDEX 0xffffffff 367 368 typedef enum _KINTERRUPT_POLARITY { 369 InterruptPolarityUnknown, 370 InterruptActiveHigh, 371 InterruptActiveLow 372 } KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY; 373 374 typedef enum _KPROFILE_SOURCE { 375 ProfileTime, 376 ProfileAlignmentFixup, 377 ProfileTotalIssues, 378 ProfilePipelineDry, 379 ProfileLoadInstructions, 380 ProfilePipelineFrozen, 381 ProfileBranchInstructions, 382 ProfileTotalNonissues, 383 ProfileDcacheMisses, 384 ProfileIcacheMisses, 385 ProfileCacheMisses, 386 ProfileBranchMispredictions, 387 ProfileStoreInstructions, 388 ProfileFpInstructions, 389 ProfileIntegerInstructions, 390 Profile2Issue, 391 Profile3Issue, 392 Profile4Issue, 393 ProfileSpecialInstructions, 394 ProfileTotalCycles, 395 ProfileIcacheIssues, 396 ProfileDcacheAccesses, 397 ProfileMemoryBarrierCycles, 398 ProfileLoadLinkedIssues, 399 ProfileMaximum 400 } KPROFILE_SOURCE; 401 402 typedef enum _KWAIT_REASON { 403 Executive, 404 FreePage, 405 PageIn, 406 PoolAllocation, 407 DelayExecution, 408 Suspended, 409 UserRequest, 410 WrExecutive, 411 WrFreePage, 412 WrPageIn, 413 WrPoolAllocation, 414 WrDelayExecution, 415 WrSuspended, 416 WrUserRequest, 417 WrEventPair, 418 WrQueue, 419 WrLpcReceive, 420 WrLpcReply, 421 WrVirtualMemory, 422 WrPageOut, 423 WrRendezvous, 424 WrKeyedEvent, 425 WrTerminated, 426 WrProcessInSwap, 427 WrCpuRateControl, 428 WrCalloutStack, 429 WrKernel, 430 WrResource, 431 WrPushLock, 432 WrMutex, 433 WrQuantumEnd, 434 WrDispatchInt, 435 WrPreempted, 436 WrYieldExecution, 437 WrFastMutex, 438 WrGuardedMutex, 439 WrRundown, 440 MaximumWaitReason 441 } KWAIT_REASON; 442 443 typedef struct _KWAIT_BLOCK { 444 LIST_ENTRY WaitListEntry; 445 #if (NTDDI_VERSION >= NTDDI_WIN8) 446 UCHAR WaitType; 447 volatile UCHAR BlockState; 448 USHORT WaitKey; 449 #ifdef _WIN64 450 LONG SpareLong; 451 #endif 452 union { 453 struct _KTHREAD *Thread; 454 struct _KQUEUE *NotificationQueue; 455 }; 456 PVOID Object; 457 PVOID SparePtr; 458 #else 459 struct _KTHREAD *Thread; 460 PVOID Object; 461 struct _KWAIT_BLOCK *NextWaitBlock; 462 USHORT WaitKey; 463 UCHAR WaitType; 464 #if (NTDDI_VERSION >= NTDDI_WIN7) 465 volatile UCHAR BlockState; 466 #else 467 UCHAR SpareByte; 468 #endif 469 #if defined(_WIN64) 470 LONG SpareLong; 471 #endif 472 #endif 473 } KWAIT_BLOCK, *PKWAIT_BLOCK, *PRKWAIT_BLOCK; 474 475 typedef enum _KINTERRUPT_MODE { 476 LevelSensitive, 477 Latched 478 } KINTERRUPT_MODE; 479 480 #define THREAD_WAIT_OBJECTS 3 481 482 _IRQL_requires_same_ 483 _Function_class_(KSTART_ROUTINE) 484 typedef VOID 485 (NTAPI KSTART_ROUTINE)( 486 _In_ PVOID StartContext); 487 typedef KSTART_ROUTINE *PKSTART_ROUTINE; 488 489 typedef VOID 490 (NTAPI *PKINTERRUPT_ROUTINE)( 491 VOID); 492 493 _Function_class_(KSERVICE_ROUTINE) 494 _IRQL_requires_(HIGH_LEVEL) 495 _IRQL_requires_same_ 496 typedef BOOLEAN 497 (NTAPI KSERVICE_ROUTINE)( 498 _In_ struct _KINTERRUPT *Interrupt, 499 _In_ PVOID ServiceContext); 500 typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE; 501 502 _Function_class_(KMESSAGE_SERVICE_ROUTINE) 503 _IRQL_requires_same_ 504 typedef BOOLEAN 505 (NTAPI KMESSAGE_SERVICE_ROUTINE)( 506 _In_ struct _KINTERRUPT *Interrupt, 507 _In_ PVOID ServiceContext, 508 _In_ ULONG MessageID); 509 typedef KMESSAGE_SERVICE_ROUTINE *PKMESSAGE_SERVICE_ROUTINE; 510 511 typedef enum _KD_OPTION { 512 KD_OPTION_SET_BLOCK_ENABLE, 513 } KD_OPTION; 514 515 #ifdef _NTSYSTEM_ 516 typedef VOID 517 (NTAPI *PKNORMAL_ROUTINE)( 518 IN PVOID NormalContext OPTIONAL, 519 IN PVOID SystemArgument1 OPTIONAL, 520 IN PVOID SystemArgument2 OPTIONAL); 521 522 typedef VOID 523 (NTAPI *PKRUNDOWN_ROUTINE)( 524 IN struct _KAPC *Apc); 525 526 typedef VOID 527 (NTAPI *PKKERNEL_ROUTINE)( 528 IN struct _KAPC *Apc, 529 IN OUT PKNORMAL_ROUTINE *NormalRoutine OPTIONAL, 530 IN OUT PVOID *NormalContext OPTIONAL, 531 IN OUT PVOID *SystemArgument1 OPTIONAL, 532 IN OUT PVOID *SystemArgument2 OPTIONAL); 533 #endif 534 535 typedef struct _KAPC { 536 UCHAR Type; 537 UCHAR SpareByte0; 538 UCHAR Size; 539 UCHAR SpareByte1; 540 ULONG SpareLong0; 541 struct _KTHREAD *Thread; 542 LIST_ENTRY ApcListEntry; 543 #ifdef _NTSYSTEM_ 544 PKKERNEL_ROUTINE KernelRoutine; 545 PKRUNDOWN_ROUTINE RundownRoutine; 546 PKNORMAL_ROUTINE NormalRoutine; 547 #else 548 PVOID Reserved[3]; 549 #endif 550 PVOID NormalContext; 551 PVOID SystemArgument1; 552 PVOID SystemArgument2; 553 CCHAR ApcStateIndex; 554 KPROCESSOR_MODE ApcMode; 555 BOOLEAN Inserted; 556 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC; 557 558 #define KAPC_OFFSET_TO_SPARE_BYTE0 FIELD_OFFSET(KAPC, SpareByte0) 559 #define KAPC_OFFSET_TO_SPARE_BYTE1 FIELD_OFFSET(KAPC, SpareByte1) 560 #define KAPC_OFFSET_TO_SPARE_LONG FIELD_OFFSET(KAPC, SpareLong0) 561 #define KAPC_OFFSET_TO_SYSTEMARGUMENT1 FIELD_OFFSET(KAPC, SystemArgument1) 562 #define KAPC_OFFSET_TO_SYSTEMARGUMENT2 FIELD_OFFSET(KAPC, SystemArgument2) 563 #define KAPC_OFFSET_TO_APCSTATEINDEX FIELD_OFFSET(KAPC, ApcStateIndex) 564 #define KAPC_ACTUAL_LENGTH (FIELD_OFFSET(KAPC, Inserted) + sizeof(BOOLEAN)) 565 566 typedef struct _KDEVICE_QUEUE_ENTRY { 567 LIST_ENTRY DeviceListEntry; 568 ULONG SortKey; 569 BOOLEAN Inserted; 570 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY, 571 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY; 572 573 typedef PVOID PKIPI_CONTEXT; 574 575 typedef VOID 576 (NTAPI *PKIPI_WORKER)( 577 IN OUT PKIPI_CONTEXT PacketContext, 578 IN PVOID Parameter1 OPTIONAL, 579 IN PVOID Parameter2 OPTIONAL, 580 IN PVOID Parameter3 OPTIONAL); 581 582 typedef struct _KIPI_COUNTS { 583 ULONG Freeze; 584 ULONG Packet; 585 ULONG DPC; 586 ULONG APC; 587 ULONG FlushSingleTb; 588 ULONG FlushMultipleTb; 589 ULONG FlushEntireTb; 590 ULONG GenericCall; 591 ULONG ChangeColor; 592 ULONG SweepDcache; 593 ULONG SweepIcache; 594 ULONG SweepIcacheRange; 595 ULONG FlushIoBuffers; 596 ULONG GratuitousDPC; 597 } KIPI_COUNTS, *PKIPI_COUNTS; 598 599 _IRQL_requires_same_ 600 _Function_class_(KIPI_BROADCAST_WORKER) 601 _IRQL_requires_(IPI_LEVEL) 602 typedef ULONG_PTR 603 (NTAPI KIPI_BROADCAST_WORKER)( 604 _In_ ULONG_PTR Argument); 605 typedef KIPI_BROADCAST_WORKER *PKIPI_BROADCAST_WORKER; 606 607 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK; 608 609 typedef struct _KSPIN_LOCK_QUEUE { 610 struct _KSPIN_LOCK_QUEUE *volatile Next; 611 PKSPIN_LOCK volatile Lock; 612 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE; 613 614 typedef struct _KLOCK_QUEUE_HANDLE { 615 KSPIN_LOCK_QUEUE LockQueue; 616 KIRQL OldIrql; 617 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE; 618 619 #if defined(_AMD64_) 620 621 typedef ULONG64 KSPIN_LOCK_QUEUE_NUMBER; 622 623 #define LockQueueDispatcherLock 0 624 #define LockQueueExpansionLock 1 625 #define LockQueuePfnLock 2 626 #define LockQueueSystemSpaceLock 3 627 #define LockQueueVacbLock 4 628 #define LockQueueMasterLock 5 629 #define LockQueueNonPagedPoolLock 6 630 #define LockQueueIoCancelLock 7 631 #define LockQueueWorkQueueLock 8 632 #define LockQueueIoVpbLock 9 633 #define LockQueueIoDatabaseLock 10 634 #define LockQueueIoCompletionLock 11 635 #define LockQueueNtfsStructLock 12 636 #define LockQueueAfdWorkQueueLock 13 637 #define LockQueueBcbLock 14 638 #define LockQueueMmNonPagedPoolLock 15 639 #define LockQueueUnusedSpare16 16 640 #define LockQueueTimerTableLock 17 641 #define LockQueueMaximumLock (LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS) 642 643 #else 644 645 typedef enum _KSPIN_LOCK_QUEUE_NUMBER { 646 LockQueueDispatcherLock, 647 LockQueueExpansionLock, 648 LockQueuePfnLock, 649 LockQueueSystemSpaceLock, 650 LockQueueVacbLock, 651 LockQueueMasterLock, 652 LockQueueNonPagedPoolLock, 653 LockQueueIoCancelLock, 654 LockQueueWorkQueueLock, 655 LockQueueIoVpbLock, 656 LockQueueIoDatabaseLock, 657 LockQueueIoCompletionLock, 658 LockQueueNtfsStructLock, 659 LockQueueAfdWorkQueueLock, 660 LockQueueBcbLock, 661 LockQueueMmNonPagedPoolLock, 662 LockQueueUnusedSpare16, 663 LockQueueTimerTableLock, 664 LockQueueMaximumLock = LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS 665 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER; 666 667 #endif /* defined(_AMD64_) */ 668 669 _Function_class_(KDEFERRED_ROUTINE) 670 _IRQL_requires_(DISPATCH_LEVEL) 671 _IRQL_requires_same_ 672 typedef VOID 673 (NTAPI KDEFERRED_ROUTINE)( 674 _In_ struct _KDPC *Dpc, 675 _In_opt_ PVOID DeferredContext, 676 _In_opt_ PVOID SystemArgument1, 677 _In_opt_ PVOID SystemArgument2); 678 typedef KDEFERRED_ROUTINE *PKDEFERRED_ROUTINE; 679 680 typedef enum _KDPC_IMPORTANCE { 681 LowImportance, 682 MediumImportance, 683 HighImportance, 684 MediumHighImportance 685 } KDPC_IMPORTANCE; 686 687 typedef struct _KDPC { 688 UCHAR Type; 689 UCHAR Importance; 690 volatile USHORT Number; 691 LIST_ENTRY DpcListEntry; 692 PKDEFERRED_ROUTINE DeferredRoutine; 693 PVOID DeferredContext; 694 PVOID SystemArgument1; 695 PVOID SystemArgument2; 696 volatile PVOID DpcData; 697 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC; 698 699 typedef struct _KDPC_WATCHDOG_INFORMATION { 700 ULONG DpcTimeLimit; 701 ULONG DpcTimeCount; 702 ULONG DpcWatchdogLimit; 703 ULONG DpcWatchdogCount; 704 ULONG Reserved; 705 } KDPC_WATCHDOG_INFORMATION, *PKDPC_WATCHDOG_INFORMATION; 706 707 typedef struct _KDEVICE_QUEUE { 708 CSHORT Type; 709 CSHORT Size; 710 LIST_ENTRY DeviceListHead; 711 KSPIN_LOCK Lock; 712 # if defined(_AMD64_) 713 _ANONYMOUS_UNION union { 714 BOOLEAN Busy; 715 _ANONYMOUS_STRUCT struct { 716 LONG64 Reserved:8; 717 LONG64 Hint:56; 718 } DUMMYSTRUCTNAME; 719 } DUMMYUNIONNAME; 720 # else 721 BOOLEAN Busy; 722 # endif 723 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE; 724 725 #define TIMER_EXPIRED_INDEX_BITS 6 726 #define TIMER_PROCESSOR_INDEX_BITS 5 727 728 typedef struct _DISPATCHER_HEADER { 729 _ANONYMOUS_UNION union { 730 _ANONYMOUS_STRUCT struct { 731 UCHAR Type; 732 _ANONYMOUS_UNION union { 733 _ANONYMOUS_UNION union { 734 UCHAR TimerControlFlags; 735 _ANONYMOUS_STRUCT struct { 736 UCHAR Absolute:1; 737 UCHAR Coalescable:1; 738 UCHAR KeepShifting:1; 739 UCHAR EncodedTolerableDelay:5; 740 } DUMMYSTRUCTNAME; 741 } DUMMYUNIONNAME; 742 UCHAR Abandoned; 743 #if (NTDDI_VERSION < NTDDI_WIN7) 744 UCHAR NpxIrql; 745 #endif 746 BOOLEAN Signalling; 747 } DUMMYUNIONNAME; 748 _ANONYMOUS_UNION union { 749 _ANONYMOUS_UNION union { 750 UCHAR ThreadControlFlags; 751 _ANONYMOUS_STRUCT struct { 752 UCHAR CpuThrottled:1; 753 UCHAR CycleProfiling:1; 754 UCHAR CounterProfiling:1; 755 UCHAR Reserved:5; 756 } DUMMYSTRUCTNAME; 757 } DUMMYUNIONNAME; 758 UCHAR Size; 759 UCHAR Hand; 760 } DUMMYUNIONNAME2; 761 _ANONYMOUS_UNION union { 762 #if (NTDDI_VERSION >= NTDDI_WIN7) 763 _ANONYMOUS_UNION union { 764 UCHAR TimerMiscFlags; 765 _ANONYMOUS_STRUCT struct { 766 #if !defined(_X86_) 767 UCHAR Index:TIMER_EXPIRED_INDEX_BITS; 768 #else 769 UCHAR Index:1; 770 UCHAR Processor:TIMER_PROCESSOR_INDEX_BITS; 771 #endif 772 UCHAR Inserted:1; 773 volatile UCHAR Expired:1; 774 } DUMMYSTRUCTNAME; 775 } DUMMYUNIONNAME; 776 #else 777 /* Pre Win7 compatibility fix to latest WDK */ 778 UCHAR Inserted; 779 #endif 780 _ANONYMOUS_UNION union { 781 BOOLEAN DebugActive; 782 _ANONYMOUS_STRUCT struct { 783 BOOLEAN ActiveDR7:1; 784 BOOLEAN Instrumented:1; 785 BOOLEAN Reserved2:4; 786 BOOLEAN UmsScheduled:1; 787 BOOLEAN UmsPrimary:1; 788 } DUMMYSTRUCTNAME; 789 } DUMMYUNIONNAME; /* should probably be DUMMYUNIONNAME2, but this is what WDK says */ 790 BOOLEAN DpcActive; 791 } DUMMYUNIONNAME3; 792 } DUMMYSTRUCTNAME; 793 volatile LONG Lock; 794 } DUMMYUNIONNAME; 795 LONG SignalState; 796 LIST_ENTRY WaitListHead; 797 } DISPATCHER_HEADER, *PDISPATCHER_HEADER; 798 799 typedef struct _KEVENT { 800 DISPATCHER_HEADER Header; 801 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT; 802 803 typedef struct _KSEMAPHORE { 804 DISPATCHER_HEADER Header; 805 LONG Limit; 806 } KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE; 807 808 #define KSEMAPHORE_ACTUAL_LENGTH (FIELD_OFFSET(KSEMAPHORE, Limit) + sizeof(LONG)) 809 810 typedef struct _KGATE { 811 DISPATCHER_HEADER Header; 812 } KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE; 813 814 typedef struct _KGUARDED_MUTEX { 815 volatile LONG Count; 816 PKTHREAD Owner; 817 ULONG Contention; 818 KGATE Gate; 819 _ANONYMOUS_UNION union { 820 _ANONYMOUS_STRUCT struct { 821 SHORT KernelApcDisable; 822 SHORT SpecialApcDisable; 823 } DUMMYSTRUCTNAME; 824 ULONG CombinedApcDisable; 825 } DUMMYUNIONNAME; 826 } KGUARDED_MUTEX, *PKGUARDED_MUTEX; 827 828 typedef struct _KMUTANT { 829 DISPATCHER_HEADER Header; 830 LIST_ENTRY MutantListEntry; 831 struct _KTHREAD *RESTRICTED_POINTER OwnerThread; 832 BOOLEAN Abandoned; 833 UCHAR ApcDisable; 834 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX; 835 836 #define TIMER_TABLE_SIZE 512 837 #define TIMER_TABLE_SHIFT 9 838 839 typedef struct _KTIMER { 840 DISPATCHER_HEADER Header; 841 ULARGE_INTEGER DueTime; 842 LIST_ENTRY TimerListEntry; 843 struct _KDPC *Dpc; 844 #if (NTDDI_VERSION >= NTDDI_WIN7) && !defined(_X86_) 845 ULONG Processor; 846 #endif 847 ULONG Period; 848 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER; 849 850 typedef enum _LOCK_OPERATION { 851 IoReadAccess, 852 IoWriteAccess, 853 IoModifyAccess 854 } LOCK_OPERATION; 855 856 #define KTIMER_ACTUAL_LENGTH (FIELD_OFFSET(KTIMER, Period) + sizeof(LONG)) 857 858 _Function_class_(KSYNCHRONIZE_ROUTINE) 859 _IRQL_requires_same_ 860 typedef BOOLEAN 861 (NTAPI KSYNCHRONIZE_ROUTINE)( 862 _In_ PVOID SynchronizeContext); 863 typedef KSYNCHRONIZE_ROUTINE *PKSYNCHRONIZE_ROUTINE; 864 865 typedef enum _POOL_TYPE { 866 NonPagedPool, 867 PagedPool, 868 NonPagedPoolMustSucceed, 869 DontUseThisType, 870 NonPagedPoolCacheAligned, 871 PagedPoolCacheAligned, 872 NonPagedPoolCacheAlignedMustS, 873 MaxPoolType, 874 875 NonPagedPoolBase = 0, 876 NonPagedPoolBaseMustSucceed = NonPagedPoolBase + 2, 877 NonPagedPoolBaseCacheAligned = NonPagedPoolBase + 4, 878 NonPagedPoolBaseCacheAlignedMustS = NonPagedPoolBase + 6, 879 880 NonPagedPoolSession = 32, 881 PagedPoolSession, 882 NonPagedPoolMustSucceedSession, 883 DontUseThisTypeSession, 884 NonPagedPoolCacheAlignedSession, 885 PagedPoolCacheAlignedSession, 886 NonPagedPoolCacheAlignedMustSSession 887 } POOL_TYPE; 888 889 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE { 890 StandardDesign, 891 NEC98x86, 892 EndAlternatives 893 } ALTERNATIVE_ARCHITECTURE_TYPE; 894 895 #ifndef _X86_ 896 897 #ifndef IsNEC_98 898 #define IsNEC_98 (FALSE) 899 #endif 900 901 #ifndef IsNotNEC_98 902 #define IsNotNEC_98 (TRUE) 903 #endif 904 905 #ifndef SetNEC_98 906 #define SetNEC_98 907 #endif 908 909 #ifndef SetNotNEC_98 910 #define SetNotNEC_98 911 #endif 912 913 #endif 914 915 typedef struct _KSYSTEM_TIME { 916 ULONG LowPart; 917 LONG High1Time; 918 LONG High2Time; 919 } KSYSTEM_TIME, *PKSYSTEM_TIME; 920 921 typedef struct DECLSPEC_ALIGN(16) _M128A { 922 ULONGLONG Low; 923 LONGLONG High; 924 } M128A, *PM128A; 925 926 typedef struct DECLSPEC_ALIGN(16) _XSAVE_FORMAT { 927 USHORT ControlWord; 928 USHORT StatusWord; 929 UCHAR TagWord; 930 UCHAR Reserved1; 931 USHORT ErrorOpcode; 932 ULONG ErrorOffset; 933 USHORT ErrorSelector; 934 USHORT Reserved2; 935 ULONG DataOffset; 936 USHORT DataSelector; 937 USHORT Reserved3; 938 ULONG MxCsr; 939 ULONG MxCsr_Mask; 940 M128A FloatRegisters[8]; 941 #if defined(_WIN64) 942 M128A XmmRegisters[16]; 943 UCHAR Reserved4[96]; 944 #else 945 M128A XmmRegisters[8]; 946 UCHAR Reserved4[192]; 947 ULONG StackControl[7]; 948 ULONG Cr0NpxState; 949 #endif 950 } XSAVE_FORMAT, *PXSAVE_FORMAT; 951 952 typedef struct DECLSPEC_ALIGN(8) _XSAVE_AREA_HEADER { 953 ULONG64 Mask; 954 ULONG64 Reserved[7]; 955 } XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER; 956 957 typedef struct DECLSPEC_ALIGN(16) _XSAVE_AREA { 958 XSAVE_FORMAT LegacyState; 959 XSAVE_AREA_HEADER Header; 960 } XSAVE_AREA, *PXSAVE_AREA; 961 962 typedef struct _XSTATE_CONTEXT { 963 ULONG64 Mask; 964 ULONG Length; 965 ULONG Reserved1; 966 _Field_size_bytes_opt_(Length) PXSAVE_AREA Area; 967 #if defined(_X86_) 968 ULONG Reserved2; 969 #endif 970 PVOID Buffer; 971 #if defined(_X86_) 972 ULONG Reserved3; 973 #endif 974 } XSTATE_CONTEXT, *PXSTATE_CONTEXT; 975 976 typedef struct _XSTATE_SAVE { 977 #if defined(_AMD64_) 978 struct _XSTATE_SAVE* Prev; 979 struct _KTHREAD* Thread; 980 UCHAR Level; 981 XSTATE_CONTEXT XStateContext; 982 #elif defined(_IA64_) || defined(_ARM_) 983 ULONG Dummy; 984 #elif defined(_X86_) 985 _ANONYMOUS_UNION union { 986 _ANONYMOUS_STRUCT struct { 987 LONG64 Reserved1; 988 ULONG Reserved2; 989 struct _XSTATE_SAVE* Prev; 990 PXSAVE_AREA Reserved3; 991 struct _KTHREAD* Thread; 992 PVOID Reserved4; 993 UCHAR Level; 994 } DUMMYSTRUCTNAME; 995 XSTATE_CONTEXT XStateContext; 996 } DUMMYUNIONNAME; 997 #endif 998 } XSTATE_SAVE, *PXSTATE_SAVE; 999 1000 #ifdef _X86_ 1001 1002 #define MAXIMUM_SUPPORTED_EXTENSION 512 1003 1004 #if !defined(__midl) && !defined(MIDL_PASS) 1005 C_ASSERT(sizeof(XSAVE_FORMAT) == MAXIMUM_SUPPORTED_EXTENSION); 1006 #endif 1007 1008 #endif /* _X86_ */ 1009 1010 #define XSAVE_ALIGN 64 1011 #define MINIMAL_XSTATE_AREA_LENGTH sizeof(XSAVE_AREA) 1012 1013 #if !defined(__midl) && !defined(MIDL_PASS) 1014 C_ASSERT((sizeof(XSAVE_FORMAT) & (XSAVE_ALIGN - 1)) == 0); 1015 C_ASSERT((FIELD_OFFSET(XSAVE_AREA, Header) & (XSAVE_ALIGN - 1)) == 0); 1016 C_ASSERT(MINIMAL_XSTATE_AREA_LENGTH == 512 + 64); 1017 #endif 1018 1019 typedef struct _CONTEXT_CHUNK { 1020 LONG Offset; 1021 ULONG Length; 1022 } CONTEXT_CHUNK, *PCONTEXT_CHUNK; 1023 1024 typedef struct _CONTEXT_EX { 1025 CONTEXT_CHUNK All; 1026 CONTEXT_CHUNK Legacy; 1027 CONTEXT_CHUNK XState; 1028 } CONTEXT_EX, *PCONTEXT_EX; 1029 1030 #define CONTEXT_EX_LENGTH ALIGN_UP_BY(sizeof(CONTEXT_EX), STACK_ALIGN) 1031 1032 #if (NTDDI_VERSION >= NTDDI_VISTA) 1033 extern NTSYSAPI volatile CCHAR KeNumberProcessors; 1034 #elif (NTDDI_VERSION >= NTDDI_WINXP) 1035 extern NTSYSAPI CCHAR KeNumberProcessors; 1036 #else 1037 __CREATE_NTOS_DATA_IMPORT_ALIAS(KeNumberProcessors) 1038 extern PCCHAR KeNumberProcessors; 1039 #endif 1040 1041 $endif (_WDMDDK_) 1042 $if (_NTDDK_) 1043 1044 typedef struct _EXCEPTION_REGISTRATION_RECORD 1045 { 1046 struct _EXCEPTION_REGISTRATION_RECORD *Next; 1047 PEXCEPTION_ROUTINE Handler; 1048 } EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD; 1049 1050 typedef struct _NT_TIB { 1051 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; 1052 PVOID StackBase; 1053 PVOID StackLimit; 1054 PVOID SubSystemTib; 1055 _ANONYMOUS_UNION union { 1056 PVOID FiberData; 1057 ULONG Version; 1058 } DUMMYUNIONNAME; 1059 PVOID ArbitraryUserPointer; 1060 struct _NT_TIB *Self; 1061 } NT_TIB, *PNT_TIB; 1062 1063 typedef struct _NT_TIB32 { 1064 ULONG ExceptionList; 1065 ULONG StackBase; 1066 ULONG StackLimit; 1067 ULONG SubSystemTib; 1068 _ANONYMOUS_UNION union { 1069 ULONG FiberData; 1070 ULONG Version; 1071 } DUMMYUNIONNAME; 1072 ULONG ArbitraryUserPointer; 1073 ULONG Self; 1074 } NT_TIB32,*PNT_TIB32; 1075 1076 typedef struct _NT_TIB64 { 1077 ULONG64 ExceptionList; 1078 ULONG64 StackBase; 1079 ULONG64 StackLimit; 1080 ULONG64 SubSystemTib; 1081 _ANONYMOUS_UNION union { 1082 ULONG64 FiberData; 1083 ULONG Version; 1084 } DUMMYUNIONNAME; 1085 ULONG64 ArbitraryUserPointer; 1086 ULONG64 Self; 1087 } NT_TIB64,*PNT_TIB64; 1088 1089 #define NX_SUPPORT_POLICY_ALWAYSOFF 0 1090 #define NX_SUPPORT_POLICY_ALWAYSON 1 1091 #define NX_SUPPORT_POLICY_OPTIN 2 1092 #define NX_SUPPORT_POLICY_OPTOUT 3 1093 1094 _IRQL_requires_same_ 1095 _Function_class_(EXPAND_STACK_CALLOUT) 1096 typedef VOID 1097 (NTAPI EXPAND_STACK_CALLOUT)( 1098 _In_opt_ PVOID Parameter); 1099 typedef EXPAND_STACK_CALLOUT *PEXPAND_STACK_CALLOUT; 1100 1101 typedef VOID 1102 (NTAPI *PTIMER_APC_ROUTINE)( 1103 _In_ PVOID TimerContext, 1104 _In_ ULONG TimerLowValue, 1105 _In_ LONG TimerHighValue); 1106 1107 typedef enum _TIMER_SET_INFORMATION_CLASS { 1108 TimerSetCoalescableTimer, 1109 MaxTimerInfoClass 1110 } TIMER_SET_INFORMATION_CLASS; 1111 1112 #if (NTDDI_VERSION >= NTDDI_WIN7) 1113 typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO { 1114 _In_ LARGE_INTEGER DueTime; 1115 _In_opt_ PTIMER_APC_ROUTINE TimerApcRoutine; 1116 _In_opt_ PVOID TimerContext; 1117 _In_opt_ struct _COUNTED_REASON_CONTEXT *WakeContext; 1118 _In_opt_ ULONG Period; 1119 _In_ ULONG TolerableDelay; 1120 _Out_opt_ PBOOLEAN PreviousState; 1121 } TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO; 1122 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 1123 1124 #define XSTATE_LEGACY_FLOATING_POINT 0 1125 #define XSTATE_LEGACY_SSE 1 1126 #define XSTATE_GSSE 2 1127 1128 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1LL << (XSTATE_LEGACY_FLOATING_POINT)) 1129 #define XSTATE_MASK_LEGACY_SSE (1LL << (XSTATE_LEGACY_SSE)) 1130 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE) 1131 #define XSTATE_MASK_GSSE (1LL << (XSTATE_GSSE)) 1132 1133 #define MAXIMUM_XSTATE_FEATURES 64 1134 1135 typedef struct _XSTATE_FEATURE { 1136 ULONG Offset; 1137 ULONG Size; 1138 } XSTATE_FEATURE, *PXSTATE_FEATURE; 1139 1140 typedef struct _XSTATE_CONFIGURATION { 1141 ULONG64 EnabledFeatures; 1142 ULONG Size; 1143 ULONG OptimizedSave:1; 1144 XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES]; 1145 } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION; 1146 1147 #define MAX_WOW64_SHARED_ENTRIES 16 1148 1149 typedef struct _KUSER_SHARED_DATA { 1150 ULONG TickCountLowDeprecated; 1151 ULONG TickCountMultiplier; 1152 volatile KSYSTEM_TIME InterruptTime; 1153 volatile KSYSTEM_TIME SystemTime; 1154 volatile KSYSTEM_TIME TimeZoneBias; 1155 USHORT ImageNumberLow; 1156 USHORT ImageNumberHigh; 1157 WCHAR NtSystemRoot[260]; 1158 ULONG MaxStackTraceDepth; 1159 ULONG CryptoExponent; 1160 ULONG TimeZoneId; 1161 ULONG LargePageMinimum; 1162 ULONG Reserved2[7]; 1163 NT_PRODUCT_TYPE NtProductType; 1164 BOOLEAN ProductTypeIsValid; 1165 ULONG NtMajorVersion; 1166 ULONG NtMinorVersion; 1167 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX]; 1168 ULONG Reserved1; 1169 ULONG Reserved3; 1170 volatile ULONG TimeSlip; 1171 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture; 1172 ULONG AltArchitecturePad[1]; 1173 LARGE_INTEGER SystemExpirationDate; 1174 ULONG SuiteMask; 1175 BOOLEAN KdDebuggerEnabled; 1176 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) 1177 UCHAR NXSupportPolicy; 1178 #endif 1179 volatile ULONG ActiveConsoleId; 1180 volatile ULONG DismountCount; 1181 ULONG ComPlusPackage; 1182 ULONG LastSystemRITEventTickCount; 1183 ULONG NumberOfPhysicalPages; 1184 BOOLEAN SafeBootMode; 1185 #if (NTDDI_VERSION >= NTDDI_WIN7) 1186 _ANONYMOUS_UNION union { 1187 UCHAR TscQpcData; 1188 _ANONYMOUS_STRUCT struct { 1189 UCHAR TscQpcEnabled:1; 1190 UCHAR TscQpcSpareFlag:1; 1191 UCHAR TscQpcShift:6; 1192 } DUMMYSTRUCTNAME; 1193 } DUMMYUNIONNAME; 1194 UCHAR TscQpcPad[2]; 1195 #endif 1196 #if (NTDDI_VERSION >= NTDDI_VISTA) 1197 _ANONYMOUS_UNION union { 1198 ULONG SharedDataFlags; 1199 _ANONYMOUS_STRUCT struct { 1200 ULONG DbgErrorPortPresent:1; 1201 ULONG DbgElevationEnabled:1; 1202 ULONG DbgVirtEnabled:1; 1203 ULONG DbgInstallerDetectEnabled:1; 1204 ULONG DbgSystemDllRelocated:1; 1205 ULONG DbgDynProcessorEnabled:1; 1206 ULONG DbgSEHValidationEnabled:1; 1207 ULONG SpareBits:25; 1208 } DUMMYSTRUCTNAME2; 1209 } DUMMYUNIONNAME2; 1210 #else 1211 ULONG TraceLogging; 1212 #endif 1213 ULONG DataFlagsPad[1]; 1214 ULONGLONG TestRetInstruction; 1215 ULONG SystemCall; 1216 ULONG SystemCallReturn; 1217 ULONGLONG SystemCallPad[3]; 1218 _ANONYMOUS_UNION union { 1219 volatile KSYSTEM_TIME TickCount; 1220 volatile ULONG64 TickCountQuad; 1221 _ANONYMOUS_STRUCT struct { 1222 ULONG ReservedTickCountOverlay[3]; 1223 ULONG TickCountPad[1]; 1224 } DUMMYSTRUCTNAME; 1225 } DUMMYUNIONNAME3; 1226 ULONG Cookie; 1227 ULONG CookiePad[1]; 1228 #if (NTDDI_VERSION >= NTDDI_WS03) 1229 LONGLONG ConsoleSessionForegroundProcessId; 1230 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES]; 1231 #endif 1232 #if (NTDDI_VERSION >= NTDDI_VISTA) 1233 #if (NTDDI_VERSION >= NTDDI_WIN7) 1234 USHORT UserModeGlobalLogger[16]; 1235 #else 1236 USHORT UserModeGlobalLogger[8]; 1237 ULONG HeapTracingPid[2]; 1238 ULONG CritSecTracingPid[2]; 1239 #endif 1240 ULONG ImageFileExecutionOptions; 1241 #if (NTDDI_VERSION >= NTDDI_VISTASP1) 1242 ULONG LangGenerationCount; 1243 #else 1244 /* 4 bytes padding */ 1245 #endif 1246 ULONGLONG Reserved5; 1247 volatile ULONG64 InterruptTimeBias; 1248 #endif 1249 #if (NTDDI_VERSION >= NTDDI_WIN7) 1250 volatile ULONG64 TscQpcBias; 1251 volatile ULONG ActiveProcessorCount; 1252 volatile USHORT ActiveGroupCount; 1253 USHORT Reserved4; 1254 volatile ULONG AitSamplingValue; 1255 volatile ULONG AppCompatFlag; 1256 ULONGLONG SystemDllNativeRelocation; 1257 ULONG SystemDllWowRelocation; 1258 ULONG XStatePad[1]; 1259 XSTATE_CONFIGURATION XState; 1260 #endif 1261 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; 1262 1263 #if (NTDDI_VERSION >= NTDDI_VISTA) 1264 extern NTSYSAPI volatile CCHAR KeNumberProcessors; 1265 #elif (NTDDI_VERSION >= NTDDI_WINXP) 1266 extern NTSYSAPI CCHAR KeNumberProcessors; 1267 #else 1268 extern PCCHAR KeNumberProcessors; 1269 #endif 1270 1271 $endif (_NTDDK_) 1272 $if (_NTIFS_) 1273 typedef struct _KAPC_STATE { 1274 LIST_ENTRY ApcListHead[MaximumMode]; 1275 PKPROCESS Process; 1276 BOOLEAN KernelApcInProgress; 1277 BOOLEAN KernelApcPending; 1278 BOOLEAN UserApcPending; 1279 } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE; 1280 1281 #define KAPC_STATE_ACTUAL_LENGTH (FIELD_OFFSET(KAPC_STATE, UserApcPending) + sizeof(BOOLEAN)) 1282 1283 #define ASSERT_QUEUE(Q) ASSERT(((Q)->Header.Type & KOBJECT_TYPE_MASK) == QueueObject); 1284 1285 typedef struct _KQUEUE { 1286 DISPATCHER_HEADER Header; 1287 LIST_ENTRY EntryListHead; 1288 volatile ULONG CurrentCount; 1289 ULONG MaximumCount; 1290 LIST_ENTRY ThreadListHead; 1291 } KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE; 1292 1293 $endif (_NTIFS_) 1294 1295