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
- COM2FontConverter.cs
- EmptyReadOnlyDictionaryInternal.cs
- SplitterPanel.cs
- Splitter.cs
- AsyncContentLoadedEventArgs.cs
- MdiWindowListStrip.cs
- XmlDocument.cs
- NotifyCollectionChangedEventArgs.cs
- Win32PrintDialog.cs
- FactoryGenerator.cs
- ListItem.cs
- GraphicsState.cs
- xsdvalidator.cs
- UnsafePeerToPeerMethods.cs
- XmlSchemaDocumentation.cs
- XmlRootAttribute.cs
- RegexCapture.cs
- DataBinder.cs
- ApplicationActivator.cs
- EncryptedType.cs
- PartitionResolver.cs
- OleDbInfoMessageEvent.cs
- StateItem.cs
- SqlDataSourceCommandEventArgs.cs
- ScrollViewer.cs
- ObjectDataSourceDisposingEventArgs.cs
- XmlAutoDetectWriter.cs
- PolyLineSegmentFigureLogic.cs
- BindingGroup.cs
- ServiceProviders.cs
- FilteredXmlReader.cs
- DataGridViewCellCancelEventArgs.cs
- SimpleWorkerRequest.cs
- EntryIndex.cs
- PlacementWorkspace.cs
- TdsParserStateObject.cs
- TextBreakpoint.cs
- GenericXmlSecurityToken.cs
- HyperLinkColumn.cs
- Atom10ItemFormatter.cs
- SettingsContext.cs
- OdbcCommand.cs
- _UncName.cs
- DragEvent.cs
- HandleCollector.cs
- MergePropertyDescriptor.cs
- ExpressionEditorAttribute.cs
- odbcmetadatacolumnnames.cs
- XmlDomTextWriter.cs
- coordinator.cs
- DataGridViewCellCollection.cs
- ScrollProviderWrapper.cs
- Animatable.cs
- MetadataItem.cs
- BlockCollection.cs
- TypeReference.cs
- QueryContinueDragEvent.cs
- SqlMetaData.cs
- DomNameTable.cs
- DependencyPropertyKey.cs
- RecognitionEventArgs.cs
- MailAddress.cs
- ComplexObject.cs
- CustomError.cs
- ConfigViewGenerator.cs
- DrawListViewItemEventArgs.cs
- OdbcCommand.cs
- TargetControlTypeAttribute.cs
- UIElement.cs
- CacheModeValueSerializer.cs
- DataTablePropertyDescriptor.cs
- filewebresponse.cs
- StorageMappingItemCollection.cs
- WorkflowWebHostingModule.cs
- PreProcessInputEventArgs.cs
- GatewayIPAddressInformationCollection.cs
- StringPropertyBuilder.cs
- BinaryReader.cs
- _emptywebproxy.cs
- CodeEventReferenceExpression.cs
- Line.cs
- SettingsAttributes.cs
- ColorInterpolationModeValidation.cs
- BindableTemplateBuilder.cs
- StaticResourceExtension.cs
- RemoteWebConfigurationHost.cs
- SocketException.cs
- xmlsaver.cs
- StickyNote.cs
- SByteStorage.cs
- ProgramPublisher.cs
- SQLSingleStorage.cs
- ellipse.cs
- FormsAuthentication.cs
- FixedLineResult.cs
- ChangeNode.cs
- TypefaceMap.cs
- AuthenticateEventArgs.cs
- EntityCommandDefinition.cs
- safelink.cs