| View previous topic :: View next topic |
| Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Dec 22, 2009 4:55 pm Post subject: Reading Static Addresses |
|
|
I was told to find out what addresses is static or not you use the GetModuleHandleEx with the GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag, find the module base and the difference of it and your address is the offset for your address, so do I do it like this?
| Code: |
HMODULE Handle;
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR) 0x00400000, &Handle);
if (Handle != NULL)
{
char ModuleName[500] = {0};
GetModuleFileName(Handle, (LPTSTR) ModuleName, MAX_PATH);
DWORD BASE = (DWORD) GetModuleHandle((LPCTSTR) ModuleName);
DWORD OFFSET = BASE - 0x00400000;
return OFFSET;
}
|
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Dec 22, 2009 7:13 pm Post subject: |
|
|
you should not mix unicode with multibyte, unless you changed the character set in compiler options already which i would advise against
clearly ModuleName is not MAX_PATH TCHARs long though.. is it ? even if you were using the ANSI function your buffer is 500 bytes long and you're telling the function it is MAX_PATH bytes long
other than that, at first glance it looks okay
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Dec 22, 2009 10:29 pm Post subject: |
|
|
Thanks a lot.
+Reped ya
|
|
| Back to top |
|
 |
|