zhkl0228 / unidbg

Allows you to emulate an Android native library, and an experimental iOS emulation
Apache License 2.0
3.88k stars 966 forks source link

java 中的long类型怎么传入到so呢? #258

Closed wengjingqun closed 3 years ago

wengjingqun commented 3 years ago

写法是怎么样的?

wengjingqun commented 3 years ago

@zhkl0228 大佬解答一下

zhkl0228 commented 3 years ago

分解成int,注意参数对齐

wengjingqun commented 3 years ago

@zhkl0228 我模仿QDReaderJni调用另一个so文件 load-jni.so 出来的错误是这个,现在不知道参数问题还是so的问题 有劳大佬赐教一下


Find native function Java_a_b_b(JJ[BJLjava/lang/String;)[B => RX@0x40000c65[libload-jni.so]0xc65 JNIEnv->FindClass(a/b) was called from RX@0x40000d09[libload-jni.so]0xd09 JNIEnv->FindClass(a/b) was called from RX@0x40000d21[libload-jni.so]0xd21 JNIEnv->FindClass(a/b) was called from RX@0x40000d37[libload-jni.so]0xd37 [main]D/QDReader_Jni: JNI:0 [14:22:23 525] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:446) - handleInterrupt intno=2, NR=-1073744000, svcNumber=0x143, PC=unidbg@0xfffe04c4, syscall=null java.lang.NullPointerException at com.github.unidbg.linux.android.dvm.DalvikVM$68.handle(DalvikVM.java:1507) at com.github.unidbg.linux.ARM32SyscallHandler.hook(ARM32SyscallHandler.java:103) at com.github.unidbg.arm.backend.UnicornBackend$6.hook(UnicornBackend.java:299) at unicorn.Unicorn$NewHook.onInterrupt(Unicorn.java:128) at unicorn.Unicorn.emu_start(Native Method) at com.github.unidbg.arm.backend.UnicornBackend.emu_start(UnicornBackend.java:324) at com.github.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:368) at com.github.unidbg.AbstractEmulator.eFunc(AbstractEmulator.java:444) at com.github.unidbg.arm.AbstractARMEmulator.eFunc(AbstractARMEmulator.java:217) at com.github.unidbg.Module.emulateFunction(Module.java:158) at com.github.unidbg.linux.android.dvm.DvmObject.callJniMethod(DvmObject.java:128) at com.github.unidbg.linux.android.dvm.DvmClass.callStaticJniMethodObject(DvmClass.java:291) at com.w.code2.stringFromJNI(code2.java:132) at com.w.code2.main(code2.java:49) [14:22:23 528] WARN [com.github.unidbg.AbstractEmulator] (AbstractEmulator:387) - emulate RX@0x40000c65[libload-jni.so]0xc65 exception sp=unidbg@0xbffff730, msg=null, offset=22ms

zhkl0228 commented 3 years ago

参数对齐问题,我提交个代码,你把long参数写成:123L 这样的形式 https://github.com/zhkl0228/unidbg/commit/3486cfac8090e5a2e5014b56a5ea36c8e1fb2ff9

wengjingqun commented 3 years ago

辛苦了大佬,东西很好用

zhkl0228 commented 3 years ago

提交了 https://github.com/zhkl0228/unidbg/commit/3486cfac8090e5a2e5014b56a5ea36c8e1fb2ff9

wengjingqun commented 3 years ago

问题已经解决,感谢