It'll half work, and only if you've set up a stack frame, as well as disabled the epilogue.

It should really be


...
mov esp, ebp
pop ebp
ret


But why you'd want to is a mystery! By winding back the value of esp, you've effectively removed the values of eax and ecx from the stack. Although the values are still present immediately after the ret, they could be overwritten in the future, and any reliance on their being constant is probably foolish (unless you are specifically doing this).

Mirno
Posted on 2003-05-09 13:07:02 by Mirno
we just want the ret value. So let ecx and eax there for a while.
Posted on 2003-05-10 05:08:04 by realvampire