其他分享
首页 > 其他分享> > 函数调用约定, 以及特殊种类

函数调用约定, 以及特殊种类

作者:互联网

C/C++函数调用约定
调用方式 参数 栈恢复 __fastcall ecx,edx,esp n __stdcall esp 0 __cdecl esp n __stdcall(class) ecx,esp n __cdecl(class) ecx,esp 0 __fastcall(class) ecx,edx,esp n

以上为VS2010, 实际程序有些特殊约定方式(其他编译器, 或优化),
如参数传递使用ecx,edx,esp, 但是栈恢复没有,
如果需要定义该种类的函数指针或Hook之类的只能用汇编方式

__declspec(naked) int __fastcall Hook_SpdySessionDelStm(SpdySession *_ecx, int status, SpdyStream *stream) { __asm mov eax,[esp+4]; __asm pushad; __asm push eax; __asm push edx; __asm push ecx; __asm call OnSpdySessionDelStm; __asm popad; __asm jmp Real_SpdySessionDelStm; }

标签:__,fastcall,esp,约定,函数调用,种类,edx,asm,ecx
来源: https://www.cnblogs.com/zzz3265/p/15763668.html