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 


[ASM] Calculating a Relative Address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Mon Dec 24, 2007 8:13 pm    Post subject: [ASM] Calculating a Relative Address Reply with quote

How might one go about calculating a relative address?

I've tried Google, but nothing showed up; I was going to try CEF, but something strayed me away... (Look at the picture if you don't get it)

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Mon Dec 24, 2007 8:21 pm    Post subject: Reply with quote

Obtain base address.
Code:
add base, OFFSET


Anyways, you weren't being specific enough.

_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Mon Dec 24, 2007 8:28 pm    Post subject: Reply with quote

Ok, well what I meant was:

If you are given an opcode, for example

Code:

call 01002ff5


The way you would find its array of bytes is to get the opcode's defined bytes for those specified parameters (in that case, parameter), which is

Code:

e8


then still the rel32 bytes in reverse on the back.

How do you calculate the rel32 from that?

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Dec 24, 2007 9:10 pm    Post subject: Reply with quote

Code:

(Destination - (Base + 5))


so if we wanted to do call 01002ff5 from 00500000...

01002ff5 - 00500005 = 00B02FF0

expressed in little endian byte notation is:

Code:

e8 f0 2f b0 00

_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Mon Dec 24, 2007 11:15 pm    Post subject: Reply with quote

Damn it appalsap, I get back to the computer and I see this thread and feel like helping, and you beat me too it. Razz

Anyways, to OP: Its best to make an array such as this:
Code:
unsigned char jump[] = { 0xe8 /*0xe9 for JMP*/, 0x00, 0x00, 0x00, 0x00 };


Then constructing the jump using memcpy (or the intrinsic function __movsb()).

Oh, and for the sake of simplicity you could just reduce the formula to: (To - From - 5). You be surprised how many people don't realize this when all it is is basic math. Confused
Back to top
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Tue Dec 25, 2007 9:39 am    Post subject: Reply with quote

Flyte wrote:
Damn it appalsap, I get back to the computer and I see this thread and feel like helping, and you beat me too it. Razz
Welcome to the club Razz
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed Dec 26, 2007 2:09 pm    Post subject: Reply with quote

Alright, thanks a ton everyone. The dll should be finished by the end of today.
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
"A"
Grandmaster Cheater Supreme
Reputation: 0

Joined: 26 Dec 2007
Posts: 1589
Location: Deme,Broa,Scaina

PostPosted: Wed Dec 26, 2007 7:09 pm    Post subject: Reply with quote

i no this hummm gold on lol
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