separate error info and normal info of daemons

This commit is contained in:
5ec1cff
2023-12-12 12:35:13 +08:00
parent 370bb0863b
commit 056900406e
4 changed files with 33 additions and 10 deletions

View File

@@ -27,6 +27,7 @@ pub const PATH_PT_BIN32: &str = "bin/zygisk-ptracer32";
pub const PATH_PT_BIN64: &str = "bin/zygisk-ptracer64";
pub const ZYGOTE_INJECTED: i32 = lp_select!(5, 4);
pub const DAEMON_SET_INFO: i32 = lp_select!(7, 6);
pub const DAEMON_SET_ERROR_INFO: i32 = lp_select!(9, 8);
pub const MAX_RESTART_COUNT: i32 = 5;

View File

@@ -42,14 +42,15 @@ pub fn main() -> Result<()> {
{
let mut msg = Vec::<u8>::new();
msg.extend_from_slice(&constants::DAEMON_SET_INFO.to_le_bytes());
let info = match root_impl::get_impl() {
root_impl::RootImpl::KernelSU | root_impl::RootImpl::Magisk => {
msg.extend_from_slice(&constants::DAEMON_SET_INFO.to_le_bytes());
let module_names: Vec<_> = modules.iter()
.map(|m| m.name.as_str()).collect();
format!("Root: {:?},module({}): {}", root_impl::get_impl(), modules.len(), module_names.join(","))
}
_ => {
msg.extend_from_slice(&constants::DAEMON_SET_ERROR_INFO.to_le_bytes());
format!("Invalid root implementation: {:?}", root_impl::get_impl())
}
};