[NTOSKRNL/x64] Fix bug in KiInitializeContextThread

The function set CtxSwitchFrame->ApcBypass to FALSE, preventing APCs (like when user mode sets the context while the thread is suspended) from being delivered as soon as the thread lowers IRQL to PASSIVE_LEVEL. This resulted in the SetContext APC to be delivered only after the user mode APC was initialized, overwriting the user mode APC context in the trap frame. This caused kernel32_winetest process to break.
This commit is contained in:
Timo Kreuzer 2023-08-16 01:14:28 +03:00
parent 995d255962
commit 583be404dd

View file

@ -134,7 +134,7 @@ KiInitializeContextThread(IN PKTHREAD Thread,
/* Set up the Context Switch Frame */
CtxSwitchFrame->Return = (ULONG64)KiThreadStartup;
CtxSwitchFrame->ApcBypass = FALSE;
CtxSwitchFrame->ApcBypass = TRUE;
StartFrame->P1Home = (ULONG64)StartRoutine;
StartFrame->P2Home = (ULONG64)StartContext;