Don't call DebugSetProcessKillOnExit if SafeAttach is enabled

This commit is contained in:
Matthijs Lavrijsen 2020-08-30 18:47:33 +02:00 committed by Duncan Ogilvie
parent 8f83721fd3
commit 35fdd5684e
1 changed files with 4 additions and 7 deletions

View File

@ -553,14 +553,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;