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 


Address of function inside dll changes everytime

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Sun Jul 05, 2020 7:59 pm    Post subject: Address of function inside dll changes everytime Reply with quote

I need to get the pointer or somehow get this address automatically.
It is a function that is inside one dll of the game.
Changes everytime the game is started so i have to open it in x32dbg, check symbols, go to the function, copy it and insert it in my hack manually.

I tried finding pointer for it. Nothing.
How should i proceed?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jul 05, 2020 10:53 pm    Post subject: Reply with quote

DLLs are loaded dynamically (hence the name) which means their base address can move. They can encourage the system to load them at a certain range, but there is no guarantee that will be adhered to.

To re-find your function, you just need to make an offset to it. That is done via:
Function Address - DLL Base Address = Offset

Then next time you load up the game, you can get the function via:
DLL Base Address + Offset = Function Address

Something to keep in mind though, this will break if the game updates the DLL.
It is better to use pattern scans for this instead.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Mon Jul 06, 2020 12:41 pm    Post subject: Reply with quote

Thanks Atomos. But if the address of the DLL changes everytime how do i find it each time?

Is there something like a pointer to the DLL?

Quote:
pattern scan


Ahh. So i got to do a pattern scan.[/quote]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25867
Location: The netherlands

PostPosted: Mon Jul 06, 2020 1:18 pm    Post subject: Reply with quote

use modulename+offset in ce
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Jul 06, 2020 4:46 pm    Post subject: Reply with quote

LongBeardedLion wrote:
Thanks Atomos. But if the address of the DLL changes everytime how do i find it each time?

Is there something like a pointer to the DLL?

Quote:
pattern scan


Ahh. So i got to do a pattern scan.
[/quote]

Depends on how you are using things and what you are doing. If you are just using CE, then what DarkByte said. You can get base addresses just using the module name directly in CE.

If you are in an injected DLL, you can use the 'GetModuleHandle' API call to obtain module base addresses.

If you are in an external program, you will need to enumerate the remote processes modules to obtain the base address. That can be done a number of different ways.

Most commonly via API such as:
- Tlhelp32: CreateToolhelp32Snapshot + Module32First/Module32Next
- PSAPI: EnumProcessModules / EnumProcessModulesEx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Mon Jul 06, 2020 5:09 pm    Post subject: Reply with quote

modulename? you mean game.exe ? or the dll?
The dll changes address everytime
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25867
Location: The netherlands

PostPosted: Mon Jul 06, 2020 5:54 pm    Post subject: Reply with quote

e.g if the dll is game.dll

first run game.dll is at 20000000 and the address you're interested in is at 20012345
second run game.dll is at 21000000 and the address you're interested in is now at 21012345

you can then tell CE that the address is
Code:

game.dll+12345

and CE will get you the correct address each time

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Thu Jul 16, 2020 11:43 pm    Post subject: Reply with quote

Thank you DarkByte. I came back to this post and solved my problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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