Code:
/ FX-1434 / FX-1434 / 1.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
- TableAdapterManagerMethodGenerator.cs
- CombinedGeometry.cs
- MessageBox.cs
- Misc.cs
- TypeViewSchema.cs
- ConnectivityStatus.cs
- SafeIUnknown.cs
- ChtmlImageAdapter.cs
- StringHelper.cs
- DataGridViewAddColumnDialog.cs
- InkCanvasFeedbackAdorner.cs
- ChannelBase.cs
- AppSecurityManager.cs
- MinimizableAttributeTypeConverter.cs
- ObjectTypeMapping.cs
- FileLevelControlBuilderAttribute.cs
- ModuleElement.cs
- HttpHandlerActionCollection.cs
- TerminatorSinks.cs
- MailAddressCollection.cs
- Currency.cs
- WebPartConnectionsCancelVerb.cs
- RIPEMD160Managed.cs
- WebBrowsableAttribute.cs
- IriParsingElement.cs
- RenderingEventArgs.cs
- HttpValueCollection.cs
- QueryTask.cs
- MemberNameValidator.cs
- ReturnEventArgs.cs
- CursorConverter.cs
- RuntimeArgumentHandle.cs
- _HelperAsyncResults.cs
- XmlMemberMapping.cs
- LOSFormatter.cs
- MemberPath.cs
- PathFigureCollection.cs
- EventTrigger.cs
- PersonalizationProviderHelper.cs
- ReadOnlyHierarchicalDataSource.cs
- ReadOnlyPermissionSet.cs
- ArrayConverter.cs
- SoapConverter.cs
- _NegoState.cs
- SyntaxCheck.cs
- ScalarRestriction.cs
- COM2PictureConverter.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- Encoder.cs
- versioninfo.cs
- Oci.cs
- CodeCommentStatement.cs
- RelatedEnd.cs
- ChildrenQuery.cs
- ISFClipboardData.cs
- precedingquery.cs
- TogglePatternIdentifiers.cs
- GlyphCollection.cs
- _AutoWebProxyScriptWrapper.cs
- SoapIncludeAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- CryptoHelper.cs
- CodeAccessSecurityEngine.cs
- RijndaelManagedTransform.cs
- Encoder.cs
- CFStream.cs
- uribuilder.cs
- ConsoleKeyInfo.cs
- StatusBarItemAutomationPeer.cs
- DbProviderServices.cs
- MultipleViewPattern.cs
- SqlError.cs
- MetadataSet.cs
- SBCSCodePageEncoding.cs
- Span.cs
- HtmlFormAdapter.cs
- AsmxEndpointPickerExtension.cs
- CompilationLock.cs
- SQLConvert.cs
- SchemaNotation.cs
- VirtualPathUtility.cs
- CqlParserHelpers.cs
- CertificateElement.cs
- SoapObjectInfo.cs
- MemberPath.cs
- DateTimeConverter.cs
- EventLogPermissionAttribute.cs
- HtmlProps.cs
- Flattener.cs
- LogExtent.cs
- FrameworkElement.cs
- PropertyItem.cs
- AssemblyNameProxy.cs
- ActivationArguments.cs
- MouseGestureConverter.cs
- DuplexChannelFactory.cs
- TypeConverterAttribute.cs
- MetaDataInfo.cs
- ContentFileHelper.cs
- XPathPatternParser.cs