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