Code:
/ DotNET / DotNET / 8.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
- ProtocolsSection.cs
- FloatUtil.cs
- SystemIcons.cs
- RootNamespaceAttribute.cs
- XPathNodeHelper.cs
- XhtmlBasicCommandAdapter.cs
- ISAPIRuntime.cs
- EditorOptionAttribute.cs
- CipherData.cs
- TabControl.cs
- FormClosingEvent.cs
- RuntimeCompatibilityAttribute.cs
- SystemIcmpV6Statistics.cs
- FloatSumAggregationOperator.cs
- WindowsPrincipal.cs
- FileAuthorizationModule.cs
- FontSizeConverter.cs
- RelationshipFixer.cs
- SerialStream.cs
- SoapFormatExtensions.cs
- CodeTypeReferenceExpression.cs
- Timer.cs
- EdmSchemaAttribute.cs
- PropertyInfoSet.cs
- WriteableBitmap.cs
- AssociationEndMember.cs
- SingletonChannelAcceptor.cs
- ListViewEditEventArgs.cs
- Int16.cs
- Message.cs
- ReplyChannel.cs
- SourceSwitch.cs
- SyndicationFeedFormatter.cs
- Itemizer.cs
- StorageEntityTypeMapping.cs
- Thread.cs
- StrongNameUtility.cs
- ModelTreeEnumerator.cs
- MaskInputRejectedEventArgs.cs
- AnimationStorage.cs
- XmlArrayItemAttributes.cs
- XmlChildEnumerator.cs
- DefaultParameterValueAttribute.cs
- OutputCacheSettings.cs
- DesignerActionVerbItem.cs
- SocketAddress.cs
- AndCondition.cs
- TableLayoutPanelDesigner.cs
- DesignRelationCollection.cs
- ResourceProviderFactory.cs
- EdmItemCollection.cs
- PointCollectionConverter.cs
- TypeToken.cs
- RuleSettingsCollection.cs
- TdsParserSessionPool.cs
- DefaultValidator.cs
- Int64AnimationBase.cs
- TextBreakpoint.cs
- TimerEventSubscription.cs
- WeakEventManager.cs
- ItemType.cs
- MouseButton.cs
- DataServiceResponse.cs
- UniqueIdentifierService.cs
- BitmapEffectState.cs
- XmlTextReaderImplHelpers.cs
- RankException.cs
- ASCIIEncoding.cs
- IdentitySection.cs
- UnsafeCollabNativeMethods.cs
- Claim.cs
- OciEnlistContext.cs
- TimerElapsedEvenArgs.cs
- ValueSerializerAttribute.cs
- XPathScanner.cs
- ScriptDescriptor.cs
- Axis.cs
- RegistrationServices.cs
- DiscoveryReferences.cs
- CompositionAdorner.cs
- ListControlConvertEventArgs.cs
- HttpHostedTransportConfiguration.cs
- PipelineModuleStepContainer.cs
- ListGeneralPage.cs
- BaseDataListActionList.cs
- StyleReferenceConverter.cs
- XmlDataSourceView.cs
- PeerHelpers.cs
- BinaryMethodMessage.cs
- WizardForm.cs
- EventDescriptorCollection.cs
- DocumentApplicationDocumentViewer.cs
- EncryptedKey.cs
- filewebrequest.cs
- WindowsStatic.cs
- FormatException.cs
- DockProviderWrapper.cs
- PointLight.cs
- DataShape.cs
- MultipleViewPattern.cs