summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs')
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs81
1 files changed, 1 insertions, 80 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
index a5c058da43..28abe0cb3b 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
@@ -17,7 +17,6 @@ using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
-using System.Security.Permissions;
using System.Reflection;
using Microsoft.Win32;
using System.Runtime.Versioning;
@@ -25,96 +24,18 @@ using StackCrawlMark = System.Threading.StackCrawlMark;
namespace System.Runtime.InteropServices
{
- [System.Runtime.InteropServices.ComVisible(true)]
- static public class RuntimeEnvironment {
+ static internal class RuntimeEnvironment {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern String GetModuleFileName();
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern String GetDeveloperPath();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern String GetHostBindingFile();
-
- public static bool FromGlobalAccessCache(Assembly a)
- {
- return a.GlobalAssemblyCache;
- }
-
[MethodImpl (MethodImplOptions.NoInlining)]
public static String GetSystemVersion()
{
return Assembly.GetExecutingAssembly().ImageRuntimeVersion;
}
- public static String GetRuntimeDirectory()
- {
- String dir = GetRuntimeDirectoryImpl();
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, dir).Demand();
- return dir;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern String GetRuntimeDirectoryImpl();
-
- // Returns the system ConfigurationFile
- public static String SystemConfigurationFile {
- get {
- StringBuilder sb = new StringBuilder(Path.MaxPath);
- sb.Append(GetRuntimeDirectory());
- sb.Append(AppDomainSetup.RuntimeConfigurationFile);
- String path = sb.ToString();
-
- // Do security check
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand();
-
- return path;
- }
- }
-
#if FEATURE_COMINTEROP
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- private static extern IntPtr GetRuntimeInterfaceImpl(
- [In, MarshalAs(UnmanagedType.LPStruct)] Guid clsid,
- [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
-
- //
- // This function does the equivalent of calling GetInterface(clsid, riid) on the
- // ICLRRuntimeInfo representing this runtime. See MetaHost.idl for a list of
- // CLSIDs and IIDs supported by this method.
- //
- // Returns unmanaged pointer to requested interface on success. Throws
- // COMException with failed HR if there is a QI failure.
- //
- [ComVisible(false)]
- public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid)
- {
- return GetRuntimeInterfaceImpl(clsid, riid);
- }
-
- //
- // This function does the equivalent of calling GetInterface(clsid, riid) on the
- // ICLRRuntimeInfo representing this runtime. See MetaHost.idl for a list of
- // CLSIDs and IIDs supported by this method.
- //
- // Returns an RCW to requested interface on success. Throws
- // COMException with failed HR if there is a QI failure.
- //
- [ComVisible(false)]
- public static object GetRuntimeInterfaceAsObject(Guid clsid, Guid riid)
- {
- IntPtr p = IntPtr.Zero;
- try {
- p = GetRuntimeInterfaceImpl(clsid, riid);
- return Marshal.GetObjectForIUnknown(p);
- } finally {
- if(p != IntPtr.Zero) {
- Marshal.Release(p);
- }
- }
- }
#endif // FEATURE_COMINTEROP
}
}