Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
e8ae103d
Commit
e8ae103d
authored
Oct 14, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update jni hooks
parent
b0198dab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
8 deletions
+5
-8
gen_jni_hooks.py
native/jni/zygisk/gen_jni_hooks.py
+2
-4
hook.cpp
native/jni/zygisk/hook.cpp
+1
-0
jni_hooks.hpp
native/jni/zygisk/jni_hooks.hpp
+2
-4
No files found.
native/jni/zygisk/gen_jni_hooks.py
View file @
e8ae103d
...
...
@@ -255,16 +255,14 @@ def gen_jni_hook():
decl
+=
ind
(
1
)
+
'auto &class_map = (*jni_method_map)[className];'
decl
+=
ind
(
1
)
+
'for (int i = 0; i < numMethods; ++i) {'
decl
+=
ind
(
2
)
+
'class_map[methods[i].name][methods[i].signature] = methods[i].fnPtr;'
decl
+=
ind
(
2
)
+
'if (hook_cnt == 0) continue;'
for
index
,
methods
in
enumerate
(
hook_map
.
values
()):
decl
+=
ind
(
2
)
+
f
'if (clz_id == {index}) {{'
decl
+=
ind
(
2
)
+
f
'if (
hook_cnt &&
clz_id == {index}) {{'
for
m
in
methods
:
decl
+=
ind
(
3
)
+
f
'HOOK_JNI({m})'
decl
+=
ind
(
3
)
+
'continue;'
decl
+=
ind
(
2
)
+
'}'
decl
+=
ind
(
2
)
+
'class_map[methods[i].name][methods[i].signature] = methods[i].fnPtr;'
decl
+=
ind
(
1
)
+
'}'
decl
+=
ind
(
1
)
+
'return newMethods;'
...
...
native/jni/zygisk/hook.cpp
View file @
e8ae103d
...
...
@@ -88,6 +88,7 @@ if (methods[i].name == #method##sv) { \
break; \
} \
} \
ZLOGE("unknown signature of %s#" #method ": %s\n", className, methods[i].signature); \
continue; \
}
...
...
native/jni/zygisk/jni_hooks.hpp
View file @
e8ae103d
...
...
@@ -303,14 +303,12 @@ unique_ptr<JNINativeMethod[]> hookAndSaveJNIMethods(const char *className, const
}
auto
&
class_map
=
(
*
jni_method_map
)[
className
];
for
(
int
i
=
0
;
i
<
numMethods
;
++
i
)
{
class_map
[
methods
[
i
].
name
][
methods
[
i
].
signature
]
=
methods
[
i
].
fnPtr
;
if
(
hook_cnt
==
0
)
continue
;
if
(
clz_id
==
0
)
{
if
(
hook_cnt
&&
clz_id
==
0
)
{
HOOK_JNI
(
nativeForkAndSpecialize
)
HOOK_JNI
(
nativeSpecializeAppProcess
)
HOOK_JNI
(
nativeForkSystemServer
)
continue
;
}
class_map
[
methods
[
i
].
name
][
methods
[
i
].
signature
]
=
methods
[
i
].
fnPtr
;
}
return
newMethods
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment