Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / clr / src / BCL / System / Runtime / InteropServices / RuntimeEnvironment.cs / 1 / RuntimeEnvironment.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: RuntimeEnvironment ** ** ** Purpose: Runtime information ** ** =============================================================================*/ using System; using System.Text; using System.IO; using System.Runtime.CompilerServices; using System.Security.Permissions; using System.Reflection; using Microsoft.Win32; namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(true)] public 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(); [DllImport(Win32Native.SHIM, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)] private static extern int GetCORVersion(StringBuilder sb, int BufferLength, ref int retLength); [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool FromGlobalAccessCache(Assembly a); public static String GetSystemVersion() { StringBuilder s = new StringBuilder(256); int retLength = 0; if(GetCORVersion(s, 256, ref retLength) == 0) return s.ToString(); else return null; } 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.MAX_PATH); sb.Append(GetRuntimeDirectory()); sb.Append(AppDomainSetup.RuntimeConfigurationFile); String path = sb.ToString(); // Do security check new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand(); return path; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: RuntimeEnvironment ** ** ** Purpose: Runtime information ** ** =============================================================================*/ using System; using System.Text; using System.IO; using System.Runtime.CompilerServices; using System.Security.Permissions; using System.Reflection; using Microsoft.Win32; namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(true)] public 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(); [DllImport(Win32Native.SHIM, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)] private static extern int GetCORVersion(StringBuilder sb, int BufferLength, ref int retLength); [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool FromGlobalAccessCache(Assembly a); public static String GetSystemVersion() { StringBuilder s = new StringBuilder(256); int retLength = 0; if(GetCORVersion(s, 256, ref retLength) == 0) return s.ToString(); else return null; } 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.MAX_PATH); sb.Append(GetRuntimeDirectory()); sb.Append(AppDomainSetup.RuntimeConfigurationFile); String path = sb.ToString(); // Do security check new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand(); return path; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PasswordBoxAutomationPeer.cs
- WmlLiteralTextAdapter.cs
- DbProviderFactories.cs
- JournalNavigationScope.cs
- XmlCodeExporter.cs
- UrlUtility.cs
- DeviceContext2.cs
- Vector.cs
- RSAPKCS1SignatureFormatter.cs
- BooleanAnimationBase.cs
- ControlPager.cs
- LedgerEntryCollection.cs
- UIElementParagraph.cs
- LogicalTreeHelper.cs
- ConnectionStringSettings.cs
- MailAddress.cs
- ForwardPositionQuery.cs
- shaperfactoryquerycacheentry.cs
- DashStyles.cs
- DependencyProperty.cs
- MasterPageParser.cs
- SqlDependencyUtils.cs
- NamespaceInfo.cs
- CodeNamespaceCollection.cs
- PersonalizableTypeEntry.cs
- ListComponentEditorPage.cs
- Brush.cs
- JoinGraph.cs
- VectorValueSerializer.cs
- SmiMetaDataProperty.cs
- HtmlInputButton.cs
- ExportException.cs
- Point3DValueSerializer.cs
- LocalBuilder.cs
- DBSchemaTable.cs
- CacheMemory.cs
- SpanIndex.cs
- Model3DGroup.cs
- SingleTagSectionHandler.cs
- CroppedBitmap.cs
- ToolStripContainer.cs
- EventLogger.cs
- SecurityTokenSerializer.cs
- AssemblyCache.cs
- VarRefManager.cs
- DataObjectEventArgs.cs
- HttpGetServerProtocol.cs
- SqlDataRecord.cs
- CharUnicodeInfo.cs
- StringExpressionSet.cs
- EntityContainerRelationshipSetEnd.cs
- WindowsListViewSubItem.cs
- DataBoundControl.cs
- GradientBrush.cs
- EntityDataSource.cs
- MetaType.cs
- TiffBitmapEncoder.cs
- SuppressMergeCheckAttribute.cs
- TraceHwndHost.cs
- controlskin.cs
- KeyNotFoundException.cs
- SwitchAttribute.cs
- UIElementParagraph.cs
- BevelBitmapEffect.cs
- XmlReader.cs
- EpmHelper.cs
- AuthenticationSection.cs
- DescendantOverDescendantQuery.cs
- ScopelessEnumAttribute.cs
- ExternalCalls.cs
- DataBoundLiteralControl.cs
- TimeSpanStorage.cs
- EventLogException.cs
- ChangesetResponse.cs
- AppDomainFactory.cs
- CatalogZoneAutoFormat.cs
- DataError.cs
- SetStoryboardSpeedRatio.cs
- TextBoxDesigner.cs
- CellRelation.cs
- CircleEase.cs
- EntitySqlQueryCacheKey.cs
- MetaData.cs
- ImageInfo.cs
- HostingEnvironment.cs
- AppDomainUnloadedException.cs
- XmlQualifiedNameTest.cs
- Switch.cs
- GeneralTransform.cs
- ProgressBarAutomationPeer.cs
- ReturnEventArgs.cs
- HttpRequestCacheValidator.cs
- PartitionedStreamMerger.cs
- NumericPagerField.cs
- SkinBuilder.cs
- BaseParagraph.cs
- ScopelessEnumAttribute.cs
- PackageRelationship.cs
- Quaternion.cs
- SqlDataSourceCommandEventArgs.cs