From a859b0c7398c048e5cbe0f17f1a58fc5befddf8c Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Thu, 10 Feb 2022 20:40:59 +0800 Subject: [PATCH] ... --- .../yukihookapi/hook/core/YukiHookCreater.kt | 2 +- .../highcapable/yukihookapi/hook/param/HookParam.kt | 2 +- .../hook/param/wrapper/HookParamWrapper.kt | 2 +- .../yukihookapi/hook/utils/ReflectionUtils.java | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiHookCreater.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiHookCreater.kt index 034354c2..12b842ee 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiHookCreater.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiHookCreater.kt @@ -433,7 +433,7 @@ class YukiHookCreater(private val packageParam: PackageParam, private val hookCl private fun onHookFailureMsg(throwable: Throwable) = loggerE(msg = "Try to hook ${hookClass.instance ?: hookClass.name}[$member] got an Exception [$tag]", e = throwable) - override fun toString() = "$member$tag#YukiHook" + override fun toString() = "${hookClass.name}$member$tag#YukiHookAPI" /** * 监听 Hook 结果实现类 diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/HookParam.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/HookParam.kt index a1fe2af9..d6511101 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/HookParam.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/HookParam.kt @@ -121,7 +121,7 @@ class HookParam(private val wrapper: HookParamWrapper) { * @param args 参数实例 * @return [T] */ - fun Member.invokeOriginal(vararg args: Array?) = wrapper.invokeOriginalMember(member = this, *args) as? T? + fun Member.invokeOriginal(vararg args: Any?) = wrapper.invokeOriginalMember(member = this, *args) as? T? /** * 设置 [result] 返回值为 true diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/wrapper/HookParamWrapper.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/wrapper/HookParamWrapper.kt index a3347179..4f3d5399 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/wrapper/HookParamWrapper.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/wrapper/HookParamWrapper.kt @@ -83,6 +83,6 @@ class HookParamWrapper(private val baseParam: XC_MethodHook.MethodHookParam) { * @param args 参数实例 * @return [Any] or null */ - fun invokeOriginalMember(member: Member, vararg args: Array?): Any? = + fun invokeOriginalMember(member: Member, vararg args: Any?): Any? = XposedBridge.invokeOriginalMethod(member, instance, args) } \ No newline at end of file diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/utils/ReflectionUtils.java b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/utils/ReflectionUtils.java index 076ea5f2..78362a1e 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/utils/ReflectionUtils.java +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/utils/ReflectionUtils.java @@ -108,7 +108,7 @@ public class ReflectionUtils { } public static Field findFieldIfExists(Class clazz, String typeName, String fieldName) throws NoSuchFieldException { - String fullFieldName = "name:[" + fieldName + "] type:[" + typeName + "] in Class [" + clazz.getName() + "] by YukiHook#finder"; + String fullFieldName = "name:[" + fieldName + "] type:[" + typeName + "] in Class [" + clazz.getName() + "] by YukiHookAPI#finder"; if (!fieldCache.containsKey(fullFieldName)) { if (clazz != null && !TextUtils.isEmpty(typeName) && !TextUtils.isEmpty(fieldName)) { Class clz = clazz; @@ -143,7 +143,7 @@ public class ReflectionUtils { * @param methodName 方法名 */ public static Method findMethodNoParam(Class clazz, Class returnType, String methodName) { - String fullMethodName = "name:[" + methodName + "] in Class [" + clazz.getName() + "] by YukiHook#finder"; + String fullMethodName = "name:[" + methodName + "] in Class [" + clazz.getName() + "] by YukiHookAPI#finder"; if (!methodCache.containsKey(fullMethodName)) { Method method = findMethodIfExists(clazz, returnType, methodName); methodCache.put(fullMethodName, method); @@ -162,7 +162,7 @@ public class ReflectionUtils { * @param parameterTypes 方法参数类型数组 */ public static Method findMethodBestMatch(Class clazz, Class returnType, String methodName, Class... parameterTypes) { - String fullMethodName = "name:[" + methodName + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHook#finder"; + String fullMethodName = "name:[" + methodName + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHookAPI#finder"; if (!methodCache.containsKey(fullMethodName)) { Method method = findMethodIfExists(clazz, returnType, methodName, parameterTypes); methodCache.put(fullMethodName, method); @@ -179,7 +179,7 @@ public class ReflectionUtils { * @param parameterTypes 构造类方法参数类型数组 */ public static Constructor findConstructorExact(Class clazz, Class... parameterTypes) { - String fullConstructorName = "paramType:[" + getParametersString(parameterTypes) + "in Class [" + clazz.getName() + "] by YukiHook#finder"; + String fullConstructorName = "paramType:[" + getParametersString(parameterTypes) + "in Class [" + clazz.getName() + "] by YukiHookAPI#finder"; try { Constructor constructor = clazz.getDeclaredConstructor(parameterTypes); constructor.setAccessible(true); @@ -190,7 +190,7 @@ public class ReflectionUtils { } private static Method findMethodExact(Class clazz, String methodName, Class... parameterTypes) { - String fullMethodName = "name:[" + methodName + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHook#finder"; + String fullMethodName = "name:[" + methodName + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHookAPI#finder"; try { Method method = clazz.getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); @@ -210,6 +210,6 @@ public class ReflectionUtils { for (Method method : methods) if (method.getName().equals(methodName)) return method; } while ((clz = clz.getSuperclass()) != null); } - throw new IllegalArgumentException("Can't find this method --> name:[" + methodName + "] returnType:[" + returnType.getName() + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHook#finder"); + throw new IllegalArgumentException("Can't find this method --> name:[" + methodName + "] returnType:[" + returnType.getName() + "] paramType:[" + getParametersString(parameterTypes) + "] in Class [" + clazz.getName() + "] by YukiHookAPI#finder"); } }