[System] Process.WaitForExit now triggers event Exited.
[mono.git] / mcs / class / corlib / System.Security / SecurityContext.cs
index eec9b9480bad66bee501c9f8fb4396f4aff55f04..7d3f942fc8c473953e535a97bec25ce3065939b1 100644 (file)
@@ -34,13 +34,14 @@ using System.Threading;
 namespace System.Security {
 
        public sealed class SecurityContext
-#if NET_4_0
                : IDisposable
-#endif
        {
                private bool _capture;
                private IntPtr _winid;
+
+#if !MOBILE    
                private CompressedStack _stack;
+#endif
                private bool _suppressFlowWindowsIdentity;
                private bool _suppressFlow;
 
@@ -71,9 +72,11 @@ namespace System.Security {
 
                static public SecurityContext Capture ()
                {
+#if !MOBILE                    
                        SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
                        if (sc.FlowSuppressed)
                                return null;
+#endif
 
                        SecurityContext capture = new SecurityContext ();
                        capture._capture = true;
@@ -84,11 +87,9 @@ namespace System.Security {
                        return capture;
                }
                
-#if NET_4_0
                public void Dispose ()
                {
                }
-#endif
 
                // internal stuff
 
@@ -102,10 +103,12 @@ namespace System.Security {
                        set { _suppressFlowWindowsIdentity = value; }
                }
 
+#if !MOBILE    
                internal CompressedStack CompressedStack {
                        get { return _stack; }
                        set { _stack = value; }
                }
+#endif
 
                internal IntPtr IdentityToken {
                        get { return _winid; }
@@ -116,16 +119,25 @@ namespace System.Security {
 
                static public bool IsFlowSuppressed ()
                {
+#if MOBILE
+                       return false;
+#else
                        return Thread.CurrentThread.ExecutionContext.SecurityContext.FlowSuppressed;
+#endif
                } 
 
                static public bool IsWindowsIdentityFlowSuppressed ()
                {
+#if MOBILE
+                       return false;
+#else
                        return Thread.CurrentThread.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed;
+#endif
                }
 
                static public void RestoreFlow ()
                {
+#if !MOBILE
                        SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
                        // if nothing is suppressed then throw
                        if (!sc.FlowSuppressed && !sc.WindowsIdentityFlowSuppressed)
@@ -133,6 +145,7 @@ namespace System.Security {
 
                        sc.FlowSuppressed = false;
                        sc.WindowsIdentityFlowSuppressed = false;
+#endif
                }
 
                // if you got the context then you can use it
@@ -171,18 +184,26 @@ namespace System.Security {
                [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
                static public AsyncFlowControl SuppressFlow ()
                {
+#if MOBILE
+                       throw new NotSupportedException ();
+#else                  
                        Thread t = Thread.CurrentThread;
                        // suppress both flows
                        t.ExecutionContext.SecurityContext.FlowSuppressed = true;
                        t.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed = true;
                        return new AsyncFlowControl (t, AsyncFlowControlType.Security);
+#endif
                }
 
                static public AsyncFlowControl SuppressFlowWindowsIdentity ()
                {
+#if MOBILE
+                       throw new NotSupportedException ();
+#else                  
                        Thread t = Thread.CurrentThread;
                        t.ExecutionContext.SecurityContext.WindowsIdentityFlowSuppressed = true;
                        return new AsyncFlowControl (t, AsyncFlowControlType.Security);
+#endif
                }
        }
 }