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
- DrawingServices.cs
- PkcsUtils.cs
- ConcatQueryOperator.cs
- SoapInteropTypes.cs
- infer.cs
- FormViewCommandEventArgs.cs
- GridViewRowCollection.cs
- RegexCharClass.cs
- CanonicalFormWriter.cs
- EdmItemError.cs
- ValidationEventArgs.cs
- BackStopAuthenticationModule.cs
- PageHandlerFactory.cs
- TextHidden.cs
- OdbcErrorCollection.cs
- EntityDataSourceColumn.cs
- SchemaDeclBase.cs
- DoubleLinkList.cs
- CustomTrackingQuery.cs
- AlignmentXValidation.cs
- PageEventArgs.cs
- DependencyProperty.cs
- SqlConnectionManager.cs
- ProtocolsConfigurationEntry.cs
- Psha1DerivedKeyGenerator.cs
- CatalogZoneAutoFormat.cs
- SqlBinder.cs
- SendingRequestEventArgs.cs
- ITreeGenerator.cs
- TitleStyle.cs
- ServicePerformanceCounters.cs
- HtmlMeta.cs
- ResourceExpressionBuilder.cs
- PartManifestEntry.cs
- OrderedEnumerableRowCollection.cs
- UriTemplateVariablePathSegment.cs
- PopupEventArgs.cs
- PolicyValidationException.cs
- TextSpan.cs
- Bitmap.cs
- StylusOverProperty.cs
- MessageSecurityOverMsmq.cs
- IisTraceListener.cs
- Operator.cs
- LogicalCallContext.cs
- CodeObject.cs
- Label.cs
- Gdiplus.cs
- WebPartConnectionCollection.cs
- SharedUtils.cs
- PersonalizationEntry.cs
- Vector3D.cs
- ConfigXmlElement.cs
- XmlSchemaSimpleContent.cs
- PeerCollaborationPermission.cs
- isolationinterop.cs
- TextModifierScope.cs
- StoragePropertyMapping.cs
- CustomAttribute.cs
- Rect.cs
- WorkflowInlining.cs
- GACIdentityPermission.cs
- ProfileSettingsCollection.cs
- MetadataArtifactLoaderResource.cs
- ConfigsHelper.cs
- FormsAuthenticationCredentials.cs
- MobilePage.cs
- ParserContext.cs
- RootBrowserWindow.cs
- DBAsyncResult.cs
- SQLSingleStorage.cs
- FontDialog.cs
- ObjectContextServiceProvider.cs
- ProxyGenerationError.cs
- RotationValidation.cs
- Vector3DCollectionConverter.cs
- embossbitmapeffect.cs
- HttpRuntime.cs
- HMAC.cs
- OutputWindow.cs
- TextBox.cs
- ActivityTypeDesigner.xaml.cs
- RTLAwareMessageBox.cs
- FileFormatException.cs
- TextMetrics.cs
- IFlowDocumentViewer.cs
- DataSourceCollectionBase.cs
- ToolStripManager.cs
- InfoCardAsymmetricCrypto.cs
- ProtectedConfigurationSection.cs
- CreatingCookieEventArgs.cs
- Bidi.cs
- CompoundFileDeflateTransform.cs
- WhitespaceSignificantCollectionAttribute.cs
- Label.cs
- ProfileGroupSettingsCollection.cs
- FragmentQueryKB.cs
- StyleSheetDesigner.cs
- UrlMapping.cs
- SerializationFieldInfo.cs