#include "stdafx.h"
#include <iostream>
#include <time.h>
using namespace std;
void fun2();
void fun( int a, int b )
{
int retAddr =(int)(&a)-4; // :获取fun返回地址
*(int *)retAddr= (int)(fun2); // :破坏fun返回地址,改为fun2
// :效果同上
int* pretAddr =(&a)-1; // :获取fun返回地址
*pretAddr = (int)(fun2); // :破坏fun返回地址
}
void fun2()
{
cout<<"come here baby!"<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
int d = 3;
fun(d, d);
system("pause");
return 0;
}