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
- Substitution.cs
- XmlEnumAttribute.cs
- CacheSection.cs
- Parser.cs
- CodeCatchClauseCollection.cs
- DecimalConstantAttribute.cs
- XmlEntity.cs
- GridView.cs
- DataMemberListEditor.cs
- MetadataArtifactLoader.cs
- FieldAccessException.cs
- StringFreezingAttribute.cs
- XmlSerializerVersionAttribute.cs
- DictionaryEntry.cs
- ComNativeDescriptor.cs
- UnsafeNativeMethodsMilCoreApi.cs
- XPathNavigatorKeyComparer.cs
- OleTxTransaction.cs
- ListViewAutomationPeer.cs
- DataTemplateKey.cs
- MetadataStore.cs
- SpeakProgressEventArgs.cs
- SQLSingleStorage.cs
- ExecutedRoutedEventArgs.cs
- FormatException.cs
- WebZone.cs
- WebPartDisplayModeEventArgs.cs
- CellConstant.cs
- TransformerInfo.cs
- FunctionParameter.cs
- EdmRelationshipRoleAttribute.cs
- sitestring.cs
- DropSource.cs
- FontWeightConverter.cs
- AttributeQuery.cs
- TextRangeEditLists.cs
- StateItem.cs
- WindowsRebar.cs
- DesignerCategoryAttribute.cs
- Perspective.cs
- __ConsoleStream.cs
- AssemblyAttributesGoHere.cs
- NamedPipeChannelListener.cs
- WmlCalendarAdapter.cs
- ButtonStandardAdapter.cs
- URLString.cs
- PropertyGroupDescription.cs
- WebControl.cs
- RadioButtonAutomationPeer.cs
- CompositeActivityTypeDescriptorProvider.cs
- FormsAuthenticationUserCollection.cs
- ObjectCloneHelper.cs
- SizeConverter.cs
- ErrorStyle.cs
- _TLSstream.cs
- ReturnEventArgs.cs
- WebDisplayNameAttribute.cs
- SqlCachedBuffer.cs
- RuntimeConfigurationRecord.cs
- SEHException.cs
- ProfileModule.cs
- EntityModelSchemaGenerator.cs
- SchemaNames.cs
- Model3DCollection.cs
- SQLResource.cs
- HMACSHA384.cs
- MaskDescriptors.cs
- SqlDataSourceCommandParser.cs
- FileDetails.cs
- ReadOnlyNameValueCollection.cs
- assemblycache.cs
- TypeForwardedFromAttribute.cs
- ContainerSelectorGlyph.cs
- DirectionalLight.cs
- TextRangeEdit.cs
- Grant.cs
- MediaScriptCommandRoutedEventArgs.cs
- XmlSchemaAttribute.cs
- ResourceDescriptionAttribute.cs
- BitmapEffect.cs
- ToolboxItemSnapLineBehavior.cs
- MouseButton.cs
- InvalidOleVariantTypeException.cs
- DbProviderSpecificTypePropertyAttribute.cs
- ResourceReferenceExpressionConverter.cs
- DBPropSet.cs
- RangeValidator.cs
- CurrencyManager.cs
- CDSCollectionETWBCLProvider.cs
- Attachment.cs
- ExpressionSelection.cs
- ProcessHostServerConfig.cs
- FlowLayoutSettings.cs
- ZipIOLocalFileHeader.cs
- PeerTransportListenAddressValidatorAttribute.cs
- SqlMethodAttribute.cs
- FunctionDetailsReader.cs
- JsonSerializer.cs
- AttributeProviderAttribute.cs
- MappedMetaModel.cs