pub struct ProcessModule<P: Process> { /* private fields */ }Expand description
A struct representing a loaded module of a running process.
Implementations§
Source§impl<P: Process> ProcessModule<P>
impl<P: Process> ProcessModule<P>
Sourcepub unsafe fn new_unchecked(handle: ModuleHandle, process: P) -> Self
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).
Sourcepub unsafe fn new_local_unchecked(handle: ModuleHandle) -> Self
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).
Sourcepub fn borrowed(&self) -> BorrowedProcessModule<'_>
pub fn borrowed(&self) -> BorrowedProcessModule<'_>
Returns a borrowed instance of this module.
Sourcepub fn find(
module_name_or_path: impl AsRef<Path>,
process: P,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn find_by_name(
module_name: impl AsRef<Path>,
process: P,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn find_by_path(
module_path: impl AsRef<Path>,
process: P,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn find_local(
module_name_or_path: impl AsRef<Path>,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn find_local_by_name(
module_name: impl AsRef<Path>,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn find_local_by_path(
module_path: impl AsRef<Path>,
) -> Result<Option<ProcessModule<P>>, IoOrNulError>
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.
Sourcepub fn handle(&self) -> ModuleHandle
pub fn handle(&self) -> ModuleHandle
Returns the underlying handle og the module.
Sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Returns a value indicating whether the module is loaded in current process.
Sourcepub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
Returns a value indicating whether the module is loaded in a remote process (not the current one).
Sourcepub fn base_name(&self) -> Result<OsString, Error>
pub fn base_name(&self) -> Result<OsString, Error>
Returns the base name of the file the module was loaded from.
Sourcepub fn get_local_procedure_address(
&self,
proc_name: impl AsRef<str>,
) -> Result<RawFunctionPtr, GetLocalProcedureAddressError>
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.
Sourcepub unsafe fn get_local_procedure<F: FunctionPtr>(
&self,
proc_name: impl AsRef<str>,
) -> Result<F, GetLocalProcedureAddressError>
pub unsafe fn get_local_procedure<F: FunctionPtr>( &self, proc_name: impl AsRef<str>, ) -> Result<F, GetLocalProcedureAddressError>
Sourcepub fn guess_is_loaded(&self) -> bool
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.
Sourcepub fn try_guess_is_loaded(&self) -> Result<bool, Error>
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<'_>>
impl ProcessModule<BorrowedProcess<'_>>
Sourcepub fn try_to_owned(&self) -> Result<OwnedProcessModule, Error>
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>
impl<P: Clone + Process> Clone for ProcessModule<P>
Source§fn clone(&self) -> ProcessModule<P>
fn clone(&self) -> ProcessModule<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<P: Copy + Process> Copy for ProcessModule<P>
impl<P: Eq + Process> Eq for ProcessModule<P>
Source§impl<'a> From<&'a ProcessModule<OwnedProcess>> for BorrowedProcessModule<'a>
impl<'a> From<&'a ProcessModule<OwnedProcess>> for BorrowedProcessModule<'a>
Source§fn from(module: &'a OwnedProcessModule) -> Self
fn from(module: &'a OwnedProcessModule) -> Self
Source§impl<P: PartialEq + Process> PartialEq for ProcessModule<P>
impl<P: PartialEq + Process> PartialEq for ProcessModule<P>
Source§fn eq(&self, other: &ProcessModule<P>) -> bool
fn eq(&self, other: &ProcessModule<P>) -> bool
self and other values to be equal, and is used by ==.