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 


Find previous dynamic call target?

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

Joined: 17 Jul 2013
Posts: 4

PostPosted: Fri Dec 18, 2015 9:26 pm    Post subject: Find previous dynamic call target? Reply with quote

I've found the code that accesses a certain variable, and that code is reached by a jump from an unknown location. When looking at the stack trace, the first return address is for a dynamic call (call eax).

What I want to do is find the value of eax in the dynamic call that eventually leads to my breakpoint in the code that accesses the variable. The dynamic call is used hundreds of times between the one call that leads to the relevant code section. I've tried Dissect Code to find the jump origin with no success.

Is there a way to store the value of eax each time that call is taken so I know the most recent call target when my breakpoint gets hit? (I have no idea how much code is between the dynamic call and my breakpoint)

Is there another way of finding what function is being called dynamically to reach the code that accesses the variable?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Dec 18, 2015 9:58 pm    Post subject: Reply with quote

Well, you know the general value of EAX from where the instruction you found is located.
You could inject at the CALL statement to find all occurrences of EAX between that address and minus X.

Or execute the following Lua and set a breakpoint on the CALL statement.
Code:
values={}
function debugger_onBreakpoint()
  values[EAX] = EAX
  debug_continueFromBreakpoint(co_run)
  return 1
end

Let it run during your action, then run the following.
Code:
local myinstruction = 0x12345678
local closest = 0
for a in pairs(values) do
  if a < myinstruction and a > closest then
    closest = a
  end
end
print(string.format("%X",closest))

Pick the value closest to your instruction. Smile
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Dec 23, 2015 3:58 pm    Post subject: Reply with quote

Super easy.

Memory Viewer>Tools>Dissect Code.

Let it run and it will tell you the address thats jumps/calls to GIVEN code. Very Informative.

But if you know its a "call" just Find the "ret" at the bottom of the code and toggle breakpoint on the "ret" then use...

Memory Viewer>Debug>Step to return after the call.


Both ways have their ups and downs. But you really should always run a dissect code if your hacking a game. Just makes everything smoother and allows you better place injections. Especially when you need to use registers to add custom code.

_________________
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 Gamehacking 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