// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+
+#if !BOOTSTRAP_BASIC
+
using Microsoft.Win32.SafeHandles;
using System;
using System.IO;
using System.Security.AccessControl;
using System.Security.Permissions;
using System.Security.Principal;
+using System.Runtime.InteropServices;
namespace System.IO.Pipes
{
PipeTransmissionMode transmission_mode, read_trans_mode;
int buffer_size;
SafePipeHandle handle;
- FileStream stream;
+ Stream stream;
public override bool CanRead {
get { return (direction & PipeDirection.In) != 0; }
public bool IsConnected { get; protected set; }
- private Stream Stream {
+ internal Stream Stream {
get {
if (!IsConnected)
throw new InvalidOperationException ("Pipe is not connected");
if (stream == null)
- stream = new FileStream (handle.DangerousGetHandle (), CanRead ? (CanWrite ? FileAccess.ReadWrite : FileAccess.Read) : FileAccess.Write, true, buffer_size, IsAsync);
+ stream = new FileStream (handle.DangerousGetHandle (),
+ CanRead ? (CanWrite ? FileAccess.ReadWrite : FileAccess.Read)
+ : FileAccess.Write, true, buffer_size, IsAsync);
return stream;
}
+ set { stream = value; }
}
protected bool IsHandleExposed { get; private set; }
protected internal void CheckWriteOperations ()
{
if (!IsConnected)
- throw new InvalidOperationException ("Pipe us not connected");
+ throw new InvalidOperationException ("Pipe is not connected");
if (!CanWrite)
throw new NotSupportedException ("The pipe stream does not support write operations");
}
throw new NotSupportedException ();
}
- [MonoNotSupported ("ACL is not supported in Mono")]
public PipeSecurity GetAccessControl ()
{
- throw ThrowACLException ();
+ return new PipeSecurity (SafePipeHandle,
+ AccessControlSections.Owner |
+ AccessControlSections.Group |
+ AccessControlSections.Access);
}
- [MonoNotSupported ("ACL is not supported in Mono")]
public void SetAccessControl (PipeSecurity pipeSecurity)
{
- throw ThrowACLException ();
+ if (pipeSecurity == null)
+ throw new ArgumentNullException ("pipeSecurity");
+
+ pipeSecurity.Persist (SafePipeHandle);
}
// pipe I/O
}
[MonoTODO]
- public override int Read (byte [] buffer, int offset, int count)
+ public override int Read ([In] byte [] buffer, int offset, int count)
{
CheckReadOperations ();
}
}
}
+
+#endif