Skip to main content

DllInjection

Struct DllInjection 

Source
pub struct DllInjection<D: DllApp> { /* private fields */ }
Available on crate feature inject-dll only.
Expand description

Represents an injected DLL with its syringe, payload, and remote apply function.

Implementations§

Source§

impl<D: DllApp> DllInjection<D>

Source

pub fn pid(&self) -> Pid

Source

pub fn maybe_apply( &self, input: Option<&D::Input>, ) -> Result<D::Output, PayloadRpcError>

Call DllApp::APPLY with the given input.

Source

pub fn apply(&self, input: &D::Input) -> Result<D::Output, PayloadRpcError>

Call DllApp::APPLY with the given input.

§Implementation
let args = (input,);
let config = bincode::config::standard();

let mut size_writer = bincode::enc::write::SizeWriter::default();
bincode::serde::encode_into_writer(&args, &mut size_writer, config)?;
let arg_bytes = size_writer.bytes_written;
let mut local_arg_buf = Vec::with_capacity(arg_bytes);
bincode::serde::encode_into_std_write(&args, &mut local_arg_buf, config)?;
unsafe { local_arg_buf.set_len(arg_bytes) };
// println!("{:02X?}", local_arg_buf);

/*
let buf = &local_arg_buf[..arg_bytes].to_owned();
println!("decode_from_slice {:02X?}", buf);
let args: Result<((Option<Input>,), usize), bincode::error::DecodeError> =
    bincode::serde::decode_from_slice::<(Option<Input>,), _>(buf, config);
println!("{:?}", args);
*/
...
Source

pub fn unapply(&self) -> Result<D::Output, PayloadRpcError>

Source

pub fn eject(&mut self) -> Result<(), InjectError>

Eject the DLL from the target process.

This will first unapply if it was applied before.

Source

pub fn leak(&mut self)

Leak the injection, preventing both manual and automatic eject().

Source

pub fn inject<'f1, 'f2>( process: OwnedProcess, ) -> DllInjectionInjectBuilder<'f1, 'f2, D>

Inject the DLL into the given process and optionally appliy it (call APPLY()).

Trait Implementations§

Source§

impl<D: DllApp> Drop for DllInjection<D>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<D: DllApp> Send for DllInjection<D>

Syringe contains [RemoteBoxAllocator] which is [Rc] inner and thus !Send. But Syringe itself is !Clone, it’s actually Send.

Auto Trait Implementations§

§

impl<D> !Freeze for DllInjection<D>

§

impl<D> !RefUnwindSafe for DllInjection<D>

§

impl<D> !Sync for DllInjection<D>

§

impl<D> Unpin for DllInjection<D>

§

impl<D> UnsafeUnpin for DllInjection<D>

§

impl<D> !UnwindSafe for DllInjection<D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DropFlavorWrapper<T> for T

Source§

type Flavor = MayDrop

The DropFlavor that wraps T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more