|
|
@ -82,50 +82,183 @@ namespace DFHack
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Private data
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace DFHack
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
class OffsetGroupPrivate
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
map <string, uint32_t> addresses;
|
|
|
|
|
|
|
|
map <string, int32_t> offsets;
|
|
|
|
|
|
|
|
map <string, uint32_t> hexvals;
|
|
|
|
|
|
|
|
map <string, string> strings;
|
|
|
|
|
|
|
|
map <string, OffsetGroup> groups;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OffsetGroup::setOffset (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int32_t offset = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->offsets[key] = offset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OffsetGroup::setAddress (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t address = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->addresses[key] = address;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OffsetGroup::setHexValue (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t hexval = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->hexvals[key] = hexval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OffsetGroup::setString (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->strings[key] = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named address
|
|
|
|
|
|
|
|
uint32_t OffsetGroup::getAddress (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->addresses.find(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(iter != d->addresses.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("address", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named offset
|
|
|
|
|
|
|
|
int32_t OffsetGroup::getOffset (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, int32_t>::iterator iter = d->offsets.find(key);
|
|
|
|
|
|
|
|
if(iter != d->offsets.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("offset", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named numerical value
|
|
|
|
|
|
|
|
uint32_t OffsetGroup::getHexValue (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->hexvals.find(key);
|
|
|
|
|
|
|
|
if(iter != d->hexvals.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("hexvalue", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named address
|
|
|
|
|
|
|
|
uint32_t OffsetGroup::getAddress (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->addresses.find(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(iter != d->addresses.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("address", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named offset
|
|
|
|
|
|
|
|
int32_t OffsetGroup::getOffset (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, int32_t>::iterator iter = d->offsets.find(key);
|
|
|
|
|
|
|
|
if(iter != d->offsets.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("offset", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named numerical value
|
|
|
|
|
|
|
|
uint32_t OffsetGroup::getHexValue (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->hexvals.find(key);
|
|
|
|
|
|
|
|
if(iter != d->hexvals.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("hexvalue", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named string
|
|
|
|
|
|
|
|
std::string OffsetGroup::getString (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, string>::iterator iter = d->strings.find(key);
|
|
|
|
|
|
|
|
if(iter != d->strings.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("string", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Private data
|
|
|
|
* Private data
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class VersionInfo::Private
|
|
|
|
namespace DFHack
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
class VersionInfoPrivate
|
|
|
|
map <string, uint32_t> addresses;
|
|
|
|
{
|
|
|
|
map <string, int32_t> offsets;
|
|
|
|
public:
|
|
|
|
map <string, uint32_t> hexvals;
|
|
|
|
map <string, uint32_t> addresses;
|
|
|
|
map <string, string> strings;
|
|
|
|
map <string, int32_t> offsets;
|
|
|
|
|
|
|
|
map <string, uint32_t> hexvals;
|
|
|
|
|
|
|
|
map <string, string> strings;
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> professions;
|
|
|
|
vector<string> professions;
|
|
|
|
vector<string> jobs;
|
|
|
|
vector<string> jobs;
|
|
|
|
vector<string> skills;
|
|
|
|
vector<string> skills;
|
|
|
|
vector<DFHack::t_level> levels;
|
|
|
|
vector<DFHack::t_level> levels;
|
|
|
|
vector< vector<string> > traits;
|
|
|
|
vector< vector<string> > traits;
|
|
|
|
vector<string> moods;
|
|
|
|
vector<string> moods;
|
|
|
|
map <uint32_t, string> labors;
|
|
|
|
map <uint32_t, string> labors;
|
|
|
|
|
|
|
|
|
|
|
|
// storage for class and multiclass
|
|
|
|
// storage for class and multiclass
|
|
|
|
vector<t_class *> classes;
|
|
|
|
vector<t_class *> classes;
|
|
|
|
|
|
|
|
|
|
|
|
// cache for faster name lookup, indexed by classID
|
|
|
|
// cache for faster name lookup, indexed by classID
|
|
|
|
vector<string> classnames;
|
|
|
|
vector<string> classnames;
|
|
|
|
// map between vptr and class id, needs further type id lookup for multi-classes, not inherited
|
|
|
|
// map between vptr and class id, needs further type id lookup for multi-classes, not inherited
|
|
|
|
map<uint32_t, t_class *> classIDs;
|
|
|
|
map<uint32_t, t_class *> classIDs;
|
|
|
|
|
|
|
|
|
|
|
|
// index for the next added class
|
|
|
|
// index for the next added class
|
|
|
|
uint32_t classindex;
|
|
|
|
uint32_t classindex;
|
|
|
|
|
|
|
|
|
|
|
|
int32_t base;
|
|
|
|
int32_t base;
|
|
|
|
Process * p; // the process this belongs to
|
|
|
|
Process * p; // the process this belongs to
|
|
|
|
|
|
|
|
|
|
|
|
string version;
|
|
|
|
string version;
|
|
|
|
OSType OS;
|
|
|
|
VersionInfo::OSType OS;
|
|
|
|
std::string md5;
|
|
|
|
std::string md5;
|
|
|
|
uint32_t PE_timestamp;
|
|
|
|
uint32_t PE_timestamp;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// normal constructor
|
|
|
|
// normal constructor
|
|
|
|
VersionInfo::VersionInfo()
|
|
|
|
VersionInfo::VersionInfo()
|
|
|
|
:d(new Private)
|
|
|
|
:d(new VersionInfoPrivate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->base = 0;
|
|
|
|
d->base = 0;
|
|
|
|
d->p = 0;
|
|
|
|
d->p = 0;
|
|
|
@ -139,7 +272,7 @@ VersionInfo::VersionInfo()
|
|
|
|
|
|
|
|
|
|
|
|
// copy constructor
|
|
|
|
// copy constructor
|
|
|
|
VersionInfo::VersionInfo(const VersionInfo &old)
|
|
|
|
VersionInfo::VersionInfo(const VersionInfo &old)
|
|
|
|
:d(new Private)
|
|
|
|
:d(new VersionInfoPrivate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
copy(&old);
|
|
|
|
copy(&old);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -289,33 +422,6 @@ void VersionInfo::setBase (const uint32_t b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfo::setOffset (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int32_t offset = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->offsets[key] = offset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfo::setAddress (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t address = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->addresses[key] = address;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfo::setHexValue (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t hexval = strtol(value.c_str(), NULL, 16);
|
|
|
|
|
|
|
|
d->hexvals[key] = hexval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfo::setString (const string & key, const string & value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->strings[key] = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfo::setLabor(const string & key, const string & value)
|
|
|
|
void VersionInfo::setLabor(const string & key, const string & value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t keyInt = strtol(key.c_str(), NULL, 10);
|
|
|
|
uint32_t keyInt = strtol(key.c_str(), NULL, 10);
|
|
|
@ -600,92 +706,6 @@ void VersionInfo::RebaseVTable(int32_t offset)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named address
|
|
|
|
|
|
|
|
uint32_t VersionInfo::getAddress (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->addresses.find(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(iter != d->addresses.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("address", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named offset
|
|
|
|
|
|
|
|
int32_t VersionInfo::getOffset (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, int32_t>::iterator iter = d->offsets.find(key);
|
|
|
|
|
|
|
|
if(iter != d->offsets.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("offset", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named numerical value
|
|
|
|
|
|
|
|
uint32_t VersionInfo::getHexValue (const char *key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->hexvals.find(key);
|
|
|
|
|
|
|
|
if(iter != d->hexvals.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("hexvalue", key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named address
|
|
|
|
|
|
|
|
uint32_t VersionInfo::getAddress (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->addresses.find(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(iter != d->addresses.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("address", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named offset
|
|
|
|
|
|
|
|
int32_t VersionInfo::getOffset (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, int32_t>::iterator iter = d->offsets.find(key);
|
|
|
|
|
|
|
|
if(iter != d->offsets.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("offset", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named numerical value
|
|
|
|
|
|
|
|
uint32_t VersionInfo::getHexValue (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, uint32_t>::iterator iter = d->hexvals.find(key);
|
|
|
|
|
|
|
|
if(iter != d->hexvals.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("hexvalue", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get named string
|
|
|
|
|
|
|
|
std::string VersionInfo::getString (const string &key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map <string, string>::iterator iter = d->strings.find(key);
|
|
|
|
|
|
|
|
if(iter != d->strings.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (*iter).second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error::MissingMemoryDefinition("string", key.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get Profession
|
|
|
|
// Get Profession
|
|
|
|
string VersionInfo::getProfession (const uint32_t key) const
|
|
|
|
string VersionInfo::getProfession (const uint32_t key) const
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -811,11 +831,11 @@ std::string VersionInfo::PrintOffsets()
|
|
|
|
switch (getOS())
|
|
|
|
switch (getOS())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case OS_LINUX:
|
|
|
|
case OS_LINUX:
|
|
|
|
ss << "<MD5 value=\"" << getString("md5") << "\" />" << endl;
|
|
|
|
ss << "<MD5 value=\"" << getMD5() << "\" />" << endl;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case OS_WINDOWS:
|
|
|
|
case OS_WINDOWS:
|
|
|
|
ss << "<PETimeStamp value=\"" << hex << "0x" << getHexValue("pe_timestamp") << "\" />" << endl;
|
|
|
|
ss << "<PETimeStamp value=\"" << hex << "0x" << getPE() << "\" />" << endl;
|
|
|
|
ss << "<MD5 value=\"" << getString("md5") << "\" />" << endl;
|
|
|
|
ss << "<MD5 value=\"" << getMD5() << "\" />" << endl;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ss << " UNKNOWN" << endl;
|
|
|
|
ss << " UNKNOWN" << endl;
|
|
|
|