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 


How are the non-local addresses handled in a dll?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
fffffaaaaa
How do I cheat?
Reputation: 0

Joined: 20 Nov 2012
Posts: 7

PostPosted: Thu Mar 17, 2016 12:12 am    Post subject: How are the non-local addresses handled in a dll? Reply with quote

I have been looking at the following piece of a function and compare it with the bytes in the dll, the early bytes are pretty much the same between the dll and memory. But the last sentence that pushes a non-local address is given as "6A FF 68 77 C5 32 10" in the dll, same opcode but different address. All the non-local function calls are different in the dll too.

Could anyone help to explain how such non-local addresses are stored in a dll, and how they get converted when loaded into memory? Much appreciated!!!

Game.GAME::ControllerCombat::KillMe - 55 - push ebp
Game.GAME::ControllerCombat::KillMe+1- 8B EC - mov ebp,esp
Game.GAME::ControllerCombat::KillMe+3- 64 A1 00000000 - mov eax,fs:[00000000]
Game.GAME::ControllerCombat::KillMe+9- 6A FF - push -01
Game.GAME::ControllerCombat::KillMe+B- 68 77C5BC00 - push Game.GAME::WeaponArmor_Offhand::GetLeftHandType+10777
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Thu Mar 17, 2016 2:24 am    Post subject: Reply with quote

are you sure this is dll memory and not jit'ed code (c#) ?

anyhow, assuming dll, then it's done using the relocation table.
that is a table with addresses that need to be changed when the dll is loaded at an address it wasn't programmed for.
so when windows loads the dll, it parses that list and appplies the difference of the new address and the expected address to that address's value

_________________
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
fffffaaaaa
How do I cheat?
Reputation: 0

Joined: 20 Nov 2012
Posts: 7

PostPosted: Thu Mar 17, 2016 6:42 pm    Post subject: Reply with quote

Thanks, the one I looked at is not a c# one, doesnt have the c# header.

I found the relocation table at the end of the dll, but there are so many offset words, how can I pinpoint which one is used one a particular call is made? E.g. for the push in my dll, "6A FF 68 77 C5 32 10", is it possible to find the offset from 32 10?


Dark Byte wrote:
are you sure this is dll memory and not jit'ed code (c#) ?

anyhow, assuming dll, then it's done using the relocation table.
that is a table with addresses that need to be changed when the dll is loaded at an address it wasn't programmed for.
so when windows loads the dll, it parses that list and appplies the difference of the new address and the expected address to that address's value
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Fri Mar 18, 2016 3:01 am    Post subject: Reply with quote

In the memory viewer, go to view -> show symbols and make sure it's not checked.
Instead of "Game.GAME::WeaponArmor_Offhand::GetLeftHandType+10777" you should get same static "Something.dll+Offset".
Use that to calculate the address.
Back to top
View user's profile Send private message
fffffaaaaa
How do I cheat?
Reputation: 0

Joined: 20 Nov 2012
Posts: 7

PostPosted: Fri Mar 18, 2016 12:25 pm    Post subject: Reply with quote

Thanks! I'll dig into it.
Back to top
View user's profile Send private message
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