Comments (3)
#include <stdarg.h> jint (*originCallStaticIntMethod)(JNIEnv *env, jclass obj, jmethodID methodId, ...); jint CallStaticIntMethodOverride(JNIEnv *env, jclass javaclass, jmethodID methodId, ...) { LOG("hook success"); va_list args; va_start(args, methodId); jint result = originCallStaticIntMethod(env, javaclass, methodId, args); va_end(args); return result; } void hookStaticIntMethod(JNIEnv *env) { auto *functionTable = env->functions; void** funcPointerAddress = (void **)&(functionTable->CallStaticIntMethod); accessWrite(reinterpret_cast<unsigned long>(funcPointerAddress)); originCallStaticIntMethod = functionTable->CallStaticIntMethod; void** newFuncPointerAddress = reinterpret_cast<void **>(&CallStaticIntMethodOverride); *funcPointerAddress = newFuncPointerAddress; }可变参数方法hook未生效,普通方法没问题,也不报错,不知道什么原因导致
可以看一下 https://github.com/PTrainbow/JNIHook/tree/dev/args 我这里的提交
可变参数需要指定的类型数组来接收参数,或者直接使用 void*
from jnihook.
不好意思,今天才看到,等周末看一下
from jnihook.
- 我搜到的资料是用va_list去接收可变参数,这里只能用类型数据,大佬请指点一二
from jnihook.
Related Issues (2)
- GC抑制Android10以后的适配方法 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jnihook.