Пример #1
0
        //[DllImport(Win32DLL.Kernel32, CharSet = CharSet.Auto, SetLastError = true, EntryPoint = "CreateNamedPipe")]
        //static public extern IntPtr CreateNamedPipe2(string pipeName, uint dwOpenMode, uint dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr lpSecurityAttributes);
        #endregion

        #region ======== File ========
        static public CAutoHandle CreateFile(string filename, ACCESS_TYPE access, FILE_SHARE_MODE share,
                                             SECURITY_ATTRIBUTES security, FILE_DISPOSITION disposition, FILE_ATTR_AND_FLAG attribute,
                                             CAutoHandle template)
        {
            IntPtr temp = (template == null) ? IntPtr.Zero : (IntPtr)template;
            IntPtr ret  = CreateFile(filename, (uint)access, (uint)share, security, (uint)disposition, (uint)attribute, temp);

            return(new CAutoHandle(ret));
        }
Пример #2
0
        static public bool CreatePipe(out CAutoHandle read_pipe, out CAutoHandle write_pipe, SECURITY_ATTRIBUTES attribute, uint size)
        {
            IntPtr read  = IntPtr.Zero;
            IntPtr write = IntPtr.Zero;
            bool   ret   = CreatePipe(out read, out write, attribute, size);

            read_pipe  = new CAutoHandle(read);
            write_pipe = new CAutoHandle(write);
            return(ret);
        }