iqiyi / xHook

🔥 A PLT hook library for Android native ELF.
Other
4.05k stars 752 forks source link

error: ‘PAGE_MASK’ undeclared (first use in this function) #103

Open darkgirl opened 1 year ago

darkgirl commented 1 year ago

https://github.com/iqiyi/xHook/blob/master/docs/overview/android_plt_hook_overview.zh-CN.md 按照这个文章中的步骤操作 编译带 hook 的 main.c 报错

` main_hook.c: In function ‘hook’: main_hook.c:9:36: error: ‘PAGE_MASK’ undeclared (first use in this function) 9 | #define PAGE_START(addr) ((addr) & PAGE_MASK) | ^~~~~ main_hook.c:40:22: note: in expansion of macro ‘PAGE_START’ 40 | mprotect((void )PAGE_START(addr), PAGE_SIZE, PROT_READ | PROT_WRITE); | ^~~~~~ main_hook.c:9:36: note: each undeclared identifier is reported only once for each function it appears in 9 | #define PAGE_START(addr) ((addr) & PAGE_MASK) | ^~~~~ main_hook.c:40:22: note: in expansion of macro ‘PAGE_START’ 40 | mprotect((void )PAGE_START(addr), PAGE_SIZE, PROT_READ | PROT_WRITE); | ^~~~~~ main_hook.c:40:40: error: ‘PAGE_SIZE’ undeclared (first use in this function) 40 | mprotect((void *)PAGE_START(addr), PAGE_SIZE, PROT_READ | PROT_WRITE); | ^~~~~

` PAGE_MASK 和 PAGE_SIZE 是安卓自带的吗?