Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在子线程做dalvik hook,线程退出以后Hook失效 #9

Open
alhah opened this issue Nov 9, 2017 · 0 comments
Open

在子线程做dalvik hook,线程退出以后Hook失效 #9

alhah opened this issue Nov 9, 2017 · 0 comments

Comments

@alhah
Copy link

alhah commented Nov 9, 2017

11-07 21:36:23.092 2589 2589 E AndroidRuntime: java.lang.IllegalArgumentException: wrong number of arguments; expected 1114564912, got 2

从代码流程看是info指针或者bakMethod指针失效,gdb跟踪(ArrayObject *) info->paramTypes,发现会被memset, fork等函数修改,在主线程调用java_method_hook就无此问题

HookInfo *info = (HookInfo *) malloc(sizeof(HookInfo));
......
Method *bakMethod = (Method *) malloc(sizeof(Method));
Memcpy(bakMethod, method, sizeof(Method));
info->originalMethod = (void *) bakMethod;
......
method->insns = (u2 *) info;
......
HookInfo *info = (HookInfo *) method->insns;

pResult->l = (void *) dvmInvokeMethod(thisObject, originalMethod, argTypes,
                                      (ArrayObject *) info->paramTypes,
                                      (ClassObject *) info->returnType, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant