mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
Fix termination of process under debug.
svn path=/trunk/; revision=32007
This commit is contained in:
parent
ff436a13fc
commit
4b0245fc44
|
@ -1063,6 +1063,17 @@ DbgkpDeleteObject(IN PVOID DebugObject)
|
|||
ASSERT(IsListEmpty(&((PDEBUG_OBJECT)DebugObject)->EventList));
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
DbgkpDelayedTerminateProcess(PVOID Arg)
|
||||
{
|
||||
PWORK_QUEUE_ITEM WorkItem = (PWORK_QUEUE_ITEM)Arg;
|
||||
PEPROCESS OwnerProcess = *((PEPROCESS *)&WorkItem[1]);
|
||||
ExFreePool(WorkItem);
|
||||
/* Terminate the process */
|
||||
PsTerminateProcess(OwnerProcess, STATUS_DEBUGGER_INACTIVE);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
||||
|
@ -1079,6 +1090,8 @@ DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
|||
DBGKTRACE(DBGK_OBJECT_DEBUG, "OwnerProcess: %p DebugObject: %p\n",
|
||||
OwnerProcess, DebugObject);
|
||||
|
||||
DPRINT("APC DISABLE: %d\n", ((PETHREAD)KeGetCurrentThread())->Tcb.CombinedApcDisable);
|
||||
|
||||
/* If this isn't the last handle, do nothing */
|
||||
if (SystemHandleCount > 1) return;
|
||||
|
||||
|
@ -1127,8 +1140,16 @@ DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
|||
/* Check if we terminate on exit */
|
||||
if (DebugObject->KillProcessOnExit)
|
||||
{
|
||||
/* Terminate the process */
|
||||
PsTerminateProcess(OwnerProcess, STATUS_DEBUGGER_INACTIVE);
|
||||
PWORK_QUEUE_ITEM WorkItem =
|
||||
ExAllocatePool
|
||||
(NonPagedPool,
|
||||
sizeof(WORK_QUEUE_ITEM) + sizeof(PVOID));
|
||||
ExInitializeWorkItem
|
||||
(WorkItem,
|
||||
DbgkpDelayedTerminateProcess,
|
||||
WorkItem);
|
||||
*((PEPROCESS *)&WorkItem[1]) = OwnerProcess;
|
||||
ExQueueWorkItem(WorkItem, CriticalWorkQueue);
|
||||
}
|
||||
|
||||
/* Dereference the debug object */
|
||||
|
|
Loading…
Reference in a new issue