Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- EncryptedReference.cs
- ManualResetEvent.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- FunctionDetailsReader.cs
- InstanceKey.cs
- UrlMapping.cs
- WindowsToolbar.cs
- DiscoveryDocumentSerializer.cs
- HandleCollector.cs
- UnsafeNetInfoNativeMethods.cs
- ServiceNotStartedException.cs
- EventSinkHelperWriter.cs
- SecurityBindingElement.cs
- BaseCodeDomTreeGenerator.cs
- ClickablePoint.cs
- GorillaCodec.cs
- ElapsedEventArgs.cs
- MoveSizeWinEventHandler.cs
- HtmlPageAdapter.cs
- ExpressionList.cs
- SystemInfo.cs
- DiscreteKeyFrames.cs
- ReferencedType.cs
- SqlDependency.cs
- XmlTextReader.cs
- ProcessThreadCollection.cs
- TextContainerChangeEventArgs.cs
- TextServicesCompartmentContext.cs
- Random.cs
- XmlnsDictionary.cs
- SafeFileMapViewHandle.cs
- SecurityHelper.cs
- DependencyProperty.cs
- VisualBrush.cs
- PropertyCollection.cs
- ProgressiveCrcCalculatingStream.cs
- DateTimeEditor.cs
- SchemaCollectionPreprocessor.cs
- UTF32Encoding.cs
- Int16AnimationBase.cs
- SecurityDescriptor.cs
- WebPartEditorCancelVerb.cs
- FileCodeGroup.cs
- Geometry.cs
- GPStream.cs
- CompilerInfo.cs
- StylusSystemGestureEventArgs.cs
- ObsoleteAttribute.cs
- FirewallWrapper.cs
- LogRecordSequence.cs
- BooleanAnimationBase.cs
- StringSorter.cs
- DiscoveryServerProtocol.cs
- DirectoryObjectSecurity.cs
- WebPartConnectVerb.cs
- HttpContextBase.cs
- Int32CollectionConverter.cs
- BuildResultCache.cs
- ExtentCqlBlock.cs
- BlockUIContainer.cs
- SqlReferenceCollection.cs
- MemberHolder.cs
- CopyAction.cs
- TextContainerChangedEventArgs.cs
- ExtensionCollection.cs
- TextEndOfSegment.cs
- GlobalEventManager.cs
- RawUIStateInputReport.cs
- AppDomainUnloadedException.cs
- EntityDataSourceDataSelection.cs
- SymDocumentType.cs
- ParallelQuery.cs
- DataGridTextBox.cs
- MessageQueuePermissionEntry.cs
- XPathNavigatorKeyComparer.cs
- OuterProxyWrapper.cs
- DeviceContext.cs
- LogicalExpressionTypeConverter.cs
- BitSet.cs
- TextServicesLoader.cs
- AuthenticationService.cs
- SessionPageStateSection.cs
- UseAttributeSetsAction.cs
- PlatformCulture.cs
- BinaryExpressionHelper.cs
- UriParserTemplates.cs
- SignatureToken.cs
- DataGridViewTextBoxCell.cs
- AttributeAction.cs
- XmlEncoding.cs
- EditableTreeList.cs
- TabControlEvent.cs
- PagesChangedEventArgs.cs
- ListViewDeletedEventArgs.cs
- SByte.cs
- CommonXSendMessage.cs
- DbModificationClause.cs
- WebPartConnectionsConfigureVerb.cs
- Visitors.cs
- InstanceStoreQueryResult.cs