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
- ReachUIElementCollectionSerializer.cs
- GrammarBuilderBase.cs
- QueryableDataSourceView.cs
- UnsafeNativeMethodsPenimc.cs
- StateManagedCollection.cs
- WebScriptMetadataFormatter.cs
- WSSecurityTokenSerializer.cs
- MsmqTransportReceiveParameters.cs
- Error.cs
- SafeNativeMethods.cs
- Point4D.cs
- BamlResourceContent.cs
- HasRunnableWorkflowEvent.cs
- DataListDesigner.cs
- DataRecordInfo.cs
- SafeTokenHandle.cs
- TimeStampChecker.cs
- DataGridColumnStyleMappingNameEditor.cs
- XmlFormatReaderGenerator.cs
- InputLangChangeEvent.cs
- MergeEnumerator.cs
- TreeView.cs
- InvalidFilterCriteriaException.cs
- TreeWalker.cs
- TextAnchor.cs
- Codec.cs
- WebPart.cs
- ResourceContainer.cs
- MultipartIdentifier.cs
- CleanUpVirtualizedItemEventArgs.cs
- namescope.cs
- LineBreak.cs
- OrderedEnumerableRowCollection.cs
- DecoderReplacementFallback.cs
- PocoPropertyAccessorStrategy.cs
- CacheEntry.cs
- SemanticBasicElement.cs
- ForEachAction.cs
- XmlSchemaCollection.cs
- BaseInfoTable.cs
- TextShapeableCharacters.cs
- SHA384Managed.cs
- SQLChars.cs
- GridViewCommandEventArgs.cs
- bidPrivateBase.cs
- PEFileEvidenceFactory.cs
- EnumerableRowCollectionExtensions.cs
- FamilyTypeface.cs
- MessageHeader.cs
- ObfuscationAttribute.cs
- XmlSchemaRedefine.cs
- TemplatedMailWebEventProvider.cs
- DesignerDataView.cs
- CmsInterop.cs
- DependentList.cs
- ListBindingHelper.cs
- IteratorFilter.cs
- HierarchicalDataSourceControl.cs
- HandlerBase.cs
- StylusTip.cs
- JumpTask.cs
- QueryConverter.cs
- SafeProcessHandle.cs
- ConfigXmlComment.cs
- Funcletizer.cs
- AnonymousIdentificationSection.cs
- ParallelEnumerableWrapper.cs
- VarRemapper.cs
- XslAstAnalyzer.cs
- ItemDragEvent.cs
- SettingsContext.cs
- TableLayoutStyleCollection.cs
- ClientUtils.cs
- FormViewDeleteEventArgs.cs
- RootContext.cs
- Native.cs
- IgnoreSectionHandler.cs
- DetailsViewUpdateEventArgs.cs
- ArrayTypeMismatchException.cs
- EastAsianLunisolarCalendar.cs
- CommandManager.cs
- CompilerWrapper.cs
- EngineSiteSapi.cs
- DriveInfo.cs
- AccessedThroughPropertyAttribute.cs
- TraceListeners.cs
- ComponentRenameEvent.cs
- streamingZipPartStream.cs
- ChildDocumentBlock.cs
- DrawToolTipEventArgs.cs
- BasicCellRelation.cs
- EndOfStreamException.cs
- CatalogZone.cs
- COAUTHIDENTITY.cs
- XmlObjectSerializerContext.cs
- ChannelFactoryRefCache.cs
- HtmlContainerControl.cs
- CapabilitiesAssignment.cs
- _Win32.cs
- TypeUtil.cs