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