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
9469e79e
Commit
9469e79e
authored
Jun 15, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper namespacing
The IDE will get confused when #include is in a namespace
parent
db78c201
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
gen_jni_hooks.py
native/jni/zygisk/gen_jni_hooks.py
+2
-1
hook.cpp
native/jni/zygisk/hook.cpp
+4
-0
jni_hooks.hpp
native/jni/zygisk/jni_hooks.hpp
+4
-0
No files found.
native/jni/zygisk/gen_jni_hooks.py
View file @
9469e79e
...
...
@@ -271,6 +271,7 @@ def gen_jni_hook():
with
open
(
'jni_hooks.hpp'
,
'w'
)
as
f
:
f
.
write
(
'// Generated by gen_jni_hooks.py
\n
'
)
f
.
write
(
'
\n
namespace {
\n
'
)
zygote
=
'com/android/internal/os/Zygote'
...
...
@@ -285,4 +286,4 @@ with open('jni_hooks.hpp', 'w') as f:
f
.
write
(
gen_jni_hook
())
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
\n
} // namespace
\n
'
)
native/jni/zygisk/hook.cpp
View file @
9469e79e
...
...
@@ -79,6 +79,8 @@ HookContext *g_ctx;
const
JNINativeInterface
*
old_functions
;
JNINativeInterface
*
new_functions
;
}
// namespace
#define HOOK_JNI(method) \
if (methods[i].name == #method##sv) { \
int j = 0; \
...
...
@@ -103,6 +105,8 @@ if (methods[i].name == #method##sv) {
#undef HOOK_JNI
namespace
{
jclass
gClassRef
;
jmethodID
class_getName
;
string
get_class_name
(
JNIEnv
*
env
,
jclass
clazz
)
{
...
...
native/jni/zygisk/jni_hooks.hpp
View file @
9469e79e
// Generated by gen_jni_hooks.py
namespace
{
void
*
nativeForkAndSpecialize_orig
=
nullptr
;
jint
nativeForkAndSpecialize_l
(
JNIEnv
*
env
,
jclass
clazz
,
jint
uid
,
jint
gid
,
jintArray
gids
,
jint
runtime_flags
,
jobjectArray
rlimits
,
jint
mount_external
,
jstring
se_info
,
jstring
nice_name
,
jintArray
fds_to_close
,
jstring
instruction_set
,
jstring
app_data_dir
)
{
AppSpecializeArgs_v3
args
(
uid
,
gid
,
gids
,
runtime_flags
,
rlimits
,
mount_external
,
se_info
,
nice_name
,
instruction_set
,
app_data_dir
);
...
...
@@ -318,3 +320,5 @@ unique_ptr<JNINativeMethod[]> hookAndSaveJNIMethods(const char *className, const
}
return
newMethods
;
}
}
// namespace
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