J
Joris
Hi
I'm not sure if this is the correct newsgroup for this question
as it involves both ASM and c++, but here goes.
I have written a function in C++ that has to replace one of
a process in memory (to change functionality).
The original function's address is retrieved from 1 offset.
When the application starts I write the address of my new
function to that offset. So far so good. I found out the original
function has 1 argument (4-byte) and returns a 4-byte value
(1 or 0, BOOL). This fails. I took a look at the code c++
had generated, in a debugger. I saw c++ ends the new
function with "retn". When I changed this to "retn 4"
the process ran without any problems.
Why does "retn 4" work and "retn" not? Why does
Visual C++ compile "retn" and not "retn 4"?
Thanks
Joris
I'm not sure if this is the correct newsgroup for this question
as it involves both ASM and c++, but here goes.
I have written a function in C++ that has to replace one of
a process in memory (to change functionality).
The original function's address is retrieved from 1 offset.
When the application starts I write the address of my new
function to that offset. So far so good. I found out the original
function has 1 argument (4-byte) and returns a 4-byte value
(1 or 0, BOOL). This fails. I took a look at the code c++
had generated, in a debugger. I saw c++ ends the new
function with "retn". When I changed this to "retn 4"
the process ran without any problems.
Why does "retn 4" work and "retn" not? Why does
Visual C++ compile "retn" and not "retn 4"?
Thanks
Joris