Saturday, July 14, 2007

A win32 funny stuff!

I got a job.Im work for IVISAKA now.I got some funny stuff from the win32 platform.One of things about function call in win32 that you can using cl compiler to view a structure of function call:
#define shawn _stdcall
#define cayla _cdecl
#define chris _fastcall

void test(int a,int b,int c,int d)
{}
chris int main()
{
test(10,20,30,40);
return 0;
}

#define shawn _stdcall
push 40 ; 00000028H
push 30 ; 0000001eH
push 20 ; 00000014H
push 10 ; 0000000aH
call ?test@@YGXHHHH@Z ; test

#define cayla _cdecl
push 40 ; 00000028H
push 30 ; 0000001eH
push 20 ; 00000014H
push 10 ; 0000000aH
call ?test@@YAXHHHH@Z ; test
add esp, 16 ; 00000010H

#define chris _fastcall
push 40 ; 00000028H
push 30 ; 0000001eH
mov edx, 20 ; 00000014H
mov ecx, 10 ; 0000000aH
call ?test@@YIXHHHH@Z ; test

No comments: