Saturday 31 August 2013

How can I get the base address of the target process after DLL injection?

How can I get the base address of the target process after DLL injection?

After I've successfully injected my dll into my target process, say
"target.exe", how can I get the base address of "target.exe"?
I've tried GetModuleHandle(0) and GetModuleHandle("target.exe") but it
doesn't seem to be right and I'm not sure how to debug. I've tried to
print it like this:
//retrive target's base address
DWORD EXEBaseAddr = (DWORD) GetModuleHandle((LPCWSTR)"target.exe");
std::stringstream sstr;
sstr << EXEBaseAddr;
std::string str = sstr.str();
String^ str3 = gcnew String(str.c_str());
baseAddressLBL->Text = str3;
I had to cast it at the end again because I'm using a Windows Form (not
sure if that's what it's called) to print the address in my interface.

No comments:

Post a Comment