Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Identity.cs
- IndependentAnimationStorage.cs
- Light.cs
- DBParameter.cs
- ScriptRef.cs
- SqlHelper.cs
- SByte.cs
- ReadOnlyDictionary.cs
- bindurihelper.cs
- ListControl.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- RuleInfoComparer.cs
- InternalCache.cs
- SendKeys.cs
- MessageQueuePermission.cs
- TextElementEditingBehaviorAttribute.cs
- figurelengthconverter.cs
- Facet.cs
- FormViewCommandEventArgs.cs
- UnicodeEncoding.cs
- CurrentChangedEventManager.cs
- ProfileParameter.cs
- Int32CAMarshaler.cs
- InternalEnumValidator.cs
- __Filters.cs
- ExceptionUtil.cs
- OleDbReferenceCollection.cs
- ResourceContainer.cs
- ExpressionBinding.cs
- SelfSignedCertificate.cs
- UnaryNode.cs
- ProxyHelper.cs
- CriticalFinalizerObject.cs
- FatalException.cs
- WebPartTransformer.cs
- HashAlgorithm.cs
- ContextProperty.cs
- UnsafeNetInfoNativeMethods.cs
- CdpEqualityComparer.cs
- XhtmlTextWriter.cs
- Separator.cs
- SelectorItemAutomationPeer.cs
- Scalars.cs
- ImageUrlEditor.cs
- DetailsViewDeletedEventArgs.cs
- ActivationWorker.cs
- EncryptionUtility.cs
- ServiceMemoryGates.cs
- JsonServiceDocumentSerializer.cs
- SmtpTransport.cs
- ECDiffieHellmanPublicKey.cs
- SessionStateModule.cs
- TableRowCollection.cs
- BinaryMessageEncodingElement.cs
- ClientBuildManagerCallback.cs
- ToolStripRendererSwitcher.cs
- XsltArgumentList.cs
- UniqueEventHelper.cs
- ToolStripDropDownClosingEventArgs.cs
- RecognizerStateChangedEventArgs.cs
- _FixedSizeReader.cs
- RowTypeElement.cs
- StatusStrip.cs
- ValidationRuleCollection.cs
- LiteralDesigner.cs
- CodeTryCatchFinallyStatement.cs
- QualifiedCellIdBoolean.cs
- CallbackWrapper.cs
- SQLDateTime.cs
- ConvertEvent.cs
- AuthorizationRule.cs
- ReturnType.cs
- CompressStream.cs
- Select.cs
- FreezableOperations.cs
- StorageEntityContainerMapping.cs
- ObjectCacheSettings.cs
- ObjectHandle.cs
- SourceFileInfo.cs
- MimeMapping.cs
- DataKeyArray.cs
- SoapIgnoreAttribute.cs
- SignatureHelper.cs
- WorkingDirectoryEditor.cs
- SafeFindHandle.cs
- MetadataPropertyCollection.cs
- Application.cs
- VirtualizingPanel.cs
- PersistenceProvider.cs
- XmlSchemaImport.cs
- OleDbCommand.cs
- AppDomainUnloadedException.cs
- TextEvent.cs
- ExclusiveCanonicalizationTransform.cs
- SchemaTypeEmitter.cs
- LocatorBase.cs
- OracleConnectionStringBuilder.cs
- OperationPickerDialog.cs
- WebPartAddingEventArgs.cs
- XPathArrayIterator.cs