#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/user.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
pid_t traced_process;
struct user_regs_struct regsl;
long ins;
if (argc != 2) {
printf("PID?");
return 1;
}
traced_process = atoi(argv[1]);
ptrace(PTRACE_ATTACH, traced_process,NULL, NULL);
wait(NULL);
ptrace(PTRACE_GETREGS, traced_process,NULL, ®sl);
/* 这两句编译不通过
ins = ptrace(PTRACE_PEEKTEXT,traced_process, regsl.eip, NULL);
printf("EIP: %lx Instruction executed:%lx ", regsl.eip, ins);
*/
ptrace(PTRACE_DETACH, traced_process,NULL, NULL);
return 0;
}
gcc -o hook hook.c
提示:
error: ‘structuser_regs_struct’hasnomembernamed‘eip’
相关文章:a71K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6T1L8r3!0Y4i4K6u0W2j5%4y4V1L8W2)9J5k6h3&6W2N6q4)9J5c8Y4A6Y4L8o6l9%4i4K6u0r3j5i4u0@1K9h3y4D9k6g2)9J5c8X3c8W2N6r3q4A6L8s2y4Q4x3V1j5@1x3U0V1I4y4o6b7H3y4H3`.`.
我的改成 在x64机器上需要进行修改,改成<sys/user.h>
还是编译不了是什么问题
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课