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
- TypeResolver.cs
- CodeObjectCreateExpression.cs
- ContentType.cs
- DataContractSet.cs
- Utility.cs
- NativeMsmqMessage.cs
- IDQuery.cs
- TypeDescriptor.cs
- XmlSchemaAnnotated.cs
- GatewayIPAddressInformationCollection.cs
- HitTestResult.cs
- CompoundFileReference.cs
- Span.cs
- BlockCollection.cs
- QualificationDataAttribute.cs
- EdmToObjectNamespaceMap.cs
- CharacterString.cs
- SetUserLanguageRequest.cs
- SerializationSectionGroup.cs
- FunctionNode.cs
- Activity.cs
- EncodingNLS.cs
- Module.cs
- DataGridToolTip.cs
- Trace.cs
- ToolStripItemEventArgs.cs
- Translator.cs
- TableParaClient.cs
- DataBinding.cs
- ServiceManager.cs
- ContextQuery.cs
- PointAnimationClockResource.cs
- GradientSpreadMethodValidation.cs
- EntityDataSourceContextCreatedEventArgs.cs
- ExpressionContext.cs
- GridViewDesigner.cs
- RadioButtonPopupAdapter.cs
- ResXBuildProvider.cs
- TraceHandlerErrorFormatter.cs
- SystemResourceKey.cs
- Normalization.cs
- SchemaImporterExtensionsSection.cs
- XhtmlBasicControlAdapter.cs
- ScrollChrome.cs
- XPathNodeInfoAtom.cs
- TrustManagerMoreInformation.cs
- SystemIPGlobalProperties.cs
- PointCollection.cs
- EditBehavior.cs
- HttpApplication.cs
- DocumentReference.cs
- TypeConstant.cs
- MatrixValueSerializer.cs
- PointUtil.cs
- Lease.cs
- DispatchWrapper.cs
- HostedImpersonationContext.cs
- WebPartVerbsEventArgs.cs
- FilteredAttributeCollection.cs
- RuntimeHandles.cs
- ContentTextAutomationPeer.cs
- ItemCollection.cs
- SystemInfo.cs
- DictionaryContent.cs
- GeneralTransformGroup.cs
- CardSpaceException.cs
- ComponentCache.cs
- InvalidComObjectException.cs
- MethodCallExpression.cs
- ResourceContainer.cs
- XmlNodeChangedEventArgs.cs
- WebControlsSection.cs
- Section.cs
- __Error.cs
- SqlServer2KCompatibilityCheck.cs
- ThreadStateException.cs
- OleDbFactory.cs
- SchemaImporterExtensionElementCollection.cs
- VBCodeProvider.cs
- FixedFlowMap.cs
- Header.cs
- Array.cs
- EntitySqlQueryCacheKey.cs
- DigestTraceRecordHelper.cs
- DynamicValueConverter.cs
- AutomationTextAttribute.cs
- CalendarItem.cs
- CollectionViewProxy.cs
- ResourcesGenerator.cs
- RuntimeResourceSet.cs
- DataStorage.cs
- BamlRecordHelper.cs
- DataGridItemCollection.cs
- CheckBox.cs
- ZipFileInfo.cs
- SafeSystemMetrics.cs
- Point3DAnimation.cs
- DbConnectionStringCommon.cs
- TextRangeProviderWrapper.cs
- PropertyNames.cs