[sgen] Clear the card table in the finishing pause
[mono.git] / mcs / class / corlib / System.Runtime.InteropServices / RuntimeEnvironment.cs
index e5bc822b494747c97c8aa0442619fb3f35c31e2b..d2808208368d3309fc4fd3ae9ea82b32ca756d82 100644 (file)
@@ -3,12 +3,10 @@
 //
 // Authors:
 //     Dominik Fretz (roboto@gmx.net)
+//     Sebastien Pouliot (sebastien@ximian.com)
 //
 // (C) 2003 Dominik Fretz
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Security.Permissions;
 
 namespace System.Runtime.InteropServices
 {
+       [ComVisible (true)]
        public class RuntimeEnvironment
        {
                public RuntimeEnvironment ()
                {
                }
 
-               public static string SystemConfigurationFile 
-               {
-                       get { return Environment.GetMachineConfigPath (); }
+               public static string SystemConfigurationFile {
+                       get {
+                               // GetMachineConfigPath is internal and not protected by CAS
+                               string path = Environment.GetMachineConfigPath ();
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
+                               }
+                               return path;
+                       }
                }
 
-               
-               [MonoTODO]
                public static bool FromGlobalAccessCache (Assembly a)
                {
-                       throw new NotImplementedException ();
+                       // yes, this will throw a NullReferenceException (just like MS, reported as ...)
+                       return a.GlobalAssemblyCache;
                }
-
        
                public static string GetRuntimeDirectory ()
                {
                        return Path.GetDirectoryName (typeof (int).Assembly.Location);  
                }
 
+               [SecuritySafeCritical]
                public static string GetSystemVersion ()
                {
                        return "v" + Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build;
                }
-               
        }
 }
-