diff --git a/core b/core index ee2c1a3..b36c170 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit ee2c1a3320a4173c50c03c1fb3d5e0181840ee77 +Subproject commit b36c170b8c6e138b7211371c47764f63c83a6f1e diff --git a/patch-loader/src/main/jni/api/patch_main.cpp b/patch-loader/src/main/jni/api/patch_main.cpp index 1be8db0..4f1368c 100644 --- a/patch-loader/src/main/jni/api/patch_main.cpp +++ b/patch-loader/src/main/jni/api/patch_main.cpp @@ -23,6 +23,7 @@ #include +#include "config_impl.h" #include "patch_loader.h" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { @@ -31,6 +32,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { return JNI_ERR; } lspd::PatchLoader::Init(); + lspd::ConfigImpl::Init(); lspd::PatchLoader::GetInstance()->Load(env); return JNI_VERSION_1_6; } diff --git a/patch-loader/src/main/jni/src/config_impl.h b/patch-loader/src/main/jni/src/config_impl.h new file mode 100644 index 0000000..8da49f4 --- /dev/null +++ b/patch-loader/src/main/jni/src/config_impl.h @@ -0,0 +1,57 @@ +/* + * This file is part of LSPosed. + * + * LSPosed is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LSPosed is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LSPosed. If not, see . + * + * Copyright (C) 2022 LSPosed Contributors + */ + +// +// Created by Nullptr on 2022/5/11. +// + +#pragma once + +#include +#include "ConfigBridge.h" + +namespace lspd { + + class ConfigImpl : public ConfigBridge { + public: + inline static void Init() { + instance_ = std::make_unique(); + } + + virtual obfuscation_map_t& obfuscation_map() override { + return obfuscation_map_; + } + + virtual void obfuscation_map(obfuscation_map_t m) override { + obfuscation_map_ = std::move(m); + } + + private: + inline static std::map obfuscation_map_ = { + {"de.robv.android.xposed.", "de.robv.android.xposed."}, + { "android.app.AndroidApp", "android.app.AndroidApp"}, + { "android.content.res.XRes", "android.content.res.XRes"}, + { "android.content.res.XModule", "android.content.res.XModule"}, + { "org.lsposed.lspd.core.", "org.lsposed.lspd.core."}, + { "org.lsposed.lspd.nativebridge.", "org.lsposed.lspd.nativebridge."}, + { "org.lsposed.lspd.service.", "org.lsposed.lspd.service."}, + }; + }; +} + diff --git a/patch-loader/src/main/jni/src/patch_loader.cpp b/patch-loader/src/main/jni/src/patch_loader.cpp index 8785369..048d84b 100644 --- a/patch-loader/src/main/jni/src/patch_loader.cpp +++ b/patch-loader/src/main/jni/src/patch_loader.cpp @@ -25,7 +25,6 @@ #include "art/runtime/jit/profile_saver.h" #include "elf_util.h" #include "jni/bypass_sig.h" -#include "native_hook.h" #include "native_util.h" #include "patch_loader.h" #include "symbol_cache.h" @@ -100,8 +99,10 @@ namespace lspd { .art_symbol_resolver = [](auto symbol) { return GetArt()->getSymbAddress(symbol); }, + .art_symbol_prefix_resolver = [](auto symbol) { + return GetArt()->getSymbPrefixFirstOffset(symbol); + }, }; - InstallInlineHooks(env, initInfo); auto stub = JNI_FindClass(env, "org/lsposed/lspatch/appstub/LSPAppComponentFactoryStub"); auto dex_field = JNI_GetStaticFieldID(env, stub, "dex", "[B"); diff --git a/share/java/src/template/java/org.lsposed.lspatch.share/LSPConfig.java b/share/java/src/template/java/org.lsposed.lspatch.share/LSPConfig.java index 3d0e823..e5bf515 100644 --- a/share/java/src/template/java/org.lsposed.lspatch.share/LSPConfig.java +++ b/share/java/src/template/java/org.lsposed.lspatch.share/LSPConfig.java @@ -2,7 +2,7 @@ package org.lsposed.lspatch.share; public class LSPConfig { - public static final LSPConfig instance = factory(); + public static final LSPConfig instance; public int API_CODE; public int VERSION_CODE; @@ -13,13 +13,12 @@ public class LSPConfig { private LSPConfig() { } - private static LSPConfig factory() { - LSPConfig config = new LSPConfig(); - config.API_CODE = ${apiCode}; - config.VERSION_CODE = ${verCode}; - config.VERSION_NAME = "${verName}"; - config.CORE_VERSION_CODE = ${coreVerCode}; - config.CORE_VERSION_NAME = "${coreVerName}"; - return config; + static { + instance = new LSPConfig(); + instance.API_CODE = ${apiCode}; + instance.VERSION_CODE = ${verCode}; + instance.VERSION_NAME = "${verName}"; + instance.CORE_VERSION_CODE = ${coreVerCode}; + instance.CORE_VERSION_NAME = "${coreVerName}"; } }