Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafeFileHandle.cs / 1 / SafeFileHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileHandle ** ** ** A wrapper for file handles ** ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using Microsoft.Win32; namespace Microsoft.Win32.SafeHandles { [SecurityPermission(SecurityAction.LinkDemand,UnmanagedCode=true)] public sealed class SafeFileHandle: SafeHandleZeroOrMinusOneIsInvalid { private SafeFileHandle() : base(true) { } public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(preexistingHandle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ValidatedControlConverter.cs
- HttpSessionStateBase.cs
- CompositeControl.cs
- AssemblyNameProxy.cs
- WrapPanel.cs
- Transactions.cs
- MetadataPropertyCollection.cs
- ReservationNotFoundException.cs
- DeleteIndexBinder.cs
- AQNBuilder.cs
- StdRegProviderWrapper.cs
- CodeConditionStatement.cs
- WebServiceData.cs
- IListConverters.cs
- TargetConverter.cs
- PlatformNotSupportedException.cs
- ListCollectionView.cs
- UserControlCodeDomTreeGenerator.cs
- PreviewKeyDownEventArgs.cs
- DropTarget.cs
- SQLRoleProvider.cs
- OleDbFactory.cs
- CompilationPass2TaskInternal.cs
- BufferedGraphics.cs
- ImageDrawing.cs
- ProxyAttribute.cs
- WorkItem.cs
- UserPreferenceChangedEventArgs.cs
- _Connection.cs
- NonVisualControlAttribute.cs
- SamlSerializer.cs
- SafeThemeHandle.cs
- WebBrowserSiteBase.cs
- FormViewDeletedEventArgs.cs
- PocoEntityKeyStrategy.cs
- DashStyle.cs
- ChannelDispatcherBase.cs
- TableRowGroup.cs
- Transform.cs
- AutomationFocusChangedEventArgs.cs
- TemplateXamlParser.cs
- IdentifierCollection.cs
- SourceItem.cs
- RefreshPropertiesAttribute.cs
- WmlTextBoxAdapter.cs
- DateTimeFormatInfoScanner.cs
- Predicate.cs
- HtmlContainerControl.cs
- SQLByteStorage.cs
- ReadOnlyPropertyMetadata.cs
- ValidationErrorCollection.cs
- MenuEventArgs.cs
- DynamicRenderer.cs
- MaterialGroup.cs
- GlyphInfoList.cs
- ToolStripSeparator.cs
- FrameworkContentElement.cs
- StringHelper.cs
- IdentityHolder.cs
- PropertyTabAttribute.cs
- XmlSiteMapProvider.cs
- XmlReflectionImporter.cs
- DataGridTextBox.cs
- HtmlMeta.cs
- TearOffProxy.cs
- _IPv4Address.cs
- Sorting.cs
- SortExpressionBuilder.cs
- SystemColorTracker.cs
- EntryIndex.cs
- AssemblyFilter.cs
- PasswordTextNavigator.cs
- XsltContext.cs
- EventLogPermissionEntryCollection.cs
- TypeUnloadedException.cs
- EventLogException.cs
- XamlSerializationHelper.cs
- MembershipValidatePasswordEventArgs.cs
- EntityDataSourceView.cs
- WebBaseEventKeyComparer.cs
- PathFigureCollection.cs
- WindowInteropHelper.cs
- PropertiesTab.cs
- TabControl.cs
- Int16.cs
- ClassGenerator.cs
- ComponentResourceManager.cs
- CachedCompositeFamily.cs
- RelationshipDetailsCollection.cs
- ButtonStandardAdapter.cs
- XmlExtensionFunction.cs
- DataTable.cs
- ConfigPathUtility.cs
- CurrentTimeZone.cs
- Condition.cs
- MasterPage.cs
- ScriptHandlerFactory.cs
- WrapperSecurityCommunicationObject.cs
- LinqDataSourceHelper.cs
- ColorContextHelper.cs