Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Problem with Return Address (https://forum.exetools.com/showthread.php?t=2449)

ArC 08-02-2003 16:50

Problem with Return Address
 
I got an application which calls a MFC function.
That MFC function calls another MFC function.
Now my problem:
As you know, when a call is executed, the return
address is pushed on the stack.
But not in this case:
When that MFC function calls the other MFC function,
0 is pushed on the stack as return address instead of
the real return address.
The result of this is that when that call
returns, the app crashes.

So how can this happen?

Notice:
That application is protected.
In the protected version of the app
that problem does not seem to occur.
However, I've unpacked that app by hand
and now I got this problem.

Thx

Squidge 08-02-2003 18:39

Which protection was it? As any app that uses CALL to jump into MFC is guaranteed to have a valid return address as it's pushed onto the stack by the hardware. What you are most likely seeing is that the app itself is doing the PUSH and then JMPing into MFC. Maybe it pushes the address of some protection function onto the stack, and once the protection is removed, the result is zero, hence the crash?

ArC 08-03-2003 16:13

Sorry, everything is ok:
Inside that call there's a pointer pointing
to the return address.
However, there's an AND [pointer],0 executed
which causes that the return address is "removed"

However, it's still a bit strange, cause the return address
is duplicated on the stack. You can say that it is stored
twice.
But when we come to the RET of the call, the stack points
to the old return address which was removed with the AND
I mentioned above....

However, thx for your reply :)


All times are GMT +8. The time now is 16:26.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX