Code:
/ FX-1434 / FX-1434 / 1.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
- ApplicationActivator.cs
- RelatedImageListAttribute.cs
- __Filters.cs
- CompositeDataBoundControl.cs
- GeneratedCodeAttribute.cs
- SettingsAttributeDictionary.cs
- ISCIIEncoding.cs
- CharConverter.cs
- ResourceDescriptionAttribute.cs
- AutomationAttributeInfo.cs
- Image.cs
- SymbolEqualComparer.cs
- WebResourceUtil.cs
- coordinator.cs
- CompoundFileIOPermission.cs
- MeshGeometry3D.cs
- UICuesEvent.cs
- RealProxy.cs
- ConnectionManagementElement.cs
- TraceContextRecord.cs
- XmlWriterDelegator.cs
- RequiredAttributeAttribute.cs
- ExternalException.cs
- BulletedList.cs
- ProvidersHelper.cs
- BrowserCapabilitiesCompiler.cs
- OdbcPermission.cs
- HTMLTagNameToTypeMapper.cs
- SecureStringHasher.cs
- DataGridViewCell.cs
- Utility.cs
- safesecurityhelperavalon.cs
- Certificate.cs
- BorderSidesEditor.cs
- ExplicitDiscriminatorMap.cs
- ManagedFilter.cs
- _LazyAsyncResult.cs
- QuaternionAnimationUsingKeyFrames.cs
- DesignerForm.cs
- PrintSchema.cs
- SafeNativeMethods.cs
- RuntimeWrappedException.cs
- assemblycache.cs
- PrePostDescendentsWalker.cs
- RsaKeyIdentifierClause.cs
- TreeViewHitTestInfo.cs
- SpellerHighlightLayer.cs
- TraceSection.cs
- CodeEventReferenceExpression.cs
- FormViewPageEventArgs.cs
- NullableIntSumAggregationOperator.cs
- precedingsibling.cs
- ApplicationBuildProvider.cs
- MSAANativeProvider.cs
- EnumDataContract.cs
- PopupRootAutomationPeer.cs
- NegatedCellConstant.cs
- Adorner.cs
- LocalIdCollection.cs
- ProtocolElementCollection.cs
- SupportingTokenSecurityTokenResolver.cs
- ActivityPreviewDesigner.cs
- CngProperty.cs
- XmlSerializerFactory.cs
- StringStorage.cs
- TemplateBamlTreeBuilder.cs
- DataExchangeServiceBinder.cs
- SqlTopReducer.cs
- __Filters.cs
- XmlSchemaChoice.cs
- WebCodeGenerator.cs
- SizeIndependentAnimationStorage.cs
- ToolStripScrollButton.cs
- DispatcherHookEventArgs.cs
- WriteableBitmap.cs
- HtmlPageAdapter.cs
- HyperLinkField.cs
- WindowsIPAddress.cs
- MembershipValidatePasswordEventArgs.cs
- ChannelBase.cs
- FileDialogCustomPlace.cs
- Literal.cs
- SoapAttributes.cs
- ErrorWrapper.cs
- Translator.cs
- Table.cs
- UserControlParser.cs
- DocumentPageViewAutomationPeer.cs
- NotSupportedException.cs
- SafeHandles.cs
- WindowsPen.cs
- XPathDocumentNavigator.cs
- FontFamilyIdentifier.cs
- QilInvoke.cs
- Rect.cs
- XmlBinaryReader.cs
- ViewBase.cs
- ViewCellRelation.cs
- EntityReference.cs
- SimpleHandlerFactory.cs