Code:
/ DotNET / DotNET / 8.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
- SpeechDetectedEventArgs.cs
- StructureChangedEventArgs.cs
- PathSegmentCollection.cs
- StreamInfo.cs
- baseshape.cs
- FormatVersion.cs
- OptimalTextSource.cs
- AuthenticatedStream.cs
- ViewStateModeByIdAttribute.cs
- BitmapEffectInputData.cs
- ConnectionString.cs
- FrameworkObject.cs
- XmlProcessingInstruction.cs
- MessageQueueInstaller.cs
- CustomDictionarySources.cs
- RangeValueProviderWrapper.cs
- DataGridPageChangedEventArgs.cs
- EventItfInfo.cs
- PersonalizablePropertyEntry.cs
- UserControl.cs
- COM2FontConverter.cs
- HandleCollector.cs
- SmtpLoginAuthenticationModule.cs
- ProxyWebPartManager.cs
- LockedBorderGlyph.cs
- XmlReflectionMember.cs
- EditorBrowsableAttribute.cs
- ExpandCollapseProviderWrapper.cs
- Baml2006KnownTypes.cs
- HitTestParameters3D.cs
- PageStatePersister.cs
- AuthStoreRoleProvider.cs
- GeometryDrawing.cs
- RefreshEventArgs.cs
- LayoutTableCell.cs
- DuplicateWaitObjectException.cs
- XPathException.cs
- ReaderWriterLock.cs
- StreamHelper.cs
- DirectoryInfo.cs
- Aes.cs
- DetectEofStream.cs
- SystemTcpStatistics.cs
- VisualTreeHelper.cs
- XomlCompilerResults.cs
- ResourceType.cs
- MenuBindingsEditor.cs
- AuthorizationSection.cs
- DataGridParentRows.cs
- MetadataPropertyCollection.cs
- AnnotationComponentManager.cs
- Vector3D.cs
- _TLSstream.cs
- XmlElement.cs
- CompositeCollection.cs
- DataGridHeaderBorder.cs
- SafeBitVector32.cs
- DataViewListener.cs
- CacheRequest.cs
- SaveWorkflowAsyncResult.cs
- FileUpload.cs
- OutputScopeManager.cs
- WebPartAddingEventArgs.cs
- RubberbandSelector.cs
- TextBox.cs
- SafeEventLogWriteHandle.cs
- EntitySqlQueryBuilder.cs
- DecimalAnimation.cs
- XMLSchema.cs
- ParseElementCollection.cs
- NativeMethods.cs
- RelationalExpressions.cs
- CheckBoxList.cs
- ExpressionBinding.cs
- EntityDataSourceDataSelection.cs
- RequestCacheValidator.cs
- CacheEntry.cs
- CompModSwitches.cs
- NameValueSectionHandler.cs
- NavigationProperty.cs
- NumberSubstitution.cs
- OrderedHashRepartitionEnumerator.cs
- LogRecordSequence.cs
- ClientConvert.cs
- SchemaDeclBase.cs
- DateTime.cs
- Group.cs
- UserCancellationException.cs
- SqlVersion.cs
- DataSysAttribute.cs
- InstanceStoreQueryResult.cs
- MarkupCompilePass2.cs
- MappingException.cs
- VariableDesigner.xaml.cs
- HierarchicalDataBoundControlAdapter.cs
- RangeContentEnumerator.cs
- Label.cs
- PasswordTextContainer.cs
- __Filters.cs
- FixedFlowMap.cs