Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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; } } } // 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
- OdbcCommand.cs
- Int32Storage.cs
- TimelineCollection.cs
- WebServiceHandler.cs
- StatementContext.cs
- xmlsaver.cs
- Window.cs
- CacheOutputQuery.cs
- COSERVERINFO.cs
- EntityContainerEntitySetDefiningQuery.cs
- TimeManager.cs
- BaseCodeDomTreeGenerator.cs
- ELinqQueryState.cs
- DbTransaction.cs
- TileModeValidation.cs
- Crypto.cs
- XmlAttributes.cs
- LineProperties.cs
- FormsAuthenticationTicket.cs
- GridViewRowEventArgs.cs
- DesignTimeParseData.cs
- MenuTracker.cs
- HttpCapabilitiesBase.cs
- SelectionList.cs
- Metadata.cs
- InfoCardAsymmetricCrypto.cs
- TreeNodeSelectionProcessor.cs
- LockCookie.cs
- CompositeTypefaceMetrics.cs
- BaseResourcesBuildProvider.cs
- ContextMarshalException.cs
- ErrorLog.cs
- WorkingDirectoryEditor.cs
- SessionStateItemCollection.cs
- Byte.cs
- Baml2006Reader.cs
- MenuAutomationPeer.cs
- FileStream.cs
- CodeLinePragma.cs
- WebPermission.cs
- SqlDependency.cs
- RtfControlWordInfo.cs
- EdmValidator.cs
- WebPartDescription.cs
- MultipleViewProviderWrapper.cs
- ViewCellRelation.cs
- Stacktrace.cs
- PropertyGridCommands.cs
- UpdatePanelControlTrigger.cs
- SQLInt16.cs
- Native.cs
- VirtualDirectoryMappingCollection.cs
- ConfigsHelper.cs
- ProcessHostConfigUtils.cs
- UrlPropertyAttribute.cs
- CodeTypeReference.cs
- DesignerOptions.cs
- ObjectStateManagerMetadata.cs
- CoreSwitches.cs
- OdbcConnection.cs
- PropertyValueChangedEvent.cs
- ConfigurationSectionCollection.cs
- LocalsItemDescription.cs
- TreeViewDesigner.cs
- InternalTransaction.cs
- SynchronousChannel.cs
- NameNode.cs
- FreezableDefaultValueFactory.cs
- SqlDelegatedTransaction.cs
- DataGridViewComboBoxEditingControl.cs
- AddressingProperty.cs
- UDPClient.cs
- CategoryGridEntry.cs
- CqlLexerHelpers.cs
- EventlogProvider.cs
- DataBindingCollection.cs
- GridViewEditEventArgs.cs
- WebPartsSection.cs
- MappedMetaModel.cs
- IEnumerable.cs
- InProcStateClientManager.cs
- OneToOneMappingSerializer.cs
- EntitySetDataBindingList.cs
- OrCondition.cs
- MembershipSection.cs
- DiagnosticsConfigurationHandler.cs
- RenderDataDrawingContext.cs
- _NativeSSPI.cs
- OleDbRowUpdatingEvent.cs
- AlternateView.cs
- OleDbCommand.cs
- TreeViewTemplateSelector.cs
- LogSwitch.cs
- _NativeSSPI.cs
- KeyNotFoundException.cs
- StrongNameKeyPair.cs
- StylusTip.cs
- SerializationException.cs
- CellNormalizer.cs
- SBCSCodePageEncoding.cs