Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Reading Static Addresses

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Tue Dec 22, 2009 4:55 pm    Post subject: Reading Static Addresses Reply with quote

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
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Dec 22, 2009 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Tue Dec 22, 2009 10:29 pm    Post subject: Reply with quote

Thanks a lot.

+Reped ya Wink
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites