Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- FixUpCollection.cs
- StyleCollection.cs
- WebPartDisplayModeCollection.cs
- ThreadPool.cs
- DoubleLinkList.cs
- CompressionTracing.cs
- MULTI_QI.cs
- UnmanagedHandle.cs
- SafeBuffer.cs
- SiteMapHierarchicalDataSourceView.cs
- ChtmlTextWriter.cs
- Soap12FormatExtensions.cs
- ComplexBindingPropertiesAttribute.cs
- SyndicationItem.cs
- ButtonBase.cs
- DataGridViewRowPrePaintEventArgs.cs
- SignedPkcs7.cs
- RoutedEvent.cs
- InlineUIContainer.cs
- XXXOnTypeBuilderInstantiation.cs
- ImageClickEventArgs.cs
- WindowsFormsLinkLabel.cs
- WeakReferenceKey.cs
- VisualStyleRenderer.cs
- HostingPreferredMapPath.cs
- PenLineJoinValidation.cs
- PrintControllerWithStatusDialog.cs
- ContentValidator.cs
- SortedList.cs
- SqlMethodCallConverter.cs
- DecoderBestFitFallback.cs
- SeekableReadStream.cs
- EdmPropertyAttribute.cs
- QilFunction.cs
- Line.cs
- StreamInfo.cs
- _Win32.cs
- dsa.cs
- TCPListener.cs
- CapabilitiesState.cs
- SystemWebCachingSectionGroup.cs
- ClickablePoint.cs
- SqlClientPermission.cs
- RawStylusInput.cs
- ToolboxItemCollection.cs
- Compilation.cs
- CompositeTypefaceMetrics.cs
- xmlglyphRunInfo.cs
- DeobfuscatingStream.cs
- DropDownList.cs
- ReliableOutputSessionChannel.cs
- CodeEventReferenceExpression.cs
- ObjectManager.cs
- SelectionProviderWrapper.cs
- CatalogZoneBase.cs
- Camera.cs
- BCLDebug.cs
- ModelPropertyImpl.cs
- IsolatedStorageFileStream.cs
- SystemFonts.cs
- UserControlCodeDomTreeGenerator.cs
- TypeSystem.cs
- CollectionViewGroupInternal.cs
- GridToolTip.cs
- FileUtil.cs
- ArrayConverter.cs
- WebHttpElement.cs
- ColorDialog.cs
- ToolStripScrollButton.cs
- While.cs
- CustomTokenProvider.cs
- EncodingDataItem.cs
- ComponentRenameEvent.cs
- IndexOutOfRangeException.cs
- ObjectDataSourceChooseMethodsPanel.cs
- OleDbRowUpdatingEvent.cs
- SendMailErrorEventArgs.cs
- Trace.cs
- Avt.cs
- BookmarkList.cs
- NoPersistHandle.cs
- DecoderFallback.cs
- CultureInfo.cs
- UIHelper.cs
- Rule.cs
- TiffBitmapEncoder.cs
- XmlSchemaValidator.cs
- ReturnValue.cs
- FormViewActionList.cs
- MexHttpsBindingCollectionElement.cs
- BaseTemplateBuildProvider.cs
- ItemMap.cs
- ValidationRuleCollection.cs
- ZipFileInfoCollection.cs
- WebScriptServiceHostFactory.cs
- CancellableEnumerable.cs
- ContractMapping.cs
- SmtpException.cs
- IsolatedStorage.cs
- CommittableTransaction.cs