MCPcopy Create free account
hub / github.com/Kudaes/Fiber / open_process

Function open_process

loader/dinvoke/src/lib.rs:933–948  ·  view source on GitHub ↗

Opens a HANDLE to a process. If the function fails, it will return a null HANDLE. # Examples ``` let pid = 792u32; let handle = dinvoke::open_process(0x0040, 0, pid); //PROCESS_DUP_HANDLE access right. if handle.0 != 0 { println!("Handle to process with id {} with PROCESS_DUP_HANDLE access right successfully obtained.", pid); } ```

(desired_access: u32, inherit_handle: i32, process_id: u32)

Source from the content-addressed store, hash-verified

931/// }
932/// ```
933pub fn open_process(desired_access: u32, inherit_handle: i32, process_id: u32) -> HANDLE {
934
935 unsafe
936 {
937 let ret: Option<HANDLE>;
938 let func_ptr: data::OpenProcess;
939 let module_base_address = get_module_base_address(&lc!("kernel32.dll"));
940 dynamic_invoke!(module_base_address,&lc!("OpenProcess"),func_ptr,ret,desired_access,inherit_handle,process_id);
941
942 match ret {
943 Some(x) => return x,
944 None => return HANDLE::default(),
945 }
946 }
947
948}
949
950/// Closes a HANDLE object.
951///

Callers

nothing calls this directly

Calls 1

get_module_base_addressFunction · 0.70

Tested by

no test coverage detected