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 


JMP Offset

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

Joined: 03 Sep 2021
Posts: 7

PostPosted: Fri Sep 03, 2021 4:59 am    Post subject: JMP Offset Reply with quote

hi, i'm trying to create code cave using python Rolling Eyes
my problem for now is the jmp offset...i can't calculate it's relative...
the situation is this:
Code:
instruction address:
0x004ECF25
allocated address:
0x05190000


the calculated offset for e9 is 4CA 30DB
Code:
allocAdr - instrAddr - 5(bytes for instruction)=4CA 30DB


but when i modify the bytes...i see in the memory viewer:
Code:
E9 04 CA 30 DB      jmp DB7F992E


but the exact bytes(wich calculate CE are diferent):
Code:
E9 D6 30 CA 04      jmp 05190000



where i am wrong?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Sep 03, 2021 10:58 am    Post subject: Reply with quote

First of all, the jump is relative to RIP, which points to the next instruction to execute. You need to account for the instruction size (5 bytes) before you assemble the offset. Therefore the jump effectively starts at 0x004ECF2A, and the offset would be 0x05190000 - 0x004ECF2A = 0x4CA30D6.

Second, you're writing the offset in big endian when it should be in little endian. i.e. bytes for 0x4CA30D6 = D6 30 CA 04.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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