ESP:(Extended stack pointer)是指针寄存器的一种,用于指向栈的栈顶。
_cdecl:C/C++默认的调用方式,调用方平衡栈,不定参数的函数可以试用。
调用方:
1、参数压栈。esp-=4
2、调用函数。
3、实现栈平衡。esp+=4

此处的printf也是同样道理
0x004010CB、0x004010CC两处压入参数,共8个字节
0x004010D6平衡esp。esp+=8
_stdcall:被调方平衡栈,不定参数的函数无法使用。

调用方:
1、参数压栈。esp-=4
2、调用函数。

被调方:0x00401099 ret 4,平衡栈,esp+=4
_fastcall:寄存器方式传参,被调方平衡栈,不定参数的函数无法使用。 只使用2个寄存器ecx,edx,超出部分转成栈传递。

调用方:
1、第一、二个参数用了寄存器
2、超出部分压入栈。
被调方:0x0040114d ret 8,平衡栈,esp+=8
printf同理:
0x00401123、0x00401127、0x0040112B、0x0040112F、0x00401130一共5次压入栈共20(0x14)个字节。
0x0040113A 平衡栈 esp+=0x14
执行至0x00401130时,传入的4个参数1,2,3,4分别存放于ebp-4、ebp-8、ebp+8、ebp+0xC中,那么ebp和ebp+4存放的是什么呢?
通过0x00401101可以看出此时的ebp是栈的底部,指向了刚才0x00401100保存的前一次ebp的值。
而ebp+4保存的是0x0040137B call 的下一条指令地址,在调用call时会自动把下一条指令地址压入栈。



函数栈帧的粗略图
