mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-02 07:51:07 -08:00
Reorganize zygisk code
This commit is contained in:
@@ -22,6 +22,27 @@ extern "C" [[maybe_unused]] void zygisk_inject_entry(void *handle) {
|
||||
ZLOGD("load success\n");
|
||||
}
|
||||
|
||||
static bool is_compatible_with(uint32_t) {
|
||||
auto name = get_prop(NBPROP);
|
||||
android_dlextinfo info = {
|
||||
.flags = ANDROID_DLEXT_FORCE_LOAD
|
||||
};
|
||||
void *handle = android_dlopen_ext(name.data(), RTLD_LAZY, &info);
|
||||
if (handle) {
|
||||
auto entry = reinterpret_cast<void (*)(void *)>(dlsym(handle, "zygisk_inject_entry"));
|
||||
if (entry) {
|
||||
entry(handle);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" [[maybe_unused]] NativeBridgeCallbacks NativeBridgeItf{
|
||||
.version = 2,
|
||||
.padding = {},
|
||||
.isCompatibleWith = &is_compatible_with,
|
||||
};
|
||||
|
||||
// The following code runs in zygote/app process
|
||||
|
||||
static inline bool should_load_modules(uint32_t flags) {
|
||||
|
||||
Reference in New Issue
Block a user