public IPCBus(string path) { _downstream = new System.IO.Pipes.NamedPipeClientStream("com.h3m3.posix.sockets." + System.Diagnostics.Process.GetCurrentProcess().Id); _upstream = new System.IO.Pipes.NamedPipeServerStream("com.h3m3.posix.sockets.SockServ"); System.IO.Pipes.PipeSecurity downstreamACL = new System.IO.Pipes.PipeSecurity(); downstreamACL.AddAccessRule(new System.IO.Pipes.PipeAccessRule(Environment.UserName, System.IO.Pipes.PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow)); _downstream.SetAccessControl(downstreamACL); }
private static System.IO.Pipes.NamedPipeServerStream GetPipeServer(string aPipeName, System.IO.Pipes.PipeDirection aDir) { //Get "Everyone" for localized OS: http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/0737f978-a998-453d-9a6a-c348285d7ea3/ System.Security.Principal.SecurityIdentifier sid = new System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.WorldSid, null); System.Security.Principal.NTAccount acct = sid.Translate(typeof(System.Security.Principal.NTAccount)) as System.Security.Principal.NTAccount; System.IO.Pipes.PipeSecurity ps = new System.IO.Pipes.PipeSecurity(); System.IO.Pipes.PipeAccessRule par = new System.IO.Pipes.PipeAccessRule(acct, System.IO.Pipes.PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow); ps.AddAccessRule(par); return new System.IO.Pipes.NamedPipeServerStream(aPipeName, aDir, 1, System.IO.Pipes.PipeTransmissionMode.Message, System.IO.Pipes.PipeOptions.None, 4096, 4096, ps); }
public MyServer(string pipeName) { var rule = new System.IO.Pipes.PipeAccessRule("Everyone", System.IO.Pipes.PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow); var security = new System.IO.Pipes.PipeSecurity(); security.AddAccessRule(rule); var server = new NamedPipeServer <MyMessage>(pipeName, security); server.ClientConnected += OnClientConnected; server.ClientDisconnected += OnClientDisconnected; server.ClientMessage += OnClientMessage; server.Error += OnError; server.Start(); while (KeepRunning) { // Do nothing - wait for user to press 'q' key } server.Stop(); }
public static void SetAccessControl(this System.IO.Pipes.PipeStream stream, System.IO.Pipes.PipeSecurity pipeSecurity) { }
private System.IO.Pipes.NamedPipeServerStream GetPipeServer(System.IO.Pipes.PipeDirection aDir) { System.IO.Pipes.PipeSecurity ps = new System.IO.Pipes.PipeSecurity(); System.IO.Pipes.PipeAccessRule par = new System.IO.Pipes.PipeAccessRule("Everyone", System.IO.Pipes.PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow); ps.AddAccessRule(par); return new System.IO.Pipes.NamedPipeServerStream("XervBackup.Pipe." + aDir.ToString(), aDir, 1, System.IO.Pipes.PipeTransmissionMode.Message, System.IO.Pipes.PipeOptions.Asynchronous, 4096, 4096, ps); }
public static System.IO.Pipes.NamedPipeServerStream Create(string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize, System.IO.Pipes.PipeSecurity pipeSecurity, System.IO.HandleInheritability inheritability = System.IO.HandleInheritability.None, System.IO.Pipes.PipeAccessRights additionalAccessRights = default) { throw null; }
public static System.IO.Pipes.AnonymousPipeServerStream Create(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability, int bufferSize, System.IO.Pipes.PipeSecurity pipeSecurity) { throw null; }