int main(int argc, char *argv[])
{
push ebp
mov ebp,esp
sub esp,40h
push ebx
push esi
push edi
lea edi,[ebp-40h]
mov ecx,10h
mov eax,0CCCCCCCCh
rep stos dword ptr [edi]
return add(1,2);
push 2
push 1
call @ILT+35(abc5) (00401028)
add esp,8
}
pop edi
pop esi
pop ebx
add esp,40h
cmp ebp,esp
call __chkesp (004013e0)
mov esp,ebp
pop ebp
ret
_stdcall
是被调用函数自己平栈,ret n,n为被调用者的函数参数所占字节数
int main(int argc, char *argv)
{
push ebp
mov ebp,esp
sub esp,40h
push ebx
push esi
push edi
lea edi,[ebp-40h]
mov ecx,10h
mov eax,0CCCCCCCCh
rep stos dword ptr [edi]
return add(1,2);
push 2
push 1
call @ILT+40(abc5) (0040102d)
}
pop edi
pop esi
pop ebx
add esp,40h
cmp ebp,esp
call __chkesp (004013e0)
mov esp,ebp
pop ebp
ret
int _stdcall add(int a, int b)
{
push ebp
mov ebp,esp
sub esp,40h
push ebx
push esi
push edi
lea edi,[ebp-40h]
mov ecx,10h
mov eax,0CCCCCCCCh
rep stos dword ptr [edi]
return a+b;
mov eax,dword ptr [ebp+8]
add eax,dword ptr [ebp+0Ch]
}
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 8
int _stdcall add(int a, int b)
3: {
00401020 push ebp
00401021 mov ebp,esp
00401023 sub esp,40h
00401026 push ebx
00401027 push esi
00401028 push edi
00401029 lea edi,[ebp-40h]
0040102C mov ecx,10h
00401031 mov eax,0CCCCCCCCh
00401036 rep stos dword ptr [edi]
4: return a+b;
00401038 mov eax,dword ptr [ebp+8]
0040103B add eax,dword ptr [ebp+0Ch]
cmp eax,0
jz xxxxxxx
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 8 //----------------
5: }
xxxxxxx pop edi
0040103F pop esi
00401040 pop ebx
00401041 mov esp,ebp
00401043 pop ebp
00401044 ret 8 //----------------