Fix RTTI in Win64 - offsets are relative to the current module (e.g. the DLL), so it needs to be looked up explicitly

develop
Quietust 2017-01-21 15:16:06 -06:00
parent e2fc7d3e00
commit cc02ced0ac
1 changed files with 4 additions and 2 deletions

@ -342,12 +342,14 @@ int Process::adjustOffset(int offset, bool to_file)
return -1; return -1;
} }
string Process::doReadClassName (void * vptr) string Process::doReadClassName (void * vptr)
{ {
char * rtti = readPtr((char *)vptr - sizeof(void*)); char * rtti = readPtr((char *)vptr - sizeof(void*));
#ifdef DFHACK64 #ifdef DFHACK64
char * typeinfo = d->base + readDWord(rtti + 0xC); void *base;
if (!RtlPcToFileHeader(rtti, &base))
return "dummy";
char * typeinfo = (char *)base + readDWord(rtti + 0xC);
string raw = readCString(typeinfo + 0x10+4); // skips the .?AV string raw = readCString(typeinfo + 0x10+4); // skips the .?AV
#else #else
char * typeinfo = readPtr(rtti + 0xC); char * typeinfo = readPtr(rtti + 0xC);