OpenByteDev / dll-syringe

A windows dll injection library written in rust.
MIT License
166 stars 14 forks source link

module not found, yet dll exists #30

Closed hp8wvvvgnj6asjm7 closed 1 month ago

hp8wvvvgnj6asjm7 commented 1 month ago
use dll_syringe::{Syringe, process::OwnedProcess};
use std::fs;

fn main() {

    let metadata = fs::metadata("./bossKW-X-2.dll").unwrap();

    dbg!(metadata.is_file()); // prints true

    let target_process = OwnedProcess::find_first_by_name("cnc3ep1.dat").unwrap();

    let syringe = Syringe::for_process(target_process);

    let injected_payload = syringe.inject("./bossKW-X-2.dll").unwrap();
}
thread 'main' panicked at src/main.rs:15:63:
called `Result::unwrap()` on an `Err` value: RemoteIo(Os { code: 126, kind: Uncategorized, message: "The specified module could not be found." })

how can I debug this?

OpenByteDev commented 1 month ago

Try to specify an absolute path or make the path relative to the executable of the target process.

hp8wvvvgnj6asjm7 commented 1 month ago
use dll_syringe::{Syringe, process::OwnedProcess};
use std::fs;

fn main() {

    let metadata = fs::metadata("C:/Users/_/Desktop/injection-dll/src/bossKW-X-2.dll").unwrap();

    dbg!(metadata.is_file());

    let target_process = OwnedProcess::find_first_by_name("cnc3ep1.dat").unwrap();

    let syringe = Syringe::for_process(target_process);

    let injected_payload = syringe.inject("C:/Users/_/Desktop/injection-dll/src/bossKW-X-2.dll").unwrap();
}
[src/main.rs:9:5] metadata.is_file() = true
thread 'main' panicked at src/main.rs:15:98:
called `Result::unwrap()` on an `Err` value: RemoteIo(Os { code: 126, kind: Uncategorized, message: "The specified module could not be found." })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\injection-dll.exe .` (exit code: 101)
hp8wvvvgnj6asjm7 commented 1 month ago

Tried to look with procmon if the dll depends on some missing dll, but could not find any clue.