Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMappingHandle.cs / 1 / SafeFileMappingHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMappingHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for handle to file mappings, returned by ** CreateFileMapping and OpenFileMapping. Used for shared ** memory. ** ** Date: July 8, 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 SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that CreateFileMapping returns 0 on failure. // Note that you can pass in -1 for the hFile parameter. [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeFileMappingHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseHandle(IntPtr handle); override protected bool ReleaseHandle() { return CloseHandle(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMappingHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for handle to file mappings, returned by ** CreateFileMapping and OpenFileMapping. Used for shared ** memory. ** ** Date: July 8, 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 SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that CreateFileMapping returns 0 on failure. // Note that you can pass in -1 for the hFile parameter. [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeFileMappingHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseHandle(IntPtr handle); override protected bool ReleaseHandle() { return CloseHandle(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
- PropertyManager.cs
- DataViewSettingCollection.cs
- ReadOnlyObservableCollection.cs
- Util.cs
- CriticalFinalizerObject.cs
- FontStretchConverter.cs
- BindingObserver.cs
- ContainerUIElement3D.cs
- ITreeGenerator.cs
- ChannelServices.cs
- InternalsVisibleToAttribute.cs
- _SSPISessionCache.cs
- PersonalizationProviderCollection.cs
- Message.cs
- DataServiceRequestException.cs
- BamlBinaryReader.cs
- MessageAction.cs
- MenuStrip.cs
- WorkflowTransactionService.cs
- Event.cs
- UnsafeNativeMethodsPenimc.cs
- Directory.cs
- PropertyInformationCollection.cs
- ErrorWrapper.cs
- AssociationTypeEmitter.cs
- EntityCommand.cs
- SafeNativeMethodsMilCoreApi.cs
- RawStylusInputCustomData.cs
- CellIdBoolean.cs
- EndpointAddressMessageFilter.cs
- CollectionViewProxy.cs
- AlphaSortedEnumConverter.cs
- RawKeyboardInputReport.cs
- Boolean.cs
- JoinTreeSlot.cs
- DoWorkEventArgs.cs
- DesignerDataParameter.cs
- Propagator.JoinPropagator.cs
- AssemblyResourceLoader.cs
- BatchWriter.cs
- SafeLibraryHandle.cs
- ValidationRuleCollection.cs
- AssemblyCache.cs
- RoleGroupCollection.cs
- DetailsViewUpdatedEventArgs.cs
- MissingFieldException.cs
- OperationAbortedException.cs
- WebPartZoneBase.cs
- TableDetailsRow.cs
- MenuItem.cs
- XmlNullResolver.cs
- CatalogPartCollection.cs
- DataGridAddNewRow.cs
- BookmarkScopeInfo.cs
- UnsafeNativeMethods.cs
- HierarchicalDataBoundControl.cs
- TemplateBindingExpressionConverter.cs
- InheritablePropertyChangeInfo.cs
- SqlTypeConverter.cs
- DateTimeFormat.cs
- ShadowGlyph.cs
- SingleObjectCollection.cs
- TargetInvocationException.cs
- Page.cs
- SecurityTokenInclusionMode.cs
- ZipQueryOperator.cs
- ToolBar.cs
- UnauthorizedAccessException.cs
- SerialReceived.cs
- MethodAccessException.cs
- CounterSampleCalculator.cs
- TcpProcessProtocolHandler.cs
- AppSettingsExpressionBuilder.cs
- FastEncoder.cs
- WindowShowOrOpenTracker.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- TableHeaderCell.cs
- DBBindings.cs
- SystemTcpStatistics.cs
- ArraySubsetEnumerator.cs
- ItemList.cs
- ThousandthOfEmRealPoints.cs
- DPCustomTypeDescriptor.cs
- BitmapPalette.cs
- DataMemberAttribute.cs
- ConstrainedDataObject.cs
- SmiXetterAccessMap.cs
- MailBnfHelper.cs
- RewritingPass.cs
- FixedDocumentPaginator.cs
- ValueType.cs
- ListBoxItemWrapperAutomationPeer.cs
- DesignerVerb.cs
- PanningMessageFilter.cs
- NetworkCredential.cs
- Inflater.cs
- DetailsViewPageEventArgs.cs
- WS2007HttpBinding.cs
- AutoCompleteStringCollection.cs
- PasswordPropertyTextAttribute.cs