diff --git a/TitanEngine/TitanEngine.Debugger.cpp b/TitanEngine/TitanEngine.Debugger.cpp index 49fce80..c3fa3fd 100644 --- a/TitanEngine/TitanEngine.Debugger.cpp +++ b/TitanEngine/TitanEngine.Debugger.cpp @@ -554,14 +554,11 @@ __declspec(dllexport) bool TITCALL AttachDebugger(DWORD ProcessId, bool KillOnEx { if(engineEnableDebugPrivilege) EngineSetDebugPrivilege(GetCurrentProcess(), false); - if(KillOnExit) + funcDebugSetProcessKillOnExit = GetProcAddress(GetModuleHandleA("kernel32.dll"), "DebugSetProcessKillOnExit"); + if(funcDebugSetProcessKillOnExit != NULL) { - funcDebugSetProcessKillOnExit = GetProcAddress(GetModuleHandleA("kernel32.dll"), "DebugSetProcessKillOnExit"); - if(funcDebugSetProcessKillOnExit != NULL) - { - myDebugSetProcessKillOnExit = (fDebugSetProcessKillOnExit)(funcDebugSetProcessKillOnExit); - myDebugSetProcessKillOnExit(KillOnExit); - } + myDebugSetProcessKillOnExit = (fDebugSetProcessKillOnExit)(funcDebugSetProcessKillOnExit); + myDebugSetProcessKillOnExit(KillOnExit && !engineSafeAttach ? true : false); } DebugDebuggingDLL = false; DebugAttachedToProcess = true;