implement process modules

This commit is contained in:
2024-12-30 16:52:02 +00:00
parent 45ecf9bed6
commit ff7674615d
4 changed files with 87 additions and 11 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ impl Drop for Handle {
if self.0 != INVALID_HANDLE_VALUE {
unsafe {
if let Err(why) = CloseHandle(**self) {
eprintln!("couldn't close handle: {why}");
eprintln!("failed to close handle: {why}");
};
}
}
@@ -35,13 +35,13 @@ impl Handle {
.or_else(|_| OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE, false, pid))
.map_err(|why| {
crate::Error::HandleError(format!(
"couldn't open process with needed access: {why}",
"failed to open process with needed access: {why}",
))
})?
};
if handle == INVALID_HANDLE_VALUE {
return Err(crate::Error::HandleError(
"couldn't get a valid handle".to_string(),
"failed to get a valid handle".to_string(),
));
}
Ok(Self(handle))