|
| bool | Init (JNIEnv *env, const InitInfo &info) |
| | Initialize LSPlant for the proceeding hook. It mainly prefetch needed symbols and hook some functions. The env should not have any restriction for accessing hidden APIs. You can obtain such a JNIEnv in JNI_OnLoad(). Internal hook callbacks on other threads wait until initialization succeeds or fails. Hooks reentered on the initializing thread execute without waiting. JNI preparation finishes before installing hooks, which runs with ART threads suspended. Inline hookers and symbol resolvers must not call JNI or wait for suspended ART threads.
|
| |
| jobject | Hook (JNIEnv *env, jobject target_method, jobject hooker_object, jobject callback_method) |
| | Hook a Java method by providing the target_method together with the context object hooker_object and its callback callback_method.
|
| |
| bool | UnHook (JNIEnv *env, jobject target_method) |
| | Unhook a Java function that is previously hooked.
|
| |
| bool | IsHooked (JNIEnv *env, jobject method) |
| | Check if a Java function is hooked by LSPlant or not.
|
| |
| bool | Deoptimize (JNIEnv *env, jobject method) |
| | Deoptimize a method to avoid hooked callee not being called because of inline.
|
| |
| void * | GetNativeFunction (JNIEnv *env, jobject method) |
| | Get the registered native function pointer of a native function. It helps user to hook native methods directly by backing up the native function pointer this function returns and env->registerNatives another native function pointer.
|
| |
| bool | MakeClassInheritable (JNIEnv *env, jclass target) |
| | Make a class inheritable. It will make the class non-final and make all its private constructors protected.
|
| |
| bool | MakeDexFileTrusted (JNIEnv *env, jobject cookie) |
| | Make a DexFile trustable so that it can access hidden APIs. This is useful because we likely need to access hidden APIs when hooking system methods. A concern of this function is that cookie of the DexFile maybe a hidden APIs. So get please get the needed jfieldID beforehand (like in JNI_OnLoad as Init()).
|
| |