public Win32AnonymousPipeServer (AnonymousPipeServerStream owner, PipeDirection direction, HandleInheritability inheritability, int bufferSize)
{
IntPtr r, w;
SecurityAttributesHack att = new SecurityAttributesHack (inheritability == HandleInheritability.Inheritable);
if (!Win32Marshal.CreatePipe (out r, out w, ref att, bufferSize))
throw new Win32Exception (Marshal.GetLastWin32Error ());
var rh = new SafePipeHandle (r, true);
var wh = new SafePipeHandle (w, true);
if (direction == PipeDirection.Out) {
server_handle = wh;
client_handle = rh;
} else {
server_handle = rh;
client_handle = wh;
}
}