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
- SamlAuthorityBinding.cs
- KeyGestureConverter.cs
- InfoCardTrace.cs
- SynchronizedInputAdaptor.cs
- COM2Properties.cs
- SqlBulkCopyColumnMappingCollection.cs
- FontStyleConverter.cs
- MenuItem.cs
- Separator.cs
- Trace.cs
- UserPersonalizationStateInfo.cs
- ContextBase.cs
- InputLanguageCollection.cs
- DbMetaDataFactory.cs
- WebPartConnectionsCancelVerb.cs
- RadioButtonStandardAdapter.cs
- ScrollPattern.cs
- CommandID.cs
- ExceptionValidationRule.cs
- CompModSwitches.cs
- WindowsStatusBar.cs
- BlurBitmapEffect.cs
- Compiler.cs
- RootProjectionNode.cs
- SafePointer.cs
- FrameworkContentElement.cs
- DataControlImageButton.cs
- FontFaceLayoutInfo.cs
- ObjectView.cs
- XmlSchemaFacet.cs
- BufferedStream.cs
- FileUpload.cs
- CapabilitiesSection.cs
- BitmapEffectOutputConnector.cs
- MsmqEncryptionAlgorithm.cs
- EventWaitHandle.cs
- CachedBitmap.cs
- HtmlInputPassword.cs
- GroupBox.cs
- ComplexLine.cs
- HttpListenerElement.cs
- ReadOnlyAttribute.cs
- X509IssuerSerialKeyIdentifierClause.cs
- AsyncContentLoadedEventArgs.cs
- DataObject.cs
- LateBoundBitmapDecoder.cs
- CacheEntry.cs
- TrustLevelCollection.cs
- AspNetHostingPermission.cs
- DrawListViewColumnHeaderEventArgs.cs
- OverflowException.cs
- NaturalLanguageHyphenator.cs
- SystemSounds.cs
- FixedDocument.cs
- EntityStoreSchemaGenerator.cs
- DeclarativeExpressionConditionDeclaration.cs
- ObjectDataProvider.cs
- PeerToPeerException.cs
- TraceInternal.cs
- PropagatorResult.cs
- KeyValuePairs.cs
- WebPartCatalogAddVerb.cs
- FormViewCommandEventArgs.cs
- CompositeActivityDesigner.cs
- HttpHandlersSection.cs
- ZipIOLocalFileDataDescriptor.cs
- LocatorPartList.cs
- ContentOperations.cs
- Registry.cs
- ResXResourceSet.cs
- HttpCapabilitiesBase.cs
- CalendarDay.cs
- StyleBamlRecordReader.cs
- NegationPusher.cs
- XmlUnspecifiedAttribute.cs
- SessionEndedEventArgs.cs
- ConfigXmlText.cs
- CroppedBitmap.cs
- SharedPersonalizationStateInfo.cs
- ASCIIEncoding.cs
- KeyedHashAlgorithm.cs
- ButtonFlatAdapter.cs
- DetailsViewDeleteEventArgs.cs
- graph.cs
- PersonalizationProvider.cs
- HostedTransportConfigurationBase.cs
- FormView.cs
- ZipPackage.cs
- PropertyValueChangedEvent.cs
- SchemaCollectionCompiler.cs
- BaseInfoTable.cs
- DesignerOptions.cs
- Invariant.cs
- TypeBuilder.cs
- PasswordPropertyTextAttribute.cs
- SqlAggregateChecker.cs
- ProcessHost.cs
- SizeKeyFrameCollection.cs
- ModuleBuilderData.cs
- DesignerAutoFormat.cs