Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DispatcherTimer.cs
- QueryCursorEventArgs.cs
- ProviderUtil.cs
- ServiceReflector.cs
- PanelStyle.cs
- NodeCounter.cs
- MappingException.cs
- Compiler.cs
- FileSystemInfo.cs
- WebServiceErrorEvent.cs
- TrackingServices.cs
- ProfileProvider.cs
- TextServicesContext.cs
- WhitespaceRuleLookup.cs
- HtmlAnchor.cs
- XmlNotation.cs
- ProjectedSlot.cs
- ObjectSet.cs
- PropertyNames.cs
- ComplexPropertyEntry.cs
- OdbcCommand.cs
- X509CertificateStore.cs
- RoleServiceManager.cs
- FontEmbeddingManager.cs
- GridItemPattern.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- MenuItemStyleCollection.cs
- WhitespaceRule.cs
- MasterPage.cs
- AdPostCacheSubstitution.cs
- ErrorView.xaml.cs
- ProcessManager.cs
- FormViewInsertEventArgs.cs
- SystemNetHelpers.cs
- ConnectionPoint.cs
- ExecutionContext.cs
- GeneralTransform2DTo3DTo2D.cs
- XamlBrushSerializer.cs
- XmlSchemaSimpleType.cs
- CreateUserWizard.cs
- ColorContextHelper.cs
- Expressions.cs
- ConnectorDragDropGlyph.cs
- ThreadExceptionDialog.cs
- DocumentXmlWriter.cs
- PrtCap_Base.cs
- UrlUtility.cs
- UnmanagedMemoryStreamWrapper.cs
- SqlDataSourceStatusEventArgs.cs
- ColumnBinding.cs
- QualifierSet.cs
- Pair.cs
- ColorAnimationBase.cs
- PageAdapter.cs
- EntityDataSourceStatementEditor.cs
- WriteTimeStream.cs
- HostedTransportConfigurationManager.cs
- XmlSchemaSimpleTypeRestriction.cs
- GridView.cs
- GlobalProxySelection.cs
- followingquery.cs
- BuilderPropertyEntry.cs
- SizeConverter.cs
- Polyline.cs
- GlyphingCache.cs
- CollectionBase.cs
- SizeChangedEventArgs.cs
- InputBinding.cs
- ZoneMembershipCondition.cs
- PrintDialogDesigner.cs
- UnwrappedTypesXmlSerializerManager.cs
- ExpressionEditorSheet.cs
- PackWebResponse.cs
- XmlSchemaExternal.cs
- Binding.cs
- PropertyChangeTracker.cs
- ProviderSettings.cs
- Base64Encoding.cs
- SecurityTokenProvider.cs
- UInt16Converter.cs
- ComUdtElement.cs
- SimpleWebHandlerParser.cs
- XmlSerializationGeneratedCode.cs
- WpfKnownMemberInvoker.cs
- ConfigurationErrorsException.cs
- XmlNodeWriter.cs
- BitmapCodecInfoInternal.cs
- WebServiceBindingAttribute.cs
- ExtendedPropertiesHandler.cs
- XdrBuilder.cs
- SafeFindHandle.cs
- CultureInfo.cs
- NumericExpr.cs
- CircleEase.cs
- BamlRecordReader.cs
- ClipboardProcessor.cs
- SimpleWebHandlerParser.cs
- StartUpEventArgs.cs
- CodeTypeDelegate.cs
- CallSite.cs