Struct inject_lib::Injector
source · [−]Expand description
This Crate Provides functionality, for injecting dlls into other processes. Most of the crate is right now accessible through the Injector class.
You will need to provide a pid, and a dll to inject. This crate will do the rest for you.
The main focus will always be on performing the injection reliable.
If you have any suggestions, on improving the outfacing api of this crate create an issue, or pr. I am not sure yet, if I like this design.
Linux support may come, but I am unsure if I will get to it. (and how easy it will be). This struct will expose certain module private functions, to actually use the api.
Fields
dll: &'a str
The path to a dll. This may be in any format, that rust understands
pid: u32
The pid the dll should be injected into
Implementations
sourceimpl<'a> Injector<'a>
impl<'a> Injector<'a>
sourcepub fn find_pid<P: AsRef<Path>>(name: P) -> Result<Vec<u32>, Error>
pub fn find_pid<P: AsRef<Path>>(name: P) -> Result<Vec<u32>, Error>
This Function will find all currently processes, with a given name. Even if no processes are found, an empty Vector should return.
sourcepub fn eject(&self) -> Result<(), Error>
pub fn eject(&self) -> Result<(), Error>
This function will attempt, to eject a dll from another process. Notice:This implementation blocks, and waits, until the library is injected, or the injection failed.
sourcepub fn inject(&self) -> Result<(), Error>
pub fn inject(&self) -> Result<(), Error>
Inject a DLL into another process Notice:This implementation blocks, and waits, until the library is injected, or the injection failed.
sourcepub fn find_pid_selector<F>(select: F) -> Result<Vec<u32>, Error> where
F: Fn(&PROCESSENTRY32W) -> bool,
pub fn find_pid_selector<F>(select: F) -> Result<Vec<u32>, Error> where
F: Fn(&PROCESSENTRY32W) -> bool,
Find a PID, where the process-name matches some user defined selector
sourcepub fn get_is_dll_x64(&self) -> Result<bool, Error>
pub fn get_is_dll_x64(&self) -> Result<bool, Error>
This function will return, whether a dll is x64, or x86. The Return value will be Ok(true), if the dll is x64(64bit), and Ok(false), if the dll is x86(32bit).
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Injector<'a>
impl<'a> Send for Injector<'a>
impl<'a> Sync for Injector<'a>
impl<'a> Unpin for Injector<'a>
impl<'a> UnwindSafe for Injector<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more