process: make searching for a module case-insensitive

This commit is contained in:
2025-12-04 04:13:08 +00:00
parent b09fdc5fbf
commit a62b11df3f
+2 -4
View File
@@ -64,13 +64,11 @@ impl Process {
Ok(process) Ok(process)
} }
/// get a `Module` of a `Process` by name /// get a `Module` of a `Process` by name (case-insensitive)
///
/// note: the casing matters (don't search for `shell32.dll` if you want `SHELL32.dll`)
pub fn module(&self, name: &str) -> Result<Module, Error> { pub fn module(&self, name: &str) -> Result<Module, Error> {
let Some(snapshot) = snapshot::ModuleSnapshot::get_modules(self.id)? let Some(snapshot) = snapshot::ModuleSnapshot::get_modules(self.id)?
.into_iter() .into_iter()
.find(|snapshot| snapshot.name == name) .find(|snapshot| name.eq_ignore_ascii_case(&snapshot.name))
else { else {
return Err(Error::CreateProcessError(format!( return Err(Error::CreateProcessError(format!(
"failed to find a module with identifier `{name}`", "failed to find a module with identifier `{name}`",