Remarks To stop debugging the process, you must exit the process or call the DebugActiveProcessStop function. Exiting the debugger also exits the process unless you use the DebugSetProcessKillOnExit function.
DebugSetProcessKillOnExit
The DebugSetProcessKillOnExit function sets the action to be performed when the debugging thread exits.
Parameters KillOnExit [in] If this parameter is TRUE, the debug thread will kill the process being debugged on exit. Otherwise, the debug thread will detach from the process being debugged on exit.