extern crate process_memory;
use process_memory::TryIntoProcessHandle;
use std::error::Error;
use std::process;
use std::path::PathBuf;
trait Attempt {
fn attempt(&self);
}
impl<T> Attempt for Result<(), T> {
fn attempt(&self) {
match self {
&Ok(_) => {},
&Err(_) => {
println!("Couldn't write to memory!");
process::exit(1);
}
}
}
}
fn main() {
use process_memory::Inject;
let process_handle = match process_memory::platform::get_pid("MirrorsEdgeCatalyst.exe").try_into_process_handle() {
Ok(x) => x,
Err(err) => {
println!("Error!\n\n{}", err.description());
return;
}
};
process_handle.inject(PathBuf::from(r"D:\Dropbox\Projects\process-dll\target\release\process_dll.dll").canonicalize().unwrap()).unwrap();
}