Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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); } } } // 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
- IdentitySection.cs
- IsolatedStorageFileStream.cs
- DataView.cs
- BaseConfigurationRecord.cs
- Wildcard.cs
- SourceFilter.cs
- VerificationAttribute.cs
- SignatureDescription.cs
- MessageSecurityOverTcp.cs
- Utils.cs
- ResourceReferenceExpressionConverter.cs
- WindowHelperService.cs
- DBDataPermissionAttribute.cs
- ProviderManager.cs
- XmlExpressionDumper.cs
- ACE.cs
- ComponentGlyph.cs
- Setter.cs
- OleDbSchemaGuid.cs
- ConsoleKeyInfo.cs
- ReflectionPermission.cs
- InheritablePropertyChangeInfo.cs
- UniqueCodeIdentifierScope.cs
- InheritanceRules.cs
- PropertyEntry.cs
- HybridObjectCache.cs
- MetadataWorkspace.cs
- XmlWriter.cs
- ToolboxDataAttribute.cs
- SignatureToken.cs
- Html32TextWriter.cs
- FormsAuthenticationUserCollection.cs
- DataConnectionHelper.cs
- UTF7Encoding.cs
- DeviceSpecific.cs
- PageVisual.cs
- DataControlImageButton.cs
- EntityViewGenerationAttribute.cs
- EntityAdapter.cs
- ArraySet.cs
- WebPartZone.cs
- BooleanSwitch.cs
- BuildProviderAppliesToAttribute.cs
- Vector3DCollection.cs
- Mappings.cs
- CultureSpecificStringDictionary.cs
- MenuItemStyleCollection.cs
- XmlSchemaAppInfo.cs
- CdpEqualityComparer.cs
- Point.cs
- ListChunk.cs
- CurrentTimeZone.cs
- EventLog.cs
- WindowsScroll.cs
- _ChunkParse.cs
- EnumType.cs
- EditingContext.cs
- EncoderReplacementFallback.cs
- HTMLTagNameToTypeMapper.cs
- OverflowException.cs
- XmlCountingReader.cs
- OutputCacheSection.cs
- SqlOuterApplyReducer.cs
- EdmError.cs
- StateManagedCollection.cs
- SqlBuffer.cs
- HelpKeywordAttribute.cs
- ProxyManager.cs
- SpellerInterop.cs
- IndexedString.cs
- DetailsViewDeletedEventArgs.cs
- QueryableDataSourceView.cs
- WmlCommandAdapter.cs
- CodeCastExpression.cs
- StickyNoteContentControl.cs
- PageParserFilter.cs
- ReferencedType.cs
- TransformGroup.cs
- ConfigurationElementCollection.cs
- Floater.cs
- BitmapImage.cs
- DependencyPropertyConverter.cs
- TextEffect.cs
- AuthorizationRuleCollection.cs
- SearchForVirtualItemEventArgs.cs
- DBSchemaRow.cs
- TextParagraph.cs
- JsonReader.cs
- ServiceOperationParameter.cs
- ColorAnimationUsingKeyFrames.cs
- MenuItemCollection.cs
- PaintValueEventArgs.cs
- ImageSource.cs
- FormParameter.cs
- EventMappingSettings.cs
- UnknownWrapper.cs
- WindowsListViewItemCheckBox.cs
- BitmapMetadata.cs
- DiscoveryInnerClientAdhocCD1.cs
- autovalidator.cs