I have this code for my Win32 application:
class Foo {
public:
string mystring;
__declspec(dllexport) void foo();
};
void Foo::foo(){
printf("foo called");
}
int _tmain(int argc, _TCHAR* argv[])
{
Foo foo;
foo.mystring = "all your base are belong to us";
return 0;
}
If I know have the image base address of this Win32 in memory:
- Given that I have the image base address how can I get the
Foo
class instance offset - Given that I have the image base address of the win32 application in
memory, how can I get the offset address for the variable
mystring
- Acquiring the function address of the function
foo()
was fairly easy, I was able to do that, and even call the function from another process. However, I am not sure how to get (at least read) the address of variables.
The idea is that I will execute this program, then some other program gets the image base address of this application then will try to read variables inside the said application.