本文共 3008 字,大约阅读时间需要 10 分钟。
stdcall方式: --- d:\projects\lab\call_type\call_type.cpp ------------------------------------ int __stdcall add(int a, int b) 002613AC lea edi,[ebp-0C0h] 002613B7 mov eax,0CCCCCCCCh 002613BC rep stos dword ptr es:[edi] 002613BE mov eax,dword ptr [a] 002613C1 add eax,dword ptr [b] 002613CA ret 8 --------------------------------------------------- --- d:\projects\lab\call_type\call_type.cpp ------------------------------------ 002613EC lea edi,[ebp-0CCh] 002613F7 mov eax,0CCCCCCCCh 002613FC rep stos dword ptr es:[edi] 00261402 call add (261109h) 00261407 mov dword ptr [sum],eax 00261417 call @ILT+315(__RTC_CheckEsp) (261140h) 0026141F ret ===================================================
cdecl方式: --- d:\projects\lab\call_type\call_type.cpp ------------------------------------ 00E713AC lea edi,[ebp-0C0h] 00E713B7 mov eax,0CCCCCCCCh 00E713BC rep stos dword ptr es:[edi] 00E713BE mov eax,dword ptr [a] 00E713C1 add eax,dword ptr [b] 00E713CA ret --------------------------------------------------- --- d:\projects\lab\call_type\call_type.cpp ------------------------------------ 00E713EC lea edi,[ebp-0CCh] 00E713F7 mov eax,0CCCCCCCCh 00E713FC rep stos dword ptr es:[edi] 00E71402 call add (0E71096h) 00E7140A mov dword ptr [sum],eax 00E7141A call @ILT+315(__RTC_CheckEsp) (0E71140h) --------------------------------------------------- const unsigned char thunkCodeTemplate[] =
{
0x55, // push ebp
0x8B, 0xEC, // mov ebp, esp
0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, [new_addr]
0xB9, 0x00, 0x00, 0x00, 0x00, // mov ecx, [old_addr]
0x51, // push ecx
0xFF, 0xD0, // call eax
0xC9, // leave
0xC3 // ret
}; 本文转sinojelly51CTO博客,原文链接: http://blog.51cto.com/sinojelly/431704 ,如需转载请自行联系原作者