Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- WindowsComboBox.cs
- JoinSymbol.cs
- DuplicateDetector.cs
- SecurityUniqueId.cs
- SrgsOneOf.cs
- ToolStripProgressBar.cs
- ProgressiveCrcCalculatingStream.cs
- AuthenticationException.cs
- RuleValidation.cs
- UiaCoreProviderApi.cs
- MethodImplAttribute.cs
- ComponentManagerBroker.cs
- ConfigurationSchemaErrors.cs
- HasCopySemanticsAttribute.cs
- ActivationWorker.cs
- EventMappingSettingsCollection.cs
- MailMessage.cs
- AffineTransform3D.cs
- XmlQualifiedName.cs
- AutomationPattern.cs
- ThreadAbortException.cs
- XmlSchemaCompilationSettings.cs
- Point.cs
- TemplateXamlTreeBuilder.cs
- SerialReceived.cs
- EntityContainer.cs
- Drawing.cs
- DoubleSumAggregationOperator.cs
- ExtensionSimplifierMarkupObject.cs
- PrimarySelectionGlyph.cs
- BuildProviderUtils.cs
- XmlSerializerSection.cs
- UnsignedPublishLicense.cs
- DesignerView.cs
- NetworkAddressChange.cs
- XmlIlTypeHelper.cs
- Message.cs
- WMIGenerator.cs
- TreeNodeCollection.cs
- WindowsTokenRoleProvider.cs
- Profiler.cs
- TemplateContainer.cs
- ArrayList.cs
- RadioButtonAutomationPeer.cs
- PenThreadWorker.cs
- BitmapFrame.cs
- DataBindingExpressionBuilder.cs
- EditorPartChrome.cs
- SimpleHandlerBuildProvider.cs
- CodeTypeOfExpression.cs
- TypeCollectionDesigner.xaml.cs
- Version.cs
- FileEnumerator.cs
- DiscoveryUtility.cs
- ListManagerBindingsCollection.cs
- UriScheme.cs
- TargetException.cs
- SystemGatewayIPAddressInformation.cs
- HMACRIPEMD160.cs
- GZipStream.cs
- UnsafeNativeMethods.cs
- ErrorRuntimeConfig.cs
- DiscoveryRequestHandler.cs
- TransformerConfigurationWizardBase.cs
- NullableConverter.cs
- EventEntry.cs
- CodeEventReferenceExpression.cs
- BitmapEffectInputConnector.cs
- DataSvcMapFileSerializer.cs
- HtmlForm.cs
- XmlElementElement.cs
- SmtpNegotiateAuthenticationModule.cs
- ChannelTraceRecord.cs
- MembershipUser.cs
- CommonRemoteMemoryBlock.cs
- DataRelationPropertyDescriptor.cs
- VariableBinder.cs
- SyntaxCheck.cs
- XmlSerializerFaultFormatter.cs
- XmlSchemaAttribute.cs
- C14NUtil.cs
- GetReadStreamResult.cs
- MetadataWorkspace.cs
- SocketInformation.cs
- PartialCachingAttribute.cs
- NameNode.cs
- XmlMemberMapping.cs
- SendKeys.cs
- RewritingPass.cs
- ToolZone.cs
- AlphaSortedEnumConverter.cs
- WMICapabilities.cs
- Accessors.cs
- AttributeParameterInfo.cs
- UpdatePanelTriggerCollection.cs
- TextElementAutomationPeer.cs
- ImageClickEventArgs.cs
- IdnMapping.cs
- _ListenerResponseStream.cs
- NTAccount.cs