[NTOS:KD] Correctly define previous mode when entering KDBG (addendum to 0c76bbfe98)

This commit is contained in:
Hervé Poussineau 2020-11-17 14:22:27 +01:00
parent 6488440a6a
commit 44c6df4b27

View file

@ -56,6 +56,7 @@ static ULONG KdbgNextApiNumber = DbgKdContinueApi;
static CONTEXT KdbgContext; static CONTEXT KdbgContext;
static EXCEPTION_RECORD64 KdbgExceptionRecord; static EXCEPTION_RECORD64 KdbgExceptionRecord;
static BOOLEAN KdbgFirstChanceException; static BOOLEAN KdbgFirstChanceException;
static KPROCESSOR_MODE KdbgPreviousMode;
static NTSTATUS KdbgContinueStatus = STATUS_SUCCESS; static NTSTATUS KdbgContinueStatus = STATUS_SUCCESS;
/* LOCKING FUNCTIONS *********************************************************/ /* LOCKING FUNCTIONS *********************************************************/
@ -580,6 +581,7 @@ KdSendPacket(
KdbgNextApiNumber = DbgKdGetContextApi; KdbgNextApiNumber = DbgKdGetContextApi;
KdbgExceptionRecord = WaitStateChange->u.Exception.ExceptionRecord; KdbgExceptionRecord = WaitStateChange->u.Exception.ExceptionRecord;
KdbgFirstChanceException = WaitStateChange->u.Exception.FirstChance; KdbgFirstChanceException = WaitStateChange->u.Exception.FirstChance;
KdbgPreviousMode = ((PKTHREAD)(ULONG_PTR)WaitStateChange->Thread)->PreviousMode;
return; return;
} }
} }
@ -599,7 +601,7 @@ KdSendPacket(
} }
Result = KdbEnterDebuggerException(&KdbgExceptionRecord, Result = KdbEnterDebuggerException(&KdbgExceptionRecord,
KernelMode, // FIXME KdbgPreviousMode,
&KdbgContext, &KdbgContext,
KdbgFirstChanceException); KdbgFirstChanceException);
#else #else