MCPcopy Index your code
hub / github.com/RustPython/RustPython / OpenProcess

Function OpenProcess

crates/vm/src/stdlib/_winapi.rs:359–376  ·  view source on GitHub ↗
(
        desired_access: u32,
        inherit_handle: bool,
        process_id: u32,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

357
358 #[pyfunction]
359 fn OpenProcess(
360 desired_access: u32,
361 inherit_handle: bool,
362 process_id: u32,
363 vm: &VirtualMachine,
364 ) -> PyResult<WinHandle> {
365 let handle = unsafe {
366 windows_sys::Win32::System::Threading::OpenProcess(
367 desired_access,
368 i32::from(inherit_handle),
369 process_id,
370 )
371 };
372 if handle.is_null() {
373 return Err(vm.new_last_os_error());
374 }
375 Ok(WinHandle(handle))
376 }
377
378 #[pyfunction]
379 fn ExitProcess(exit_code: u32) {

Callers 1

killFunction · 0.85

Calls 3

WinHandleClass · 0.85
new_last_os_errorMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected