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
- AutoCompleteStringCollection.cs
- SqlVersion.cs
- EnterpriseServicesHelper.cs
- CmsUtils.cs
- ChtmlPageAdapter.cs
- CSharpCodeProvider.cs
- SourceFileInfo.cs
- IPHostEntry.cs
- ContextStack.cs
- CollectionChangeEventArgs.cs
- RightsManagementPermission.cs
- NetworkInterface.cs
- DataGridTemplateColumn.cs
- figurelength.cs
- sqlser.cs
- HtmlTableRowCollection.cs
- TextFormatterImp.cs
- TerminatorSinks.cs
- ObjRef.cs
- ISSmlParser.cs
- XmlElementAttribute.cs
- DateTimePickerDesigner.cs
- ArraySegment.cs
- SqlBuffer.cs
- SchemaImporter.cs
- DataGridAddNewRow.cs
- X509CertificateStore.cs
- CultureMapper.cs
- GroupStyle.cs
- PropertyReference.cs
- CompiledRegexRunner.cs
- PerformanceCounterPermission.cs
- ItemCollection.cs
- SqlSelectStatement.cs
- ResourceDefaultValueAttribute.cs
- SqlInternalConnectionSmi.cs
- SendKeys.cs
- SQLInt32Storage.cs
- DataKey.cs
- CLSCompliantAttribute.cs
- TemplateControl.cs
- CodeDomConfigurationHandler.cs
- EntityCommandDefinition.cs
- ClientConvert.cs
- SubstitutionList.cs
- Matrix3D.cs
- DbConnectionFactory.cs
- sqlcontext.cs
- IncrementalReadDecoders.cs
- NavigationCommands.cs
- OrthographicCamera.cs
- HttpCookie.cs
- RecordManager.cs
- DataGridViewUtilities.cs
- ImmutableObjectAttribute.cs
- MetadataItemCollectionFactory.cs
- RoutedPropertyChangedEventArgs.cs
- DataBoundControl.cs
- SmtpDigestAuthenticationModule.cs
- NativeMethods.cs
- ItemsControl.cs
- CornerRadiusConverter.cs
- BlockingCollection.cs
- WindowsAuthenticationModule.cs
- ClientBuildManagerCallback.cs
- IRCollection.cs
- MenuDesigner.cs
- TextTreeUndoUnit.cs
- WorkflowDefinitionDispenser.cs
- ValueUnavailableException.cs
- XPathMessageFilter.cs
- DateRangeEvent.cs
- OrderedDictionary.cs
- ProcessModelInfo.cs
- GeneralTransform3DTo2DTo3D.cs
- QueueNameHelper.cs
- BindStream.cs
- BoundsDrawingContextWalker.cs
- MatrixTransform3D.cs
- CompareValidator.cs
- UdpReplyToBehavior.cs
- IfAction.cs
- CorePropertiesFilter.cs
- JavascriptCallbackBehaviorAttribute.cs
- RowCache.cs
- XmlDownloadManager.cs
- ExpressionEvaluator.cs
- DefaultProxySection.cs
- SoapCodeExporter.cs
- StringValidatorAttribute.cs
- Exception.cs
- SaveFileDialog.cs
- IndexedGlyphRun.cs
- XmlReader.cs
- IsolatedStorageException.cs
- XmlSchemaValidator.cs
- AssociationTypeEmitter.cs
- XmlAnyAttributeAttribute.cs
- Stylus.cs
- Claim.cs