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 


"Return Address" and "Parameters" in Mem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Tue Nov 15, 2016 8:07 pm    Post subject: "Return Address" and "Parameters" in Mem Reply with quote

Please take a look at the following screenshot.

I want to know what " Return Address" and "Parameters" mean in Memory Viewer.

1. Does "Return Address" indicate the address of the calling function (caller)?

2. Does "Parameters" indicate the parameters in the calling function, which is at the location of "Return Address"?

Thanks a lot.



Capture.JPG
 Description:
 Filesize:  30.68 KB
 Viewed:  5939 Time(s)

Capture.JPG


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 155

Joined: 06 Jul 2014
Posts: 4758

PostPosted: Tue Nov 15, 2016 9:04 pm    Post subject: Reply with quote

They're based on standard calling conventions of subroutines that establish their own stack frames. The return address is the address the current subroutine may return to, and the parameters are possible arguments that were passed to the subroutine.

Of course, they don't have to be correct. Smaller subroutines don't need to establish a stack frame and are free to use the ebp register for other purposes.

_________________
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
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Tue Nov 15, 2016 9:25 pm    Post subject: Reply with quote

ParkourPenguin wrote:
They're based on standard calling conventions of subroutines that establish their own stack frames. The return address is the address the current subroutine may return to, and the parameters are possible arguments that were passed to the subroutine.

Of course, they don't have to be correct. Smaller subroutines don't need to establish a stack frame and are free to use the ebp register for other purposes.


Thanks, Penguin. So if I understand correctly:

1. The parameters will be passed from the current subroutine to whatever is at the return address, right?

2. Why are there so many return addresses? Does the first return address return to the second return address in the list?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 155

Joined: 06 Jul 2014
Posts: 4758

PostPosted: Tue Nov 15, 2016 9:50 pm    Post subject: Reply with quote

That is not what a parameter is. A parameter/argument (more or less refers to the same thing) is a value passed to the subroutine by the caller. They are sometimes passed through registers (e.g. fastcall, x64 calling conventions), but are commonly passed through the stack (e.g. stdcall, cdecl). The value that is returned by the subroutine to the caller is passed almost exclusively through the eax register (rax for x64, sometimes st(0) for x87 or xmm0 for SSE).

There are so many return addresses because functions can call other functions.
Code:
function f1()
  ...
end

function f2()
  f1()
end

function f3()
  f2()
end

In the above Lua example, f3 will call f2 which in turn calls f1. In such a case, f1 will return to f2 which will then return to f3.

Perhaps you should learn the basics of a higher-level language first so that you are more familiar with common programming terminology (such as "parameter") and mechanics (how to use functions).

_________________
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
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Tue Nov 15, 2016 10:27 pm    Post subject: Reply with quote

ParkourPenguin wrote:
That is not what a parameter is. A parameter/argument (more or less refers to the same thing) is a value passed to the subroutine by the caller. They are sometimes passed through registers (e.g. fastcall, x64 calling conventions), but are commonly passed through the stack (e.g. stdcall, cdecl). The value that is returned by the subroutine to the caller is passed almost exclusively through the eax register (rax for x64, sometimes st(0) for x87 or xmm0 for SSE).

There are so many return addresses because functions can call other functions.
Code:
function f1()
  ...
end

function f2()
  f1()
end

function f3()
  f2()
end

In the above Lua example, f3 will call f2 which in turn calls f1. In such a case, f1 will return to f2 which will then return to f3.

Perhaps you should learn the basics of a higher-level language first so that you are more familiar with common programming terminology (such as "parameter") and mechanics (how to use functions).


Oh, got it. my brain wasn't functioning and asked a stupid question. Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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