(h: WinHandle, ms: i64, vm: &VirtualMachine)
| 539 | |
| 540 | #[pyfunction] |
| 541 | fn WaitForSingleObject(h: WinHandle, ms: i64, vm: &VirtualMachine) -> PyResult<u32> { |
| 542 | // Negative values (e.g., -1) map to INFINITE (0xFFFFFFFF) |
| 543 | let ms = if ms < 0 { |
| 544 | windows_sys::Win32::System::Threading::INFINITE |
| 545 | } else if ms > u32::MAX as i64 { |
| 546 | return Err(vm.new_overflow_error("timeout value is too large")); |
| 547 | } else { |
| 548 | ms as u32 |
| 549 | }; |
| 550 | let ret = unsafe { windows_sys::Win32::System::Threading::WaitForSingleObject(h.0, ms) }; |
| 551 | if ret == windows_sys::Win32::Foundation::WAIT_FAILED { |
| 552 | Err(vm.new_last_os_error()) |
| 553 | } else { |
| 554 | Ok(ret) |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | #[pyfunction] |
| 559 | fn WaitForMultipleObjects( |
no test coverage detected