Skip to main content

ProcessModule

Struct ProcessModule 

Source
pub struct ProcessModule<P: Process> { /* private fields */ }
Available on Windows only.
Expand description

A struct representing a loaded module of a running process.

Implementations§

Source§

impl<P: Process> ProcessModule<P>

Source

pub unsafe fn new_unchecked(handle: ModuleHandle, process: P) -> Self

Contructs a new instance from the given module handle and its corresponding process.

§Safety

The caller must guarantee that the given handle is valid and that the module is loaded into the given process. (and stays that way while using the returned instance).

Source

pub unsafe fn new_local_unchecked(handle: ModuleHandle) -> Self

Contructs a new instance from the given module handle loaded in the current process.

§Safety

The caller must guarantee that the given handle is valid and that the module is loaded into the given process. (and stays that way while using the returned instance).

Source

pub fn borrowed(&self) -> BorrowedProcessModule<'_>

Returns a borrowed instance of this module.

Source

pub fn find( module_name_or_path: impl AsRef<Path>, process: P, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given name or path in the given process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn find_by_name( module_name: impl AsRef<Path>, process: P, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given name in the given process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn find_by_path( module_path: impl AsRef<Path>, process: P, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given path in the given process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn find_local( module_name_or_path: impl AsRef<Path>, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given name or path in the current process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn find_local_by_name( module_name: impl AsRef<Path>, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given name in the current process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn find_local_by_path( module_path: impl AsRef<Path>, ) -> Result<Option<ProcessModule<P>>, IoOrNulError>

Searches for a module with the given path in the current process. If the extension is omitted, the default library extension .dll is appended.

Source

pub fn handle(&self) -> ModuleHandle

Returns the underlying handle og the module.

Source

pub fn process(&self) -> &P

Returns the process this module is loaded in.

Source

pub fn is_local(&self) -> bool

Returns a value indicating whether the module is loaded in current process.

Source

pub fn is_remote(&self) -> bool

Returns a value indicating whether the module is loaded in a remote process (not the current one).

Source

pub fn path(&self) -> Result<PathBuf, Error>

Returns the path that the module was loaded from.

Source

pub fn base_name(&self) -> Result<OsString, Error>

Returns the base name of the file the module was loaded from.

Source

pub fn get_local_procedure_address( &self, proc_name: impl AsRef<str>, ) -> Result<RawFunctionPtr, GetLocalProcedureAddressError>

Returns a pointer to the procedure with the given name from this module.

§Note

This function is only supported for modules in the current process.

Source

pub unsafe fn get_local_procedure<F: FunctionPtr>( &self, proc_name: impl AsRef<str>, ) -> Result<F, GetLocalProcedureAddressError>

Returns a pointer to the procedure with the given name from this module.

§Note

This function is only supported for modules in the current process.

§Safety

The target function must abide by the given function signature.

Source

pub fn guess_is_loaded(&self) -> bool

Returns whether this module is still loaded in the respective process. If the operation fails, the module is considered to be unloaded.

Source

pub fn try_guess_is_loaded(&self) -> Result<bool, Error>

Returns whether this module is still loaded in the respective process.

Source§

impl ProcessModule<BorrowedProcess<'_>>

Source

pub fn try_to_owned(&self) -> Result<OwnedProcessModule, Error>

Tries to create a new OwnedProcessModule instance for this process module.

Trait Implementations§

Source§

impl<P: Clone + Process> Clone for ProcessModule<P>

Source§

fn clone(&self) -> ProcessModule<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Copy + Process> Copy for ProcessModule<P>

Source§

impl<P: Debug + Process> Debug for ProcessModule<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Eq + Process> Eq for ProcessModule<P>

Source§

impl<'a> From<&'a ProcessModule<OwnedProcess>> for BorrowedProcessModule<'a>

Source§

fn from(module: &'a OwnedProcessModule) -> Self

Converts to this type from the input type.
Source§

impl<P: Hash + Process> Hash for ProcessModule<P>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<P: PartialEq + Process> PartialEq for ProcessModule<P>

Source§

fn eq(&self, other: &ProcessModule<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: Process + Send> Send for ProcessModule<P>

Source§

impl<P: Process> StructuralPartialEq for ProcessModule<P>

Source§

impl<P: Process + Sync> Sync for ProcessModule<P>

Source§

impl TryFrom<ProcessModule<BorrowedProcess<'_>>> for OwnedProcessModule

Source§

type Error = Error

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

fn try_from(module: BorrowedProcessModule<'_>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<P> Freeze for ProcessModule<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for ProcessModule<P>
where P: RefUnwindSafe,

§

impl<P> Unpin for ProcessModule<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for ProcessModule<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for ProcessModule<P>
where P: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.