sorry if i'm lazy to read again the tutorials ....

Is it correct if always use esi, edi, ebx regs without pushing an pop them for API calls ? Seems them are always preserved...

Is it always true for all 95 98 2K ME and NT ?

thanks Angelo
Posted on 2001-10-30 12:40:03 by Bit7
yes, it's always true for all 95 98 2K ME and NT.
Posted on 2001-10-30 13:52:04 by n u M I T_o r
n u M I T_o r ,

So it should be true that eax, ecx, edx are lost after api call.

thanks.
Posted on 2001-10-30 15:52:06 by Bit7
Yeah. It's just like when you write functions to be called by Windows. The function can do whatever it wants with eax, ecx, and edx, and it has to preserve edi, esi, and ebx.
Posted on 2001-10-30 16:32:42 by Irving W.
I've gotten into the habit of just putting "USES esi edi ebx" at the start of every function (proc), it prevents problems in the long run.
Posted on 2001-10-30 22:56:06 by sluggy
tanks all
Posted on 2001-10-31 00:45:26 by Bit7
Sluggy, the only place you should need those "uses" are in your
wndprocs, dlgprocs, and other forms of callbacks. Perhaps you
might use the registers in some subproc of yours, but when you
return to the callback, they will be restored for the API.

But of course, if you use esi,edi,ebx other places in your code and
depend on them being preserved... :)
Posted on 2001-10-31 04:54:17 by f0dder
again everybody forgets ebp ;(
Posted on 2001-11-01 11:33:28 by lifewire
Is ebp nessacary?
Posted on 2001-11-02 23:29:20 by lackluster
You really only need to push / save the registers
EBX, ESI, EDI, & EBP if your routine (or any
routine / procedure / API your routine calls)
modifies those registers. It's probably unusual
within a WIN32 routine or callback to modify EBP
without eventually restoring it back to it's
original value.

farrier
Posted on 2001-11-03 00:09:12 by farrier