From 9f822af45a3adb22db3a25f88fd215aefc4fbc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 16 Jul 2011 23:00:28 +0200 Subject: [PATCH] Process: added a method for getting the main module base (windows). Returns 0 on linux. --- library/Process-linux.cpp | 5 +++++ library/Process-windows.cpp | 7 +++++++ library/include/dfhack/Process.h | 1 + 3 files changed, 13 insertions(+) diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index af3b77f15..23d8baf12 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -120,6 +120,11 @@ void Process::getMemRanges( vector & ranges ) } } +uint32_t Process::getBase() +{ + return 0; +} + static int getdir (string dir, vector &files) { DIR *dp; diff --git a/library/Process-windows.cpp b/library/Process-windows.cpp index 7bf786446..2edfc6325 100644 --- a/library/Process-windows.cpp +++ b/library/Process-windows.cpp @@ -330,6 +330,13 @@ void Process::getMemRanges( vector & ranges ) } } +uint32_t Process::getBase() +{ + if(d) + return d->base; + return 0x400000; +} + string Process::doReadClassName (void * vptr) { int rtti = readDWord((uint32_t)vptr - 0x4); diff --git a/library/include/dfhack/Process.h b/library/include/dfhack/Process.h index 54c14ea0d..75b0edc86 100644 --- a/library/include/dfhack/Process.h +++ b/library/include/dfhack/Process.h @@ -264,6 +264,7 @@ namespace DFHack { return my_descriptor; }; + uint32_t getBase(); /// get the DF Process ID int getPID(); /// get the DF Process FilePath