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
- RuntimeArgumentHandle.cs
- NaturalLanguageHyphenator.cs
- ClientUrlResolverWrapper.cs
- ResolvedKeyFrameEntry.cs
- AssemblyCache.cs
- ComponentResourceKey.cs
- DeferredTextReference.cs
- _LoggingObject.cs
- HtmlControl.cs
- VisualStates.cs
- ProjectionPathBuilder.cs
- LayoutEvent.cs
- ComPlusContractBehavior.cs
- StylusButton.cs
- BitSet.cs
- ConfigPathUtility.cs
- IntAverageAggregationOperator.cs
- SqlInfoMessageEvent.cs
- ListComponentEditorPage.cs
- FilteredDataSetHelper.cs
- EventItfInfo.cs
- TextTreeUndoUnit.cs
- StaticFileHandler.cs
- SendKeys.cs
- GraphicsPathIterator.cs
- Function.cs
- DeferredTextReference.cs
- LinkClickEvent.cs
- XmlLanguageConverter.cs
- DynamicResourceExtension.cs
- ListViewTableCell.cs
- GPPOINT.cs
- SystemKeyConverter.cs
- Rfc2898DeriveBytes.cs
- XmlQueryOutput.cs
- SizeF.cs
- MetafileHeaderWmf.cs
- ListBoxItemWrapperAutomationPeer.cs
- LicenseManager.cs
- NetStream.cs
- SafeHandle.cs
- BooleanFunctions.cs
- CodeGeneratorOptions.cs
- InputLanguageCollection.cs
- TrustLevel.cs
- DelegateTypeInfo.cs
- IOThreadTimer.cs
- ZipIORawDataFileBlock.cs
- DbBuffer.cs
- Int16Animation.cs
- METAHEADER.cs
- ActivityCodeGenerator.cs
- SqlDataSourceView.cs
- AutomationPatternInfo.cs
- GC.cs
- ListViewTableRow.cs
- ContextStack.cs
- SqlDependencyListener.cs
- PenContext.cs
- Light.cs
- TypeSystem.cs
- CreatingCookieEventArgs.cs
- StandardCommands.cs
- DNS.cs
- CodeSubDirectory.cs
- DesignerAttribute.cs
- DataGridViewTopRowAccessibleObject.cs
- DbConnectionOptions.cs
- RootProfilePropertySettingsCollection.cs
- ListViewAutomationPeer.cs
- BmpBitmapEncoder.cs
- _AutoWebProxyScriptWrapper.cs
- UriWriter.cs
- WorkflowApplicationIdleEventArgs.cs
- DragDropHelper.cs
- ScaleTransform.cs
- AnchoredBlock.cs
- DependencyPropertyKind.cs
- BitmapEffectCollection.cs
- SecurityCookieModeValidator.cs
- SettingsAttributeDictionary.cs
- ControlPropertyNameConverter.cs
- DocumentViewerBase.cs
- counter.cs
- XpsInterleavingPolicy.cs
- Parameter.cs
- StringCollection.cs
- RemotingAttributes.cs
- TableRowGroup.cs
- XmlAttributeHolder.cs
- AVElementHelper.cs
- AttributeQuery.cs
- WebServiceEnumData.cs
- BufferModeSettings.cs
- WindowsAltTab.cs
- PropertyValidationContext.cs
- ListControlDesigner.cs
- ObjectSpanRewriter.cs
- ClientTargetCollection.cs
- RegistryDataKey.cs