From 04302a09678b5baa2f8e83228d29665a9a7b1ead Mon Sep 17 00:00:00 2001 From: Md Arif <111168803+sabamdarif@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:14:44 +0530 Subject: [PATCH] remove unnecessary comment, add missing jlongArray --- loader/src/injector/gen_jni_hooks.py | 1 + loader/src/injector/jni_hooks.hpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/loader/src/injector/gen_jni_hooks.py b/loader/src/injector/gen_jni_hooks.py index 570b2cd4..79ace4bc 100644 --- a/loader/src/injector/gen_jni_hooks.py +++ b/loader/src/injector/gen_jni_hooks.py @@ -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): diff --git a/loader/src/injector/jni_hooks.hpp b/loader/src/injector/jni_hooks.hpp index 47b2c51b..96b8b2f5 100644 --- a/loader/src/injector/jni_hooks.hpp +++ b/loader/src/injector/jni_hooks.hpp @@ -359,36 +359,32 @@ static void do_hook_zygote(JNIEnv *env) { vector 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)); }