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));
|
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
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
||||||
|
@ -1079,6 +1090,8 @@ DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
||||||
DBGKTRACE(DBGK_OBJECT_DEBUG, "OwnerProcess: %p DebugObject: %p\n",
|
DBGKTRACE(DBGK_OBJECT_DEBUG, "OwnerProcess: %p DebugObject: %p\n",
|
||||||
OwnerProcess, DebugObject);
|
OwnerProcess, DebugObject);
|
||||||
|
|
||||||
|
DPRINT("APC DISABLE: %d\n", ((PETHREAD)KeGetCurrentThread())->Tcb.CombinedApcDisable);
|
||||||
|
|
||||||
/* If this isn't the last handle, do nothing */
|
/* If this isn't the last handle, do nothing */
|
||||||
if (SystemHandleCount > 1) return;
|
if (SystemHandleCount > 1) return;
|
||||||
|
|
||||||
|
@ -1127,8 +1140,16 @@ DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
|
||||||
/* Check if we terminate on exit */
|
/* Check if we terminate on exit */
|
||||||
if (DebugObject->KillProcessOnExit)
|
if (DebugObject->KillProcessOnExit)
|
||||||
{
|
{
|
||||||
/* Terminate the process */
|
PWORK_QUEUE_ITEM WorkItem =
|
||||||
PsTerminateProcess(OwnerProcess, STATUS_DEBUGGER_INACTIVE);
|
ExAllocatePool
|
||||||
|
(NonPagedPool,
|
||||||
|
sizeof(WORK_QUEUE_ITEM) + sizeof(PVOID));
|
||||||
|
ExInitializeWorkItem
|
||||||
|
(WorkItem,
|
||||||
|
DbgkpDelayedTerminateProcess,
|
||||||
|
WorkItem);
|
||||||
|
*((PEPROCESS *)&WorkItem[1]) = OwnerProcess;
|
||||||
|
ExQueueWorkItem(WorkItem, CriticalWorkQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dereference the debug object */
|
/* Dereference the debug object */
|
||||||
|
|
Loading…
Reference in a new issue