System.IO.Pipes.Win32Marshal.CreatePipe C# (CSharp) Méthode

CreatePipe() private méthode

private CreatePipe ( IntPtr &readHandle, IntPtr &writeHandle, SecurityAttributesHack &pipeAtts, int size ) : bool
readHandle System.IntPtr
writeHandle System.IntPtr
pipeAtts SecurityAttributesHack
size int
Résultat bool
		internal static extern bool CreatePipe (out IntPtr readHandle, out IntPtr writeHandle, ref SecurityAttributesHack pipeAtts, int size);

Usage Example

Exemple #1
0
        // AnonymousPipeServerStream owner;

        public unsafe Win32AnonymousPipeServer(AnonymousPipeServerStream owner, PipeDirection direction,
                                               HandleInheritability inheritability, int bufferSize,
                                               PipeSecurity pipeSecurity)
        {
            IntPtr r, w;

            byte[] securityDescriptor = null;
            if (pipeSecurity != null)
            {
                securityDescriptor = pipeSecurity.GetSecurityDescriptorBinaryForm();

                fixed(byte *securityDescriptorPtr = securityDescriptor)
                {
                    SecurityAttributes att = new SecurityAttributes(inheritability, (IntPtr)securityDescriptorPtr);

                    if (!Win32Marshal.CreatePipe(out r, out w, ref att, bufferSize))
                    {
                        throw Win32PipeError.GetException();
                    }
                }

                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;
                }
        }
All Usage Examples Of System.IO.Pipes.Win32Marshal::CreatePipe