bytedance / bhook

:fire: ByteHook is an Android PLT hook library which supports armeabi-v7a, arm64-v8a, x86 and x86_64.
https://github.com/bytedance/bhook/tree/main/doc#readme
MIT License
2.05k stars 315 forks source link

hook __android_log_print没效果 #79

Closed helengray closed 1 year ago

helengray commented 1 year ago

bytehook Version

1.0.8

Android OS Version

12

Android ABIs

arm64-v8a

Device Manufacturers and Models

小米MIX4

Describe the Bug

` int my_log_print(int prio, const char tag, const char fmt, ...) { return 0; }

int disableLogcat() { bytehook_init(BYTEHOOK_MODE_AUTOMATIC, false); bytehook_hook_all(nullptr, "__android_log_print", (void *) (my_log_print), nullptr, nullptr); } ` 想拦截logcat的输出,但是hook没效果,logcat还是会打印

helengray commented 1 year ago

使用源码依赖,编译到自己so的方式

helengray commented 1 year ago

解决了,问题原因是在new_func函数里没有调用BYTEHOOK_STACK_SCOPE