Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BeginEvent.cs
- figurelengthconverter.cs
- AddInServer.cs
- DivideByZeroException.cs
- RadioButtonList.cs
- OpenTypeCommon.cs
- XmlAnyElementAttribute.cs
- RSAOAEPKeyExchangeDeformatter.cs
- Clipboard.cs
- ButtonFieldBase.cs
- ArglessEventHandlerProxy.cs
- rsa.cs
- SerializerProvider.cs
- InternalBufferOverflowException.cs
- NamedPipeConnectionPool.cs
- IntranetCredentialPolicy.cs
- CellConstantDomain.cs
- MsmqQueue.cs
- TemplateLookupAction.cs
- BinaryFormatter.cs
- GroupByQueryOperator.cs
- DrawingCollection.cs
- Label.cs
- RSAOAEPKeyExchangeDeformatter.cs
- _Rfc2616CacheValidators.cs
- DataSourceDesigner.cs
- DTCTransactionManager.cs
- TransferRequestHandler.cs
- BinaryFormatterWriter.cs
- DeviceOverridableAttribute.cs
- ScrollChrome.cs
- TextUtf8RawTextWriter.cs
- PropertyEmitterBase.cs
- ExtensionFile.cs
- SelectionPattern.cs
- ReadOnlyDataSource.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- DragCompletedEventArgs.cs
- InstanceView.cs
- DataGridTable.cs
- AlignmentXValidation.cs
- HtmlEmptyTagControlBuilder.cs
- XmlDocumentType.cs
- FixedTextSelectionProcessor.cs
- MobileControlsSectionHandler.cs
- BypassElementCollection.cs
- URI.cs
- NameTable.cs
- TreeNodeStyleCollection.cs
- MeasureItemEvent.cs
- Tile.cs
- HtmlHistory.cs
- WebPartEditorCancelVerb.cs
- SchemaMerger.cs
- ShaderEffect.cs
- BrowserCapabilitiesCompiler.cs
- Message.cs
- Inline.cs
- PropertyTabChangedEvent.cs
- ColorInterpolationModeValidation.cs
- ItemContainerProviderWrapper.cs
- TextMarkerSource.cs
- RootProjectionNode.cs
- MasterPageBuildProvider.cs
- WindowsFormsSectionHandler.cs
- ErrorBehavior.cs
- SiteMapDataSource.cs
- ObjectStorage.cs
- ProtocolsConfiguration.cs
- HttpBrowserCapabilitiesBase.cs
- DataGridViewCellEventArgs.cs
- StorageAssociationTypeMapping.cs
- ToolStripStatusLabel.cs
- xmlglyphRunInfo.cs
- MetadataItemEmitter.cs
- BaseHashHelper.cs
- TreeChangeInfo.cs
- ClientConfigPaths.cs
- DoWorkEventArgs.cs
- HwndPanningFeedback.cs
- validation.cs
- ProcessInfo.cs
- Compress.cs
- TimeSpanValidator.cs
- ValidationVisibilityAttribute.cs
- SqlProcedureAttribute.cs
- XslTransform.cs
- OleDbEnumerator.cs
- streamingZipPartStream.cs
- Point4D.cs
- XslCompiledTransform.cs
- GeneralTransform3DGroup.cs
- ListViewInsertedEventArgs.cs
- LocalizationComments.cs
- DataGridViewColumnHeaderCell.cs
- BatchWriter.cs
- NonVisualControlAttribute.cs
- ContractReference.cs
- StylusCollection.cs
- OleDbParameterCollection.cs