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
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- FontEmbeddingManager.cs
- AttributeUsageAttribute.cs
- CanonicalFontFamilyReference.cs
- NaturalLanguageHyphenator.cs
- UnwrappedTypesXmlSerializerManager.cs
- ReadContentAsBinaryHelper.cs
- QueryConverter.cs
- PEFileReader.cs
- TypeBrowserDialog.cs
- VBIdentifierTrimConverter.cs
- DataObject.cs
- BaseEntityWrapper.cs
- PathParser.cs
- AssemblyInfo.cs
- DetailsViewPageEventArgs.cs
- DateTimeSerializationSection.cs
- Matrix3D.cs
- ChildTable.cs
- Operand.cs
- ErrorWrapper.cs
- HttpInputStream.cs
- CompoundFileDeflateTransform.cs
- WithStatement.cs
- MetadataItemSerializer.cs
- SqlDataSource.cs
- NetCodeGroup.cs
- DiscardableAttribute.cs
- altserialization.cs
- PermissionSet.cs
- TextEffectResolver.cs
- ContentType.cs
- BaseProcessor.cs
- MobileListItem.cs
- SerializationBinder.cs
- MetafileEditor.cs
- TextSpanModifier.cs
- SecureUICommand.cs
- Validator.cs
- Evaluator.cs
- UnsafeNativeMethods.cs
- InvokeHandlers.cs
- ListItem.cs
- InlineCollection.cs
- EditorPart.cs
- XmlCollation.cs
- PropertyPathConverter.cs
- CopyOnWriteList.cs
- StringPropertyBuilder.cs
- CheckBoxRenderer.cs
- TargetException.cs
- LinkButton.cs
- ADConnectionHelper.cs
- CompiledRegexRunner.cs
- ByteAnimation.cs
- LayeredChannelListener.cs
- OleDbRowUpdatingEvent.cs
- RegistryKey.cs
- MsmqChannelFactory.cs
- NamespaceDisplayAutomationPeer.cs
- HtmlElement.cs
- Slider.cs
- MyContact.cs
- XmlCharCheckingWriter.cs
- Bold.cs
- DbgUtil.cs
- ZoneButton.cs
- XmlEntityReference.cs
- ColumnHeader.cs
- XamlSerializerUtil.cs
- ValidatorUtils.cs
- AutomationPropertyInfo.cs
- WsatAdminException.cs
- RuntimeConfigLKG.cs
- ConfigXmlComment.cs
- XmlAttributes.cs
- XPathBuilder.cs
- MetadataException.cs
- ValidationHelpers.cs
- OleDbPropertySetGuid.cs
- ConnectionStringSettings.cs
- EFAssociationProvider.cs
- HostProtectionPermission.cs
- WindowsListViewSubItem.cs
- MenuItem.cs
- WebPartCatalogCloseVerb.cs
- DocumentViewerBase.cs
- ViewBase.cs
- WebControlAdapter.cs
- Parser.cs
- ComponentCollection.cs
- ProfileInfo.cs
- HorizontalAlignConverter.cs
- AttributeUsageAttribute.cs
- ReflectPropertyDescriptor.cs
- LoadMessageLogger.cs
- LassoHelper.cs
- ConnectionsZone.cs
- PngBitmapEncoder.cs
- FocusChangedEventArgs.cs