Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeLocalMemHandle.cs / 1 / SafeLocalMemHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeLocalMemHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for handle to local 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 SafeLocalMemHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeLocalMemHandle() : base(true) {} [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeLocalMemHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Auto, SetLastError=true, BestFitMapping=false)] internal static extern unsafe bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, int StringSDRevision, out SafeLocalMemHandle pSecurityDescriptor, IntPtr SecurityDescriptorSize); [DllImport(ExternDll.Kernel32)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern IntPtr LocalFree(IntPtr hMem); override protected bool ReleaseHandle() { return LocalFree(handle) == IntPtr.Zero; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeLocalMemHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for handle to local 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 SafeLocalMemHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeLocalMemHandle() : base(true) {} [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeLocalMemHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Auto, SetLastError=true, BestFitMapping=false)] internal static extern unsafe bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, int StringSDRevision, out SafeLocalMemHandle pSecurityDescriptor, IntPtr SecurityDescriptorSize); [DllImport(ExternDll.Kernel32)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern IntPtr LocalFree(IntPtr hMem); override protected bool ReleaseHandle() { return LocalFree(handle) == IntPtr.Zero; } } } // 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
- TextHintingModeValidation.cs
- GetParentChain.cs
- Latin1Encoding.cs
- PeekCompletedEventArgs.cs
- TableChangeProcessor.cs
- AppDomainManager.cs
- Visual.cs
- DataGridCellEditEndingEventArgs.cs
- EnumBuilder.cs
- ErrorLog.cs
- SrgsSemanticInterpretationTag.cs
- DecoderReplacementFallback.cs
- DataMisalignedException.cs
- EmptyQuery.cs
- Span.cs
- ChannelManager.cs
- ResourceReferenceExpressionConverter.cs
- ItemType.cs
- BlockCollection.cs
- WinFormsUtils.cs
- DiscreteKeyFrames.cs
- TextTreePropertyUndoUnit.cs
- CacheEntry.cs
- Memoizer.cs
- PersonalizationState.cs
- XmlSchemaRedefine.cs
- MenuItemStyleCollection.cs
- SessionEndingCancelEventArgs.cs
- CodeDirectoryCompiler.cs
- HitTestParameters3D.cs
- WebException.cs
- SimpleTypesSurrogate.cs
- Group.cs
- BuilderPropertyEntry.cs
- HttpCachePolicy.cs
- SolidColorBrush.cs
- DocumentAutomationPeer.cs
- EmptyArray.cs
- OperationPerformanceCounters.cs
- ActivityDesigner.cs
- SimpleRecyclingCache.cs
- XMLSchema.cs
- ApplicationFileParser.cs
- Odbc32.cs
- CustomPopupPlacement.cs
- UIElement3D.cs
- CodeDirectiveCollection.cs
- UndoManager.cs
- PipeSecurity.cs
- SmtpFailedRecipientException.cs
- ChannelManager.cs
- OleServicesContext.cs
- SafeRightsManagementHandle.cs
- XmlSchemaSet.cs
- XmlSchemaAppInfo.cs
- LocatorPartList.cs
- PrefixHandle.cs
- SystemColorTracker.cs
- PathFigureCollection.cs
- EntityDataSourceEntitySetNameItem.cs
- ContourSegment.cs
- XsltLoader.cs
- CustomAttributeBuilder.cs
- FolderLevelBuildProviderCollection.cs
- DataGridViewCellPaintingEventArgs.cs
- PartialCachingAttribute.cs
- SystemIcmpV4Statistics.cs
- GifBitmapEncoder.cs
- IDReferencePropertyAttribute.cs
- XmlNodeList.cs
- RectAnimationClockResource.cs
- D3DImage.cs
- Pen.cs
- XmlIterators.cs
- OdbcParameter.cs
- ProxyWebPartManagerDesigner.cs
- UrlMappingCollection.cs
- Int64Converter.cs
- SmiRequestExecutor.cs
- ProjectedSlot.cs
- BuildManager.cs
- CircleHotSpot.cs
- TypeDependencyAttribute.cs
- QilParameter.cs
- TimeSpanValidatorAttribute.cs
- CqlParserHelpers.cs
- TextCompositionManager.cs
- DataGridViewColumnEventArgs.cs
- VectorAnimationBase.cs
- CharacterBuffer.cs
- XmlNamespaceDeclarationsAttribute.cs
- EventLog.cs
- DocumentViewerConstants.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- HtmlTitle.cs
- DictionaryEntry.cs
- OpenTypeLayout.cs
- AsyncParams.cs
- XmlQueryTypeFactory.cs
- ObjectContext.cs