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
- SafeWaitHandle.cs
- DesignTimeDataBinding.cs
- Model3D.cs
- CopyOfAction.cs
- TemplateBuilder.cs
- ComponentCommands.cs
- RectAnimationBase.cs
- IsolatedStorageFilePermission.cs
- Nullable.cs
- ListCollectionView.cs
- XPathMultyIterator.cs
- GradientStop.cs
- AppDomainProtocolHandler.cs
- FuncTypeConverter.cs
- DescendantQuery.cs
- Exceptions.cs
- LogoValidationException.cs
- TextElementEnumerator.cs
- GatewayDefinition.cs
- xsdvalidator.cs
- MemoryPressure.cs
- XmlObjectSerializer.cs
- RectValueSerializer.cs
- FeatureSupport.cs
- View.cs
- StreamingContext.cs
- ToolboxCategoryItems.cs
- RoleGroupCollection.cs
- FileCodeGroup.cs
- EntityDataSourceDataSelectionPanel.cs
- SplineKeyFrames.cs
- ComponentEvent.cs
- SmtpReplyReader.cs
- SiteMapHierarchicalDataSourceView.cs
- XpsSerializerWriter.cs
- FrameAutomationPeer.cs
- BoolLiteral.cs
- SignatureDescription.cs
- HostingPreferredMapPath.cs
- MsmqInputMessagePool.cs
- ExpressionBindingsDialog.cs
- DropDownList.cs
- PointAnimationBase.cs
- WindowsToolbarAsMenu.cs
- AuthenticationException.cs
- Models.cs
- ThemeableAttribute.cs
- securitycriticaldata.cs
- RoleManagerEventArgs.cs
- CachedFontFace.cs
- XslVisitor.cs
- ConstructorBuilder.cs
- WriteFileContext.cs
- EdmComplexTypeAttribute.cs
- GridItem.cs
- AccessDataSource.cs
- XmlNamespaceManager.cs
- DateTimeParse.cs
- WorkflowExecutor.cs
- PropertyItemInternal.cs
- ListSourceHelper.cs
- Point3DAnimation.cs
- SizeKeyFrameCollection.cs
- StylusPointPropertyUnit.cs
- Version.cs
- UIPermission.cs
- RegionData.cs
- FlowDocumentPage.cs
- SQLDateTime.cs
- DSASignatureDeformatter.cs
- SqlProviderManifest.cs
- TypeNameParser.cs
- OleDbPermission.cs
- XmlSchemaAny.cs
- XPathAncestorQuery.cs
- IncrementalCompileAnalyzer.cs
- ChtmlSelectionListAdapter.cs
- CalendarKeyboardHelper.cs
- IisTraceListener.cs
- PermissionSet.cs
- ImageMapEventArgs.cs
- HwndAppCommandInputProvider.cs
- SqlDataSourceEnumerator.cs
- SqlDataSourceCommandEventArgs.cs
- SHA512.cs
- HtmlTernaryTree.cs
- SiteMapDataSourceView.cs
- PagerSettings.cs
- ScrollViewer.cs
- SapiAttributeParser.cs
- URLEditor.cs
- TableCell.cs
- SmiConnection.cs
- FileLoadException.cs
- StrongName.cs
- MappingModelBuildProvider.cs
- SizeValueSerializer.cs
- XPathAncestorQuery.cs
- PermissionToken.cs
- ConnectorDragDropGlyph.cs