#include "windows.h" #include "stdio.h" _declspec(naked) void Fun() { _asm { push ebp; mov ebp ,esp; sub esp ,0x40; push esi; push edi; push ecx; mov eax,0xcccccccc; mov ecx,0x10; lea edi,[ebp-0x40]; REP STOS DWORD PTR ES:[EDI]; mov eax,[ebp+0x8]; add eax,[ebp+0xc]; pop ecx; pop edi; pop esi; mov esp,ebp; pop ebp; ret; } } void main() { int arg =0; _asm { push 0x3; push 0x5; call Fun; mov DWORD ptr [arg],eax; //赋值到内存地址 add esp,0x8; //外平栈,自己恢复堆栈 } printf("res=%d\n",arg); getchar(); }