Commit 14200bef authored by swift_gan's avatar swift_gan

fix

parent 187156d5
......@@ -15,12 +15,11 @@ public class MyApp extends Application {
public void onCreate() {
super.onCreate();
try {
SandHook.addHookClass(CtrHook.class,
SandHook.addHookClass(JniHooker.class,CtrHook.class,
LogHooker.class,
CustmizeHooker.class,
ActivityHooker.class,
ObjectHooker.class,
JniHooker.class);
ObjectHooker.class);
} catch (HookErrorException e) {
e.printStackTrace();
}
......
......@@ -130,6 +130,8 @@ namespace SandHook {
static IMember<art::mirror::ArtMethod, uint32_t>* dexMethodIndex;
static IMember<art::mirror::ArtMethod, uint32_t>* accessFlag;
static void* quickToInterpreterBridge;
static void* genericJniStub;
static void* staticResolveStub;
static void init(JNIEnv *env, int sdk) {
......@@ -164,6 +166,12 @@ namespace SandHook {
art::mirror::ArtMethod* neverCall = reinterpret_cast<art::mirror::ArtMethod *>(env->GetMethodID(neverCallTestClass, "neverCall", "()V"));
quickToInterpreterBridge = entryPointQuickCompiled->get(neverCall);
art::mirror::ArtMethod* neverCallStatic = reinterpret_cast<art::mirror::ArtMethod *>(env->GetStaticMethodID(neverCallTestClass, "neverCallStatic", "()V"));
staticResolveStub = entryPointQuickCompiled->get(neverCallStatic);
art::mirror::ArtMethod* neverCallNative = reinterpret_cast<art::mirror::ArtMethod *>(env->GetMethodID(neverCallTestClass, "neverCallNative", "()V"));
genericJniStub = entryPointQuickCompiled->get(neverCallNative);
}
static void copy(art::mirror::ArtMethod* from, art::mirror::ArtMethod* to) {
......@@ -179,6 +187,8 @@ namespace SandHook {
IMember<art::mirror::ArtMethod, uint32_t>* CastArtMethod::dexMethodIndex = nullptr;
IMember<art::mirror::ArtMethod, uint32_t>* CastArtMethod::accessFlag = nullptr;
void* CastArtMethod::quickToInterpreterBridge = nullptr;
void* CastArtMethod::genericJniStub = nullptr;
void* CastArtMethod::staticResolveStub = nullptr;
}
......
......@@ -150,6 +150,7 @@ Java_com_swift_sandhook_SandHook_hookMethod(JNIEnv *env, jclass type, jobject or
bool isInterpreter = SandHook::CastArtMethod::entryPointQuickCompiled->get(origin) == SandHook::CastArtMethod::quickToInterpreterBridge;
bool idJNi = SandHook::CastArtMethod::entryPointQuickCompiled->get(origin) == SandHook::CastArtMethod::genericJniStub;
// #if defined(__arm__)
// doHookWithReplacement(origin, hook, backup);
// return JNI_TRUE;
......@@ -189,3 +190,12 @@ Java_com_swift_sandhook_test_TestClass_jni_1test(JNIEnv *env, jobject instance)
int a = 1 + 1;
int b = a + 1;
}
extern "C"
JNIEXPORT void JNICALL
Java_com_swift_sandhook_ClassNeverCall_neverCallNative(JNIEnv *env, jobject instance) {
// TODO
int a = 1 + 1;
int b = a + 1;
}
\ No newline at end of file
......@@ -56,7 +56,10 @@ const vixl::aarch64::CPURegList callee_saved_core_registers(
结论,x16/x17
x22 - x28 貌似可以使用
X16 = IP0
Stub 中有使用
尽量使用 X17
*
*/
......
......@@ -3,4 +3,5 @@ package com.swift.sandhook;
public class ClassNeverCall {
private void neverCall() {}
private static void neverCallStatic() {}
private native void neverCallNative();
}
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