pub struct ProcessHandle(/* private fields */);
Expand description
A handle to a running process. This is not a process ID on all platforms.
For convenience, this crate implements TryFrom
-backed conversions from
Pid
to ProcessHandle
.
§Examples
use read_process_memory::*;
use std::convert::TryInto;
use std::io;
fn pid_to_handle(pid: Pid) -> io::Result<ProcessHandle> {
Ok(pid.try_into()?)
}
This operation is not guaranteed to succeed. Specifically, on Windows
OpenProcess
may fail. On macOS task_for_pid
will generally fail
unless run as root, and even then it may fail when called on certain
programs; it may however run without root on the current process.
On Windows a ProcessHandle
is a HANDLE
.
Trait Implementations§
Source§impl Clone for ProcessHandle
impl Clone for ProcessHandle
Source§fn clone(&self) -> ProcessHandle
fn clone(&self) -> ProcessHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl CopyAddress for ProcessHandle
Use ReadProcessMemory
to read memory from another process on Windows.
impl CopyAddress for ProcessHandle
Use ReadProcessMemory
to read memory from another process on Windows.
Source§impl Deref for ProcessHandle
impl Deref for ProcessHandle
Source§impl Hash for ProcessHandle
impl Hash for ProcessHandle
Source§impl PartialEq for ProcessHandle
impl PartialEq for ProcessHandle
Source§impl TryFrom<&Child> for ProcessHandle
A std::process::Child
has a HANDLE
from calling CreateProcess
.
impl TryFrom<&Child> for ProcessHandle
A std::process::Child
has a HANDLE
from calling CreateProcess
.
Source§impl TryFrom<u32> for ProcessHandle
A Pid
can be turned into a ProcessHandle
with OpenProcess
.
impl TryFrom<u32> for ProcessHandle
A Pid
can be turned into a ProcessHandle
with OpenProcess
.
impl Eq for ProcessHandle
impl StructuralPartialEq for ProcessHandle
Auto Trait Implementations§
impl Freeze for ProcessHandle
impl RefUnwindSafe for ProcessHandle
impl !Send for ProcessHandle
impl !Sync for ProcessHandle
impl Unpin for ProcessHandle
impl UnwindSafe for ProcessHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more