eax and ecx?
Posted on 2003-04-19 11:33:41 by suspy
Only ebx,esi,edi,esp will be preserved.

Thus expect eax,ecx,edx not to be preserved.

oopz... ebp will be preserved. Just remember to preserve esi,edi,ebx...

Posted on 2003-04-19 11:35:53 by roticv
You forgot ebp :)

P.S. wrong forum
Posted on 2003-04-19 11:37:46 by Thomas

Windows works by establishing a convention or set of rules if you like about how registers are used.

If you use normal procedures, the two registers ESP and EBP are handled automatically. The convention is that each procedure must preserve EBX ESI and EDI if it is going to use them but is free to modify EAX ECX and EDX.

This means in practical terms that if you want to call a Windows API function, it will preserve EBX ESI and EDI but it will most probably modify one or more of the registers EAX ECX and EDX.

If you observe the convention properly, you preserve EBX ESI and EDI in your own procedure which will not be changed by an API call but preserve any values you have in EAX ECX and EDX before the API call and restore them aftre the API call had returned.

This way you can safely nest as many procedures and API calls as you like without any problems.


Posted on 2003-04-19 21:37:54 by hutch--
I got it
Posted on 2003-04-20 23:51:11 by suspy