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
- QueueProcessor.cs
- SqlGatherProducedAliases.cs
- DataConnectionHelper.cs
- RegistryKey.cs
- BamlLocalizableResource.cs
- DataTableNewRowEvent.cs
- MatchSingleFxEngineOpcode.cs
- SyndicationContent.cs
- EventNotify.cs
- EntityDataSource.cs
- CustomLineCap.cs
- SqlNotificationEventArgs.cs
- DataGridViewCell.cs
- StringToken.cs
- Stylesheet.cs
- BmpBitmapEncoder.cs
- XamlSerializationHelper.cs
- SchemaSetCompiler.cs
- XmlSchemaGroup.cs
- CqlWriter.cs
- SwitchCase.cs
- MenuItemStyle.cs
- CellParagraph.cs
- ListMarkerLine.cs
- XmlKeywords.cs
- StateMachineWorkflowInstance.cs
- Setter.cs
- WebPartZoneCollection.cs
- ReflectPropertyDescriptor.cs
- AtomContentProperty.cs
- LZCodec.cs
- PathTooLongException.cs
- ToolStripComboBox.cs
- CryptographicAttribute.cs
- DefaultObjectMappingItemCollection.cs
- DynamicObjectAccessor.cs
- ImpersonationContext.cs
- BevelBitmapEffect.cs
- AbstractDataSvcMapFileLoader.cs
- SelectiveScrollingGrid.cs
- DbCommandTree.cs
- ValidatorUtils.cs
- PointLight.cs
- MsmqBindingBase.cs
- StringComparer.cs
- HtmlControlPersistable.cs
- DataGridViewTextBoxColumn.cs
- TextDecorationCollection.cs
- FrameworkElementFactoryMarkupObject.cs
- SqlNode.cs
- AttachmentService.cs
- NetDataContractSerializer.cs
- RectangleF.cs
- MexHttpsBindingCollectionElement.cs
- VerbConverter.cs
- BitmapMetadataBlob.cs
- OSFeature.cs
- AttachedPropertyMethodSelector.cs
- WinFormsComponentEditor.cs
- TrustLevel.cs
- Light.cs
- RouteCollection.cs
- TypeElement.cs
- ReflectionHelper.cs
- ResXResourceSet.cs
- IISUnsafeMethods.cs
- PathSegment.cs
- ValidationErrorCollection.cs
- ExtensionQuery.cs
- RoutedEventConverter.cs
- HttpHandler.cs
- XXXInfos.cs
- InkCanvasAutomationPeer.cs
- ContractListAdapter.cs
- UpdateExpressionVisitor.cs
- HttpStreamFormatter.cs
- SchemaElementLookUpTable.cs
- AutomationTextAttribute.cs
- HtmlControlPersistable.cs
- QueryStatement.cs
- DataSourceCacheDurationConverter.cs
- TableChangeProcessor.cs
- XamlToRtfParser.cs
- DocComment.cs
- ExternalException.cs
- Control.cs
- TextDecorationCollectionConverter.cs
- SQLCharsStorage.cs
- recordstatescratchpad.cs
- RequiredFieldValidator.cs
- handlecollector.cs
- InitializationEventAttribute.cs
- HMACSHA384.cs
- XmlSchemaComplexContent.cs
- OleDbRowUpdatedEvent.cs
- Camera.cs
- DeviceContext.cs
- ChangePassword.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- ServiceEndpointCollection.cs