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
- HttpBindingExtension.cs
- NameValueCollection.cs
- OperatingSystem.cs
- DataGridViewSelectedCellCollection.cs
- DataGridViewCellPaintingEventArgs.cs
- OperatingSystem.cs
- ForceCopyBuildProvider.cs
- StylusButtonEventArgs.cs
- InternalSafeNativeMethods.cs
- SaveFileDialog.cs
- XPathChildIterator.cs
- ExecutionContext.cs
- ProfileManager.cs
- MessageBox.cs
- XomlSerializationHelpers.cs
- ElementAction.cs
- CreateUserWizardStep.cs
- HiddenFieldPageStatePersister.cs
- ACE.cs
- AccessorTable.cs
- CodeEntryPointMethod.cs
- DataGridHeaderBorder.cs
- brushes.cs
- __Filters.cs
- FontSourceCollection.cs
- HtmlTableRow.cs
- GraphicsContainer.cs
- SimpleRecyclingCache.cs
- HttpWriter.cs
- WindowsListViewScroll.cs
- UpdatePanelControlTrigger.cs
- ConfigXmlText.cs
- DrawListViewSubItemEventArgs.cs
- RoleService.cs
- MeasurementDCInfo.cs
- PersonalizationState.cs
- DetailsViewPageEventArgs.cs
- TextRenderer.cs
- OperationContractGenerationContext.cs
- XmlDataSource.cs
- HtmlToClrEventProxy.cs
- Control.cs
- NGCSerializerAsync.cs
- WorkflowTraceTransfer.cs
- StatusBarPanel.cs
- MD5CryptoServiceProvider.cs
- ForeignKeyConstraint.cs
- Application.cs
- DetailsViewModeEventArgs.cs
- ServiceDescriptionReflector.cs
- EntityDataSourceQueryBuilder.cs
- ClipboardProcessor.cs
- Int32.cs
- TableLayout.cs
- RowUpdatingEventArgs.cs
- ButtonStandardAdapter.cs
- HiddenField.cs
- WebPartDisplayModeCancelEventArgs.cs
- Metafile.cs
- NestPullup.cs
- DbParameterHelper.cs
- TimeStampChecker.cs
- StylusCaptureWithinProperty.cs
- FormViewUpdateEventArgs.cs
- XsltLibrary.cs
- MsmqNonTransactedPoisonHandler.cs
- DocComment.cs
- HttpInputStream.cs
- ConfigurationPropertyAttribute.cs
- CompoundFileIOPermission.cs
- QilPatternVisitor.cs
- Viewport2DVisual3D.cs
- BrowserCapabilitiesFactoryBase.cs
- ContractsBCL.cs
- Selector.cs
- SettingsBase.cs
- DesignerCategoryAttribute.cs
- Point3D.cs
- NestedContainer.cs
- PrtCap_Public_Simple.cs
- WebPartCancelEventArgs.cs
- GlyphingCache.cs
- ExceptionList.cs
- CatalogZoneBase.cs
- CodeBinaryOperatorExpression.cs
- CreateUserErrorEventArgs.cs
- SubMenuStyleCollection.cs
- BooleanAnimationBase.cs
- TextPointer.cs
- SoapReflector.cs
- BaseValidatorDesigner.cs
- CodePrimitiveExpression.cs
- COM2Properties.cs
- PostBackTrigger.cs
- JapaneseCalendar.cs
- TableItemProviderWrapper.cs
- PropertyGridDesigner.cs
- GlyphCache.cs
- HostingPreferredMapPath.cs
- ToolStripEditorManager.cs