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
- BrowserDefinition.cs
- FormViewCommandEventArgs.cs
- WebServiceHostFactory.cs
- EntityObject.cs
- XmlQuerySequence.cs
- ProviderSettingsCollection.cs
- CommandField.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- GridViewRow.cs
- CharacterBufferReference.cs
- ValidationErrorCollection.cs
- RequestCacheEntry.cs
- OutputCacheModule.cs
- ToolStripContainerActionList.cs
- TraversalRequest.cs
- AttributeProviderAttribute.cs
- Serializer.cs
- FactoryMaker.cs
- SchemaImporter.cs
- ScanQueryOperator.cs
- _ListenerResponseStream.cs
- RegexCompiler.cs
- X509AsymmetricSecurityKey.cs
- DataError.cs
- LookupNode.cs
- CalendarAutomationPeer.cs
- DateTimeOffsetStorage.cs
- AnonymousIdentificationModule.cs
- GiveFeedbackEventArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- FontWeight.cs
- TextTreePropertyUndoUnit.cs
- HttpHandler.cs
- ExecutionPropertyManager.cs
- ADMembershipProvider.cs
- CodeTypeConstructor.cs
- PointConverter.cs
- ListParaClient.cs
- QueryableDataSource.cs
- DSACryptoServiceProvider.cs
- TextModifier.cs
- ReturnValue.cs
- SqlClientMetaDataCollectionNames.cs
- WebPartZone.cs
- LogAppendAsyncResult.cs
- FileDialog_Vista.cs
- KeyedHashAlgorithm.cs
- PointValueSerializer.cs
- URL.cs
- SqlStream.cs
- SerializationStore.cs
- Avt.cs
- WorkflowDispatchContext.cs
- HttpCapabilitiesSectionHandler.cs
- DatasetMethodGenerator.cs
- DSASignatureDeformatter.cs
- SimpleWorkerRequest.cs
- ContractSearchPattern.cs
- ExpressionEditorAttribute.cs
- SchemaNamespaceManager.cs
- versioninfo.cs
- AssemblyBuilderData.cs
- PasswordDeriveBytes.cs
- PrivilegeNotHeldException.cs
- InvalidAsynchronousStateException.cs
- IndependentAnimationStorage.cs
- Rotation3D.cs
- CatalogZoneBase.cs
- QuotedPrintableStream.cs
- CodeVariableReferenceExpression.cs
- StorageComplexPropertyMapping.cs
- SqlDataSourceCache.cs
- RouteValueDictionary.cs
- TextServicesPropertyRanges.cs
- ListItemsCollectionEditor.cs
- CustomValidator.cs
- ReceiveSecurityHeaderElementManager.cs
- ObjectQueryProvider.cs
- ProfilePropertySettingsCollection.cs
- Span.cs
- MailWriter.cs
- ChannelSinkStacks.cs
- TextBoxDesigner.cs
- DecimalConstantAttribute.cs
- ExpandSegmentCollection.cs
- MonitorWrapper.cs
- SiteMapNodeCollection.cs
- TypedDataSourceCodeGenerator.cs
- PerformanceCounter.cs
- QilVisitor.cs
- HtmlTableRowCollection.cs
- ConfigDefinitionUpdates.cs
- counter.cs
- FixedSchema.cs
- DeclaredTypeValidator.cs
- OneOfTypeConst.cs
- CheckPair.cs
- Location.cs
- GenericTypeParameterBuilder.cs
- UnauthorizedWebPart.cs