From 855f86591fa57b2ab2939af882db5cbf7dc84efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=99=A8?= Date: Thu, 10 Oct 2024 14:56:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3files=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/src/main/cpp/game.h | 2 +- module/src/main/cpp/hack.cpp | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/module/src/main/cpp/game.h b/module/src/main/cpp/game.h index 012bdb7..f6d3683 100644 --- a/module/src/main/cpp/game.h +++ b/module/src/main/cpp/game.h @@ -5,6 +5,6 @@ #ifndef ZYGISK_IL2CPPDUMPER_GAME_H #define ZYGISK_IL2CPPDUMPER_GAME_H -#define AimPackageName "com.example.myapplication" +#define AimPackageName "re.pwnme" #endif //ZYGISK_IL2CPPDUMPER_GAME_H diff --git a/module/src/main/cpp/hack.cpp b/module/src/main/cpp/hack.cpp index a959177..9d98ca6 100644 --- a/module/src/main/cpp/hack.cpp +++ b/module/src/main/cpp/hack.cpp @@ -22,9 +22,29 @@ void hack_start(const char *game_data_dir) { bool load = false; LOGI("hack_start %s", game_data_dir); + // 构建 files 目录路径 + char files_dir[256]; + snprintf(files_dir, sizeof(files_dir), "%s/files", game_data_dir); + + // 检查 files 目录是否存在 + struct stat st = {0}; + if (stat(files_dir, &st) == -1) { + LOGI("%s directory does not exist, creating...", files_dir); + + // 创建目录并赋予 0755 权限 + if (mkdir(files_dir, 0755) != 0) { + LOGE("Failed to create directory %s: %s (errno: %d)", files_dir, strerror(errno), errno); + return; + } else { + LOGI("Successfully created directory %s with 0755 permissions", files_dir); + } + } else { + LOGI("Directory %s already exists", files_dir); + } + // 构建新文件路径 char new_so_path[256]; - snprintf(new_so_path, sizeof(new_so_path), "%s/files/%s.so", game_data_dir, "test"); + snprintf(new_so_path, sizeof(new_so_path), "%s/test.so", files_dir); // 复制 /sdcard/test.so 到 game_data_dir 并重命名 const char *src_path = "/data/local/tmp/test.so";