Lehona
August 23rd, 2011, 17:39
I'm quite new to the IDA SDK (To be honest, this is my first project) and I have encountered some problems and questions:
The PlugIn is specific to one program (Gothic2 if anyone knows that game) and will be used during creating modifications, helping the modder to debug with more ease.
Actually I want to print out some data in the RAM of the debugged process (Giving out some variables' data). To find them by name I have to search through a table and since Piranha Bytes, who created Gothic, made their own strings (zStrings) which don't always end with a nullbyte since they hold their length as a member, I had some struggle to cast them to normal char* when wanting to read them. This is the class (Can't modify it since it's internal representation):
the getStr()-method kinda seems to fail, if I print 'mem' it just turns out to be an empty string. Do you any thing which could be wrong? I'm still always unsure when dealing with "normal" memory and the dbg-memory.
With best regards, Lehona
The PlugIn is specific to one program (Gothic2 if anyone knows that game) and will be used during creating modifications, helping the modder to debug with more ease.
Actually I want to print out some data in the RAM of the debugged process (Giving out some variables' data). To find them by name I have to search through a table and since Piranha Bytes, who created Gothic, made their own strings (zStrings) which don't always end with a nullbyte since they hold their length as a member, I had some struggle to cast them to normal char* when wanting to read them. This is the class (Can't modify it since it's internal representation):
Code:
class zString {
public:
int _vtbl;
int _allocater;
private:
char* ptr; //not always ending with a nullbyte therefore private
public:
int len; //Length
int res; //amount of allocated memory (bytes)
zString() {};
zString(int zstrptr) { // This does copy the string!
dbg->read_memory(zstrptr, this, sizeof(zString));
}
char* getStr() { // You gotta free those after use!
char* mem = (char*)qcalloc(len+1, 1);
dbg->read_memory((ea_t)this->ptr, mem, len)
return mem;
}
};
the getStr()-method kinda seems to fail, if I print 'mem' it just turns out to be an empty string. Do you any thing which could be wrong? I'm still always unsure when dealing with "normal" memory and the dbg-memory.
With best regards, Lehona