1 /****************************************************************************** 2 * Kernel Functions * 3 ******************************************************************************/ 4 $if (_WDMDDK_) 5 #if defined(_M_IX86) 6 $include(x86/ke.h) 7 #elif defined(_M_AMD64) 8 $include(amd64/ke.h) 9 #elif defined(_M_IA64) 10 $include(ia64/ke.h) 11 #elif defined(_M_PPC) 12 $include(ppc/ke.h) 13 #elif defined(_M_MIPS) 14 $include(mips/ke.h) 15 #elif defined(_M_ARM) 16 $include(arm/ke.h) 17 #else 18 #error Unknown Architecture 19 #endif 20 21 NTKERNELAPI 22 VOID 23 NTAPI 24 KeInitializeEvent( 25 _Out_ PRKEVENT Event, 26 _In_ EVENT_TYPE Type, 27 _In_ BOOLEAN State); 28 29 _IRQL_requires_max_(DISPATCH_LEVEL) 30 NTKERNELAPI 31 VOID 32 NTAPI 33 KeClearEvent( 34 _Inout_ PRKEVENT Event); 35 $endif (_WDMDDK_) 36 $if (_NTDDK_) 37 38 _IRQL_requires_min_(PASSIVE_LEVEL) 39 _IRQL_requires_max_(DISPATCH_LEVEL) 40 NTKERNELAPI 41 VOID 42 FASTCALL 43 KeInvalidateRangeAllCaches( 44 _In_ PVOID BaseAddress, 45 _In_ ULONG Length); 46 $endif (_NTDDK_) 47 48 #if (NTDDI_VERSION >= NTDDI_WIN2K) 49 50 $if (_WDMDDK_) 51 #if defined(_NTDDK_) || defined(_NTIFS_) 52 _Maybe_raises_SEH_exception_ 53 _IRQL_requires_max_(APC_LEVEL) 54 NTKERNELAPI 55 VOID 56 NTAPI 57 ProbeForRead( 58 __in_data_source(USER_MODE) _In_reads_bytes_(Length) CONST VOID *Address, /* CONST is added */ 59 _In_ SIZE_T Length, 60 _In_ ULONG Alignment); 61 #endif /* defined(_NTDDK_) || defined(_NTIFS_) */ 62 63 _Maybe_raises_SEH_exception_ 64 _IRQL_requires_max_(APC_LEVEL) 65 NTKERNELAPI 66 VOID 67 NTAPI 68 ProbeForWrite( 69 __in_data_source(USER_MODE) _Out_writes_bytes_(Length) PVOID Address, 70 _In_ SIZE_T Length, 71 _In_ ULONG Alignment); 72 73 $endif (_WDMDDK_) 74 $if (_NTDDK_) 75 NTKERNELAPI 76 VOID 77 NTAPI 78 KeSetImportanceDpc( 79 _Inout_ PRKDPC Dpc, 80 _In_ KDPC_IMPORTANCE Importance); 81 82 _IRQL_requires_max_(DISPATCH_LEVEL) 83 NTKERNELAPI 84 LONG 85 NTAPI 86 KePulseEvent( 87 _Inout_ PRKEVENT Event, 88 _In_ KPRIORITY Increment, 89 _In_ BOOLEAN Wait); 90 91 _IRQL_requires_min_(PASSIVE_LEVEL) 92 _IRQL_requires_max_(DISPATCH_LEVEL) 93 NTKERNELAPI 94 LONG 95 NTAPI 96 KeSetBasePriorityThread( 97 _Inout_ PRKTHREAD Thread, 98 _In_ LONG Increment); 99 100 _Acquires_lock_(_Global_critical_region_) 101 _IRQL_requires_max_(APC_LEVEL) 102 NTKERNELAPI 103 VOID 104 NTAPI 105 KeEnterCriticalRegion(VOID); 106 107 _Releases_lock_(_Global_critical_region_) 108 _IRQL_requires_max_(APC_LEVEL) 109 NTKERNELAPI 110 VOID 111 NTAPI 112 KeLeaveCriticalRegion(VOID); 113 114 NTKERNELAPI 115 DECLSPEC_NORETURN 116 VOID 117 NTAPI 118 KeBugCheck( 119 _In_ ULONG BugCheckCode); 120 $endif(_NTDDK_) 121 $if (_WDMDDK_ || _NTDDK_) 122 #if defined(SINGLE_GROUP_LEGACY_API) 123 $endif (_WDMDDK_ || _NTDDK_) 124 125 $if (_WDMDDK_) 126 _IRQL_requires_min_(PASSIVE_LEVEL) 127 _IRQL_requires_max_(APC_LEVEL) 128 NTKERNELAPI 129 VOID 130 NTAPI 131 KeRevertToUserAffinityThread(VOID); 132 133 _IRQL_requires_min_(PASSIVE_LEVEL) 134 _IRQL_requires_max_(APC_LEVEL) 135 NTKERNELAPI 136 VOID 137 NTAPI 138 KeSetSystemAffinityThread( 139 _In_ KAFFINITY Affinity); 140 141 NTKERNELAPI 142 VOID 143 NTAPI 144 KeSetTargetProcessorDpc( 145 _Inout_ PRKDPC Dpc, 146 _In_ CCHAR Number); 147 148 NTKERNELAPI 149 KAFFINITY 150 NTAPI 151 KeQueryActiveProcessors(VOID); 152 $endif (_WDMDDK_) 153 $if (_NTDDK_) 154 155 NTKERNELAPI 156 VOID 157 NTAPI 158 KeSetTargetProcessorDpc( 159 _Inout_ PRKDPC Dpc, 160 _In_ CCHAR Number); 161 162 NTKERNELAPI 163 KAFFINITY 164 NTAPI 165 KeQueryActiveProcessors(VOID); 166 $endif (_NTDDK_) 167 $if (_WDMDDK_ || _NTDDK_) 168 #endif /* defined(SINGLE_GROUP_LEGACY_API) */ 169 $endif (_WDMDDK_ || _NTDDK_) 170 171 $if (_WDMDDK_) 172 #if !defined(_M_AMD64) 173 NTKERNELAPI 174 ULONGLONG 175 NTAPI 176 KeQueryInterruptTime(VOID); 177 178 NTKERNELAPI 179 VOID 180 NTAPI 181 KeQuerySystemTime( 182 _Out_ PLARGE_INTEGER CurrentTime); 183 #endif /* !_M_AMD64 */ 184 185 #if !defined(_X86_) && !defined(_M_ARM) 186 _Requires_lock_not_held_(*SpinLock) 187 _Acquires_lock_(*SpinLock) 188 _IRQL_requires_max_(DISPATCH_LEVEL) 189 _IRQL_saves_ 190 _IRQL_raises_(DISPATCH_LEVEL) 191 NTKERNELAPI 192 KIRQL 193 NTAPI 194 KeAcquireSpinLockRaiseToDpc( 195 _Inout_ PKSPIN_LOCK SpinLock); 196 197 #define KeAcquireSpinLock(SpinLock, OldIrql) \ 198 *(OldIrql) = KeAcquireSpinLockRaiseToDpc(SpinLock) 199 200 _Requires_lock_not_held_(*SpinLock) 201 _Acquires_lock_(*SpinLock) 202 _IRQL_requires_min_(DISPATCH_LEVEL) 203 NTKERNELAPI 204 VOID 205 NTAPI 206 KeAcquireSpinLockAtDpcLevel( 207 _Inout_ PKSPIN_LOCK SpinLock); 208 209 _Requires_lock_held_(*SpinLock) 210 _Releases_lock_(*SpinLock) 211 _IRQL_requires_(DISPATCH_LEVEL) 212 NTKERNELAPI 213 VOID 214 NTAPI 215 KeReleaseSpinLock( 216 _Inout_ PKSPIN_LOCK SpinLock, 217 _In_ _IRQL_restores_ KIRQL NewIrql); 218 219 _Requires_lock_held_(*SpinLock) 220 _Releases_lock_(*SpinLock) 221 _IRQL_requires_min_(DISPATCH_LEVEL) 222 NTKERNELAPI 223 VOID 224 NTAPI 225 KeReleaseSpinLockFromDpcLevel( 226 _Inout_ PKSPIN_LOCK SpinLock); 227 #endif /* !_X86_ */ 228 229 #if defined(_X86_) && (defined(_WDM_INCLUDED_) || defined(WIN9X_COMPAT_SPINLOCK)) 230 NTKERNELAPI 231 VOID 232 NTAPI 233 KeInitializeSpinLock( 234 _Out_ PKSPIN_LOCK SpinLock); 235 #else 236 FORCEINLINE 237 VOID 238 KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock) 239 { 240 /* Clear the lock */ 241 *SpinLock = 0; 242 } 243 #endif 244 245 NTKERNELAPI 246 DECLSPEC_NORETURN 247 VOID 248 NTAPI 249 KeBugCheckEx( 250 _In_ ULONG BugCheckCode, 251 _In_ ULONG_PTR BugCheckParameter1, 252 _In_ ULONG_PTR BugCheckParameter2, 253 _In_ ULONG_PTR BugCheckParameter3, 254 _In_ ULONG_PTR BugCheckParameter4); 255 256 _IRQL_requires_max_(DISPATCH_LEVEL) 257 NTKERNELAPI 258 BOOLEAN 259 NTAPI 260 KeCancelTimer( 261 _Inout_ PKTIMER); 262 263 _IRQL_requires_min_(PASSIVE_LEVEL) 264 _IRQL_requires_max_(APC_LEVEL) 265 NTKERNELAPI 266 NTSTATUS 267 NTAPI 268 KeDelayExecutionThread( 269 _In_ KPROCESSOR_MODE WaitMode, 270 _In_ BOOLEAN Alertable, 271 _In_ PLARGE_INTEGER Interval); 272 273 _Must_inspect_result_ 274 NTKERNELAPI 275 BOOLEAN 276 NTAPI 277 KeDeregisterBugCheckCallback( 278 _Inout_ PKBUGCHECK_CALLBACK_RECORD CallbackRecord); 279 280 _Acquires_lock_(_Global_critical_region_) 281 _IRQL_requires_max_(APC_LEVEL) 282 NTKERNELAPI 283 VOID 284 NTAPI 285 KeEnterCriticalRegion(VOID); 286 287 _IRQL_requires_max_(DISPATCH_LEVEL) 288 NTKERNELAPI 289 VOID 290 NTAPI 291 KeInitializeDeviceQueue( 292 _Out_ PKDEVICE_QUEUE DeviceQueue); 293 294 NTKERNELAPI 295 VOID 296 NTAPI 297 KeInitializeDpc( 298 _Out_ __drv_aliasesMem PRKDPC Dpc, 299 _In_ PKDEFERRED_ROUTINE DeferredRoutine, 300 _In_opt_ __drv_aliasesMem PVOID DeferredContext); 301 302 NTKERNELAPI 303 VOID 304 NTAPI 305 KeInitializeMutex( 306 _Out_ PRKMUTEX Mutex, 307 _In_ ULONG Level); 308 309 _IRQL_requires_max_(PASSIVE_LEVEL) 310 NTKERNELAPI 311 VOID 312 NTAPI 313 KeInitializeSemaphore( 314 _Out_ PRKSEMAPHORE Semaphore, 315 _In_ LONG Count, 316 _In_ LONG Limit); 317 318 _IRQL_requires_max_(DISPATCH_LEVEL) 319 NTKERNELAPI 320 VOID 321 NTAPI 322 KeInitializeTimer( 323 _Out_ PKTIMER Timer); 324 325 _IRQL_requires_max_(DISPATCH_LEVEL) 326 NTKERNELAPI 327 VOID 328 NTAPI 329 KeInitializeTimerEx( 330 _Out_ PKTIMER Timer, 331 _In_ TIMER_TYPE Type); 332 333 _IRQL_requires_(DISPATCH_LEVEL) 334 NTKERNELAPI 335 BOOLEAN 336 NTAPI 337 KeInsertByKeyDeviceQueue( 338 _Inout_ PKDEVICE_QUEUE DeviceQueue, 339 _Inout_ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry, 340 _In_ ULONG SortKey); 341 342 _IRQL_requires_(DISPATCH_LEVEL) 343 NTKERNELAPI 344 BOOLEAN 345 NTAPI 346 KeInsertDeviceQueue( 347 _Inout_ PKDEVICE_QUEUE DeviceQueue, 348 _Inout_ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry); 349 350 NTKERNELAPI 351 BOOLEAN 352 NTAPI 353 KeInsertQueueDpc( 354 _Inout_ PRKDPC Dpc, 355 _In_opt_ PVOID SystemArgument1, 356 _In_opt_ PVOID SystemArgument2); 357 358 _Releases_lock_(_Global_critical_region_) 359 _IRQL_requires_max_(APC_LEVEL) 360 NTKERNELAPI 361 VOID 362 NTAPI 363 KeLeaveCriticalRegion(VOID); 364 365 NTHALAPI 366 LARGE_INTEGER 367 NTAPI 368 KeQueryPerformanceCounter( 369 _Out_opt_ PLARGE_INTEGER PerformanceFrequency); 370 371 _IRQL_requires_max_(PASSIVE_LEVEL) 372 NTKERNELAPI 373 KPRIORITY 374 NTAPI 375 KeQueryPriorityThread( 376 _In_ PRKTHREAD Thread); 377 378 NTKERNELAPI 379 ULONG 380 NTAPI 381 KeQueryTimeIncrement(VOID); 382 383 _IRQL_requires_max_(DISPATCH_LEVEL) 384 NTKERNELAPI 385 LONG 386 NTAPI 387 KeReadStateEvent( 388 _In_ PRKEVENT Event); 389 390 _IRQL_requires_max_(DISPATCH_LEVEL) 391 NTKERNELAPI 392 LONG 393 NTAPI 394 KeReadStateMutex( 395 _In_ PRKMUTEX Mutex); 396 397 _IRQL_requires_max_(DISPATCH_LEVEL) 398 NTKERNELAPI 399 LONG 400 NTAPI 401 KeReadStateSemaphore( 402 _In_ PRKSEMAPHORE Semaphore); 403 404 _IRQL_requires_max_(DISPATCH_LEVEL) 405 NTKERNELAPI 406 BOOLEAN 407 NTAPI 408 KeReadStateTimer( 409 _In_ PKTIMER Timer); 410 411 _Must_inspect_result_ 412 NTKERNELAPI 413 BOOLEAN 414 NTAPI 415 KeRegisterBugCheckCallback( 416 _Out_ PKBUGCHECK_CALLBACK_RECORD CallbackRecord, 417 _In_ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine, 418 _In_reads_bytes_opt_(Length) PVOID Buffer, 419 _In_ ULONG Length, 420 _In_ PUCHAR Component); 421 422 _When_(Wait==0, _IRQL_requires_max_(DISPATCH_LEVEL)) 423 _When_(Wait==1, _IRQL_requires_max_(APC_LEVEL)) 424 NTKERNELAPI 425 LONG 426 NTAPI 427 KeReleaseMutex( 428 _Inout_ PRKMUTEX Mutex, 429 _In_ BOOLEAN Wait); 430 431 _When_(Wait==0, _IRQL_requires_max_(DISPATCH_LEVEL)) 432 _When_(Wait==1, _IRQL_requires_max_(APC_LEVEL)) 433 NTKERNELAPI 434 LONG 435 NTAPI 436 KeReleaseSemaphore( 437 _Inout_ PRKSEMAPHORE Semaphore, 438 _In_ KPRIORITY Increment, 439 _In_ LONG Adjustment, 440 _In_ _Literal_ BOOLEAN Wait); 441 442 _IRQL_requires_(DISPATCH_LEVEL) 443 NTKERNELAPI 444 PKDEVICE_QUEUE_ENTRY 445 NTAPI 446 KeRemoveByKeyDeviceQueue( 447 _Inout_ PKDEVICE_QUEUE DeviceQueue, 448 _In_ ULONG SortKey); 449 450 _IRQL_requires_(DISPATCH_LEVEL) 451 NTKERNELAPI 452 PKDEVICE_QUEUE_ENTRY 453 NTAPI 454 KeRemoveDeviceQueue( 455 _Inout_ PKDEVICE_QUEUE DeviceQueue); 456 457 _IRQL_requires_max_(DISPATCH_LEVEL) 458 NTKERNELAPI 459 BOOLEAN 460 NTAPI 461 KeRemoveEntryDeviceQueue( 462 _Inout_ PKDEVICE_QUEUE DeviceQueue, 463 _Inout_ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry); 464 465 _IRQL_requires_max_(HIGH_LEVEL) 466 NTKERNELAPI 467 BOOLEAN 468 NTAPI 469 KeRemoveQueueDpc( 470 _Inout_ PRKDPC Dpc); 471 472 _IRQL_requires_max_(DISPATCH_LEVEL) 473 NTKERNELAPI 474 LONG 475 NTAPI 476 KeResetEvent( 477 _Inout_ PRKEVENT Event); 478 479 _When_(Wait==0, _IRQL_requires_max_(DISPATCH_LEVEL)) 480 _When_(Wait==1, _IRQL_requires_max_(APC_LEVEL)) 481 NTKERNELAPI 482 LONG 483 NTAPI 484 KeSetEvent( 485 _Inout_ PRKEVENT Event, 486 _In_ KPRIORITY Increment, 487 _In_ _Literal_ BOOLEAN Wait); 488 489 NTKERNELAPI 490 VOID 491 NTAPI 492 KeSetImportanceDpc( 493 _Inout_ PRKDPC Dpc, 494 _In_ KDPC_IMPORTANCE Importance); 495 496 _IRQL_requires_min_(PASSIVE_LEVEL) 497 _IRQL_requires_max_(DISPATCH_LEVEL) 498 NTKERNELAPI 499 KPRIORITY 500 NTAPI 501 KeSetPriorityThread( 502 _Inout_ PKTHREAD Thread, 503 _In_ KPRIORITY Priority); 504 505 _IRQL_requires_max_(DISPATCH_LEVEL) 506 NTKERNELAPI 507 BOOLEAN 508 NTAPI 509 KeSetTimer( 510 _Inout_ PKTIMER Timer, 511 _In_ LARGE_INTEGER DueTime, 512 _In_opt_ PKDPC Dpc); 513 514 _IRQL_requires_max_(DISPATCH_LEVEL) 515 NTKERNELAPI 516 BOOLEAN 517 NTAPI 518 KeSetTimerEx( 519 _Inout_ PKTIMER Timer, 520 _In_ LARGE_INTEGER DueTime, 521 _In_ LONG Period OPTIONAL, 522 _In_opt_ PKDPC Dpc); 523 524 NTHALAPI 525 VOID 526 NTAPI 527 KeStallExecutionProcessor( 528 _In_ ULONG MicroSeconds); 529 530 _IRQL_requires_max_(HIGH_LEVEL) 531 NTKERNELAPI 532 BOOLEAN 533 NTAPI 534 KeSynchronizeExecution( 535 _Inout_ PKINTERRUPT Interrupt, 536 _In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, 537 _In_opt_ __drv_aliasesMem PVOID SynchronizeContext); 538 539 _IRQL_requires_min_(PASSIVE_LEVEL) 540 _When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) 541 _When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) 542 NTKERNELAPI 543 NTSTATUS 544 NTAPI 545 KeWaitForMultipleObjects( 546 _In_ ULONG Count, 547 _In_reads_(Count) PVOID Object[], 548 _In_ __drv_strictTypeMatch(__drv_typeConst) WAIT_TYPE WaitType, 549 _In_ __drv_strictTypeMatch(__drv_typeCond) KWAIT_REASON WaitReason, 550 _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) KPROCESSOR_MODE WaitMode, 551 _In_ BOOLEAN Alertable, 552 _In_opt_ PLARGE_INTEGER Timeout, 553 _Out_opt_ PKWAIT_BLOCK WaitBlockArray); 554 555 #define KeWaitForMutexObject KeWaitForSingleObject 556 557 _IRQL_requires_min_(PASSIVE_LEVEL) 558 _When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) 559 _When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) 560 NTKERNELAPI 561 NTSTATUS 562 NTAPI 563 KeWaitForSingleObject( 564 _In_ _Points_to_data_ PVOID Object, 565 _In_ __drv_strictTypeMatch(__drv_typeCond) KWAIT_REASON WaitReason, 566 _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) KPROCESSOR_MODE WaitMode, 567 _In_ BOOLEAN Alertable, 568 _In_opt_ PLARGE_INTEGER Timeout); 569 $endif (_WDMDDK_) 570 $if (_NTIFS_) 571 572 NTKERNELAPI 573 VOID 574 NTAPI 575 KeInitializeMutant( 576 _Out_ PRKMUTANT Mutant, 577 _In_ BOOLEAN InitialOwner); 578 579 _IRQL_requires_max_(DISPATCH_LEVEL) 580 NTKERNELAPI 581 LONG 582 NTAPI 583 KeReadStateMutant( 584 _In_ PRKMUTANT Mutant); 585 586 _When_(Wait==0, _IRQL_requires_max_(DISPATCH_LEVEL)) 587 _When_(Wait==1, _IRQL_requires_max_(APC_LEVEL)) 588 NTKERNELAPI 589 LONG 590 NTAPI 591 KeReleaseMutant( 592 _Inout_ PRKMUTANT Mutant, 593 _In_ KPRIORITY Increment, 594 _In_ BOOLEAN Abandoned, 595 _In_ BOOLEAN Wait); 596 597 NTKERNELAPI 598 VOID 599 NTAPI 600 KeInitializeQueue( 601 _Out_ PRKQUEUE Queue, 602 _In_ ULONG Count); 603 604 _IRQL_requires_max_(DISPATCH_LEVEL) 605 NTKERNELAPI 606 LONG 607 NTAPI 608 KeReadStateQueue( 609 _In_ PRKQUEUE Queue); 610 611 _IRQL_requires_min_(PASSIVE_LEVEL) 612 _IRQL_requires_max_(DISPATCH_LEVEL) 613 NTKERNELAPI 614 LONG 615 NTAPI 616 KeInsertQueue( 617 _Inout_ PRKQUEUE Queue, 618 _Inout_ PLIST_ENTRY Entry); 619 620 _IRQL_requires_min_(PASSIVE_LEVEL) 621 _IRQL_requires_max_(DISPATCH_LEVEL) 622 NTKERNELAPI 623 LONG 624 NTAPI 625 KeInsertHeadQueue( 626 _Inout_ PRKQUEUE Queue, 627 _Inout_ PLIST_ENTRY Entry); 628 629 _IRQL_requires_min_(PASSIVE_LEVEL) 630 _When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) 631 _When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) 632 NTKERNELAPI 633 PLIST_ENTRY 634 NTAPI 635 KeRemoveQueue( 636 _Inout_ PRKQUEUE Queue, 637 _In_ KPROCESSOR_MODE WaitMode, 638 _In_opt_ PLARGE_INTEGER Timeout); 639 640 _IRQL_requires_max_(APC_LEVEL) 641 NTKERNELAPI 642 VOID 643 NTAPI 644 KeAttachProcess( 645 _Inout_ PKPROCESS Process); 646 647 _IRQL_requires_max_(APC_LEVEL) 648 NTKERNELAPI 649 VOID 650 NTAPI 651 KeDetachProcess(VOID); 652 653 _IRQL_requires_max_(DISPATCH_LEVEL) 654 NTKERNELAPI 655 PLIST_ENTRY 656 NTAPI 657 KeRundownQueue( 658 _Inout_ PRKQUEUE Queue); 659 660 _IRQL_requires_max_(APC_LEVEL) 661 NTKERNELAPI 662 VOID 663 NTAPI 664 KeStackAttachProcess( 665 _Inout_ PKPROCESS Process, 666 _Out_ PKAPC_STATE ApcState); 667 668 _IRQL_requires_max_(APC_LEVEL) 669 NTKERNELAPI 670 VOID 671 NTAPI 672 KeUnstackDetachProcess( 673 _In_ PKAPC_STATE ApcState); 674 675 _IRQL_requires_min_(PASSIVE_LEVEL) 676 _IRQL_requires_max_(DISPATCH_LEVEL) 677 NTKERNELAPI 678 UCHAR 679 NTAPI 680 KeSetIdealProcessorThread( 681 _Inout_ PKTHREAD Thread, 682 _In_ UCHAR Processor); 683 684 _IRQL_requires_max_(APC_LEVEL) 685 NTKERNELAPI 686 BOOLEAN 687 NTAPI 688 KeSetKernelStackSwapEnable( 689 _In_ BOOLEAN Enable); 690 691 #if defined(_X86_) 692 _Requires_lock_not_held_(*SpinLock) 693 _Acquires_lock_(*SpinLock) 694 _IRQL_raises_(SYNCH_LEVEL) 695 _IRQL_saves_ 696 NTHALAPI 697 KIRQL 698 FASTCALL 699 KeAcquireSpinLockRaiseToSynch( 700 _Inout_ PKSPIN_LOCK SpinLock); 701 #else 702 _Requires_lock_not_held_(*SpinLock) 703 _Acquires_lock_(*SpinLock) 704 _IRQL_raises_(SYNCH_LEVEL) 705 _IRQL_saves_ 706 NTKERNELAPI 707 KIRQL 708 KeAcquireSpinLockRaiseToSynch( 709 _Inout_ PKSPIN_LOCK SpinLock); 710 #endif 711 $endif (_NTIFS_) 712 713 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 714 715 #if (NTDDI_VERSION >= NTDDI_WINXP) 716 717 $if (_WDMDDK_) 718 _Requires_lock_not_held_(*LockHandle) 719 _Acquires_lock_(*LockHandle) 720 _Post_same_lock_(*SpinLock, *LockHandle) 721 _IRQL_requires_max_(DISPATCH_LEVEL) 722 _IRQL_saves_global_(QueuedSpinLock,LockHandle) 723 _IRQL_raises_(DISPATCH_LEVEL) 724 _DECL_HAL_KE_IMPORT 725 VOID 726 FASTCALL 727 KeAcquireInStackQueuedSpinLock( 728 _Inout_ PKSPIN_LOCK SpinLock, 729 _Out_ PKLOCK_QUEUE_HANDLE LockHandle); 730 731 _Requires_lock_not_held_(*LockHandle) 732 _Acquires_lock_(*LockHandle) 733 _Post_same_lock_(*SpinLock, *LockHandle) 734 _IRQL_requires_min_(DISPATCH_LEVEL) 735 NTKERNELAPI 736 VOID 737 FASTCALL 738 KeAcquireInStackQueuedSpinLockAtDpcLevel( 739 _Inout_ PKSPIN_LOCK SpinLock, 740 _Out_ PKLOCK_QUEUE_HANDLE LockHandle); 741 742 _Requires_lock_not_held_(*Interrupt->ActualLock) 743 _Acquires_lock_(*Interrupt->ActualLock) 744 _IRQL_requires_max_(HIGH_LEVEL) 745 _IRQL_saves_ 746 _IRQL_raises_(HIGH_LEVEL) 747 NTKERNELAPI 748 KIRQL 749 NTAPI 750 KeAcquireInterruptSpinLock( 751 _Inout_ PKINTERRUPT Interrupt); 752 753 _IRQL_requires_min_(PASSIVE_LEVEL) 754 _IRQL_requires_max_(DISPATCH_LEVEL) 755 NTKERNELAPI 756 BOOLEAN 757 NTAPI 758 KeAreApcsDisabled(VOID); 759 760 NTKERNELAPI 761 ULONG 762 NTAPI 763 KeGetRecommendedSharedDataAlignment(VOID); 764 765 _IRQL_requires_max_(PASSIVE_LEVEL) 766 NTKERNELAPI 767 ULONG 768 NTAPI 769 KeQueryRuntimeThread( 770 _In_ PKTHREAD Thread, 771 _Out_ PULONG UserTime); 772 773 _Requires_lock_held_(*LockHandle) 774 _Releases_lock_(*LockHandle) 775 _IRQL_requires_(DISPATCH_LEVEL) 776 NTKERNELAPI 777 VOID 778 FASTCALL 779 KeReleaseInStackQueuedSpinLockFromDpcLevel( 780 _In_ PKLOCK_QUEUE_HANDLE LockHandle); 781 782 _Requires_lock_held_(*Interrupt->ActualLock) 783 _Releases_lock_(*Interrupt->ActualLock) 784 _IRQL_requires_(HIGH_LEVEL) 785 NTKERNELAPI 786 VOID 787 NTAPI 788 KeReleaseInterruptSpinLock( 789 _Inout_ PKINTERRUPT Interrupt, 790 _In_ _IRQL_restores_ KIRQL OldIrql); 791 792 _IRQL_requires_(DISPATCH_LEVEL) 793 NTKERNELAPI 794 PKDEVICE_QUEUE_ENTRY 795 NTAPI 796 KeRemoveByKeyDeviceQueueIfBusy( 797 _Inout_ PKDEVICE_QUEUE DeviceQueue, 798 _In_ ULONG SortKey); 799 800 _Requires_lock_held_(*LockHandle) 801 _Releases_lock_(*LockHandle) 802 _IRQL_requires_(DISPATCH_LEVEL) 803 _IRQL_restores_global_(QueuedSpinLock,LockHandle) 804 _DECL_HAL_KE_IMPORT 805 VOID 806 FASTCALL 807 KeReleaseInStackQueuedSpinLock( 808 _In_ PKLOCK_QUEUE_HANDLE LockHandle); 809 $endif (_WDMDDK_) 810 $if (_NTDDK_) 811 _IRQL_requires_min_(PASSIVE_LEVEL) 812 _IRQL_requires_max_(DISPATCH_LEVEL) 813 NTKERNELAPI 814 BOOLEAN 815 NTAPI 816 KeAreApcsDisabled(VOID); 817 $endif (_NTDDK_) 818 $if (_NTIFS_) 819 820 _Requires_lock_not_held_(Number) 821 _Acquires_lock_(Number) 822 _IRQL_raises_(DISPATCH_LEVEL) 823 _DECL_HAL_KE_IMPORT 824 KIRQL 825 FASTCALL 826 KeAcquireQueuedSpinLock( 827 _In_ KSPIN_LOCK_QUEUE_NUMBER Number); 828 829 _Requires_lock_held_(Number) 830 _Releases_lock_(Number) 831 _DECL_HAL_KE_IMPORT 832 VOID 833 FASTCALL 834 KeReleaseQueuedSpinLock( 835 _In_ KSPIN_LOCK_QUEUE_NUMBER Number, 836 _In_ KIRQL OldIrql); 837 838 _Must_inspect_result_ 839 _Post_satisfies_(return == 1 || return == 0) 840 _DECL_HAL_KE_IMPORT 841 LOGICAL 842 FASTCALL 843 KeTryToAcquireQueuedSpinLock( 844 _In_ KSPIN_LOCK_QUEUE_NUMBER Number, 845 _Out_ _At_(*OldIrql, _IRQL_saves_) PKIRQL OldIrql); 846 $endif (_NTIFS_) 847 848 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 849 850 $if (_WDMDDK_) 851 #if (NTDDI_VERSION >= NTDDI_WINXPSP1) 852 853 _Must_inspect_result_ 854 NTKERNELAPI 855 BOOLEAN 856 NTAPI 857 KeDeregisterBugCheckReasonCallback( 858 _Inout_ PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord); 859 860 _Must_inspect_result_ 861 NTKERNELAPI 862 BOOLEAN 863 NTAPI 864 KeRegisterBugCheckReasonCallback( 865 _Out_ PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, 866 _In_ PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, 867 _In_ KBUGCHECK_CALLBACK_REASON Reason, 868 _In_ PUCHAR Component); 869 870 #endif /* (NTDDI_VERSION >= NTDDI_WINXPSP1) */ 871 872 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) 873 _IRQL_requires_max_(APC_LEVEL) 874 NTKERNELAPI 875 VOID 876 NTAPI 877 KeFlushQueuedDpcs(VOID); 878 #endif /* (NTDDI_VERSION >= NTDDI_WINXPSP2) */ 879 $endif (_WDMDDK_) 880 $if (_WDMDDK_ || _NTDDK_) 881 #if (NTDDI_VERSION >= NTDDI_WS03) 882 $endif (_WDMDDK_ || _NTDDK_) 883 884 $if (_WDMDDK_) 885 _IRQL_requires_max_(APC_LEVEL) 886 NTKERNELAPI 887 PVOID 888 NTAPI 889 KeRegisterNmiCallback( 890 _In_ PNMI_CALLBACK CallbackRoutine, 891 _In_opt_ PVOID Context); 892 893 _IRQL_requires_max_(APC_LEVEL) 894 NTKERNELAPI 895 NTSTATUS 896 NTAPI 897 KeDeregisterNmiCallback( 898 _In_ PVOID Handle); 899 900 NTKERNELAPI 901 VOID 902 NTAPI 903 KeInitializeThreadedDpc( 904 _Out_ PRKDPC Dpc, 905 _In_ PKDEFERRED_ROUTINE DeferredRoutine, 906 _In_opt_ PVOID DeferredContext); 907 908 _IRQL_requires_min_(PASSIVE_LEVEL) 909 _IRQL_requires_max_(IPI_LEVEL-1) 910 NTKERNELAPI 911 ULONG_PTR 912 NTAPI 913 KeIpiGenericCall( 914 _In_ PKIPI_BROADCAST_WORKER BroadcastFunction, 915 _In_ ULONG_PTR Context); 916 917 _Requires_lock_not_held_(*SpinLock) 918 _Acquires_lock_(*SpinLock) 919 _IRQL_requires_max_(DISPATCH_LEVEL) 920 _IRQL_saves_ 921 NTKERNELAPI 922 KIRQL 923 FASTCALL 924 KeAcquireSpinLockForDpc( 925 _Inout_ PKSPIN_LOCK SpinLock); 926 927 _Requires_lock_held_(*SpinLock) 928 _Releases_lock_(*SpinLock) 929 _IRQL_requires_(DISPATCH_LEVEL) 930 NTKERNELAPI 931 VOID 932 FASTCALL 933 KeReleaseSpinLockForDpc( 934 _Inout_ PKSPIN_LOCK SpinLock, 935 _In_ _IRQL_restores_ KIRQL OldIrql); 936 937 _Must_inspect_result_ 938 NTKERNELAPI 939 BOOLEAN 940 FASTCALL 941 KeTestSpinLock( 942 _In_ PKSPIN_LOCK SpinLock); 943 $endif (_WDMDDK_) 944 945 $if (_NTDDK_) 946 NTKERNELAPI 947 BOOLEAN 948 NTAPI 949 KeInvalidateAllCaches(VOID); 950 $endif (_NTDDK_) 951 $if (_WDMDDK_ || _NTDDK_) 952 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 953 $endif (_WDMDDK_ || _NTDDK_) 954 $if (_WDMDDK_ || _NTDDK_) 955 #if (NTDDI_VERSION >= NTDDI_WS03SP1) 956 $endif (_WDMDDK_ || _NTDDK_) 957 958 $if (_WDMDDK_) 959 _Must_inspect_result_ 960 _IRQL_requires_min_(DISPATCH_LEVEL) 961 _Post_satisfies_(return == 1 || return == 0) 962 NTKERNELAPI 963 BOOLEAN 964 FASTCALL 965 KeTryToAcquireSpinLockAtDpcLevel( 966 _Inout_ _Requires_lock_not_held_(*_Curr_) 967 _When_(return!=0, _Acquires_lock_(*_Curr_)) 968 PKSPIN_LOCK SpinLock); 969 970 _IRQL_requires_min_(PASSIVE_LEVEL) 971 _IRQL_requires_max_(DISPATCH_LEVEL) 972 NTKERNELAPI 973 BOOLEAN 974 NTAPI 975 KeAreAllApcsDisabled(VOID); 976 977 _Acquires_lock_(_Global_critical_region_) 978 _Requires_lock_not_held_(*Mutex) 979 _Acquires_lock_(*Mutex) 980 _IRQL_requires_max_(APC_LEVEL) 981 _IRQL_requires_min_(PASSIVE_LEVEL) 982 NTKERNELAPI 983 VOID 984 FASTCALL 985 KeAcquireGuardedMutex( 986 _Inout_ PKGUARDED_MUTEX GuardedMutex); 987 988 _Requires_lock_not_held_(*FastMutex) 989 _Acquires_lock_(*FastMutex) 990 _IRQL_requires_max_(APC_LEVEL) 991 _IRQL_requires_min_(PASSIVE_LEVEL) 992 NTKERNELAPI 993 VOID 994 FASTCALL 995 KeAcquireGuardedMutexUnsafe( 996 _Inout_ PKGUARDED_MUTEX GuardedMutex); 997 998 _Acquires_lock_(_Global_critical_region_) 999 _IRQL_requires_max_(APC_LEVEL) 1000 NTKERNELAPI 1001 VOID 1002 NTAPI 1003 KeEnterGuardedRegion(VOID); 1004 1005 _Releases_lock_(_Global_critical_region_) 1006 _IRQL_requires_max_(APC_LEVEL) 1007 NTKERNELAPI 1008 VOID 1009 NTAPI 1010 KeLeaveGuardedRegion(VOID); 1011 1012 _IRQL_requires_max_(APC_LEVEL) 1013 _IRQL_requires_min_(PASSIVE_LEVEL) 1014 NTKERNELAPI 1015 VOID 1016 FASTCALL 1017 KeInitializeGuardedMutex( 1018 _Out_ PKGUARDED_MUTEX GuardedMutex); 1019 1020 _Requires_lock_held_(*FastMutex) 1021 _Releases_lock_(*FastMutex) 1022 _IRQL_requires_max_(APC_LEVEL) 1023 NTKERNELAPI 1024 VOID 1025 FASTCALL 1026 KeReleaseGuardedMutexUnsafe( 1027 _Inout_ PKGUARDED_MUTEX GuardedMutex); 1028 1029 _Releases_lock_(_Global_critical_region_) 1030 _Requires_lock_held_(*Mutex) 1031 _Releases_lock_(*Mutex) 1032 _IRQL_requires_max_(APC_LEVEL) 1033 NTKERNELAPI 1034 VOID 1035 FASTCALL 1036 KeReleaseGuardedMutex( 1037 _Inout_ PKGUARDED_MUTEX GuardedMutex); 1038 1039 _Must_inspect_result_ 1040 _Success_(return != FALSE) 1041 _IRQL_requires_max_(APC_LEVEL) 1042 _Post_satisfies_(return == 1 || return == 0) 1043 NTKERNELAPI 1044 BOOLEAN 1045 FASTCALL 1046 KeTryToAcquireGuardedMutex( 1047 _When_ (return, _Requires_lock_not_held_(*_Curr_) _Acquires_exclusive_lock_(*_Curr_)) _Acquires_lock_(_Global_critical_region_) 1048 _Inout_ PKGUARDED_MUTEX GuardedMutex); 1049 $endif (_WDMDDK_) 1050 $if (_NTDDK_) 1051 _Must_inspect_result_ 1052 _IRQL_requires_max_(APC_LEVEL) 1053 NTKERNELAPI 1054 NTSTATUS 1055 NTAPI 1056 KeExpandKernelStackAndCallout( 1057 _In_ PEXPAND_STACK_CALLOUT Callout, 1058 _In_opt_ PVOID Parameter, 1059 _In_ SIZE_T Size); 1060 1061 _Acquires_lock_(_Global_critical_region_) 1062 _IRQL_requires_max_(APC_LEVEL) 1063 NTKERNELAPI 1064 VOID 1065 NTAPI 1066 KeEnterGuardedRegion(VOID); 1067 1068 _Releases_lock_(_Global_critical_region_) 1069 _IRQL_requires_max_(APC_LEVEL) 1070 NTKERNELAPI 1071 VOID 1072 NTAPI 1073 KeLeaveGuardedRegion(VOID); 1074 $endif (_NTDDK_) 1075 $if (_WDMDDK_ || _NTDDK_) 1076 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */ 1077 $endif (_WDMDDK_ || _NTDDK_) 1078 1079 #if (NTDDI_VERSION >= NTDDI_VISTA) 1080 $if (_WDMDDK_) 1081 _Requires_lock_not_held_(*LockHandle) 1082 _Acquires_lock_(*LockHandle) 1083 _Post_same_lock_(*SpinLock, *LockHandle) 1084 _IRQL_requires_max_(DISPATCH_LEVEL) 1085 _IRQL_saves_global_(QueuedSpinLock,LockHandle) 1086 NTKERNELAPI 1087 VOID 1088 FASTCALL 1089 KeAcquireInStackQueuedSpinLockForDpc( 1090 _Inout_ PKSPIN_LOCK SpinLock, 1091 _Out_ PKLOCK_QUEUE_HANDLE LockHandle); 1092 1093 _Requires_lock_held_(*LockHandle) 1094 _Releases_lock_(*LockHandle) 1095 _IRQL_requires_(DISPATCH_LEVEL) 1096 _IRQL_restores_global_(QueuedSpinLock,LockHandle) 1097 NTKERNELAPI 1098 VOID 1099 FASTCALL 1100 KeReleaseInStackQueuedSpinLockForDpc( 1101 _In_ PKLOCK_QUEUE_HANDLE LockHandle); 1102 1103 _IRQL_requires_(DISPATCH_LEVEL) 1104 NTKERNELAPI 1105 NTSTATUS 1106 NTAPI 1107 KeQueryDpcWatchdogInformation( 1108 _Out_ PKDPC_WATCHDOG_INFORMATION WatchdogInformation); 1109 $endif (_WDMDDK_) 1110 $if (_WDMDDK_ || _NTDDK_) 1111 #if defined(SINGLE_GROUP_LEGACY_API) 1112 $endif (_WDMDDK_ || _NTDDK_) 1113 1114 $if (_WDMDDK_) 1115 _IRQL_requires_min_(PASSIVE_LEVEL) 1116 _IRQL_requires_max_(APC_LEVEL) 1117 NTKERNELAPI 1118 KAFFINITY 1119 NTAPI 1120 KeSetSystemAffinityThreadEx( 1121 _In_ KAFFINITY Affinity); 1122 1123 _IRQL_requires_min_(PASSIVE_LEVEL) 1124 _IRQL_requires_max_(APC_LEVEL) 1125 NTKERNELAPI 1126 VOID 1127 NTAPI 1128 KeRevertToUserAffinityThreadEx( 1129 _In_ KAFFINITY Affinity); 1130 1131 NTKERNELAPI 1132 ULONG 1133 NTAPI 1134 KeQueryActiveProcessorCount( 1135 _Out_opt_ PKAFFINITY ActiveProcessors); 1136 1137 NTKERNELAPI 1138 ULONG 1139 NTAPI 1140 KeQueryMaximumProcessorCount(VOID); 1141 $endif (_WDMDDK_) 1142 $if (_NTDDK_) 1143 NTKERNELAPI 1144 ULONG 1145 NTAPI 1146 KeQueryActiveProcessorCount( 1147 _Out_opt_ PKAFFINITY ActiveProcessors); 1148 1149 NTKERNELAPI 1150 ULONG 1151 NTAPI 1152 KeQueryMaximumProcessorCount(VOID); 1153 $endif (_NTDDK_) 1154 $if (_WDMDDK_ || _NTDDK_) 1155 #endif /* SINGLE_GROUP_LEGACY_API */ 1156 $endif (_WDMDDK_ || _NTDDK_) 1157 $if (_NTIFS_) 1158 _IRQL_requires_max_(DISPATCH_LEVEL) 1159 NTKERNELAPI 1160 VOID 1161 KeQueryOwnerMutant( 1162 _In_ PKMUTANT Mutant, 1163 _Out_ PCLIENT_ID ClientId); 1164 1165 _IRQL_requires_min_(PASSIVE_LEVEL) 1166 _When_((Timeout==NULL || *Timeout!=0), _IRQL_requires_max_(APC_LEVEL)) 1167 _When_((Timeout!=NULL && *Timeout==0), _IRQL_requires_max_(DISPATCH_LEVEL)) 1168 NTKERNELAPI 1169 ULONG 1170 NTAPI 1171 KeRemoveQueueEx( 1172 _Inout_ PKQUEUE Queue, 1173 _In_ KPROCESSOR_MODE WaitMode, 1174 _In_ BOOLEAN Alertable, 1175 _In_opt_ PLARGE_INTEGER Timeout, 1176 _Out_writes_to_(Count, return) PLIST_ENTRY *EntryArray, 1177 _In_ ULONG Count); 1178 $endif (_NTIFS_) 1179 1180 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 1181 1182 $if (_WDMDDK_) 1183 #if (NTDDI_VERSION >= NTDDI_WS08) 1184 1185 _IRQL_requires_max_(APC_LEVEL) 1186 PVOID 1187 NTAPI 1188 KeRegisterProcessorChangeCallback( 1189 _In_ PPROCESSOR_CALLBACK_FUNCTION CallbackFunction, 1190 _In_opt_ PVOID CallbackContext, 1191 _In_ ULONG Flags); 1192 1193 _IRQL_requires_max_(APC_LEVEL) 1194 VOID 1195 NTAPI 1196 KeDeregisterProcessorChangeCallback( 1197 _In_ PVOID CallbackHandle); 1198 1199 #endif /* (NTDDI_VERSION >= NTDDI_WS08) */ 1200 $endif (_WDMDDK_) 1201 $if (_WDMDDK_ || _NTDDK_) 1202 #if (NTDDI_VERSION >= NTDDI_WIN7) 1203 $endif (_WDMDDK_ || _NTDDK_) 1204 1205 $if (_WDMDDK_) 1206 _IRQL_requires_max_(DISPATCH_LEVEL) 1207 _IRQL_requires_min_(PASSIVE_LEVEL) 1208 _IRQL_requires_same_ 1209 ULONG64 1210 NTAPI 1211 KeQueryTotalCycleTimeProcess( 1212 _Inout_ PKPROCESS Process, 1213 _Out_ PULONG64 CycleTimeStamp); 1214 1215 _IRQL_requires_max_(APC_LEVEL) 1216 _IRQL_requires_min_(PASSIVE_LEVEL) 1217 _IRQL_requires_same_ 1218 ULONG64 1219 NTAPI 1220 KeQueryTotalCycleTimeThread( 1221 _Inout_ PKTHREAD Thread, 1222 _Out_ PULONG64 CycleTimeStamp); 1223 1224 _Must_inspect_result_ 1225 NTKERNELAPI 1226 NTSTATUS 1227 NTAPI 1228 KeSetTargetProcessorDpcEx( 1229 _Inout_ PKDPC Dpc, 1230 _In_ PPROCESSOR_NUMBER ProcNumber); 1231 1232 _IRQL_requires_min_(PASSIVE_LEVEL) 1233 _IRQL_requires_max_(APC_LEVEL) 1234 NTKERNELAPI 1235 VOID 1236 NTAPI 1237 KeSetSystemGroupAffinityThread( 1238 _In_ PGROUP_AFFINITY Affinity, 1239 _Out_opt_ PGROUP_AFFINITY PreviousAffinity); 1240 1241 _IRQL_requires_min_(PASSIVE_LEVEL) 1242 _IRQL_requires_max_(APC_LEVEL) 1243 NTKERNELAPI 1244 VOID 1245 NTAPI 1246 KeRevertToUserGroupAffinityThread( 1247 _In_ PGROUP_AFFINITY PreviousAffinity); 1248 1249 _IRQL_requires_max_(DISPATCH_LEVEL) 1250 NTKERNELAPI 1251 BOOLEAN 1252 NTAPI 1253 KeSetCoalescableTimer( 1254 _Inout_ PKTIMER Timer, 1255 _In_ LARGE_INTEGER DueTime, 1256 _In_ ULONG Period, 1257 _In_ ULONG TolerableDelay, 1258 _In_opt_ PKDPC Dpc); 1259 1260 NTKERNELAPI 1261 ULONGLONG 1262 NTAPI 1263 KeQueryUnbiasedInterruptTime(VOID); 1264 1265 NTKERNELAPI 1266 ULONG 1267 NTAPI 1268 KeQueryActiveProcessorCountEx( 1269 _In_ USHORT GroupNumber); 1270 1271 NTKERNELAPI 1272 ULONG 1273 NTAPI 1274 KeQueryMaximumProcessorCountEx( 1275 _In_ USHORT GroupNumber); 1276 1277 NTKERNELAPI 1278 USHORT 1279 NTAPI 1280 KeQueryActiveGroupCount(VOID); 1281 1282 NTKERNELAPI 1283 USHORT 1284 NTAPI 1285 KeQueryMaximumGroupCount(VOID); 1286 1287 NTKERNELAPI 1288 KAFFINITY 1289 NTAPI 1290 KeQueryGroupAffinity( 1291 _In_ USHORT GroupNumber); 1292 1293 NTKERNELAPI 1294 ULONG 1295 NTAPI 1296 KeGetCurrentProcessorNumberEx( 1297 _Out_opt_ PPROCESSOR_NUMBER ProcNumber); 1298 1299 NTKERNELAPI 1300 VOID 1301 NTAPI 1302 KeQueryNodeActiveAffinity( 1303 _In_ USHORT NodeNumber, 1304 _Out_opt_ PGROUP_AFFINITY Affinity, 1305 _Out_opt_ PUSHORT Count); 1306 1307 NTKERNELAPI 1308 USHORT 1309 NTAPI 1310 KeQueryNodeMaximumProcessorCount( 1311 _In_ USHORT NodeNumber); 1312 1313 NTKERNELAPI 1314 USHORT 1315 NTAPI 1316 KeQueryHighestNodeNumber(VOID); 1317 1318 NTKERNELAPI 1319 USHORT 1320 NTAPI 1321 KeGetCurrentNodeNumber(VOID); 1322 1323 _IRQL_requires_max_(DISPATCH_LEVEL) 1324 NTKERNELAPI 1325 NTSTATUS 1326 NTAPI 1327 KeQueryLogicalProcessorRelationship( 1328 _In_opt_ PPROCESSOR_NUMBER ProcessorNumber OPTIONAL, 1329 _In_ LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, 1330 _Out_writes_bytes_opt_(*Length) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information, 1331 _Inout_ PULONG Length); 1332 1333 _Must_inspect_result_ 1334 _IRQL_requires_max_(DISPATCH_LEVEL) 1335 _Ret_range_(<=, 0) 1336 _When_(return==0, _Kernel_float_saved_) 1337 NTKERNELAPI 1338 NTSTATUS 1339 NTAPI 1340 KeSaveExtendedProcessorState( 1341 _In_ ULONG64 Mask, 1342 _Out_ _Requires_lock_not_held_(*_Curr_) 1343 _When_(return==0, _Acquires_lock_(*_Curr_)) 1344 PXSTATE_SAVE XStateSave); 1345 1346 _Kernel_float_restored_ 1347 NTKERNELAPI 1348 VOID 1349 NTAPI 1350 KeRestoreExtendedProcessorState( 1351 _In_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) 1352 PXSTATE_SAVE XStateSave); 1353 1354 NTSTATUS 1355 NTAPI 1356 KeGetProcessorNumberFromIndex( 1357 _In_ ULONG ProcIndex, 1358 _Out_ PPROCESSOR_NUMBER ProcNumber); 1359 1360 ULONG 1361 NTAPI 1362 KeGetProcessorIndexFromNumber( 1363 _In_ PPROCESSOR_NUMBER ProcNumber); 1364 $endif (_WDMDDK_) 1365 $if (_NTDDK_) 1366 NTKERNELAPI 1367 ULONG 1368 NTAPI 1369 KeQueryActiveProcessorCountEx( 1370 _In_ USHORT GroupNumber); 1371 1372 NTKERNELAPI 1373 ULONG 1374 NTAPI 1375 KeQueryMaximumProcessorCountEx( 1376 _In_ USHORT GroupNumber); 1377 1378 NTKERNELAPI 1379 USHORT 1380 NTAPI 1381 KeQueryActiveGroupCount(VOID); 1382 1383 NTKERNELAPI 1384 USHORT 1385 NTAPI 1386 KeQueryMaximumGroupCount(VOID); 1387 1388 NTKERNELAPI 1389 KAFFINITY 1390 NTAPI 1391 KeQueryGroupAffinity( 1392 _In_ USHORT GroupNumber); 1393 1394 NTKERNELAPI 1395 ULONG 1396 NTAPI 1397 KeGetCurrentProcessorNumberEx( 1398 _Out_opt_ PPROCESSOR_NUMBER ProcNumber); 1399 1400 NTKERNELAPI 1401 VOID 1402 NTAPI 1403 KeQueryNodeActiveAffinity( 1404 _In_ USHORT NodeNumber, 1405 _Out_opt_ PGROUP_AFFINITY Affinity, 1406 _Out_opt_ PUSHORT Count); 1407 1408 NTKERNELAPI 1409 USHORT 1410 NTAPI 1411 KeQueryNodeMaximumProcessorCount( 1412 _In_ USHORT NodeNumber); 1413 1414 NTKERNELAPI 1415 USHORT 1416 NTAPI 1417 KeQueryHighestNodeNumber(VOID); 1418 1419 NTKERNELAPI 1420 USHORT 1421 NTAPI 1422 KeGetCurrentNodeNumber(VOID); 1423 1424 _IRQL_requires_max_(DISPATCH_LEVEL) 1425 NTKERNELAPI 1426 NTSTATUS 1427 NTAPI 1428 KeQueryLogicalProcessorRelationship( 1429 _In_opt_ PPROCESSOR_NUMBER ProcessorNumber, 1430 _In_ LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, 1431 _Out_writes_bytes_opt_(*Length) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information, 1432 _Inout_ PULONG Length); 1433 1434 _IRQL_requires_max_(APC_LEVEL) 1435 NTKERNELAPI 1436 NTSTATUS 1437 NTAPI 1438 KeSetHardwareCounterConfiguration( 1439 _In_reads_(Count) PHARDWARE_COUNTER CounterArray, 1440 _In_ ULONG Count); 1441 1442 _IRQL_requires_max_(APC_LEVEL) 1443 NTKERNELAPI 1444 NTSTATUS 1445 NTAPI 1446 KeQueryHardwareCounterConfiguration( 1447 _Out_writes_to_(MaximumCount, *Count) PHARDWARE_COUNTER CounterArray, 1448 _In_ ULONG MaximumCount, 1449 _Out_ PULONG Count); 1450 $endif (_NTDDK_) 1451 $if (_WDMDDK_ || _NTDDK_) 1452 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 1453 $endif (_WDMDDK_ || _NTDDK_) 1454 $if (_WDMDDK_) 1455 #if !defined(_IA64_) 1456 NTHALAPI 1457 VOID 1458 NTAPI 1459 KeFlushWriteBuffer(VOID); 1460 #endif 1461 1462 /* VOID 1463 * KeInitializeCallbackRecord( 1464 * IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord) 1465 */ 1466 #define KeInitializeCallbackRecord(CallbackRecord) \ 1467 (CallbackRecord)->State = BufferEmpty; 1468 1469 #if defined(_PREFAST_) 1470 1471 void __PREfastPagedCode(void); 1472 void __PREfastPagedCodeLocked(void); 1473 #define PAGED_CODE() __PREfastPagedCode(); 1474 #define PAGED_CODE_LOCKED() __PREfastPagedCodeLocked(); 1475 1476 #elif DBG 1477 1478 #if (NTDDI_VERSION >= NTDDI_VISTA) 1479 #define PAGED_ASSERT( exp ) NT_ASSERT( exp ) 1480 #else 1481 #define PAGED_ASSERT( exp ) ASSERT( exp ) 1482 #endif 1483 1484 #define PAGED_CODE() { \ 1485 if (KeGetCurrentIrql() > APC_LEVEL) { \ 1486 KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \ 1487 PAGED_ASSERT(FALSE); \ 1488 } \ 1489 } 1490 1491 #define PAGED_CODE_LOCKED() NOP_FUNCTION; 1492 1493 #else 1494 1495 #define PAGED_CODE() NOP_FUNCTION; 1496 #define PAGED_CODE_LOCKED() NOP_FUNCTION; 1497 1498 #endif /* DBG */ 1499 1500 $endif (_WDMDDK_) 1501