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

Function ConnectPipe

crates/stdlib/src/overlapped.rs:1588–1613  ·  view source on GitHub ↗
(address: String, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1586
1587 #[pyfunction]
1588 fn ConnectPipe(address: String, vm: &VirtualMachine) -> PyResult<isize> {
1589 use windows_sys::Win32::Foundation::{GENERIC_READ, GENERIC_WRITE};
1590 use windows_sys::Win32::Storage::FileSystem::{
1591 CreateFileW, FILE_FLAG_OVERLAPPED, OPEN_EXISTING,
1592 };
1593
1594 let address_wide: Vec<u16> = address.encode_utf16().chain(core::iter::once(0)).collect();
1595
1596 let handle = unsafe {
1597 CreateFileW(
1598 address_wide.as_ptr(),
1599 GENERIC_READ | GENERIC_WRITE,
1600 0,
1601 core::ptr::null(),
1602 OPEN_EXISTING,
1603 FILE_FLAG_OVERLAPPED,
1604 core::ptr::null_mut(),
1605 )
1606 };
1607
1608 if handle == windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE {
1609 return Err(set_from_windows_err(0, vm));
1610 }
1611
1612 Ok(handle as isize)
1613 }
1614
1615 #[pyfunction]
1616 fn CreateIoCompletionPort(

Callers

nothing calls this directly

Calls 6

onceFunction · 0.85
set_from_windows_errFunction · 0.85
collectMethod · 0.80
chainMethod · 0.80
ErrClass · 0.50
as_ptrMethod · 0.45

Tested by

no test coverage detected