Hello
Today I needed to use the VARARG proc feature. I noticed that the VARARG arguments default to DWORD instead of QWORD.
Type casting the arguments solves the problem, but in my opinion, the default should be QWORD.
The dissassembly shows what I mean:
start:
sub rsp,38h
mov dword ptr [rsp+20h],89ABCDEFh
mov r9d,89ABCDEFh
mov r8d,89ABCDEFh
mov rdx,0B23456789ABCDEFh
mov rcx,0A23456789ABCDEFh
call TestProc (0331000h)
mov qword ptr [rsp+20h],rdx
mov r9,rcx
mov r8,rbx
mov rdx,rax
mov rcx,0A23456789ABCDEFh
call TestProc (0331000h)
add rsp,38h
ret
Source
.xmm
option casemap:none
option dotname
option frame:auto
option win64:8
option stackbase:rsp
.code
TestProc proc Arg1:QWORD, Arg2:VARARG
mov r8, Arg1
mov r9, Arg2
ret
TestProc endp
start proc
invoke TestProc, 0123456789ABCDEFh, QWORD ptr 0123456789ABCDEFh, 0123456789ABCDEFh, 0123456789ABCDEFh, 0123456789ABCDEFh
invoke TestProc, 0A23456789ABCDEFh, rax, rbx, rcx, rdx
ret
start endp
end start
Regards, Biterider