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
- FileRecordSequence.cs
- CaseInsensitiveOrdinalStringComparer.cs
- TdsParserStateObject.cs
- SecurityTokenRequirement.cs
- InputLanguageEventArgs.cs
- SymDocumentType.cs
- XmlSchemaInfo.cs
- UriParserTemplates.cs
- ResXBuildProvider.cs
- URL.cs
- InstanceLockLostException.cs
- SelectedDatesCollection.cs
- XamlBuildProvider.cs
- TypeConverterAttribute.cs
- ComponentEditorForm.cs
- Utils.cs
- DataGridViewTextBoxCell.cs
- WinFormsComponentEditor.cs
- ColumnCollection.cs
- UdpContractFilterBehavior.cs
- ResourceContainerWrapper.cs
- ReflectionServiceProvider.cs
- OnOperation.cs
- PlatformNotSupportedException.cs
- ElementHost.cs
- WebPageTraceListener.cs
- QilLiteral.cs
- XmlNamespaceDeclarationsAttribute.cs
- Trigger.cs
- SpeakCompletedEventArgs.cs
- ThreadStaticAttribute.cs
- ObjectComplexPropertyMapping.cs
- XsltInput.cs
- DataStreams.cs
- ObjectManager.cs
- CustomErrorsSection.cs
- TransferMode.cs
- CodePropertyReferenceExpression.cs
- SiteMapNode.cs
- WebServiceParameterData.cs
- LocationUpdates.cs
- GeneralTransform3DTo2D.cs
- ProtocolException.cs
- EntityClientCacheKey.cs
- DataDesignUtil.cs
- CachedTypeface.cs
- StickyNoteContentControl.cs
- CodeGroup.cs
- AddInController.cs
- CounterSample.cs
- SqlProviderManifest.cs
- DataControlImageButton.cs
- SizeChangedEventArgs.cs
- WindowsListView.cs
- NonNullItemCollection.cs
- OdbcConnectionOpen.cs
- ImageMap.cs
- HMAC.cs
- BaseValidatorDesigner.cs
- OleDbFactory.cs
- CodeCommentStatementCollection.cs
- TypeTypeConverter.cs
- ApplicationManager.cs
- QilGenerator.cs
- regiisutil.cs
- TripleDES.cs
- Parser.cs
- SafeRegistryKey.cs
- BasicHttpSecurity.cs
- Button.cs
- VisualTarget.cs
- ErrorHandlingReceiver.cs
- CompareValidator.cs
- PrtTicket_Public_Simple.cs
- EdmConstants.cs
- RequestQueue.cs
- ListBoxItem.cs
- coordinatorscratchpad.cs
- WebCategoryAttribute.cs
- EditorOptionAttribute.cs
- StyleCollection.cs
- SignatureDescription.cs
- NamedElement.cs
- AttachmentCollection.cs
- TextShapeableCharacters.cs
- QuaternionConverter.cs
- DynamicObject.cs
- OdbcConnectionHandle.cs
- DataGridViewCellEventArgs.cs
- XmlSchemas.cs
- DataColumnChangeEvent.cs
- Vector3dCollection.cs
- WebPartActionVerb.cs
- PersonalizationStateInfo.cs
- CodeMemberProperty.cs
- DocumentsTrace.cs
- DataGridItemCollection.cs
- JsonFormatGeneratorStatics.cs
- NavigationWindowAutomationPeer.cs
- Vector.cs