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
- Marshal.cs
- PresentationTraceSources.cs
- XmlReader.cs
- WsatRegistrationHeader.cs
- SQLDateTimeStorage.cs
- MethodBody.cs
- OdbcCommandBuilder.cs
- Line.cs
- ContentPosition.cs
- DataControlImageButton.cs
- SafeHandles.cs
- ContainsRowNumberChecker.cs
- DeobfuscatingStream.cs
- HostedTransportConfigurationManager.cs
- IgnorePropertiesAttribute.cs
- Model3DGroup.cs
- VideoDrawing.cs
- DragEvent.cs
- CacheChildrenQuery.cs
- ProcessingInstructionAction.cs
- ServiceNameElementCollection.cs
- GlobalizationAssembly.cs
- OleDbErrorCollection.cs
- FigureHelper.cs
- CommandConverter.cs
- ElementAction.cs
- GridViewColumnCollection.cs
- XmlTextReaderImplHelpers.cs
- SystemIcmpV6Statistics.cs
- CleanUpVirtualizedItemEventArgs.cs
- DoubleCollectionValueSerializer.cs
- ParagraphResult.cs
- ExtentJoinTreeNode.cs
- GrammarBuilderBase.cs
- ThemeInfoAttribute.cs
- BaseCAMarshaler.cs
- ConnectionStringsSection.cs
- BamlLocalizableResourceKey.cs
- Compiler.cs
- FixUp.cs
- SafeNativeMethods.cs
- TreeNode.cs
- PathFigureCollectionValueSerializer.cs
- Style.cs
- BamlTreeUpdater.cs
- AudioFormatConverter.cs
- AuthenticatedStream.cs
- ManagementObjectCollection.cs
- ArgumentOutOfRangeException.cs
- CriticalHandle.cs
- ControlCollection.cs
- DataGridCheckBoxColumn.cs
- CdpEqualityComparer.cs
- DesignerDataRelationship.cs
- RuntimeHelpers.cs
- XamlDesignerSerializationManager.cs
- SemanticKeyElement.cs
- SchemaImporterExtensionElement.cs
- MeasureData.cs
- StylusPointCollection.cs
- GridViewDeletedEventArgs.cs
- TemplateColumn.cs
- CompilationSection.cs
- XPathParser.cs
- DataGridViewCellEventArgs.cs
- UnknownWrapper.cs
- CollectionDataContractAttribute.cs
- COM2FontConverter.cs
- SmiEventSink_Default.cs
- XmlSerializerAssemblyAttribute.cs
- WpfWebRequestHelper.cs
- Token.cs
- SoapClientMessage.cs
- TypefaceMap.cs
- Serializer.cs
- PrePostDescendentsWalker.cs
- BasicExpandProvider.cs
- CompatibleIComparer.cs
- JsonQueryStringConverter.cs
- WinEventHandler.cs
- StandardBindingElement.cs
- Propagator.ExtentPlaceholderCreator.cs
- ActivityExecutionFilter.cs
- tibetanshape.cs
- BitmapScalingModeValidation.cs
- CroppedBitmap.cs
- PrintDialogException.cs
- ToolStripRenderEventArgs.cs
- ParameterReplacerVisitor.cs
- SpellerError.cs
- TextEditorLists.cs
- Descriptor.cs
- ThemeDirectoryCompiler.cs
- CallbackValidatorAttribute.cs
- AsyncPostBackErrorEventArgs.cs
- XmlAnyAttributeAttribute.cs
- HttpWebRequestElement.cs
- Inline.cs
- BinaryObjectWriter.cs
- DataGridViewTextBoxCell.cs