LSPlant LSPosed Developers
Loading...
Searching...
No Matches
lsplant.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <jni.h>
4
5#include <string_view>
6#include <functional>
7
9namespace lsplant {
10
11inline namespace v2 {
64
76[[nodiscard, maybe_unused, gnu::visibility("default")]] bool Init(JNIEnv *env,
77 const InitInfo &info);
78
115[[nodiscard, maybe_unused, gnu::visibility("default")]] jobject Hook(JNIEnv *env,
116 jobject target_method,
117 jobject hooker_object,
118 jobject callback_method);
119
127[[nodiscard, maybe_unused, gnu::visibility("default")]] bool UnHook(JNIEnv *env,
128 jobject target_method);
129
136[[nodiscard, maybe_unused, gnu::visibility("default")]] bool IsHooked(JNIEnv *env, jobject method);
137
152[[nodiscard, maybe_unused, gnu::visibility("default")]] bool Deoptimize(JNIEnv *env,
153 jobject method);
154
162[[nodiscard, maybe_unused, gnu::visibility("default")]] void *GetNativeFunction(JNIEnv *env,
163 jobject method);
164
170[[nodiscard, maybe_unused, gnu::visibility("default")]] bool MakeClassInheritable(JNIEnv *env,
171 jclass target);
172
180[[nodiscard, maybe_unused, gnu::visibility("default")]] bool MakeDexFileTrusted(JNIEnv *env,
181 jobject cookie);
182} // namespace v1
183} // namespace lsplant
struct _jobject * jobject
Definition jni.h:101
jobject jclass
Definition jni.h:102
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 ...
void * GetNativeFunction(JNIEnv *env, jobject method)
Get the registered native function pointer of a native function. It helps user to hook native methods...
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 MakeDexFileTrusted(JNIEnv *env, jobject cookie)
Make a DexFile trustable so that it can access hidden APIs. This is useful because we likely need to ...
bool Init(JNIEnv *env, const InitInfo &info)
Initialize LSPlant for the proceeding hook. It mainly prefetch needed symbols and hook some functions...
bool Deoptimize(JNIEnv *env, jobject method)
Deoptimize a method to avoid hooked callee not being called because of inline.
bool MakeClassInheritable(JNIEnv *env, jclass target)
Make a class inheritable. It will make the class non-final and make all its private constructors prot...
Information and configuration that are needed to call Init()
Definition lsplant.hpp:14
InlineHookFunType inline_hooker
The inline hooker function. Must not be null.
Definition lsplant.hpp:44
std::string_view generated_class_name
The generated class name. Must not be empty. It contains a field and a method and they could be set b...
Definition lsplant.hpp:55
std::string_view generated_method_name
The generated class name. Must not be emtpy. If {target} is set, it will follows the name of the targ...
Definition lsplant.hpp:62
std::string_view generated_field_name
The generated field name. Must not be empty.
Definition lsplant.hpp:59
ArtSymbolResolver art_symbol_resolver
The symbol resolver to libart.so. Must not be null.
Definition lsplant.hpp:48
InlineUnhookFunType inline_unhooker
The inline unhooker function. Must not be null.
Definition lsplant.hpp:46
std::string_view generated_source_name
The generated source name. Could be empty.
Definition lsplant.hpp:57
ArtSymbolPrefixResolver art_symbol_prefix_resolver
The symbol prefix resolver to libart.so. May be null.
Definition lsplant.hpp:51