add: zygiskd C99 APatch support

This commit adds support for zygiskd C99 to recognize APatch rooted devices.
This commit is contained in:
ThePedroo
2024-08-15 22:42:47 -03:00
parent 19d2a1758e
commit c1e45e9af6
13 changed files with 484 additions and 210 deletions

View File

@@ -1,19 +1,16 @@
#include <sys/types.h>
#include "kernelsu.h"
#include "apatch.h"
#include "common.h"
static enum RootImpl ROOT_IMPL = None;
void root_impls_setup(void) {
enum RootImplState ksu_version = ksu_get_kernel_su();
enum RootImpl impl = None;
if (ksu_version == Supported) impl = KernelSU;
ROOT_IMPL = impl;
if (ksu_get_existence() == Supported) ROOT_IMPL = KernelSU;
else if (apatch_get_existence() == Supported) ROOT_IMPL = APatch;
else ROOT_IMPL = None;
}
enum RootImpl get_impl(void) {
@@ -21,34 +18,43 @@ enum RootImpl get_impl(void) {
}
bool uid_granted_root(uid_t uid) {
switch (get_impl()) {
case KernelSU: {
// switch (get_impl()) {
// case KernelSU: {
return ksu_uid_granted_root(uid);
}
default: {
return false;
}
}
// }
// case APatch: {
// return apatch_uid_granted_root(uid);
// }
// default: {
// return false;
// }
// }
}
bool uid_should_umount(uid_t uid) {
switch (get_impl()) {
case KernelSU: {
// switch (get_impl()) {
// case KernelSU: {
return ksu_uid_should_umount(uid);
}
default: {
return false;
}
}
// }
// case APatch: {
// return apatch_uid_should_umount(uid);
// }
// default: {
// return false;
// }
// }
}
bool uid_is_manager(uid_t uid) {
switch (get_impl()) {
case KernelSU: {
// switch (get_impl()) {
// case KernelSU: {
return ksu_uid_is_manager(uid);
}
default: {
return false;
}
}
// }
// case APatch: {
// return apatch_uid_is_manager(uid);
// }
// default: {
// return false;
// }
// }
}