52 of the macros in \masm32\macros\macros.asm return eax ("EXITM <eax>").
When using such a macro e.g. as mov eax, fsize(hFile), OllyDbg (http://www.ollydbg.de/version2.html) reveals that you create a pretty superfluous mov eax, eax.
Here is a very simple workaround:
void MACRO args
% @CatStr(<;>, <args>)
ENDM
Usage (for example):
void fsize(hFile)
mov esi, alloc(eax)
that is a much-needed macro, Jochen
i think it allows certain use of some of these macros that has otherwise been ellusive
Dave,
mov esi, alloc(fsize(0)) works, too, but I remember some situations where I simply could not get rid of the mov eax, eax
:bg
Ummmm,
How about,
mov pMem, alloc(bytesize)
No mov eax, eax there. :bg
It is a cute macro though.
Quote from: hutch-- on December 07, 2009, 12:01:47 PM
Ummmm,
How about,
mov pMem, alloc(bytesize)
No mov eax, eax there. :bg
It is a cute macro though.
In some cases we don't want to move it anywhere. And just to have it stored in a register. And in the cases when we are content with having it left in EAX the assembler would generate an extra 'mov eax, eax' :/
thats easy to deal with, if you don't want the function format, don't use it. Just call the procedure directly or if you want a macro that works differently, write one. With the format of the macro returning EAX from the mACRo, it is in fact the author that is writing mov eax, eax, not the assembler or the macro.