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
- VisualStyleInformation.cs
- FormViewDeletedEventArgs.cs
- InvalidCastException.cs
- FtpWebResponse.cs
- FontFamilyConverter.cs
- ConditionalAttribute.cs
- UnsafePeerToPeerMethods.cs
- CompModSwitches.cs
- CorrelationService.cs
- OperationFormatStyle.cs
- _BaseOverlappedAsyncResult.cs
- TimeEnumHelper.cs
- CheckBox.cs
- ActivityTypeCodeDomSerializer.cs
- SafeRightsManagementQueryHandle.cs
- OrderingQueryOperator.cs
- GregorianCalendar.cs
- NegationPusher.cs
- StrongNamePublicKeyBlob.cs
- ServiceChannelManager.cs
- ContextMenu.cs
- HttpRequestCacheValidator.cs
- AbstractExpressions.cs
- SizeValueSerializer.cs
- EventLogPermissionEntryCollection.cs
- ApplicationManager.cs
- InitializerFacet.cs
- TypeDescriptionProviderAttribute.cs
- DbProviderSpecificTypePropertyAttribute.cs
- DataStorage.cs
- EntryWrittenEventArgs.cs
- List.cs
- BaseDataList.cs
- XmlIlGenerator.cs
- precedingsibling.cs
- PriorityChain.cs
- HierarchicalDataTemplate.cs
- UrlAuthFailedErrorFormatter.cs
- XmlQualifiedNameTest.cs
- MonitoringDescriptionAttribute.cs
- PreviewKeyDownEventArgs.cs
- RequestReplyCorrelator.cs
- Model3DGroup.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- AssertFilter.cs
- TypePropertyEditor.cs
- XmlTextReader.cs
- ImagingCache.cs
- FileDetails.cs
- XamlStream.cs
- MetadataItemSerializer.cs
- FilteredDataSetHelper.cs
- ImageCodecInfo.cs
- GreaterThanOrEqual.cs
- SqlBooleanizer.cs
- SourceFilter.cs
- HostingEnvironment.cs
- ZipIOExtraFieldZip64Element.cs
- SecureStringHasher.cs
- filewebrequest.cs
- Walker.cs
- ConfigurationSection.cs
- NamedObject.cs
- SynchronizationValidator.cs
- HMAC.cs
- RegisteredHiddenField.cs
- EmptyReadOnlyDictionaryInternal.cs
- QilReference.cs
- LinkArea.cs
- CodeValidator.cs
- CodeSnippetExpression.cs
- ManagementObjectSearcher.cs
- Deserializer.cs
- ByteAnimation.cs
- SizeIndependentAnimationStorage.cs
- FontEmbeddingManager.cs
- AppDomain.cs
- RowToParametersTransformer.cs
- BamlBinaryWriter.cs
- TargetControlTypeCache.cs
- SecurityMessageProperty.cs
- DesignConnection.cs
- CheckBoxRenderer.cs
- DataSourceXmlSerializer.cs
- Ray3DHitTestResult.cs
- WindowsSolidBrush.cs
- MetadataItemSerializer.cs
- BooleanConverter.cs
- OperatingSystem.cs
- AutoResetEvent.cs
- EntityConnectionStringBuilder.cs
- WebSysDescriptionAttribute.cs
- PasswordValidationException.cs
- ToggleProviderWrapper.cs
- DecimalSumAggregationOperator.cs
- ToolStripMenuItem.cs
- PixelShader.cs
- OwnerDrawPropertyBag.cs
- MouseDevice.cs