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
- SqlServer2KCompatibilityAnnotation.cs
- XmlSchemaAttributeGroupRef.cs
- XmlDocumentFragment.cs
- XdrBuilder.cs
- ComplexType.cs
- ToolboxComponentsCreatedEventArgs.cs
- WindowInteropHelper.cs
- ParserContext.cs
- GatewayDefinition.cs
- DiscardableAttribute.cs
- StreamInfo.cs
- XmlTextAttribute.cs
- XmlSignatureManifest.cs
- FormCollection.cs
- WindowsScrollBar.cs
- ComUdtElementCollection.cs
- DataGridState.cs
- BoundColumn.cs
- ApplicationActivator.cs
- XmlDocumentSurrogate.cs
- NetDataContractSerializer.cs
- DoubleLink.cs
- ColorPalette.cs
- BinarySerializer.cs
- ButtonFieldBase.cs
- Bidi.cs
- Policy.cs
- OdbcConnection.cs
- BitConverter.cs
- ExpressionList.cs
- SystemThemeKey.cs
- DbConnectionPoolIdentity.cs
- DebugView.cs
- LoginNameDesigner.cs
- ToolStripPanelCell.cs
- StringExpressionSet.cs
- ProvidersHelper.cs
- assemblycache.cs
- Lasso.cs
- StorageEndPropertyMapping.cs
- CorrelationManager.cs
- SqlBuffer.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- LookupBindingPropertiesAttribute.cs
- TemplateNameScope.cs
- NodeFunctions.cs
- DoubleConverter.cs
- SchemaMapping.cs
- CornerRadiusConverter.cs
- WebPartActionVerb.cs
- SafeProcessHandle.cs
- ReflectPropertyDescriptor.cs
- HotSpotCollection.cs
- StylusPointDescription.cs
- DiscriminatorMap.cs
- OpCopier.cs
- DesignerCatalogPartChrome.cs
- CounterCreationData.cs
- PermissionToken.cs
- TreeNodeCollection.cs
- WebScriptMetadataFormatter.cs
- ImageCollectionEditor.cs
- ReverseQueryOperator.cs
- ImageSourceConverter.cs
- XmlWriterSettings.cs
- DefaultValidator.cs
- Activator.cs
- ComAdminInterfaces.cs
- BitmapMetadataBlob.cs
- GridViewUpdatedEventArgs.cs
- IntSecurity.cs
- ModelPropertyCollectionImpl.cs
- TempFiles.cs
- XmlSignificantWhitespace.cs
- Part.cs
- ConstNode.cs
- MachineKeyValidationConverter.cs
- RealProxy.cs
- MemberPathMap.cs
- Base64Encoder.cs
- DoWorkEventArgs.cs
- OraclePermissionAttribute.cs
- OleDbErrorCollection.cs
- PersianCalendar.cs
- PeerName.cs
- DateTimeOffsetAdapter.cs
- EditorZoneBase.cs
- RangeValueProviderWrapper.cs
- MatrixCamera.cs
- StyleCollection.cs
- ForeignKeyFactory.cs
- MessageSecurityVersionConverter.cs
- WebPartManager.cs
- _BasicClient.cs
- RubberbandSelector.cs
- ProcessInputEventArgs.cs
- WebPartAuthorizationEventArgs.cs
- SelectingProviderEventArgs.cs
- InstalledFontCollection.cs
- Clipboard.cs