Hooks

object Hooks

供 Java 调用的 hook 入口。

已经拿到 Method / Constructor 时使用 createHook。 想按名称和参数类型查找并立即 hook 时使用 findAndHookMethodfindAndHookConstructor

findAndHookMethodfindAndHookConstructor 的最后一个可变参数必须是 IMethodHookIReplaceHook 或 libxposed 的 Hooker

Functions

Link copied to clipboard
fun createConstructorHooks(constructors: Iterable<Constructor<*>>, callback: IMethodHook): List<XposedInterface.HookHandle>

为构造器列表批量创建普通 hook。

fun createConstructorHooks(constructors: Iterable<Constructor<*>>, callback: IReplaceHook): List<XposedInterface.HookHandle>

为构造器列表批量创建替换 hook。

Link copied to clipboard
fun createHook(constructor: Constructor<*>, callback: IMethodHook): XposedInterface.HookHandle

为构造器创建普通 hook。

fun createHook(constructor: Constructor<*>, callback: IReplaceHook): XposedInterface.HookHandle

为构造器创建替换 hook。

fun createHook(method: Method, callback: IMethodHook): XposedInterface.HookHandle

为方法创建普通 hook。

fun createHook(method: Method, callback: IReplaceHook): XposedInterface.HookHandle

为方法创建替换 hook。

Link copied to clipboard
fun createHooks(methods: Iterable<Method>, callback: IMethodHook): List<XposedInterface.HookHandle>

为方法列表批量创建普通 hook。

fun createHooks(methods: Iterable<Method>, callback: IReplaceHook): List<XposedInterface.HookHandle>

为方法列表批量创建替换 hook。

Link copied to clipboard
fun findAndHookConstructor(clazz: Class<*>, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按参数类型查找构造器并立即创建 hook。

fun findAndHookConstructor(className: String, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按类名和参数类型查找构造器并立即创建 hook。

fun findAndHookConstructor(className: String, classLoader: ClassLoader, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按类名、指定 ClassLoader 和参数类型查找构造器并立即创建 hook。

Link copied to clipboard
fun findAndHookMethod(clazz: Class<*>, methodName: String, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按方法名和参数类型查找方法并立即创建 hook。

fun findAndHookMethod(className: String, methodName: String, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按类名、方法名和参数类型查找方法并立即创建 hook。

fun findAndHookMethod(className: String, classLoader: ClassLoader, methodName: String, vararg parameterTypesAndCallback: Any): XposedInterface.HookHandle

按类名、指定 ClassLoader、方法名和参数类型查找方法并立即创建 hook。

Link copied to clipboard
fun intercept(constructor: Constructor<*>, callback: XposedInterface.Hooker): XposedInterface.HookHandle

为构造器创建 intercept hook。

fun intercept(method: Method, callback: XposedInterface.Hooker): XposedInterface.HookHandle

为方法创建 intercept hook。