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
- SharedConnectionInfo.cs
- MachinePropertyVariants.cs
- ToolStripTextBox.cs
- AccessViolationException.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- FreeFormPanel.cs
- MediaTimeline.cs
- ResourceWriter.cs
- LineProperties.cs
- WebPartsSection.cs
- XmlSchemaException.cs
- DataGridViewColumnEventArgs.cs
- ComNativeDescriptor.cs
- BaseConfigurationRecord.cs
- XmlNodeReader.cs
- BamlWriter.cs
- CodeSubDirectory.cs
- XmlDomTextWriter.cs
- ComplexPropertyEntry.cs
- XhtmlCssHandler.cs
- AssociationSetEnd.cs
- SlipBehavior.cs
- EncryptedKey.cs
- HttpContext.cs
- PropagationProtocolsTracing.cs
- GeneralTransform3DCollection.cs
- LineBreakRecord.cs
- CreateUserErrorEventArgs.cs
- figurelength.cs
- HtmlWindow.cs
- Rect.cs
- TabControlCancelEvent.cs
- LogicalExpr.cs
- ExitEventArgs.cs
- RadioButtonPopupAdapter.cs
- DataAdapter.cs
- RouteParametersHelper.cs
- PropertyBuilder.cs
- UriTemplateClientFormatter.cs
- ConfigsHelper.cs
- HtmlInputFile.cs
- HttpContext.cs
- Module.cs
- AnnotationHighlightLayer.cs
- WebExceptionStatus.cs
- Condition.cs
- AdjustableArrowCap.cs
- MenuItem.cs
- X500Name.cs
- ConfigurationLockCollection.cs
- ProfileServiceManager.cs
- ChtmlCalendarAdapter.cs
- SqlCaseSimplifier.cs
- TemplateControl.cs
- ProfileSettings.cs
- basenumberconverter.cs
- BooleanKeyFrameCollection.cs
- XmlElementAttribute.cs
- SizeAnimationClockResource.cs
- RegexRunner.cs
- BooleanToVisibilityConverter.cs
- HtmlElement.cs
- WindowsPen.cs
- EndpointDiscoveryMetadata11.cs
- FeatureManager.cs
- SystemResourceHost.cs
- FontFamily.cs
- Literal.cs
- WebControlsSection.cs
- AutomationPropertyInfo.cs
- ResizingMessageFilter.cs
- Listbox.cs
- Base64Decoder.cs
- InvokeProviderWrapper.cs
- Unit.cs
- Parser.cs
- RequestResizeEvent.cs
- DupHandleConnectionReader.cs
- _NetRes.cs
- CustomAttributeSerializer.cs
- InnerItemCollectionView.cs
- GraphicsContainer.cs
- ItemsControlAutomationPeer.cs
- PluralizationServiceUtil.cs
- LongAverageAggregationOperator.cs
- Empty.cs
- PlatformCulture.cs
- XhtmlConformanceSection.cs
- CustomAssemblyResolver.cs
- DeferredSelectedIndexReference.cs
- ProjectedSlot.cs
- SmtpLoginAuthenticationModule.cs
- DataService.cs
- ModelPropertyImpl.cs
- XmlSchemaParticle.cs
- RangeValidator.cs
- SessionStateUtil.cs
- StringInfo.cs
- ThreadPool.cs
- AnnotationComponentChooser.cs