104 Apc->ApcStateIndex =
Thread->ApcStateIndex;
109 ApcMode = Apc->ApcMode;
119 if (Apc->NormalRoutine)
142 ListHead = &
ApcState->ApcListHead[ApcMode];
143 NextEntry = ListHead->
Blink;
144 while (NextEntry != ListHead)
150 if (!QueuedApc->NormalRoutine)
break;
153 NextEntry = NextEntry->
Blink;
161 if (
Thread->ApcStateIndex == Apc->ApcStateIndex)
176 if (!
Thread->SpecialApcDisable)
198 RequestInterrupt =
TRUE;
202 !(
Thread->SpecialApcDisable) &&
203 (!(Apc->NormalRoutine) ||
204 (!(
Thread->KernelApcDisable) &&
205 !(
Thread->ApcState.KernelApcInProgress))))
221 !(
Thread->SpecialApcDisable) &&
222 (!(Apc->NormalRoutine) ||
223 (!(
Thread->KernelApcDisable) &&
224 !(
Thread->ApcState.KernelApcInProgress))))
227 DPRINT1(
"A thread was in a gate wait\n");
230 Gate =
Thread->GateObject;
256 (
Thread->ApcState.UserApcPending)))
320 OldTrapFrame =
Thread->TrapFrame;
321 Thread->TrapFrame = TrapFrame;
327 if (
Thread->SpecialApcDisable)
goto Quickie;
351 NormalRoutine = Apc->NormalRoutine;
352 KernelRoutine = Apc->KernelRoutine;
388 if ((
Thread->ApcState.KernelApcInProgress) ||
389 (
Thread->KernelApcDisable))
441 (
Thread->ApcState.UserApcPending))
462 NormalRoutine = Apc->NormalRoutine;
463 KernelRoutine = Apc->KernelRoutine;
511 Thread->TrapFrame = OldTrapFrame;
665 Apc->Size =
sizeof(
KAPC);
671 Apc->ApcStateIndex =
Thread->ApcStateIndex;
676 ASSERT((TargetEnvironment <= Thread->ApcStateIndex) ||
680 Apc->ApcStateIndex = TargetEnvironment;
685 Apc->KernelRoutine = KernelRoutine;
686 Apc->RundownRoutine = RundownRoutine;
687 Apc->NormalRoutine = NormalRoutine;
700 Apc->NormalContext =
NULL;
704 Apc->Inserted =
FALSE;
750 if (!(
Thread->ApcQueueable) || (Apc->Inserted))
760 Apc->Inserted =
TRUE;
841 CurrentEntry = FirstEntry;
849 CurrentEntry = CurrentEntry->
Flink;
850 }
while (CurrentEntry != FirstEntry);
899 Inserted = Apc->Inserted;
903 Apc->Inserted =
FALSE;
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
#define ASSERT_IRQL_EQUAL(x)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define KeRaiseIrql(irql, oldIrql)
#define KeLowerIrql(oldIrql)
#define KeGetCurrentIrql()
#define InitializeListHead(ListHead)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
VOID FASTCALL HalRequestSoftwareInterrupt(IN KIRQL Irql)
#define KeGetCurrentThread
FORCEINLINE VOID KiAcquireApcLockRaiseToSynch(IN PKTHREAD Thread, IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE VOID KiAcquireApcLockRaiseToDpc(IN PKTHREAD Thread, IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE VOID KiRequestApcInterrupt(IN BOOLEAN NeedApc, IN UCHAR Processor)
FORCEINLINE VOID KiAcquireThreadLock(IN PKTHREAD Thread)
#define KeLeaveCriticalRegion()
FORCEINLINE VOID KiReleaseDispatcherObject(IN DISPATCHER_HEADER *Object)
FORCEINLINE VOID KiInsertDeferredReadyList(IN PKTHREAD Thread)
FORCEINLINE VOID KiAcquireDispatcherObject(IN DISPATCHER_HEADER *Object)
FORCEINLINE VOID KiReleaseDispatcherLockFromSynchLevel(VOID)
#define KeEnterCriticalRegion()
FORCEINLINE VOID KiReleaseThreadLock(IN PKTHREAD Thread)
FORCEINLINE VOID KiAcquireDispatcherLockAtSynchLevel(VOID)
FORCEINLINE VOID KiReleaseApcLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE KIRQL KiAcquireDispatcherLock(VOID)
FORCEINLINE VOID KiReleaseApcLock(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
VOID(NTAPI * PKRUNDOWN_ROUTINE)(IN struct _KAPC *Apc)
VOID(NTAPI * PKKERNEL_ROUTINE)(IN struct _KAPC *Apc, IN OUT PKNORMAL_ROUTINE *NormalRoutine OPTIONAL, IN OUT PVOID *NormalContext OPTIONAL, IN OUT PVOID *SystemArgument1 OPTIONAL, IN OUT PVOID *SystemArgument2 OPTIONAL)
VOID(NTAPI * PKNORMAL_ROUTINE)(IN PVOID NormalContext OPTIONAL, IN PVOID SystemArgument1 OPTIONAL, IN PVOID SystemArgument2 OPTIONAL)
enum _KAPC_ENVIRONMENT KAPC_ENVIRONMENT
VOID FASTCALL KiUnwaitThread(IN PKTHREAD Thread, IN LONG_PTR WaitStatus, IN KPRIORITY Increment)
BOOLEAN NTAPI KeTestAlertThread(IN KPROCESSOR_MODE AlertMode)
VOID NTAPI KiInitializeUserApc(IN PKEXCEPTION_FRAME Reserved, IN PKTRAP_FRAME TrapFrame, IN PKNORMAL_ROUTINE NormalRoutine, IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
VOID FASTCALL KiExitDispatcher(KIRQL OldIrql)
_Out_ PKAPC_STATE ApcState
VOID NTAPI KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, IN PKEXCEPTION_FRAME ExceptionFrame, IN PKTRAP_FRAME TrapFrame)
VOID NTAPI _KeEnterCriticalRegion(VOID)
BOOLEAN NTAPI KeInsertQueueApc(IN PKAPC Apc, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN KPRIORITY PriorityBoost)
VOID NTAPI KiCheckForKernelApcDelivery(VOID)
VOID NTAPI _KeLeaveCriticalRegion(VOID)
BOOLEAN NTAPI KeAreAllApcsDisabled(VOID)
PLIST_ENTRY NTAPI KeFlushQueueApc(IN PKTHREAD Thread, IN KPROCESSOR_MODE PreviousMode)
BOOLEAN NTAPI KeRemoveQueueApc(IN PKAPC Apc)
VOID FASTCALL KiInsertQueueApc(IN PKAPC Apc, IN KPRIORITY PriorityBoost)
FORCEINLINE VOID RepairList(IN PLIST_ENTRY Original, IN PLIST_ENTRY Copy, IN KPROCESSOR_MODE Mode)
VOID NTAPI KiMoveApcState(PKAPC_STATE OldState, PKAPC_STATE NewState)
BOOLEAN NTAPI KeAreApcsDisabled(VOID)
VOID NTAPI KeInitializeApc(IN PKAPC Apc, IN PKTHREAD Thread, IN KAPC_ENVIRONMENT TargetEnvironment, IN PKKERNEL_ROUTINE KernelRoutine, IN PKRUNDOWN_ROUTINE RundownRoutine OPTIONAL, IN PKNORMAL_ROUTINE NormalRoutine, IN KPROCESSOR_MODE Mode, IN PVOID Context)
#define STATUS_KERNEL_APC
VOID NTAPI PsExitSpecialApc(PKAPC Apc, PKNORMAL_ROUTINE *NormalRoutine, PVOID *NormalContext, PVOID *SystemArgument1, PVOID *SystemArgument2)
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
PULONG MinorVersion OPTIONAL
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
#define ASSERT_APC(Object)
#define KAPC_STATE_ACTUAL_LENGTH
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
_In_ KPROCESSOR_MODE PreviousMode