You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
Add lsplt
This commit is contained in:
@@ -16,4 +16,5 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("dev.rikka.ndk.thirdparty:cxx:1.2.0")
|
implementation("dev.rikka.ndk.thirdparty:cxx:1.2.0")
|
||||||
|
implementation("org.lsposed.lsplt:lsplt-standalone:1.1")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ LOCAL_MODULE := injector
|
|||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
FILE_LIST := $(filter %.cpp, $(call walk, $(LOCAL_PATH)/injector))
|
FILE_LIST := $(filter %.cpp, $(call walk, $(LOCAL_PATH)/injector))
|
||||||
LOCAL_SRC_FILES := $(FILE_LIST:COMMON_FILE_LIST:$(LOCAL_PATH)/%=%)
|
LOCAL_SRC_FILES := $(FILE_LIST:COMMON_FILE_LIST:$(LOCAL_PATH)/%=%)
|
||||||
LOCAL_STATIC_LIBRARIES := cxx common
|
LOCAL_STATIC_LIBRARIES := cxx common lsplt
|
||||||
LOCAL_LDLIBS := -llog
|
LOCAL_LDLIBS := -llog
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
$(call import-module,prefab/cxx)
|
$(call import-module,prefab/cxx)
|
||||||
|
$(call import-module,prefab/lsplt)
|
||||||
|
|||||||
9
loader/src/injector/injector.cpp
Normal file
9
loader/src/injector/injector.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <lsplt.hpp>
|
||||||
|
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void entry(void* handle) {
|
||||||
|
LOGD("Injector handle: %p", handle);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,6 +46,6 @@ fn entry() -> Result<()> {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if let Err(e) = entry() {
|
if let Err(e) = entry() {
|
||||||
log::error!("Crashed: {}", e.backtrace());
|
log::error!("Crashed: {}\n{}", e, e.backtrace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ pub fn start(is64: bool) -> Result<()> {
|
|||||||
let context = Arc::clone(&context);
|
let context = Arc::clone(&context);
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
if let Err(e) = handle_daemon_action(stream, &context) {
|
if let Err(e) = handle_daemon_action(stream, &context) {
|
||||||
log::warn!("Error handling daemon action: {}", e.backtrace());
|
log::warn!("Error handling daemon action: {}\n{}", e, e.backtrace());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -180,15 +180,17 @@ fn create_daemon_socket(is64: bool) -> Result<UnixListener> {
|
|||||||
|
|
||||||
fn handle_daemon_action(mut stream: UnixStream, context: &Context) -> Result<()> {
|
fn handle_daemon_action(mut stream: UnixStream, context: &Context) -> Result<()> {
|
||||||
let action = stream.read_u8()?;
|
let action = stream.read_u8()?;
|
||||||
match DaemonSocketAction::try_from(action) {
|
let action = DaemonSocketAction::try_from(action)?;
|
||||||
Ok(DaemonSocketAction::PingHeartbeat) => {
|
log::debug!("New daemon action {:?}", action);
|
||||||
|
match action {
|
||||||
|
DaemonSocketAction::PingHeartbeat => {
|
||||||
restore_native_bridge()?;
|
restore_native_bridge()?;
|
||||||
}
|
}
|
||||||
Ok(DaemonSocketAction::ReadNativeBridge) => {
|
DaemonSocketAction::ReadNativeBridge => {
|
||||||
stream.write_usize(context.native_bridge.len())?;
|
stream.write_usize(context.native_bridge.len())?;
|
||||||
stream.write_all(context.native_bridge.as_bytes())?;
|
stream.write_all(context.native_bridge.as_bytes())?;
|
||||||
}
|
}
|
||||||
Ok(DaemonSocketAction::ReadModules) => {
|
DaemonSocketAction::ReadModules => {
|
||||||
stream.write_usize(context.modules.len())?;
|
stream.write_usize(context.modules.len())?;
|
||||||
for module in context.modules.iter() {
|
for module in context.modules.iter() {
|
||||||
stream.write_usize(module.name.len())?;
|
stream.write_usize(module.name.len())?;
|
||||||
@@ -196,7 +198,7 @@ fn handle_daemon_action(mut stream: UnixStream, context: &Context) -> Result<()>
|
|||||||
stream.send_fd(module.memfd.as_raw_fd())?;
|
stream.send_fd(module.memfd.as_raw_fd())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(DaemonSocketAction::RequestCompanionSocket) => {
|
DaemonSocketAction::RequestCompanionSocket => {
|
||||||
let index = stream.read_usize()?;
|
let index = stream.read_usize()?;
|
||||||
let module = &context.modules[index];
|
let module = &context.modules[index];
|
||||||
log::debug!("New companion request from module {}", module.name);
|
log::debug!("New companion request from module {}", module.name);
|
||||||
@@ -211,7 +213,6 @@ fn handle_daemon_action(mut stream: UnixStream, context: &Context) -> Result<()>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => bail!("Invalid action code: {action}")
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user