Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AQNBuilder.cs
- InternalEnumValidator.cs
- FileUtil.cs
- InfoCardArgumentException.cs
- HttpCapabilitiesEvaluator.cs
- IteratorDescriptor.cs
- PasswordDeriveBytes.cs
- XhtmlTextWriter.cs
- SimpleLine.cs
- ThreadExceptionDialog.cs
- ModulesEntry.cs
- VerificationAttribute.cs
- SrgsText.cs
- DependencyObjectType.cs
- GifBitmapEncoder.cs
- UnauthorizedWebPart.cs
- Thread.cs
- ParamArrayAttribute.cs
- ListBox.cs
- VisualBrush.cs
- EventLogEntryCollection.cs
- FrameworkTextComposition.cs
- TimeSpanStorage.cs
- DataBoundControlActionList.cs
- XmlSchemaImporter.cs
- NetNamedPipeBinding.cs
- TransformedBitmap.cs
- columnmapfactory.cs
- FormViewRow.cs
- HierarchicalDataSourceControl.cs
- CornerRadiusConverter.cs
- ParseChildrenAsPropertiesAttribute.cs
- ReferenceConverter.cs
- AsyncPostBackErrorEventArgs.cs
- TagPrefixInfo.cs
- _TLSstream.cs
- ResXBuildProvider.cs
- HostedTransportConfigurationBase.cs
- DefaultParameterValueAttribute.cs
- MessageLoggingFilterTraceRecord.cs
- JapaneseCalendar.cs
- LOSFormatter.cs
- Normalization.cs
- SelectingProviderEventArgs.cs
- EventLog.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ErrorRuntimeConfig.cs
- ISessionStateStore.cs
- COM2IProvidePropertyBuilderHandler.cs
- SerializationInfoEnumerator.cs
- Point3DIndependentAnimationStorage.cs
- CommonEndpointBehaviorElement.cs
- TraceLevelStore.cs
- EventHandlerService.cs
- Sql8ExpressionRewriter.cs
- Tuple.cs
- UIntPtr.cs
- VideoDrawing.cs
- SizeFConverter.cs
- ContextMenuStripActionList.cs
- QueryGeneratorBase.cs
- QuaternionRotation3D.cs
- TextCollapsingProperties.cs
- ParserContext.cs
- AppDomainManager.cs
- XsltSettings.cs
- JapaneseCalendar.cs
- XsltQilFactory.cs
- TransformConverter.cs
- EntityTypeEmitter.cs
- Enumerable.cs
- BooleanAnimationUsingKeyFrames.cs
- PrintPreviewDialog.cs
- MemberRelationshipService.cs
- EpmSourcePathSegment.cs
- ToolStripItemRenderEventArgs.cs
- XmlWriterSettings.cs
- SoapFormatterSinks.cs
- MimeParameterWriter.cs
- CodeDefaultValueExpression.cs
- dbenumerator.cs
- UnsafeNativeMethods.cs
- ActiveXContainer.cs
- MLangCodePageEncoding.cs
- TakeQueryOptionExpression.cs
- Int64KeyFrameCollection.cs
- StatusBarAutomationPeer.cs
- ToolStripPanelDesigner.cs
- LinqTreeNodeEvaluator.cs
- ToolStripSystemRenderer.cs
- DependencySource.cs
- ProvidePropertyAttribute.cs
- PieceDirectory.cs
- sortedlist.cs
- MarshalDirectiveException.cs
- DockPattern.cs
- TreeNodeBinding.cs
- BasicHttpMessageSecurityElement.cs
- DataGridCommandEventArgs.cs
- Axis.cs