From cc02ced0ac854ce60d3320b426af4fa9b97d5629 Mon Sep 17 00:00:00 2001 From: Quietust Date: Sat, 21 Jan 2017 15:16:06 -0600 Subject: [PATCH] Fix RTTI in Win64 - offsets are relative to the current module (e.g. the DLL), so it needs to be looked up explicitly --- library/Process-windows.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/Process-windows.cpp b/library/Process-windows.cpp index cb2e16bd2..3a1da0ac4 100644 --- a/library/Process-windows.cpp +++ b/library/Process-windows.cpp @@ -342,12 +342,14 @@ int Process::adjustOffset(int offset, bool to_file) return -1; } - string Process::doReadClassName (void * vptr) { char * rtti = readPtr((char *)vptr - sizeof(void*)); #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 #else char * typeinfo = readPtr(rtti + 0xC);