diff --git a/src/injector.rs b/src/injector.rs index e424514..9772b21 100644 --- a/src/injector.rs +++ b/src/injector.rs @@ -12,7 +12,7 @@ pub extern "C" fn attach(pid: u32) { { let frida_code = env!("FRIDA_CODE").replace("\\n", "\n"); #[cfg(windows)] - std::thread::spawn(move || frida_attach_pid(&frida_code, AttachMode::Pid(pid))); + std::thread::spawn(move || frida_attach_with(&frida_code, AttachMode::Pid(pid))); #[cfg(not(windows))] frida_attach_with(&frida_code, AttachMode::Pid(pid)); } diff --git a/src/lib.rs b/src/lib.rs index 75b86f4..de6f24a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,10 +6,8 @@ pub use injector::attach_self; // During testing we compile a debug binary without `test`. // Enabling `ctor` during testing would hook the test runner and break it. -#[cfg(all(unix, not(test)))] pub mod loader_unix; -#[cfg(all(windows, not(test)))] pub mod loader_windows; #[cfg(all(windows, not(test)))] pub use loader_windows::DllMain; diff --git a/src/loader_unix.rs b/src/loader_unix.rs index 4f50ffc..28b4df9 100644 --- a/src/loader_unix.rs +++ b/src/loader_unix.rs @@ -1,3 +1,4 @@ +#![cfg(all(unix, not(test)))] use ctor::ctor; use crate::injector::attach_self; diff --git a/src/loader_windows.rs b/src/loader_windows.rs index ff8d1ce..9db92df 100644 --- a/src/loader_windows.rs +++ b/src/loader_windows.rs @@ -1,6 +1,9 @@ +#![cfg(all(windows, not(test)))] + use std::ffi::c_void; use winapi::um::winnt::DLL_PROCESS_ATTACH; use winapi::um::libloaderapi::LoadLibraryA; +use crate::attach_self; // For some reason ctor doesn't work on Windows - it hangs the process // during DeviceManager::obtain. DllMain works fine though.