Don't use sandhook on x86 devices

This commit is contained in:
LoveSy 2020-09-13 23:23:34 +08:00 committed by solohsu
parent b1bc7200a6
commit 782560ad96
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,7 @@ namespace edxp {
static constexpr auto kLibFwName = "libandroidfw.so";
static constexpr auto kLibWhaleName = "libwhale.edxp.so";
static constexpr auto kLibSandHookName = "libsandhook.edxp.so";
static constexpr auto kLibDlName = "libdl.so";
static constexpr auto kLibSandHookNativeName = "libsandhook-native.so";
static const auto kLibBasePath = std::string(
@ -41,6 +42,7 @@ namespace edxp {
LP_SELECT("/apex/com.android.runtime/bin/linker",
"/apex/com.android.runtime/bin/linker64"));
static const auto kLibDlPath = kLibBasePath + kLibDlName;
static const auto kLibArtLegacyPath = kLibBasePath + kLibArtName;
static const auto kLibWhalePath = kLibBasePath + kLibWhaleName;
static const auto kLibSandHookPath = kLibBasePath + kLibSandHookName;

View File

@ -70,7 +70,13 @@ namespace edxp {
hook_func = reinterpret_cast<HookFunType>(hook_func_symbol);
if (api_level >= __ANDROID_API_Q__) {
#if defined(__i386__) || defined(__x86_64__)
ScopedDlHandle dl_handle(kLibDlPath.c_str());
void *handle = dl_handle.Get();
HOOK_FUNC(mydlopen, "__loader_dlopen");
#else
InstallLinkerHooks(kLinkerPath.c_str());
#endif
} else {
ScopedDlHandle art_handle(kLibArtLegacyPath.c_str());
InstallArtHooks(art_handle.Get());