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
- UrlPath.cs
- DBSqlParserColumn.cs
- LinkArea.cs
- ThrowHelper.cs
- CacheModeValueSerializer.cs
- PreviewKeyDownEventArgs.cs
- CookieHandler.cs
- EffectiveValueEntry.cs
- SqlDataSource.cs
- SqlMethodTransformer.cs
- StreamingContext.cs
- ListViewItemCollectionEditor.cs
- Table.cs
- Stacktrace.cs
- MatrixConverter.cs
- Util.cs
- ObjectListItemCollection.cs
- ScriptManagerProxy.cs
- Expander.cs
- StorageAssociationTypeMapping.cs
- BitmapFrame.cs
- PermissionSetEnumerator.cs
- AccessViolationException.cs
- Subtree.cs
- SqlDelegatedTransaction.cs
- AutoResetEvent.cs
- AnonymousIdentificationSection.cs
- PinnedBufferMemoryStream.cs
- RoutedPropertyChangedEventArgs.cs
- ReflectTypeDescriptionProvider.cs
- InOutArgument.cs
- Matrix.cs
- TextLine.cs
- HtmlElement.cs
- ViewKeyConstraint.cs
- RsaSecurityTokenParameters.cs
- TraceEventCache.cs
- WsdlImporterElement.cs
- ComAdminWrapper.cs
- MemberNameValidator.cs
- WebPartDisplayModeEventArgs.cs
- LookupNode.cs
- AutomationPatternInfo.cs
- SecurityCriticalDataForSet.cs
- X509Chain.cs
- HitTestFilterBehavior.cs
- DataGridViewAccessibleObject.cs
- DataGridViewUtilities.cs
- ExpressionEditor.cs
- GraphicsContainer.cs
- Operators.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- IdentifierService.cs
- DependencyObjectPropertyDescriptor.cs
- CodeExporter.cs
- MemoryRecordBuffer.cs
- CodeAttributeArgument.cs
- RecognizedWordUnit.cs
- HttpWebResponse.cs
- XomlCompilerError.cs
- HelpEvent.cs
- DataTableCollection.cs
- SRef.cs
- KeyValueSerializer.cs
- PropertiesTab.cs
- DomainUpDown.cs
- ToolStripSplitStackLayout.cs
- DefaultHttpHandler.cs
- DesignSurfaceManager.cs
- XPathArrayIterator.cs
- DeviceSpecificDesigner.cs
- ExpressionDumper.cs
- ProgressBar.cs
- AttributeSetAction.cs
- ZipIOModeEnforcingStream.cs
- ConnectionStringSettingsCollection.cs
- SeparatorAutomationPeer.cs
- SecurityKeyType.cs
- SqlDataRecord.cs
- sqlser.cs
- SendKeys.cs
- Point.cs
- SafeRightsManagementSessionHandle.cs
- ToolStripSeparator.cs
- GenericPrincipal.cs
- ITextView.cs
- ProfileServiceManager.cs
- QilInvokeLateBound.cs
- ObjectPersistData.cs
- ChainOfResponsibility.cs
- DbDeleteCommandTree.cs
- ListSortDescriptionCollection.cs
- PixelFormats.cs
- ISAPIRuntime.cs
- Root.cs
- PackagePart.cs
- XmlSchemaGroupRef.cs
- SchemaSetCompiler.cs
- HttpSocketManager.cs
- SystemIPGlobalStatistics.cs