(pid: i32, sig: isize, vm: &VirtualMachine)
| 963 | |
| 964 | #[pyfunction] |
| 965 | fn kill(pid: i32, sig: isize, vm: &VirtualMachine) -> PyResult<()> { |
| 966 | let sig = sig as u32; |
| 967 | let pid = pid as u32; |
| 968 | |
| 969 | if sig == Console::CTRL_C_EVENT || sig == Console::CTRL_BREAK_EVENT { |
| 970 | let ret = unsafe { Console::GenerateConsoleCtrlEvent(sig, pid) }; |
| 971 | let res = if ret == 0 { |
| 972 | Err(vm.new_last_os_error()) |
| 973 | } else { |
| 974 | Ok(()) |
| 975 | }; |
| 976 | return res; |
| 977 | } |
| 978 | |
| 979 | let h = unsafe { Threading::OpenProcess(Threading::PROCESS_ALL_ACCESS, 0, pid) }; |
| 980 | if h.is_null() { |
| 981 | return Err(vm.new_last_os_error()); |
| 982 | } |
| 983 | let ret = unsafe { Threading::TerminateProcess(h, sig) }; |
| 984 | let res = if ret == 0 { |
| 985 | Err(vm.new_last_os_error()) |
| 986 | } else { |
| 987 | Ok(()) |
| 988 | }; |
| 989 | unsafe { Foundation::CloseHandle(h) }; |
| 990 | res |
| 991 | } |
| 992 | |
| 993 | #[pyfunction] |
| 994 | fn get_terminal_size( |
no test coverage detected