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 


Redirecting code! JMP or CALL

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Bswap
Newbie cheater
Reputation: 0

Joined: 18 Aug 2009
Posts: 21

PostPosted: Sun Nov 01, 2009 9:28 pm    Post subject: Redirecting code! JMP or CALL Reply with quote

When gamehacking we have to redirect code execution away from the main game code quite a lot... for most of us, this is quite a basic task, but it does pose the question, what is better; JMP or CALL?

Each have their benefits and cons.

JMP pros: easy to use. does not alter flags or stack.
cons: requires knowing return address, balancing overwritten instructions

CALL pros: does not require balancing of overwritten instructions
cons: modifies stack (esp)

I imagine there would be slight performance differences between them too.

I'm opening up this thread to anyone and everyone, im eager to hear your thoughts on this subject.

Peace
Back to top
View user's profile Send private message
CourtneyMarie
How do I cheat?
Reputation: 0

Joined: 27 Oct 2009
Posts: 4

PostPosted: Mon Nov 02, 2009 3:37 am    Post subject: Reply with quote

Jmp is easier to use I'd stick to jump Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

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

PostPosted: Mon Nov 02, 2009 6:04 am    Post subject: Reply with quote

call DOES require balancing of overwritten instructions

both call and jmp are 5 byte instructions. They need to be placed somewhere, so they do overwrite memory.
In the case of call, the return will be right after the call. That means if you overwrote a 6 byte instruction you HAVE to nop the last byte out
In the case of a jmp you don't have to nop it out (it's usually better to do so for readability, but not required) you can just jump after the overwritten instruction (and saves execution time, but really, you won't notice)

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
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 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