pub struct InjectionWith { /* private fields */ }Expand description
An injection builder holding the target and what to inject, returned by the
InjectionBuilder and InjectionScan methods.
Implementations§
Source§impl InjectionWith
impl InjectionWith
Sourcepub unsafe fn install(self) -> Result<Injection>
pub unsafe fn install(self) -> Result<Injection>
Installs the injection, disabled; enable it with Injection::enable.
§Errors
- The
scanerrors, for an injection built withInjection::scan. Error::AlreadyHookedif a detour or injection already holds the address.Error::Assemblyifasmcode can’t be encoded.- Otherwise an error naming the target if it can’t be patched.
§Safety
- The target (the address given to
Injection::at, or whatInjection::scanfinds) must start an instruction in executable code whose first bytes can be relocated, and which can be resumed after the injected work. - Code from
codeorasmmust follow the platform ABI: preserve every register and flag the surrounding code relies on, keep the stack balanced and aligned (with shadow space before anycallon Windows x64), and not branch into the displaced bytes. Register-context callbacks handle this themselves.
Auto Trait Implementations§
impl !RefUnwindSafe for InjectionWith
impl !Send for InjectionWith
impl !Sync for InjectionWith
impl !UnwindSafe for InjectionWith
impl Freeze for InjectionWith
impl Unpin for InjectionWith
impl UnsafeUnpin for InjectionWith
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more