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
- UnsignedPublishLicense.cs
- SqlMethods.cs
- DocumentViewerBaseAutomationPeer.cs
- RectAnimationUsingKeyFrames.cs
- ExcCanonicalXml.cs
- CollectionViewGroupRoot.cs
- BitmapEffectDrawingContent.cs
- MetafileHeader.cs
- CodeCatchClauseCollection.cs
- AccessDataSourceWizardForm.cs
- VBCodeProvider.cs
- DemultiplexingClientMessageFormatter.cs
- ArrayWithOffset.cs
- Region.cs
- RankException.cs
- IODescriptionAttribute.cs
- Transform.cs
- DataStorage.cs
- DecoderFallback.cs
- RtType.cs
- MimePart.cs
- WebConvert.cs
- DesignTimeTemplateParser.cs
- ExtractedStateEntry.cs
- FileStream.cs
- RuntimeConfig.cs
- EmptyEnumerator.cs
- MetadataReference.cs
- KeyValuePair.cs
- StrokeRenderer.cs
- SQLSingle.cs
- PriorityBinding.cs
- ConstructorExpr.cs
- RSAPKCS1SignatureFormatter.cs
- FormClosedEvent.cs
- SamlAuthorityBinding.cs
- SchemaTableOptionalColumn.cs
- TypedTableBaseExtensions.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- DataGridViewImageCell.cs
- ScalarConstant.cs
- ResXDataNode.cs
- MemberAccessException.cs
- AttachedPropertyMethodSelector.cs
- DefaultPropertyAttribute.cs
- ArrangedElementCollection.cs
- XmlLoader.cs
- SessionStateSection.cs
- TrackPointCollection.cs
- ExceptionRoutedEventArgs.cs
- Content.cs
- unsafenativemethodsother.cs
- UpdateTranslator.cs
- PowerStatus.cs
- Root.cs
- DeclaredTypeValidatorAttribute.cs
- MailMessageEventArgs.cs
- SelectionRangeConverter.cs
- MetadataUtilsSmi.cs
- FormsAuthentication.cs
- SignatureHelper.cs
- QueryOptionExpression.cs
- OrderingInfo.cs
- ChoiceConverter.cs
- AppliesToBehaviorDecisionTable.cs
- WorkflowApplicationAbortedException.cs
- SafeFileMapViewHandle.cs
- PersonalizationDictionary.cs
- XPathDocumentIterator.cs
- FullTextLine.cs
- WebRequestModuleElement.cs
- DataContractSerializerServiceBehavior.cs
- ProviderSettingsCollection.cs
- DataTableMappingCollection.cs
- TypeElement.cs
- SessionStateContainer.cs
- ExtenderProvidedPropertyAttribute.cs
- NameTable.cs
- SemaphoreSecurity.cs
- CngKeyCreationParameters.cs
- embossbitmapeffect.cs
- Directory.cs
- ControlDesigner.cs
- MatrixAnimationUsingPath.cs
- ResXResourceWriter.cs
- Translator.cs
- DynamicArgumentDesigner.xaml.cs
- IndependentlyAnimatedPropertyMetadata.cs
- ParseChildrenAsPropertiesAttribute.cs
- BufferedReadStream.cs
- CodeArgumentReferenceExpression.cs
- ImageInfo.cs
- ColumnReorderedEventArgs.cs
- ExceptQueryOperator.cs
- XAMLParseException.cs
- ActivityScheduledRecord.cs
- NonDualMessageSecurityOverHttpElement.cs
- GatewayDefinition.cs
- Accessors.cs
- PtsContext.cs