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
- XPathSelectionIterator.cs
- WebPartHelpVerb.cs
- XmlHierarchicalEnumerable.cs
- TypeNameConverter.cs
- IISUnsafeMethods.cs
- ExpressionBuilderContext.cs
- Vector3DValueSerializer.cs
- TextReader.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- ActivationArguments.cs
- AbstractDataSvcMapFileLoader.cs
- HtmlHistory.cs
- HttpDictionary.cs
- ListBoxAutomationPeer.cs
- MILUtilities.cs
- SystemSounds.cs
- DataGridColumnCollection.cs
- NestedContainer.cs
- DataBoundControlParameterTarget.cs
- TextAnchor.cs
- SecurityContextSecurityToken.cs
- CqlIdentifiers.cs
- GACMembershipCondition.cs
- __ConsoleStream.cs
- Cell.cs
- XNodeSchemaApplier.cs
- ConnectionManagementSection.cs
- SharedTcpTransportManager.cs
- SqlReferenceCollection.cs
- RegionIterator.cs
- RegularExpressionValidator.cs
- DataRowIndexBuffer.cs
- FileDialog.cs
- ErrorStyle.cs
- SchemaImporter.cs
- SystemDiagnosticsSection.cs
- DefaultSection.cs
- ResXDataNode.cs
- Soap.cs
- XslTransform.cs
- Condition.cs
- OperatingSystem.cs
- SqlStatistics.cs
- DataGridViewCheckBoxCell.cs
- ToolStrip.cs
- MenuItemBinding.cs
- XmlText.cs
- StrongNameIdentityPermission.cs
- RelationshipWrapper.cs
- TextEditorCopyPaste.cs
- ConfigXmlText.cs
- GrammarBuilderWildcard.cs
- InvalidCommandTreeException.cs
- DataGrid.cs
- ProfileInfo.cs
- HtmlInputSubmit.cs
- CollectionViewProxy.cs
- WorkflowTransactionService.cs
- PasswordPropertyTextAttribute.cs
- OracleRowUpdatingEventArgs.cs
- EncoderReplacementFallback.cs
- NameScopePropertyAttribute.cs
- PeerNameResolver.cs
- NullableDoubleAverageAggregationOperator.cs
- DBPropSet.cs
- LogicalExpr.cs
- UrlMappingsSection.cs
- ThreadStaticAttribute.cs
- RuntimeHandles.cs
- RequestUriProcessor.cs
- PublishLicense.cs
- DataTemplateSelector.cs
- LogicalExpr.cs
- TrackingMemoryStream.cs
- Function.cs
- HtmlDocument.cs
- DataGridAutomationPeer.cs
- XXXOnTypeBuilderInstantiation.cs
- EmptyEnumerable.cs
- SafeFileHandle.cs
- ThrowHelper.cs
- SortDescription.cs
- Window.cs
- Oid.cs
- StorageInfo.cs
- FillBehavior.cs
- MarkedHighlightComponent.cs
- RawStylusInput.cs
- DbConnectionPoolGroupProviderInfo.cs
- InstalledFontCollection.cs
- FreezableDefaultValueFactory.cs
- QueryTreeBuilder.cs
- Subtree.cs
- EventLogger.cs
- PlatformCulture.cs
- OleDbConnectionFactory.cs
- ParameterToken.cs
- hresults.cs
- PrintPreviewGraphics.cs
- PixelShader.cs