|
|
@ -33,7 +33,7 @@ using namespace DFHack;
|
|
|
|
class NormalProcess::Private
|
|
|
|
class NormalProcess::Private
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
Private()
|
|
|
|
Private(Process * self_)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
my_descriptor = NULL;
|
|
|
|
my_descriptor = NULL;
|
|
|
|
my_handle = NULL;
|
|
|
|
my_handle = NULL;
|
|
|
@ -42,6 +42,7 @@ class NormalProcess::Private
|
|
|
|
attached = false;
|
|
|
|
attached = false;
|
|
|
|
suspended = false;
|
|
|
|
suspended = false;
|
|
|
|
memFileHandle = 0;
|
|
|
|
memFileHandle = 0;
|
|
|
|
|
|
|
|
self = self_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
~Private(){};
|
|
|
|
~Private(){};
|
|
|
|
DFWindow* my_window;
|
|
|
|
DFWindow* my_window;
|
|
|
@ -53,11 +54,12 @@ class NormalProcess::Private
|
|
|
|
bool attached;
|
|
|
|
bool attached;
|
|
|
|
bool suspended;
|
|
|
|
bool suspended;
|
|
|
|
bool identified;
|
|
|
|
bool identified;
|
|
|
|
|
|
|
|
Process * self;
|
|
|
|
bool validate(char * exe_file, uint32_t pid, char * mem_file, vector <memory_info *> & known_versions);
|
|
|
|
bool validate(char * exe_file, uint32_t pid, char * mem_file, vector <memory_info *> & known_versions);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NormalProcess::NormalProcess(uint32_t pid, vector< memory_info* >& known_versions)
|
|
|
|
NormalProcess::NormalProcess(uint32_t pid, vector< memory_info* >& known_versions)
|
|
|
|
: d(new Private())
|
|
|
|
: d(new Private(this))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char dir_name [256];
|
|
|
|
char dir_name [256];
|
|
|
|
char exe_link_name [256];
|
|
|
|
char exe_link_name [256];
|
|
|
@ -68,6 +70,7 @@ NormalProcess::NormalProcess(uint32_t pid, vector< memory_info* >& known_version
|
|
|
|
int target_result;
|
|
|
|
int target_result;
|
|
|
|
|
|
|
|
|
|
|
|
d->identified = false;
|
|
|
|
d->identified = false;
|
|
|
|
|
|
|
|
d->my_descriptor = 0;
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(dir_name,"/proc/%d/", pid);
|
|
|
|
sprintf(dir_name,"/proc/%d/", pid);
|
|
|
|
sprintf(exe_link_name,"/proc/%d/exe", pid);
|
|
|
|
sprintf(exe_link_name,"/proc/%d/exe", pid);
|
|
|
@ -125,8 +128,9 @@ bool NormalProcess::Private::validate(char * exe_file,uint32_t pid, char * memFi
|
|
|
|
memory_info * m = *it;
|
|
|
|
memory_info * m = *it;
|
|
|
|
if (memory_info::OS_LINUX == m->getOS())
|
|
|
|
if (memory_info::OS_LINUX == m->getOS())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
my_descriptor = m;
|
|
|
|
memory_info *m2 = new memory_info(*m);
|
|
|
|
m->setParentProcess((Process*)this);
|
|
|
|
my_descriptor = m2;
|
|
|
|
|
|
|
|
m2->setParentProcess(dynamic_cast<Process *>( self ));
|
|
|
|
my_handle = my_pid = pid;
|
|
|
|
my_handle = my_pid = pid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -154,6 +158,9 @@ NormalProcess::~NormalProcess()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
detach();
|
|
|
|
detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// destroy our copy of the memory descriptor
|
|
|
|
|
|
|
|
if(d->my_descriptor)
|
|
|
|
|
|
|
|
delete d->my_descriptor;
|
|
|
|
// destroy data model. this is assigned by processmanager
|
|
|
|
// destroy data model. this is assigned by processmanager
|
|
|
|
if(d->my_window)
|
|
|
|
if(d->my_window)
|
|
|
|
delete d->my_window;
|
|
|
|
delete d->my_window;
|
|
|
|