Author Topic: invope macro  (Read 231 times)

HSE

  • Member
  • ***
  • Posts: 389
  • <AMD>< 7-32>
invope macro
« on: January 02, 2017, 02:29:14 AM »
HI all!

This is a simple macro for nicer code. Perhaps there is a similar one, but I don't saw.

Code: [Select]
;######################################################
; A wrapper to invoke
; pushing registers before, and poping after

invope macro regis:REQ, params:VARARG
local count

argstr equ <invoke >
PushAll regis                                        ;ObjAsm32 macro
count = 0
FOR param1, <params>
if count eq 0
   argstr CATSTR argstr, <param1>
count = count+1
else
  argstr CATSTR argstr, <,param1>
endif
ENDM
argstr
PopAllRev regis      ;ObjAsm32 macro
endm

That allow to change:
Code: [Select]
push ecx
        invoke IsWindowVisible, [ecx].puntero
        pop ecx
        push eax
        push ecx
        invoke StrCat, addr [esi].salida, addr [esi].str_op
        pop ecx
        pop eax
by:
Code: [Select]
invope ecx, IsWindowVisible, [ecx].puntero
invope <eax, ecx>, StrCat, addr [esi].salida, addr [esi].str_op

Regards. HSE