Fix the windows build

Signed-off-by: Dimitris Zervas <dzervas@dzervas.gr>
This commit is contained in:
Dimitris Zervas 2024-04-16 19:20:45 +03:00
parent 936080b4e8
commit a706f1d890
No known key found for this signature in database
4 changed files with 5 additions and 3 deletions

View File

@ -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));
}

View File

@ -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;

View File

@ -1,3 +1,4 @@
#![cfg(all(unix, not(test)))]
use ctor::ctor;
use crate::injector::attach_self;

View File

@ -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.