Do not create a thread when attaching

This commit is contained in:
Duncan Ogilvie 2020-10-19 22:56:11 +02:00
parent 885e290cc4
commit ce87d2bea8
2 changed files with 16 additions and 8 deletions

View File

@ -224,6 +224,9 @@ static NTSTATUS NTAPI DbgUiDebugActiveProcess_(IN HANDLE Process)
{
/* Tell the kernel to start debugging */
NTSTATUS Status = NtDebugActiveProcess(Process, NtCurrentTeb()->DbgSsReserved[1]);
return Status;
#if 0
if(NT_SUCCESS(Status))
{
/* Now break-in the process */
@ -237,6 +240,7 @@ static NTSTATUS NTAPI DbgUiDebugActiveProcess_(IN HANDLE Process)
/* Return status */
return Status;
#endif
}
static NTSTATUS NTAPI DbgUiConnectToDbg_()

View File

@ -116,6 +116,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
case CREATE_PROCESS_DEBUG_EVENT:
{
bool attachBreakpoint = false;
if(DBGFileHandle == NULL) //we didn't set the handle yet (initial process)
{
DBGEntryPoint = DBGEvent.u.CreateProcessInfo.lpStartAddress;
@ -130,6 +131,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
RtlMoveMemory(engineAttachedProcessDebugInfo, &dbgProcessInformation, sizeof PROCESS_INFORMATION);
}
attachBreakpoint = true;
}
if(DebugDebuggingDLL) //the DLL loader just started, set DLL names
{
@ -186,6 +188,13 @@ __declspec(dllexport) void TITCALL DebugLoop()
if(DBGFileHandle)
EngineCloseHandle(DBGFileHandle); //close file handle
// Call the attach breakpoint
if(attachBreakpoint)
{
myCustomBreakPoint = (fCustomBreakPoint)(DebugAttachedProcessCallBack);
myCustomBreakPoint();
}
}
break;
@ -526,11 +535,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
FirstBPX = false;
DBGCode = DBG_CONTINUE;
if(DebugAttachedToProcess)
{
myCustomBreakPoint = (fCustomBreakPoint)(DebugAttachedProcessCallBack);
myCustomBreakPoint();
}
if(engineAutoHideFromDebugger)
{
HideDebugger(dbgProcessInformation.hProcess, UE_HIDE_PEBONLY);