Here is the coinvoke macro to use with the translated sdk header.
This allow to change the header of a source code,without too many problems.
Tested with http://masm32.com/board/index.php?topic=3568.msg37519#msg37519 (http://masm32.com/board/index.php?topic=3568.msg37519#msg37519)
Quote
coinvoke MACRO pInterface:REQ, Interface:REQ, Function:REQ, args:VARARG
LOCAL istatement, arg
FOR arg, <args> ;; run thru args to see if edx is lurking in there
IFIDNI <&arg>, <edx>
.ERR <edx is not allowed as a coinvoke parameter>
ENDIF
ENDM
IFIDNI <&pInterface>, <edx>
.ERR <edx is not allowed as a coinvoke parameter>
ENDIF
istatement CATSTR <invoke (ST&Interface PTR[edx]).>,<&Function, pInterface>
IFNB <args> ;; add the list of parameter arguments if any
istatement CATSTR istatement, <, >, <&args>
ENDIF
mov edx, pInterface
mov edx, [edx]
istatement
ENDM
Hi ToutEnMasm,
Here is my version :
coinvoke MACRO ppv:REQ,interface:REQ,member:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16
FOR arg,<p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
IFNB <arg>
push arg
ENDIF
ENDM
mov eax,ppv
push eax
mov eax,DWORD PTR [eax]
call @CatStr(interface,<.>,member)[eax]
ENDM
another one,
Asio_invoke MACRO pInterface:REQ,Function:REQ,Args:VARARG
LOCAL ArgList
ArgList TEXTEQU <>
IFNB <Args>
FOR Arg,<Args>
ArgList CATSTR <Arg>,<,>,ArgList
ENDM
ArgList SUBSTR ArgList,1,@SizeStr(%ArgList)-1
ArgList CATSTR <!<>,ArgList,<!>>
%FOR parameter,ArgList
push parameter
ENDM
ENDIF
mov ecx,pInterface
mov eax,[ecx]
call DWORD PTR [eax+Function]
ENDM
If Siekmanski allow me this,as a test,i have changed the include files of his source code for the translated sdk.
The coinvoke macro posted upper is in use here.
If you don't agree,i just delet this post.
There is just a little modify of the sdk32.inc file to do to make it work.
Quote
.686P
.XMM
;.MMX ;-------------------- create a problem with other instructions
hi Yves
it might be the order...
.686p
.MMX
.XMM
Quote
it might be the order...
.686p
.MMX
.XMM
OK ,it work.
I didn't write the coinvoke macro, picked it up in 2003 when i transalated the d3d9 includes.
Believe it was written by a guy named ernie.
feel free to use and change anything i post here.