|
|
@ -121,16 +121,22 @@ void Process::freeResources()
|
|
|
|
//FIXME: should support stopping and resuming the process
|
|
|
|
//FIXME: should support stopping and resuming the process
|
|
|
|
|
|
|
|
|
|
|
|
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;*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -139,15 +145,16 @@ bool Process::detach()
|
|
|
|
if(!attached)
|
|
|
|
if(!attached)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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;*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|