revert process debug call, it's slow and dangerous

develop
Petr Mrázek 2009-09-14 20:47:20 +00:00
parent c5144b5fde
commit ea2dca0e28
2 changed files with 17 additions and 10 deletions

@ -44,7 +44,7 @@ using namespace std;
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include <dirent.h> #include <dirent.h>
#else #else
#define WINVER 0x0501 // OpenThread(), PSAPI, Toolhelp32 #define WINVER 0x0500 // OpenThread(), PSAPI, Toolhelp32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <winbase.h> #include <winbase.h>

@ -122,15 +122,21 @@ void Process::freeResources()
bool Process::attach() bool Process::attach()
{ {
if(attached)
{
return false;
}
/*
if(DebugActiveProcess(my_pid)) if(DebugActiveProcess(my_pid))
{ {
*/
attached = true; attached = true;
g_pProcess = this; g_pProcess = this;
g_ProcessHandle = my_handle; g_ProcessHandle = my_handle;
return true; return true;
} /*}
return false; return false;*/
} }
@ -140,14 +146,15 @@ bool Process::detach()
{ {
return false; return false;
} }
if(DebugActiveProcessStop(my_pid)) //TODO: find a safer way to suspend processes
{ /*if(DebugActiveProcessStop(my_pid))
{*/
attached = false; attached = false;
g_pProcess = NULL; g_pProcess = NULL;
g_ProcessHandle = 0; g_ProcessHandle = 0;
return true; return true;
} /*}
return false; return false;*/
} }