验证为啥可以修改函数地址指向的地方,这个地方难道不是在代码段吗?
修改了以后为啥备份的原函数地址还可以调用原函数,代码段原函数的首地址指向的地方的内容不是已经改成跳转方法的首地址了吗?
因为私信了,在原评论区无法给作者详细的解释,这里是我验证的几个点,希望andwei能够有所启发吧:
写了一个demo,平台为debian linux 10,x64,只在linux平台做了验证,因为android的底层即为linux,所以这里认为平台是一致的。
# include
#include
#include
#include
int Max(int, int); //函数声明
int Add(int x,int y);
int main(void)
{
int(*p_max)(int, int); //定义一个函数指针
int a=1,b=2, c;
p_max = Max; //把函数Max赋给指针变量p, 使p指向Max函数
c = (*p_max)(a, b); //通过函数指针调用Max函数
printf("p_max=%p,*p_max=%p,**p=%p\n",p_max,*p_max,**p_max);
printf("Max=%p,&Max= %p\n",Max,&Max);
void *handle;
char*(*p_strcat)(char *dest, const char *src);
//strcat
h