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
- TokenDescriptor.cs
- ShaperBuffers.cs
- HyperLinkColumn.cs
- MessagePropertyDescription.cs
- PatternMatchRules.cs
- IsolatedStorageFile.cs
- sortedlist.cs
- DecoderNLS.cs
- File.cs
- HelpInfo.cs
- CheckedListBox.cs
- FormsAuthenticationConfiguration.cs
- SqlParameterCollection.cs
- CustomActivityDesigner.cs
- ConfigurationFileMap.cs
- TypeToken.cs
- FormParameter.cs
- SafeCryptoHandles.cs
- Marshal.cs
- ResponseStream.cs
- WindowsRegion.cs
- ObjectParameterCollection.cs
- WebHeaderCollection.cs
- XappLauncher.cs
- DrawingGroupDrawingContext.cs
- ResourceExpressionBuilder.cs
- DocumentGridContextMenu.cs
- ExtendedProperty.cs
- Mappings.cs
- Stack.cs
- HwndSubclass.cs
- ProgressBarRenderer.cs
- ResourceAttributes.cs
- KnownBoxes.cs
- DataGridViewColumnTypePicker.cs
- Utils.cs
- Container.cs
- TextElementEnumerator.cs
- SignatureSummaryDialog.cs
- CancellationToken.cs
- SystemIPv4InterfaceProperties.cs
- NetworkInterface.cs
- MetadataArtifactLoaderCompositeFile.cs
- AuthorizationRule.cs
- controlskin.cs
- ThreadStartException.cs
- OutputCacheModule.cs
- Interlocked.cs
- PartitionResolver.cs
- ContextProperty.cs
- PenLineJoinValidation.cs
- ImmutableCollection.cs
- CrossAppDomainChannel.cs
- VisualTransition.cs
- CodeExpressionRuleDeclaration.cs
- DiffuseMaterial.cs
- EntityConnectionStringBuilder.cs
- OutputCacheSettingsSection.cs
- ArrayWithOffset.cs
- MetaModel.cs
- DataGridTableCollection.cs
- EventLogPermissionEntry.cs
- ReadOnlyHierarchicalDataSourceView.cs
- OutgoingWebResponseContext.cs
- _ConnectOverlappedAsyncResult.cs
- MetricEntry.cs
- WhileDesigner.cs
- GregorianCalendar.cs
- EntityCommandExecutionException.cs
- UInt32Storage.cs
- HTTPNotFoundHandler.cs
- PrinterUnitConvert.cs
- VariableBinder.cs
- FormViewInsertEventArgs.cs
- OrderablePartitioner.cs
- FamilyMap.cs
- DataKeyCollection.cs
- CollectionEditor.cs
- MultiBindingExpression.cs
- StartUpEventArgs.cs
- RSAPKCS1KeyExchangeFormatter.cs
- HtmlShimManager.cs
- DataControlReferenceCollection.cs
- CommandHelpers.cs
- MemberDomainMap.cs
- RequestValidator.cs
- MembershipUser.cs
- Byte.cs
- GridViewItemAutomationPeer.cs
- safelink.cs
- SplitterCancelEvent.cs
- RNGCryptoServiceProvider.cs
- assertwrapper.cs
- PropertyChange.cs
- ZipArchive.cs
- SelectedDatesCollection.cs
- SQLConvert.cs
- ViewgenContext.cs
- SecurityTokenAuthenticator.cs
- WebPartManager.cs