(
security_attributes: isize, // Always NULL (0)
manual_reset: bool,
initial_state: bool,
name: Option<PyStrRef>,
vm: &VirtualMachine,
)
| 1231 | /// CreateEventW - Create or open a named or unnamed event object. |
| 1232 | #[pyfunction] |
| 1233 | fn CreateEventW( |
| 1234 | security_attributes: isize, // Always NULL (0) |
| 1235 | manual_reset: bool, |
| 1236 | initial_state: bool, |
| 1237 | name: Option<PyStrRef>, |
| 1238 | vm: &VirtualMachine, |
| 1239 | ) -> PyResult<WinHandle> { |
| 1240 | use windows_sys::Win32::System::Threading::CreateEventW as WinCreateEventW; |
| 1241 | |
| 1242 | let _ = security_attributes; // Ignored, always NULL |
| 1243 | |
| 1244 | let name_wide = name.map(|n| n.as_wtf8().to_wide_with_nul()); |
| 1245 | let name_ptr = name_wide.as_ref().map_or(null(), |n| n.as_ptr()); |
| 1246 | |
| 1247 | let handle = unsafe { |
| 1248 | WinCreateEventW( |
| 1249 | null(), |
| 1250 | i32::from(manual_reset), |
| 1251 | i32::from(initial_state), |
| 1252 | name_ptr, |
| 1253 | ) |
| 1254 | }; |
| 1255 | |
| 1256 | if handle.is_null() { |
| 1257 | return Err(vm.new_last_os_error()); |
| 1258 | } |
| 1259 | |
| 1260 | Ok(WinHandle(handle)) |
| 1261 | } |
| 1262 | |
| 1263 | /// SetEvent - Set the specified event object to the signaled state. |
| 1264 | #[pyfunction] |
no test coverage detected