Skip to content

Commit

Permalink
Add get_modules for processes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinjul1704 committed Jan 18, 2025
1 parent 37f21a3 commit 5dc801b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,21 @@ impl Process
/// println!("{}", process.get_path());
/// ```
pub fn get_path(&self) -> String {return self.process_data.borrow().path.clone();}

/// Returns modules of a process
///
/// # Examples
/// ```
/// use mem_rs::prelude::*;
///
/// let mut process = Process::new("name_of_process.exe");
/// process.refresh().unwrap();
///
/// let process_modules = process.get_modules();
///
/// for process_module in process_modules {
/// println!("{}", process_module.name);
/// }
/// ```
pub fn get_modules(&self) -> Vec<ProcessModule> {return self.process_data.borrow().modules.clone();}
}
1 change: 1 addition & 0 deletions src/process_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use windows::Win32::Foundation::{HANDLE};
use windows::Win32::System::Diagnostics::Debug::ReadProcessMemory;

#[allow(dead_code)]
#[derive(Clone)]
pub struct ProcessModule
{
pub id: usize,
Expand Down

0 comments on commit 5dc801b

Please sign in to comment.