Is there any way to tell exactly which registers a specific API call will corrupt ( I know ebx , esi and edi are preserved between calls )? It seems wastefull to have to push eax , ecx and edx before each call if not all these are used before a given call. Thanks...
You could run debug however better practice would be to work on code layout/use variables I guess.... If in an inner loop you might want to know but otherwise is hardly an issue to use variable memory.... You cant test output registers because there are no guarentees a matching reg hasnt/wont changed
and then they recompile the API on you for a patch, and it uses a different set of registers... or worse...
The idea of 'efficiency' doesnt jive with API calls anyways.. call overhead is way larger than a push.
Quote from: cman on July 06, 2010, 09:26:39 PM
Is there any way to tell exactly which registers a specific API call will corrupt
No. Microsoft will guarantee that esi edi ebx ebp remain unchanged, and that eax ecx edx "might be" or "will probably be" changed. But it would be a dangerous strategy to check if a complex API call leaves ecx intact, because a) with a different set of parameters it could change and b) the next Windows version may trash it.
What annoys me more is that there is hardly any documentation on trashing of XMM registers.