addPatch

fun addPatch(member: Member, hook: XC_MethodHook): XC_MethodHook.Unhook

Hook the given reflective member (method or constructor) with the provided hook.

Return

an Unhook that can remove the applied hook

Parameters

member

the method or constructor to hook

hook

the XC_MethodHook to apply


fun addPatch(clazz: Class<*>, methodName: String, paramTypes: Array<Class<*>> = emptyArray(), hook: XC_MethodHook): XC_MethodHook.Unhook?

Hook the method with the given name on the specified class.

Return

an Unhook that can remove the applied hook, or null on failure

Parameters

clazz

the class containing the method

methodName

the name of the method to hook

paramTypes

the parameter types (defaults to none)

hook

the XC_MethodHook to apply


fun addPatch(forClass: String, methodName: String, paramTypes: Array<Class<*>> = emptyArray(), hook: XC_MethodHook): XC_MethodHook.Unhook?

Load the class by name and hook the specified method.

Return

an Unhook that can remove the applied hook, or null on failure

Parameters

forClass

the full name of the class to load (e.g. com.example.MyClass)

methodName

the name of the method to hook

paramTypes

the parameter types (defaults to none)

hook

the XC_MethodHook to apply