(zelf: &Py<Self>, pipe: isize, vm: &VirtualMachine)
| 1193 | // ConnectNamedPipe |
| 1194 | #[pymethod] |
| 1195 | fn ConnectNamedPipe(zelf: &Py<Self>, pipe: isize, vm: &VirtualMachine) -> PyResult<bool> { |
| 1196 | use windows_sys::Win32::Foundation::{ |
| 1197 | ERROR_IO_PENDING, ERROR_PIPE_CONNECTED, ERROR_SUCCESS, |
| 1198 | }; |
| 1199 | use windows_sys::Win32::System::Pipes::ConnectNamedPipe; |
| 1200 | |
| 1201 | let mut inner = zelf.inner.lock(); |
| 1202 | if !matches!(inner.data, OverlappedData::None) { |
| 1203 | return Err(vm.new_value_error("operation already attempted")); |
| 1204 | } |
| 1205 | |
| 1206 | inner.handle = pipe as HANDLE; |
| 1207 | inner.data = OverlappedData::ConnectNamedPipe; |
| 1208 | |
| 1209 | let ret = unsafe { ConnectNamedPipe(pipe as HANDLE, &mut inner.overlapped) }; |
| 1210 | |
| 1211 | let err = if ret != 0 { |
| 1212 | ERROR_SUCCESS |
| 1213 | } else { |
| 1214 | unsafe { GetLastError() } |
| 1215 | }; |
| 1216 | inner.error = err; |
| 1217 | |
| 1218 | match err { |
| 1219 | ERROR_PIPE_CONNECTED => { |
| 1220 | mark_as_completed(&mut inner.overlapped); |
| 1221 | Ok(true) |
| 1222 | } |
| 1223 | ERROR_SUCCESS | ERROR_IO_PENDING => Ok(false), |
| 1224 | _ => { |
| 1225 | inner.data = OverlappedData::NotStarted; |
| 1226 | Err(set_from_windows_err(err, vm)) |
| 1227 | } |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | // WSASendTo |
| 1232 | #[pymethod] |
no test coverage detected