Commit da81d7bd authored by swift_gan's avatar swift_gan

fix 5.1 thumb

parent c5b4c704
......@@ -99,10 +99,10 @@ bool doHookWithInline(JNIEnv* env,
SandHook::HookTrampoline* hookTrampoline = trampolineManager.installInlineTrampoline(originMethod, hookMethod, backupMethod);
if (hookTrampoline == nullptr)
return false;
void* entryPointFormInterpreter = SandHook::CastArtMethod::entryPointFormInterpreter->get(hookMethod);
if (entryPointFormInterpreter != NULL) {
SandHook::CastArtMethod::entryPointFormInterpreter->set(originMethod, entryPointFormInterpreter);
}
// void* entryPointFormInterpreter = SandHook::CastArtMethod::entryPointFormInterpreter->get(hookMethod);
// if (entryPointFormInterpreter != NULL) {
// SandHook::CastArtMethod::entryPointFormInterpreter->set(originMethod, entryPointFormInterpreter);
// }
hookTrampoline->inlineSecondory->flushCache(reinterpret_cast<Size>(hookMethod), SandHook::CastArtMethod::size);
if (hookTrampoline->callOrigin != nullptr) {
//backup
......
......@@ -64,7 +64,7 @@ namespace SandHook {
}
bool isThumbCode(Size codeAddr) {
return (codeAddr & (Size)1) == (Size)1;
return (codeAddr & 0x1) == 0x1;
}
void checkThumbCode(Trampoline* trampoline, Code code) {
......
......@@ -76,6 +76,7 @@ public class MainActivity extends AppCompatActivity {
public static int methodBeHooked(int a, int b) {
a = a + 1 + 2;
b = b + a + 3;
Log.e("MainActivity", "methodBeHooked called");
return a + b;
}
......
......@@ -5,6 +5,7 @@ import android.util.Log;
import com.swift.sandhook.MainActivity;
import com.swift.sandhook.wrapper.HookClass;
import com.swift.sandhook.wrapper.HookMethod;
import com.swift.sandhook.wrapper.HookMethodBackup;
import com.swift.sandhook.wrapper.MethodParams;
@HookClass(MainActivity.class)
......@@ -14,6 +15,12 @@ public class CustmizeHooker {
@MethodParams({int.class, int.class})
public static int staticMethodHooked(int a, int b) {
Log.e("CustmizeHooker", "methodBeHooked be hooked");
return staticMethodHookedBackup(a, b);
}
@HookMethodBackup("methodBeHooked")
@MethodParams({int.class, int.class})
public static int staticMethodHookedBackup(int a, int b) {
return 0;
}
......
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