Code:
/ FX-1434 / FX-1434 / 1.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
- CalendarData.cs
- StringToken.cs
- CallContext.cs
- XmlWriterTraceListener.cs
- DoubleLinkList.cs
- GridViewHeaderRowPresenter.cs
- DataGridViewBand.cs
- CookieParameter.cs
- ClientBuildManager.cs
- KeyGestureValueSerializer.cs
- IPEndPoint.cs
- DecoderReplacementFallback.cs
- SHA1.cs
- SchemaElementDecl.cs
- OuterGlowBitmapEffect.cs
- KeyTime.cs
- OdbcConnection.cs
- VBIdentifierDesigner.xaml.cs
- TerminateDesigner.cs
- VersionedStream.cs
- RuleValidation.cs
- FontResourceCache.cs
- BufferedStream2.cs
- XmlNamespaceMapping.cs
- TaskExtensions.cs
- Queue.cs
- Utils.cs
- SystemInfo.cs
- RequiredFieldValidator.cs
- DbParameterHelper.cs
- DesignerWidgets.cs
- MetadataUtilsSmi.cs
- MultipartIdentifier.cs
- ErrorTableItemStyle.cs
- SystemNetHelpers.cs
- SchemaTableColumn.cs
- ScaleTransform.cs
- ContractNamespaceAttribute.cs
- WindowsImpersonationContext.cs
- BamlBinaryWriter.cs
- HealthMonitoringSectionHelper.cs
- CharEnumerator.cs
- FixedSOMPageElement.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- HwndProxyElementProvider.cs
- CreateRefExpr.cs
- AnnotationResourceChangedEventArgs.cs
- NavigateEvent.cs
- ProxyWebPartConnectionCollection.cs
- DrawingContextDrawingContextWalker.cs
- ViewPort3D.cs
- SmtpReplyReaderFactory.cs
- AppSettings.cs
- CompositeScriptReferenceEventArgs.cs
- HttpCachePolicyElement.cs
- ThreadExceptionEvent.cs
- WebBrowserSiteBase.cs
- ServiceMoniker.cs
- CompilationUtil.cs
- PopupEventArgs.cs
- OdbcConnection.cs
- safelinkcollection.cs
- MachineSettingsSection.cs
- IntSecurity.cs
- WebServiceBindingAttribute.cs
- XmlSerializerNamespaces.cs
- EventSourceCreationData.cs
- XpsStructure.cs
- TCPClient.cs
- updateconfighost.cs
- relpropertyhelper.cs
- InvalidPropValue.cs
- XmlCompatibilityReader.cs
- ProtocolsConfigurationHandler.cs
- ExpressionVisitor.cs
- MenuItem.cs
- ReadWriteObjectLock.cs
- TreeViewItemAutomationPeer.cs
- IDReferencePropertyAttribute.cs
- CriticalFinalizerObject.cs
- clipboard.cs
- AttachedAnnotationChangedEventArgs.cs
- OrCondition.cs
- MessagingDescriptionAttribute.cs
- LocalIdKeyIdentifierClause.cs
- DbParameterHelper.cs
- __FastResourceComparer.cs
- SourceElementsCollection.cs
- WebPartCatalogCloseVerb.cs
- Win32PrintDialog.cs
- NavigationExpr.cs
- ContentType.cs
- ThicknessConverter.cs
- XmlSignatureManifest.cs
- odbcmetadatafactory.cs
- NativeMethods.cs
- SqlExpressionNullability.cs
- coordinatorfactory.cs
- x509store.cs
- EventLogPermissionEntry.cs