use std::{io, mem, path::Path};
use windows_sys::Win32::Security::SECURITY_ATTRIBUTES;
pub(crate) fn private_pipe(
options: &tokio::net::windows::named_pipe::ServerOptions,
address: &Path,
) -> io::Result<tokio::net::windows::named_pipe::NamedPipeServer> {
let descriptor = artifactize_foundation::platform::private::owner_descriptor()?;
let mut attributes = SECURITY_ATTRIBUTES {
nLength: mem::size_of::<SECURITY_ATTRIBUTES>() as u32,
lpSecurityDescriptor: descriptor.as_ptr(),
bInheritHandle: 0,
};
unsafe { options.create_with_security_attributes_raw(address, (&raw mut attributes).cast()) }
}