From 8e42780eedcb8533760fadf4bfb36365db0c94b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E5=91=A8XiaoZhou?= Date: Wed, 29 Oct 2025 19:48:35 +0800 Subject: [PATCH] [Refactor] Remove useless code --- src/agent/include/datautils.h | 1 - src/agent/libagent.c | 4 +--- src/agent/utils/datautils.c | 15 --------------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/agent/include/datautils.h b/src/agent/include/datautils.h index b41244d..187129c 100644 --- a/src/agent/include/datautils.h +++ b/src/agent/include/datautils.h @@ -9,7 +9,6 @@ typedef struct _InjectionInfo { char BootstrapAPIPath[INJECT_PATH_MAX]; char JuiceLoaderJarPath[INJECT_PATH_MAX]; - char JuiceLoaderLibPath[INJECT_PATH_MAX]; char EntryJarPath[INJECT_PATH_MAX]; char EntryClass[INJECT_PATH_MAX]; char EntryMethod[INJECT_PATH_MAX]; diff --git a/src/agent/libagent.c b/src/agent/libagent.c index 8faba91..a447b9e 100644 --- a/src/agent/libagent.c +++ b/src/agent/libagent.c @@ -124,11 +124,10 @@ DWORD WINAPI ThreadProc(LPVOID lpParam) { // init juiceloader log_info("init juice loader..."); init_juiceloader(env, jvmti); - + initLogger(); log_info("juice loader init done"); - // Invoke loader.init(JuiceLoaderLibPath, EntryJarPath) log_info("invoking loader init()..."); log_info("============ Loader Info ============\n"); jclass cls = (*env)->FindClass(env, "cn/xiaozhou233/juiceloader/JuiceLoader"); @@ -147,7 +146,6 @@ DWORD WINAPI ThreadProc(LPVOID lpParam) { return 1; } (*env)->CallStaticVoidMethod(env, cls, mid, - (*env)->NewStringUTF(env, InjectionInfo.JuiceLoaderLibPath), (*env)->NewStringUTF(env, InjectionInfo.EntryJarPath), (*env)->NewStringUTF(env, InjectionInfo.EntryClass), (*env)->NewStringUTF(env, InjectionInfo.EntryMethod)); diff --git a/src/agent/utils/datautils.c b/src/agent/utils/datautils.c index 16653d9..ab1685d 100644 --- a/src/agent/utils/datautils.c +++ b/src/agent/utils/datautils.c @@ -49,21 +49,6 @@ bool ReadInjectionInfo(toml_result_t result, InjectParameters* params) { safe_copy(InjectionInfo.JuiceLoaderJarPath, JuiceLoaderJarPathStr, INJECT_PATH_MAX); // ======= JuiceLoaderJarPath ======= - // ======= JuiceLoaderLibPath ======= - toml_datum_t JuiceLoaderLibPath = toml_seek(InjectionTree, "JuiceLoaderLibPath"); - char JuiceLoaderLibPathStr[INJECT_PATH_MAX]; - if (JuiceLoaderLibPath.type != TOML_STRING) { - log_error("JuiceLoaderLibPath is not a string."); - return false; - } - if (JuiceLoaderLibPath.u.s == NULL || strlen(JuiceLoaderLibPath.u.s) == 0) { - sprintf(JuiceLoaderLibPathStr, "%s\\libjuiceloader.dll", params->ConfigDir); - } else { - sprintf(JuiceLoaderLibPathStr, "%s", JuiceLoaderLibPath.u.s); - } - safe_copy(InjectionInfo.JuiceLoaderLibPath, JuiceLoaderLibPathStr, INJECT_PATH_MAX); - // ======= JuiceLoaderLibPath ======= - // ======= Entry ======= toml_datum_t EntryJarPath = toml_seek(InjectionTree, "EntryJarPath"); char EntryJarPathStr[INJECT_PATH_MAX];