CreateFile() private méthode

private CreateFile ( string name, PipeAccessRights desiredAccess, FileShare fileShare, SecurityAttributesHack &atts, int creationDisposition, int flags, IntPtr templateHandle ) : IntPtr
name string
desiredAccess PipeAccessRights
fileShare FileShare
atts SecurityAttributesHack
creationDisposition int
flags int
templateHandle System.IntPtr
Résultat System.IntPtr
Exemple #1
0
        // .ctor without handle - create new
        public Win32NamedPipeClient(NamedPipeClientStream owner, string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, HandleInheritability inheritability)
        {
            name = String.Format("\\\\{0}\\pipe\\{1}", serverName, pipeName);
            var att = new SecurityAttributesHack(inheritability == HandleInheritability.Inheritable);

            is_async = (options & PipeOptions.Asynchronous) != PipeOptions.None;

            opener = delegate {
                var ret = Win32Marshal.CreateFile(name, desiredAccessRights, 0, ref att, 3, 0, IntPtr.Zero);
                if (ret == new IntPtr(-1L))
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }

                return(new SafePipeHandle(ret, true));
            };
            this.owner = owner;
        }