you can add a function type by editing it (Key Y) and adding the name.
I wrote a page to remind me about calling conventions at ASM level.
Introduction
the original call is myfunc(0,1,2,3,4)
.
- standard order is first argument is pushed last.
- standard stack adjusting is 'callee cleanup' - after returning, the stack should be without its calling arguments.
Note: the stack looks vertically like the call order.
stdcall (stack only)
push 4
push 3
push 2
push 1
push 0
call myfunc
xor eax,eax
retn 10
Fastcall (ecx, edx)
This is actually Microsoft's fastcall.
push 4
push 3
push 2
mov edx,1
xor ecx,ecx
call myfunc
xor eax,eax
retn 10
CDECL & syscall (caller cleanup)
push 4
push 3
push 2
push 1
push 0
call myfunc
add esp,014
xor eax,eax
retn 10
Pascal (reverse order, ebx saved, even if ebx is unused...)
push ebx
push 0
push 1
push 2
push 3
push 4
call myfunc
xor eax,eax
pop ebx
retn 10
Fortran/watcall (eax, edx, ebx, ecx, then stack - ebx is saved)
Apparently it's not so clear what the fortran calling convention is, and this one is even different from raymond's post's The __fortran
calling convention isn't the calling convention used by FORTRAN.
push ebx
push 4
mov ecx,3
mov ebx,2
mov edx,1
xor eax,eax
call myfunc
xor eax,eax
pop ebx
retn 10
Delphi 'registers' calling convention (default)
Uses eax
, ecx
, edx
as first 3 arguments. Other arguments are pushed on stack in reverse order.
push 3
push 4
mov ecx, 2
mov edx, 1
xor eax,eax
call myfunc
xor eax,eax
retn 10