LSPlant  LSPosed Developers
lsplant.hpp File Reference
#include <jni.h>
#include <string_view>
#include <functional>

Go to the source code of this file.

Data Structures

struct  lsplant::v2::InitInfo
 Information and configuration that are needed to call Init() More...
 

Namespaces

 lsplant
 
 lsplant::v2
 

Functions

bool lsplant::v2::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(). More...
 
jobject lsplant::v2::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. More...
 
bool lsplant::v2::UnHook (JNIEnv *env, jobject target_method)
 Unhook a Java function that is previously hooked. More...
 
bool lsplant::v2::IsHooked (JNIEnv *env, jobject method)
 Check if a Java function is hooked by LSPlant or not. More...
 
bool lsplant::v2::Deoptimize (JNIEnv *env, jobject method)
 Deoptimize a method to avoid hooked callee not being called because of inline. More...
 
void * lsplant::v2::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. More...
 
bool lsplant::v2::MakeClassInheritable (JNIEnv *env, jclass target)
 Make a class inheritable. It will make the class non-final and make all its private constructors protected. More...
 
bool lsplant::v2::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()). More...