Hello everyone,
I was wondering, what's the right way to preserve the registers when I am using them and using API functions. I have a code, where I use many registers and many API functions. I know that some API functions don't preserve the registers. So, my code is filled with push's, pop's, pushad's and popad's.
I wonder if there is anothe solution to this?
Do I really have to do all these pushing and poping?
How can I know what registers an API function overwrites?
Thanks in advance.
Posted on 2002-01-31 18:44:45 by dilau
api functions will always preserve ebx, esi and edi (well, esp and ebp as well, but you wouldn't really use them like you use the other regs). the contents of all other registers can (and most probably will) be changed.
Posted on 2002-01-31 19:08:05 by Tola

what's the right way to preserve the registers when I am using them and using API functions


Continue using all those push's and pop's, is the best way.
Posted on 2002-01-31 19:51:19 by CodeLover