manager: Modifying the getHookType function to return a string type

Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: rifsxd <rifat.44.azad.rifs@gmail.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
ShirkNeko
2025-06-13 15:36:15 +08:00
parent 2d9783e3d4
commit d7a5e80d34
5 changed files with 47 additions and 33 deletions

View File

@@ -312,7 +312,8 @@ Java_com_sukisu_ultra_Natives_isKPMEnabled(JNIEnv *env, jobject) {
return is_KPM_enable();
}
extern "C" JNIEXPORT jboolean JNICALL
extern "C" JNIEXPORT jstring JNICALL
Java_com_sukisu_ultra_Natives_getHookType(JNIEnv *env, jobject) {
return get_hook_type();
const char* hook_type = get_hook_type();
return env->NewStringUTF(hook_type);
}

View File

@@ -105,7 +105,13 @@ bool is_KPM_enable() {
return ksuctl(CMD_ENABLE_KPM, &enabled, nullptr), enabled;
}
bool get_hook_type() {
bool enabled = false;
return ksuctl(CMD_HOOK_TYPE, &enabled, nullptr), enabled;
const char* get_hook_type() {
static char hook_type[16] = {0};
if (hook_type[0] == '\0') {
if (ksuctl(CMD_HOOK_TYPE, hook_type, nullptr)) {
return hook_type;
}
strcpy(hook_type, "Unknown");
}
return hook_type;
}

View File

@@ -85,6 +85,6 @@ bool is_su_enabled();
bool is_KPM_enable();
bool get_hook_type();
const char* get_hook_type();
#endif //KERNELSU_KSU_H