Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafeViewOfFileHandle.cs / 1 / SafeViewOfFileHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeViewOfFileHandle ** ** ** 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; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle() : base(true) {} // 0 is an Invalid Handle [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { if (Win32Native.UnmapViewOfFile(handle)) { handle = IntPtr.Zero; return true; } return false; } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SelectedCellsChangedEventArgs.cs
- SqlDelegatedTransaction.cs
- DynamicObject.cs
- _UncName.cs
- ClientUtils.cs
- DataGridViewButtonCell.cs
- TransactionState.cs
- SQLInt16Storage.cs
- WebPartCancelEventArgs.cs
- FileSystemEventArgs.cs
- SoapElementAttribute.cs
- SimpleLine.cs
- SamlSecurityTokenAuthenticator.cs
- EtwTrace.cs
- BitmapEffectInputData.cs
- InternalsVisibleToAttribute.cs
- CompressionTracing.cs
- LoadWorkflowAsyncResult.cs
- BasePattern.cs
- TraceProvider.cs
- LinkedList.cs
- Unit.cs
- WebPartConnectVerb.cs
- AssemblyInfo.cs
- DataGridViewCellValueEventArgs.cs
- WarningException.cs
- CapabilitiesAssignment.cs
- ReadOnlyCollectionBase.cs
- ButtonColumn.cs
- TypeUsageBuilder.cs
- DataMemberAttribute.cs
- FieldTemplateFactory.cs
- DataGridTextColumn.cs
- SettingsProviderCollection.cs
- DtdParser.cs
- PlanCompilerUtil.cs
- ClassDataContract.cs
- VisualStyleTypesAndProperties.cs
- DocumentReference.cs
- SqlTriggerAttribute.cs
- EventHandlerList.cs
- FilteredSchemaElementLookUpTable.cs
- MenuItemStyleCollectionEditor.cs
- WebServiceEnumData.cs
- EasingFunctionBase.cs
- CfgParser.cs
- AlignmentXValidation.cs
- XPathSelectionIterator.cs
- DispatcherObject.cs
- ParenthesizePropertyNameAttribute.cs
- ProcessHostMapPath.cs
- CheckPair.cs
- DefaultClaimSet.cs
- LinearGradientBrush.cs
- DrawingBrush.cs
- XmlResolver.cs
- IndexerNameAttribute.cs
- KnownColorTable.cs
- NoClickablePointException.cs
- OleDbConnection.cs
- PostBackTrigger.cs
- ObjectResult.cs
- SQlBooleanStorage.cs
- SByteConverter.cs
- CatalogZoneDesigner.cs
- SingleTagSectionHandler.cs
- OuterGlowBitmapEffect.cs
- CheckoutException.cs
- TextCompositionManager.cs
- AssemblyResourceLoader.cs
- PanningMessageFilter.cs
- SQLRoleProvider.cs
- BmpBitmapEncoder.cs
- _ConnectionGroup.cs
- EncoderParameter.cs
- WebPartAddingEventArgs.cs
- HtmlAnchor.cs
- SimpleTypeResolver.cs
- StorageAssociationSetMapping.cs
- PageTheme.cs
- ActivityLocationReferenceEnvironment.cs
- XmlTextReaderImpl.cs
- CodeBinaryOperatorExpression.cs
- VoiceInfo.cs
- Blend.cs
- ActivationServices.cs
- AccessText.cs
- SymbolTable.cs
- BamlLocalizabilityResolver.cs
- RealizationContext.cs
- RectangleConverter.cs
- Keywords.cs
- StreamMarshaler.cs
- DeferredReference.cs
- CheckoutException.cs
- XmlTextReader.cs
- DataTemplateKey.cs
- Span.cs
- XmlSerializerFactory.cs
- WorkflowRuntimeSection.cs