ASM Question (Caller's Address?)
Posted: Tue Sep 07, 2004 8:59 am
I have a function that needs to know where it's going to return to when it's finished... I have read up on this (and it's been discussed before here) but I simply can't get it to work!
As far as I know, the return address of a function is stored in [ebp+4] but every time I try to put it into a variable I get a big fat NULL value...
I've tried this:
But I get an error... So I try this:
and I get NULL....
So I obviously don't know assembly!... Does anybody have working code to retrieve the return address of a function? I'm stumped!
I remember somebody on the forums saying it's in [ESP+20+(4*NumOfParams)] but that doesn't work either
As far as I know, the return address of a function is stored in [ebp+4] but every time I try to put it into a variable I get a big fat NULL value...
I've tried this:
Code: Select all
MOV MyVariable,[ebp+4]Code: Select all
MOV EAX,[ebp+4]
MOV MyVariable,EAXSo I obviously don't know assembly!... Does anybody have working code to retrieve the return address of a function? I'm stumped!
I remember somebody on the forums saying it's in [ESP+20+(4*NumOfParams)] but that doesn't work either