Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DbProviderFactoriesConfigurationHandler.cs
- CaseStatementSlot.cs
- BidOverLoads.cs
- CodeTypeReference.cs
- StreamWriter.cs
- TransportChannelListener.cs
- DllNotFoundException.cs
- GlyphTypeface.cs
- WindowsMenu.cs
- XmlText.cs
- ToolStripScrollButton.cs
- IconBitmapDecoder.cs
- UrlMappingCollection.cs
- IDReferencePropertyAttribute.cs
- UnescapedXmlDiagnosticData.cs
- RawTextInputReport.cs
- OneToOneMappingSerializer.cs
- WindowsFormsHostAutomationPeer.cs
- DataGridViewColumnStateChangedEventArgs.cs
- XmlWriterDelegator.cs
- CacheManager.cs
- infer.cs
- XmlWrappingReader.cs
- AllMembershipCondition.cs
- WorkflowHostingEndpoint.cs
- File.cs
- ConnectorEditor.cs
- XmlDataCollection.cs
- CatalogZoneAutoFormat.cs
- ParameterBuilder.cs
- WindowsComboBox.cs
- WindowsComboBox.cs
- DesigntimeLicenseContextSerializer.cs
- EnumType.cs
- UIElement.cs
- EventLogger.cs
- WindowsIPAddress.cs
- TableParagraph.cs
- ZeroOpNode.cs
- RowSpanVector.cs
- ColorMatrix.cs
- AttachInfo.cs
- ViewManagerAttribute.cs
- DataObject.cs
- AdornerLayer.cs
- ObjectParameterCollection.cs
- TextFormatterContext.cs
- DoubleConverter.cs
- CmsInterop.cs
- ParseChildrenAsPropertiesAttribute.cs
- DataGridTextBox.cs
- FrameworkRichTextComposition.cs
- XmlDigitalSignatureProcessor.cs
- EntityCommandExecutionException.cs
- DrawingImage.cs
- DeadCharTextComposition.cs
- GetPageNumberCompletedEventArgs.cs
- Stacktrace.cs
- ScrollPattern.cs
- Floater.cs
- KeyPressEvent.cs
- IRCollection.cs
- FileBasedResourceGroveler.cs
- WebPartActionVerb.cs
- SmtpClient.cs
- CompositeFontFamily.cs
- NullableConverter.cs
- BaseHashHelper.cs
- CodeEventReferenceExpression.cs
- MiniMapControl.xaml.cs
- ResourceExpressionBuilder.cs
- HandleCollector.cs
- BaseTreeIterator.cs
- ResourceType.cs
- ExpressionConverter.cs
- XmlNotation.cs
- MultilineStringConverter.cs
- Axis.cs
- ServiceModelSectionGroup.cs
- ComponentRenameEvent.cs
- SqlUtil.cs
- OraclePermissionAttribute.cs
- WmlValidationSummaryAdapter.cs
- PrintDialog.cs
- Nodes.cs
- DataSourceHelper.cs
- Window.cs
- SingleConverter.cs
- ProfileGroupSettingsCollection.cs
- DoubleLinkList.cs
- FileLoadException.cs
- WebPartHelpVerb.cs
- HttpCapabilitiesSectionHandler.cs
- CacheAxisQuery.cs
- XmlMessageFormatter.cs
- ResourceKey.cs
- ExpandedProjectionNode.cs
- TreeIterator.cs
- UIEndRequest.cs
- HttpDictionary.cs