Skip to content

Commit

Permalink
exclude system process
Browse files Browse the repository at this point in the history
  • Loading branch information
lvyitian committed Aug 20, 2023
1 parent 592760a commit 089b68f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ ext {
moduleName = "YuanShenRedirect"
moduleAuthor = "Perfare"
moduleDescription = "Redirect file access of YuanShen"
moduleVersion = "v1.2.0"
moduleVersion = "v1.3.0"
moduleVersionCode = 1
}
11 changes: 7 additions & 4 deletions module/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MyModule : public zygisk::ModuleBase {
void preAppSpecialize(AppSpecializeArgs *args) override {
auto package_name = env->GetStringUTFChars(args->nice_name, nullptr);
auto app_data_dir = env->GetStringUTFChars(args->app_data_dir, nullptr);
preSpecialize(package_name, app_data_dir);
preSpecialize(package_name, app_data_dir,args->uid);
env->ReleaseStringUTFChars(args->nice_name, package_name);
env->ReleaseStringUTFChars(args->app_data_dir, app_data_dir);
}
Expand All @@ -41,11 +41,14 @@ class MyModule : public zygisk::ModuleBase {
char *game_data_dir;
void *data;
size_t length;
jint uid;

void preSpecialize(const char *package_name, const char *app_data_dir) {
void preSpecialize(const char *package_name, const char *app_data_dir, jint uid) {
//if (strcmp(package_name, GamePackageName) == 0) {
if(uid>=10000) {
LOGI("detect game: %s", package_name);
enable_hack=true;
this->uid=uid;
if(app_data_dir) {
game_data_dir = new char[strlen(app_data_dir) + 1];
strcpy(game_data_dir, app_data_dir);
Expand All @@ -69,9 +72,9 @@ class MyModule : public zygisk::ModuleBase {
LOGW("Unable to open arm file");
}
#endif
/*} else {
} else {
api->setOption(zygisk::Option::DLCLOSE_MODULE_LIBRARY);
}*/
}
}
};

Expand Down

0 comments on commit 089b68f

Please sign in to comment.