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
- ContextItemManager.cs
- Error.cs
- Header.cs
- AuthenticationService.cs
- TimelineGroup.cs
- ToolStripArrowRenderEventArgs.cs
- UpdateManifestForBrowserApplication.cs
- TargetConverter.cs
- AuthenticationServiceManager.cs
- BuildTopDownAttribute.cs
- MarkupCompilePass2.cs
- ZipPackagePart.cs
- XmlDataSourceDesigner.cs
- Resources.Designer.cs
- HtmlEmptyTagControlBuilder.cs
- PackageRelationship.cs
- errorpatternmatcher.cs
- OpacityConverter.cs
- TreeView.cs
- RecommendedAsConfigurableAttribute.cs
- WindowsToolbarItemAsMenuItem.cs
- TargetException.cs
- DesignerSerializationManager.cs
- KerberosSecurityTokenAuthenticator.cs
- WhereaboutsReader.cs
- ToolStripItemCollection.cs
- PageHandlerFactory.cs
- XmlStreamStore.cs
- DataColumnPropertyDescriptor.cs
- RenameRuleObjectDialog.cs
- ArraySegment.cs
- recordstatescratchpad.cs
- CodeNamespaceImport.cs
- RunClient.cs
- TableCellCollection.cs
- UpdateTracker.cs
- TypedDataSourceCodeGenerator.cs
- MemoryMappedView.cs
- PcmConverter.cs
- MgmtResManager.cs
- HttpListener.cs
- ReadingWritingEntityEventArgs.cs
- QilSortKey.cs
- DecoderReplacementFallback.cs
- DocobjHost.cs
- COM2ColorConverter.cs
- CodeMethodReturnStatement.cs
- SmiEventSink_Default.cs
- InstanceCompleteException.cs
- SkinBuilder.cs
- ListItemCollection.cs
- CodeMemberMethod.cs
- ArgIterator.cs
- GetCardDetailsRequest.cs
- SizeAnimationBase.cs
- baseshape.cs
- HostingMessageProperty.cs
- FormatSettings.cs
- COAUTHIDENTITY.cs
- NaturalLanguageHyphenator.cs
- CorruptingExceptionCommon.cs
- SiteMapPath.cs
- ControlCachePolicy.cs
- ObjectDataSourceSelectingEventArgs.cs
- COM2Properties.cs
- PopupEventArgs.cs
- CatalogZone.cs
- DesignBinding.cs
- TextParagraphCache.cs
- XmlElementAttribute.cs
- WorkflowOwnershipException.cs
- EventSourceCreationData.cs
- While.cs
- HScrollProperties.cs
- HttpCachePolicy.cs
- LazyTextWriterCreator.cs
- DataException.cs
- CaseInsensitiveComparer.cs
- GridViewRowPresenter.cs
- ToolStripGrip.cs
- LogicalExpr.cs
- ProviderConnectionPointCollection.cs
- ElapsedEventArgs.cs
- ServicePointManager.cs
- HostedHttpContext.cs
- ObjectAnimationBase.cs
- SeverityFilter.cs
- Timer.cs
- MergeFailedEvent.cs
- ValueTable.cs
- PointCollection.cs
- EntityDataSourceView.cs
- InstanceLockQueryResult.cs
- WebHttpSecurityModeHelper.cs
- CodeTypeConstructor.cs
- BamlBinaryWriter.cs
- tibetanshape.cs
- SurrogateEncoder.cs
- ToolStripDropDown.cs
- SoapException.cs