Just a simple question cause i dont know to code macros worth shit.
To push arguemnts one after the other.. perferably without an argument limit..

so i can do like: @push eax, eax, 15, ebx, ecx.. etc..

anyone know how to do this and maybe some guides on macros would be cool thx..
Posted on 2004-11-29 15:16:40 by pwn


_push MACRO param:VARARG
FOR arg,<param>
push arg
ENDM
ENDM


An example:


_push eax,ecx,10,OFFSET value,value
Posted on 2004-11-29 16:13:01 by Vortex
I use these two:


pushi macro Whats:VARARG
local txt1
for txt1,<Whats>
push txt1
endm
endm
popi macro arglist:VARARG
local txt1
LOCAL txt, arg
txt TEXTEQU <>
FOR arg, <arglist>
txt CATSTR <arg>, <!,>, txt
endm
txt SUBSTR txt, 1, @SizeStr( %txt ) - 1
%for txt1,<txt>
pop txt1
endm
endm

poppi textequ <popi>

pushi ebx,ecx,edx,esi,edi
invoke ...
poppi ebx,ecx,edx,esi,edi
handy ^_^
Posted on 2004-11-29 17:03:50 by Ultrano
Nested?

pushi macro Whats:VARARG 

local txt1
for txt1,<Whats>
push txt1
endm

popi macro
local txt1
LOCAL txt, arg
txt TEXTEQU <>
FOR arg, <Whats>
txt CATSTR <arg>, <!,>, txt
endm
txt SUBSTR txt, 1, @SizeStr( %txt ) - 1
%for txt1,<txt>
pop txt1
endm
endm

endm

pushi ebx,ecx,edx,esi,edi
pushi ebp,eax
popi ; but! this wont work.
popi
Posted on 2004-11-29 19:44:02 by drizz
You changed my code, that's why it doesn't work. You have missed "endm" and put it in the end. Endm is not only for ending a macro definition!
Posted on 2004-11-29 22:44:32 by Ultrano
thx vortex. i tried your code, 1 problem though.. its not in standard call.

take for instance


Invoke joe, eax, ebx, ecx, 0x100

will do this:
push 0x100
push ecx
push ebx
push eax
..

Your macro for push:
_push eax, ebx, ecx, 0x100

will do this:
push eax
push ebx
push ecx
push 0x100

anyways around this?
Posted on 2004-11-30 03:49:17 by pwn
There's a macro "Scall" search for it. Or you can modify my popi macro to do push instead of pop
Posted on 2004-11-30 04:07:16 by Ultrano
can you do it for my please?
Posted on 2004-11-30 05:12:56 by pwn


; my implementation:
Scall macro arglist:VARARG
local txt1
LOCAL txt, arg
txt TEXTEQU <>
FOR arg, <arglist>
txt CATSTR <arg>, <!,>, txt
endm
txt SUBSTR txt, 1, @SizeStr( %txt ) - 1
%for txt1,<txt>
push txt1
endm
endm





;original:

Scall MACRO name:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12, \
p13,p14,p15,p16,p17,p18,p19,p20,p21,p22

;; ---------------------------------------
;; loop through arguments backwards, push
;; NON blank ones and call the function.
;; ---------------------------------------

FOR arg,<p22,p21,p20,p19,p18,p17,p16,p15,p14,p13,\
p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
IFNB <arg> ;; If not blank
push arg ;; push parameter
ENDIF
ENDM

call name ;; call the procedure

ENDM

Posted on 2004-11-30 07:01:09 by Ultrano
Ultrano, thanks for your elegant macro.
Could you please tell me what's the difference between and [%for]?
Posted on 2004-11-30 07:38:44 by Ares