Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XamlToRtfWriter.cs
- EntityDataSourceState.cs
- ConstructorArgumentAttribute.cs
- SecurityException.cs
- SqlGenerator.cs
- SoapAttributeAttribute.cs
- PropertyIDSet.cs
- Duration.cs
- PassportAuthentication.cs
- Command.cs
- WebPartConnectionCollection.cs
- OleDbMetaDataFactory.cs
- HandlerBase.cs
- ServicesUtilities.cs
- DataGridRelationshipRow.cs
- EnumConverter.cs
- XslNumber.cs
- IndependentAnimationStorage.cs
- DecoderReplacementFallback.cs
- DbConnectionStringBuilder.cs
- TemplateNodeContextMenu.cs
- HttpDateParse.cs
- HandlerBase.cs
- DataGridViewColumnCollection.cs
- ConfigurationSectionHelper.cs
- GridViewItemAutomationPeer.cs
- PlatformNotSupportedException.cs
- RootBrowserWindow.cs
- ManagementOperationWatcher.cs
- RawStylusInputCustomData.cs
- KeyInstance.cs
- DbConnectionStringBuilder.cs
- PopupRoot.cs
- BasePropertyDescriptor.cs
- Bits.cs
- OdbcException.cs
- FloatAverageAggregationOperator.cs
- _TransmitFileOverlappedAsyncResult.cs
- QilFactory.cs
- TypeContext.cs
- ResolveNameEventArgs.cs
- SspiWrapper.cs
- XmlSchemas.cs
- activationcontext.cs
- SafeFileMappingHandle.cs
- AnnotationStore.cs
- OleDbRowUpdatedEvent.cs
- OutputCacheProfileCollection.cs
- DropShadowEffect.cs
- wmiutil.cs
- X509UI.cs
- DBPropSet.cs
- DoubleMinMaxAggregationOperator.cs
- EventSinkActivityDesigner.cs
- StatusBarDrawItemEvent.cs
- COM2FontConverter.cs
- HttpDebugHandler.cs
- PrintingPermissionAttribute.cs
- RectangleGeometry.cs
- RelationshipEndCollection.cs
- DelegatingConfigHost.cs
- HttpListenerElement.cs
- SchemaObjectWriter.cs
- ToolStripItemEventArgs.cs
- DataRelation.cs
- HttpCacheVary.cs
- TaskFileService.cs
- IndexedEnumerable.cs
- VBIdentifierNameEditor.cs
- MouseGesture.cs
- FormViewModeEventArgs.cs
- NextPreviousPagerField.cs
- NameSpaceExtractor.cs
- ReaderWriterLock.cs
- CodeDomConfigurationHandler.cs
- SHA512.cs
- HScrollBar.cs
- SecurityPermission.cs
- CodeDefaultValueExpression.cs
- BindableTemplateBuilder.cs
- ImageListUtils.cs
- RoutedEventConverter.cs
- CodeExporter.cs
- TextDecorationCollection.cs
- ThreadExceptionEvent.cs
- CacheHelper.cs
- ListControl.cs
- HttpBrowserCapabilitiesWrapper.cs
- TextEditorTables.cs
- DatatypeImplementation.cs
- TTSVoice.cs
- TextDecorationLocationValidation.cs
- SignatureToken.cs
- SqlRewriteScalarSubqueries.cs
- EditorZoneDesigner.cs
- X509Extension.cs
- DrawingAttributesDefaultValueFactory.cs
- SchemaType.cs
- DataGridViewRowCancelEventArgs.cs
- ValidatingReaderNodeData.cs