Skip to content

Commit

Permalink
remove unnecessary comment, add missing jlongArray
Browse files Browse the repository at this point in the history
  • Loading branch information
sabamdarif committed Oct 24, 2024
1 parent 94830d7 commit 04302a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions loader/src/injector/gen_jni_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def ind(i):
jstring = JType('jstring', 'Ljava/lang/String;')
jboolean = JType('jboolean', 'Z')
jlong = JType('jlong', 'J')
jlongArray = JArray(jlong)
void = JType('void', 'V')

class ForkAndSpec(JNIHook):
Expand Down
16 changes: 6 additions & 10 deletions loader/src/injector/jni_hooks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,36 +359,32 @@ static void do_hook_zygote(JNIEnv *env) {
vector<JNINativeMethod> hooks;
const char *clz = "com/android/internal/os/Zygote";

// Hook nativeForkAndSpecialize methods
hookJniNativeMethods(env, clz, nativeForkAndSpecialize_methods.data(), nativeForkAndSpecialize_methods.size());
for (auto &method : nativeForkAndSpecialize_methods) {
if (method.fnPtr) {
nativeForkAndSpecialize_orig = method.fnPtr; // Store original method pointer
hooks.emplace_back(method); // Add to hooks vector
nativeForkAndSpecialize_orig = method.fnPtr;
hooks.emplace_back(method);
break;
}
}

// Hook nativeSpecializeAppProcess methods
hookJniNativeMethods(env, clz, nativeSpecializeAppProcess_methods.data(), nativeSpecializeAppProcess_methods.size());
for (auto &method : nativeSpecializeAppProcess_methods) {
if (method.fnPtr) {
nativeSpecializeAppProcess_orig = method.fnPtr; // Store original method pointer
hooks.emplace_back(method); // Add to hooks vector
nativeSpecializeAppProcess_orig = method.fnPtr;
hooks.emplace_back(method);
break;
}
}

// Hook nativeForkSystemServer methods
hookJniNativeMethods(env, clz, nativeForkSystemServer_methods.data(), nativeForkSystemServer_methods.size());
for (auto &method : nativeForkSystemServer_methods) {
if (method.fnPtr) {
nativeForkSystemServer_orig = method.fnPtr; // Store original method pointer
hooks.emplace_back(method); // Add to hooks vector
nativeForkSystemServer_orig = method.fnPtr;
hooks.emplace_back(method);
break;
}
}

// Store all hooks in a list for further use
jni_hook_list->emplace(clz, std::move(hooks));
}

0 comments on commit 04302a0

Please sign in to comment.