Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMapViewHandle.cs / 1 / SafeFileMapViewHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMapViewHandle ** **Author: Brian Grunkemeyer ([....]) ** ** A wrapper for handles returned from MapViewOfFile, used ** for shared memory. ** ** Date: August 7, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeFileMapViewHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that MapViewOfFile returns 0 on failure internal SafeFileMapViewHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool UnmapViewOfFile(IntPtr handle); override protected bool ReleaseHandle() { return UnmapViewOfFile(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMapViewHandle ** **Author: Brian Grunkemeyer ([....]) ** ** A wrapper for handles returned from MapViewOfFile, used ** for shared memory. ** ** Date: August 7, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeFileMapViewHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that MapViewOfFile returns 0 on failure internal SafeFileMapViewHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool UnmapViewOfFile(IntPtr handle); override protected bool ReleaseHandle() { return UnmapViewOfFile(handle); } } } // 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
- MiniParameterInfo.cs
- unitconverter.cs
- MarshalDirectiveException.cs
- DataReaderContainer.cs
- GridView.cs
- TaiwanLunisolarCalendar.cs
- ScriptIgnoreAttribute.cs
- TraceContextEventArgs.cs
- SortFieldComparer.cs
- SiteMapPathDesigner.cs
- XPathMessageContext.cs
- ImageMapEventArgs.cs
- DependentList.cs
- DBCommandBuilder.cs
- OleCmdHelper.cs
- AutoGeneratedFieldProperties.cs
- ImageInfo.cs
- XmlNavigatorStack.cs
- SqlClientFactory.cs
- _LocalDataStore.cs
- BaseCodeDomTreeGenerator.cs
- Propagator.Evaluator.cs
- SecurityResources.cs
- MostlySingletonList.cs
- XmlSchemaIdentityConstraint.cs
- NativeMethods.cs
- SerializationFieldInfo.cs
- RuleProcessor.cs
- WizardDesigner.cs
- VisualStyleTypesAndProperties.cs
- SQLBytesStorage.cs
- OneOf.cs
- Psha1DerivedKeyGeneratorHelper.cs
- ModelPropertyDescriptor.cs
- LayoutExceptionEventArgs.cs
- WorkflowRuntimeSection.cs
- PreviewPageInfo.cs
- HttpCookiesSection.cs
- ChtmlTextBoxAdapter.cs
- UnsafeNativeMethods.cs
- DataGridViewTextBoxEditingControl.cs
- EntitySqlQueryCacheKey.cs
- WeakHashtable.cs
- PermissionListSet.cs
- PenLineCapValidation.cs
- Queue.cs
- ScrollBar.cs
- AssociationSetEnd.cs
- DynamicPropertyReader.cs
- RuleProcessor.cs
- DataListItemCollection.cs
- PointConverter.cs
- XmlReaderSettings.cs
- ThemeDirectoryCompiler.cs
- CodeIdentifiers.cs
- _UriTypeConverter.cs
- TrackingProfile.cs
- SerializationSectionGroup.cs
- TextEncodedRawTextWriter.cs
- PrivateFontCollection.cs
- HtmlMeta.cs
- WindowsSolidBrush.cs
- ImpersonateTokenRef.cs
- CharacterBufferReference.cs
- DataViewListener.cs
- CompilerWrapper.cs
- CaseInsensitiveHashCodeProvider.cs
- BroadcastEventHelper.cs
- IntegerValidator.cs
- DataGridColumn.cs
- ToggleButton.cs
- SrgsRule.cs
- RC2CryptoServiceProvider.cs
- ByteStack.cs
- SerializationStore.cs
- XslVisitor.cs
- IdentitySection.cs
- CodeTryCatchFinallyStatement.cs
- EnumUnknown.cs
- _PooledStream.cs
- XhtmlBasicTextViewAdapter.cs
- ReliabilityContractAttribute.cs
- MouseCaptureWithinProperty.cs
- RecordBuilder.cs
- CacheMemory.cs
- SearchForVirtualItemEventArgs.cs
- DataGridCellClipboardEventArgs.cs
- UIElementAutomationPeer.cs
- ComboBoxRenderer.cs
- ScriptReferenceEventArgs.cs
- WebZone.cs
- ResourceCategoryAttribute.cs
- IPAddressCollection.cs
- BufferedReadStream.cs
- DataPagerField.cs
- RegistryPermission.cs
- tooltip.cs
- ValidateNames.cs
- GlyphsSerializer.cs
- Timer.cs