how to define wsprintfA or W to work with x64calling.inc

Started by GUAN DE DIO, August 01, 2008, 10:40:46 PM

Previous topic - Next topic

GUAN DE DIO

Hi,

     I am using the x64calling.inc file and I had the next error when I tray to use wsprintfA API.

     error A2052: forced error : wsprintf doesn't take this number of parameters


     I have define the API in this way
     

     funcproto external,wsprintf,QWORD,QWORD,VARARG

      I spouse the problem is in VARARG.

      Do anyone know how to define this kind of APIS with numbers of param variables ?

Thanks,
GUAN

GregL

Maybe try using a C compiler that supports x64 and look at the generated assembly code. Pelle's C supports x64 now.


ecube

wsprintf is a c calling convention,(cdecl) that macro is a typical 64bit callin(fastcall) so it won't work correctly.

GregL

E^cube,

wsprintf is fastcall in x64.  The x64 C Run-Time library is fastcall too, not cdecl.  There is only one calling convention.

You call wsprintf like this (copied from working code):

  lea rcx, szBuffer  ; buffer
  lea rdx, szFmt     ; format string
  mov r8, qwNum      ; value
  call wsprintfA



I am not familiar with the funcproto macro, so I don't know why it wouldn't work, maybe it is because of VARARG.


Igor

Try it with only one QWORD: "funcproto external,wsprintf,QWORD,VARARG".