How do you swap debuggers in Windows?
In my case, I have a process A which creates a copy of itself:
CreateProcessA("XXX.exe", NULL, 0x0023f560, 0x0023f560, TRUE,
**DEBUG_ONLY_THIS_PROCESS**, NULL, NULL, 0x0023f5f8, 0x0023f550)
It, then, debugs its child (Process B) using WaitForDebugEvent(50ms)
to modify the control flow of B. After a highly active startup WaitForDebugEvent
will time out(Return false) unless I click a button in B.
Question: How do I get rid of the Debugger(Process A) and attach my own debugger to B ?
I tried to call DebugActiveProcessStop
by injection code into A (DLL Injection) as well as by debugging A and calling it from the thread that debugs B. (inline code injection) both ways I get ACCESS_DENIED
!
If you try to attach a 2nd debugger you get Error 87 (ERROR_INVALID_PARAMETER)
.
Environment: Win 7 x64