Commit 2beba56b authored by swift_gan's avatar swift_gan

catch error of load call origin class

parent 9fdd0a05
package com.swift.sandhook.xposedcompat.hookstub; package com.swift.sandhook.xposedcompat.hookstub;
import android.util.Log;
import com.swift.sandhook.SandHook; import com.swift.sandhook.SandHook;
import com.swift.sandhook.SandHookMethodResolver; import com.swift.sandhook.SandHookMethodResolver;
import com.swift.sandhook.utils.ParamWrapper; import com.swift.sandhook.utils.ParamWrapper;
...@@ -162,20 +164,21 @@ public class HookStubManager { ...@@ -162,20 +164,21 @@ public class HookStubManager {
return null; return null;
return new StubMethodsInfo(stubArgs, curUseStubIndex, hook, backup); return new StubMethodsInfo(stubArgs, curUseStubIndex, hook, backup);
} }
} catch (Exception e) { } catch (Throwable throwable) {
return null; return null;
} }
} }
public static Method getCallOriginMethod(int args, int index) { public static Method getCallOriginMethod(int args, int index) {
String className = SandHook.is64Bit() ? MethodHookerStubs64.class.getName() : MethodHookerStubs32.class.getName(); Class stubClass = SandHook.is64Bit() ? MethodHookerStubs64.class : MethodHookerStubs32.class;
String className = stubClass.getName();
className += "$"; className += "$";
className += getCallOriginClassName(args, index); className += getCallOriginClassName(args, index);
try { try {
Class callOriginClass = Class.forName(className); Class callOriginClass = Class.forName(className, true, stubClass.getClassLoader());
return callOriginClass.getDeclaredMethod("call", long[].class); return callOriginClass.getDeclaredMethod("call", long[].class);
} catch (Exception e) { } catch (Throwable e) {
e.printStackTrace(); Log.e("HookStubManager", "load call origin class error!", e);
return null; return null;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment