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 


Invoke a function...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Mon Jul 20, 2009 5:19 am    Post subject: Invoke a function... Reply with quote

I found the beginning of the opcodes that actually make my character jump. How do I invoke that function though? (is there any way to do it non-injected?)
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Jul 20, 2009 6:40 am    Post subject: Reply with quote

if it is actually a function and not a macro ( ie. it ends in a ret ) then you can create a remote thread there but that only works when there is 0 or 1 parameters to that function
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Mon Jul 20, 2009 6:50 am    Post subject: Reply with quote

it definately has a "ret" at the end.. so how do i know how many parameters it has?

*also: how do you tell how many parameters are to a function?
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Mon Jul 20, 2009 7:28 am    Post subject: Reply with quote

Follow the stack in the function.

ex:
Code:

push edx //inc esp
mov edx,[esp+8] //first parameter
push edx //parameter for call
call 12345678
mov eax,edx
pop edx
ret


that has one parameter, because the stack is never accessed any deeper than +8. (make sure you take note of the increased stack pointer..this can be done in olly much easier, it will actually show you the arguments as Arg.1, Arg.2, etc)
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Jul 20, 2009 8:21 am    Post subject: Reply with quote

sometimes you can tell by the 'ret x'

another method is breakpoint at the start of the function, look at the return address and go there and before that is the function call and arguments which unless deliberately obfuscated is probably the easiest way of finding how many parameters and what each does
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Mon Jul 20, 2009 8:55 am    Post subject: Reply with quote

Which register holds the return address?

And is it a relative location value or absolute?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Jul 20, 2009 12:00 pm    Post subject: Reply with quote

eax. return address is an absolute pointer

my return address hook :
http://wnz.zwit.org/
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Mon Jul 20, 2009 5:09 pm    Post subject: Reply with quote

if i toggle at the "ret" i get a address to the beginning of a data structure that i'm editing...

Damn, theres no way to see "which function called this function?" or simply, where it is returning to Sad
Back to top
View user's profile Send private message
Guy
Expert Cheater
Reputation: 0

Joined: 30 May 2009
Posts: 187

PostPosted: Mon Jul 20, 2009 5:33 pm    Post subject: Reply with quote

mStorm wrote:
if i toggle at the "ret" i get a address to the beginning of a data structure that i'm editing...

Damn, theres no way to see "which function called this function?" or simply, where it is returning to Sad


Olly has such features, but personally, I just use IDA's cross-references feature.

http://www.hex-rays.com/idapro/idadownfreeware.htm

_________________
Has anyone seen Hitler around..? If so, PM me!
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Jul 21, 2009 3:48 am    Post subject: Reply with quote

mStorm wrote:
if i toggle at the "ret" i get a address to the beginning of a data structure that i'm editing...

Damn, theres no way to see "which function called this function?" or simply, where it is returning to Sad

read my source and you'll see how hooking for a return address works
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Tue Jul 21, 2009 11:56 am    Post subject: Reply with quote

Hm.. Looks interesting. I traced back where the call was made from, now its a block of code with tons of jumps..

I am just toggling a breakpoint, and seeing if me jumping in the game triggers a break. I've traced it all the way up to a point that has int 3's all above it, so it must be a point where something "jumps" to it, yet I cannot find what is calling the jump. What is a good method of finding this?

(It wont let me +rep you twice in a row Slug, so I gotta rep someone else first.. heh)
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Jul 21, 2009 2:55 pm    Post subject: Reply with quote

if you're in olly then breakpointing you can see what last called/jmped from it by pressing '-'
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Tue Jul 21, 2009 3:09 pm    Post subject: Reply with quote

Cool, I'll try that when I get off work.

So just set a breakpoint at that address, make it trigger, then hit the minus key, and it will go to the instruction that was directly before it?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Jul 22, 2009 1:53 am    Post subject: Reply with quote

should do.. if that fails you i guess you could try using the run trace functions in olly
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Wed Jul 22, 2009 9:56 am    Post subject: Reply with quote

I used the "Previous" option in Olly and it took me back to a memory address that didn't make much sense, i think like 10010000 (first address in the module)

:[
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
Goto page 1, 2  Next
Page 1 of 2

 
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