Don't call DebugSetProcessKillOnExit if SafeAttach is enabled

This commit is contained in:
Matthijs Lavrijsen 2020-08-30 18:47:33 +02:00
parent 51ba022c29
commit 9fc3d5aa99
No known key found for this signature in database
GPG Key ID: D40D1DBE299B83EA
1 changed files with 4 additions and 7 deletions

View File

@ -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)
{
myDebugSetProcessKillOnExit = (fDebugSetProcessKillOnExit)(funcDebugSetProcessKillOnExit);
myDebugSetProcessKillOnExit(KillOnExit);
}
myDebugSetProcessKillOnExit(KillOnExit && !engineSafeAttach ? true : false);
}
DebugDebuggingDLL = false;
DebugAttachedToProcess = true;