#include <ntoskrnl.h>
#define NDEBUG
-#include <internal/debug.h>
+#include <debug.h>
/* TYPES *********************************************************************/
STATIC KDB_KTRAP_FRAME KdbTrapFrame = { { 0 } }; /* The trapframe which was passed to KdbEnterDebuggerException */
STATIC KDB_KTRAP_FRAME KdbThreadTrapFrame = { { 0 } }; /* The trapframe of the current thread (KdbCurrentThread) */
STATIC KAPC_STATE KdbApcState;
+extern BOOLEAN KdbpBugCheckRequested;
/* Array of conditions when to enter KDB */
STATIC KDB_ENTER_CONDITION KdbEnterConditions[][2] =
if (KeIsExecutingDpc() && Process != KdbCurrentProcess)
{
KdbpPrint("Cannot attach to thread within another process while executing a DPC.\n");
+ ObDereferenceObject(Thread);
return FALSE;
}
KdbCurrentProcess = Process;
}
+ ObDereferenceObject(Thread);
return TRUE;
}
}
Entry = Process->ThreadListHead.Flink;
+ ObDereferenceObject(Process);
if (Entry == &KdbCurrentProcess->ThreadListHead)
{
KdbpPrint("No threads in process 0x%08x, cannot attach to process!\n", (ULONG)ProcessId);
/* Leave critical section */
Ke386RestoreFlags(OldEflags);
+ /* Check if user requested a bugcheck */
+ if (KdbpBugCheckRequested)
+ {
+ /* Clear the flag and bugcheck the system */
+ KdbpBugCheckRequested = FALSE;
+ KeBugCheck(MANUALLY_INITIATED_CRASH);
+ }
+
continue_execution:
/* Clear debug status */
if (ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */
}
VOID
-STDCALL
+NTAPI
KdbpGetCommandLineSettings(PCHAR p1)
{
PCHAR p2;
IN PVOID Src,
IN ULONG Bytes)
{
- BOOLEAN Result;
+ BOOLEAN Result = TRUE;
ULONG_PTR Start, End, Write;
for (Start = (ULONG_PTR)Src,
Write = (ULONG_PTR)Dest;
Result && (Start < End);
Start++, Write++)
- if (!KdpSafeReadMemory(Start, 1, (PVOID)Write))
+ if (!KdpSafeWriteMemory(Write, 1, *((PCHAR)Start)))
Result = FALSE;
return Result ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION;