PipeStream.cs 803 B

123456789101112131415161718192021222324252627282930
  1. using System.Security.AccessControl;
  2. namespace System.IO.Pipes
  3. {
  4. public partial class PipeStream
  5. {
  6. public PipeSecurity GetAccessControl ()
  7. {
  8. if (State == PipeState.Closed) {
  9. throw Error.GetPipeNotOpen ();
  10. }
  11. // PipeState must be Disconnected, Connected, or Broken
  12. return new PipeSecurity (SafePipeHandle, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
  13. }
  14. public void SetAccessControl (PipeSecurity pipeSecurity)
  15. {
  16. if (pipeSecurity == null) {
  17. throw new ArgumentNullException (nameof(pipeSecurity));
  18. }
  19. // Checks that State != WaitingToConnect and State != Closed
  20. CheckPipePropertyOperations ();
  21. // PipeState must be either Disconected or Connected
  22. pipeSecurity.Persist (SafePipeHandle);
  23. }
  24. }
  25. }