Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- XmlSchemaNotation.cs
- MailHeaderInfo.cs
- CodeMethodReturnStatement.cs
- BmpBitmapDecoder.cs
- TableLayoutCellPaintEventArgs.cs
- TextSimpleMarkerProperties.cs
- StringStorage.cs
- sqlinternaltransaction.cs
- LookupBindingPropertiesAttribute.cs
- TextCompositionManager.cs
- RelationshipNavigation.cs
- CoreSwitches.cs
- Memoizer.cs
- StringFreezingAttribute.cs
- Win32.cs
- keycontainerpermission.cs
- Debug.cs
- UnhandledExceptionEventArgs.cs
- AppDomain.cs
- HttpWebResponse.cs
- Int32RectValueSerializer.cs
- DataPagerFieldCollection.cs
- Command.cs
- MessageAction.cs
- AssemblyCollection.cs
- XmlUtf8RawTextWriter.cs
- OleDbSchemaGuid.cs
- SqlCommandSet.cs
- Helpers.cs
- ViewCellRelation.cs
- Choices.cs
- SoapSchemaImporter.cs
- XmlSchemaAny.cs
- PaintEvent.cs
- DrawListViewSubItemEventArgs.cs
- Internal.cs
- OdbcConnection.cs
- FormViewCommandEventArgs.cs
- AspNetHostingPermission.cs
- PeerCollaborationPermission.cs
- ToolStripContentPanelDesigner.cs
- SemanticResultKey.cs
- ToolBarButtonClickEvent.cs
- WhitespaceRuleReader.cs
- HtmlEncodedRawTextWriter.cs
- NavigationHelper.cs
- CompressEmulationStream.cs
- XmlBindingWorker.cs
- Keyboard.cs
- storepermissionattribute.cs
- followingsibling.cs
- CreateRefExpr.cs
- SessionEndingEventArgs.cs
- NativeMethodsOther.cs
- DateBoldEvent.cs
- bidPrivateBase.cs
- SqlGatherProducedAliases.cs
- _SecureChannel.cs
- DetailsViewInsertedEventArgs.cs
- ClientSideProviderDescription.cs
- IndentedWriter.cs
- XMLSyntaxException.cs
- SiteMapPath.cs
- QilParameter.cs
- ProcessHost.cs
- MailMessage.cs
- UnsafeNativeMethods.cs
- BuildDependencySet.cs
- VarRemapper.cs
- BindingWorker.cs
- Helpers.cs
- SessionEndedEventArgs.cs
- ComboBoxRenderer.cs
- MailDefinitionBodyFileNameEditor.cs
- ModelTreeEnumerator.cs
- MediaSystem.cs
- TrackingRecordPreFilter.cs
- EventlogProvider.cs
- Vector3DAnimation.cs
- COM2Properties.cs
- OdbcConnectionStringbuilder.cs
- CharEnumerator.cs
- FlowDocumentView.cs
- IOException.cs
- AcceleratedTokenProviderState.cs
- ErrorProvider.cs
- WindowsImpersonationContext.cs
- WebServiceData.cs
- HorizontalAlignConverter.cs
- ItemContainerProviderWrapper.cs
- ColorIndependentAnimationStorage.cs
- PageParserFilter.cs
- PositiveTimeSpanValidatorAttribute.cs
- ColorConverter.cs
- WindowsListView.cs
- PropertyGridCommands.cs
- EventDriven.cs
- DiscoveryClientReferences.cs
- PageAdapter.cs
- GeneralTransform.cs