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
- DataGridViewLayoutData.cs
- XmlILStorageConverter.cs
- ConnectionProviderAttribute.cs
- HttpCookiesSection.cs
- TextTreePropertyUndoUnit.cs
- KnownBoxes.cs
- FixUp.cs
- XappLauncher.cs
- EdmError.cs
- ListViewHitTestInfo.cs
- InputProviderSite.cs
- LinearGradientBrush.cs
- PublishLicense.cs
- DataRowChangeEvent.cs
- DockProviderWrapper.cs
- ColumnWidthChangingEvent.cs
- MenuCommands.cs
- CancellationHandlerDesigner.cs
- DefaultValueMapping.cs
- ListMarkerSourceInfo.cs
- IPipelineRuntime.cs
- PhysicalFontFamily.cs
- InstanceKeyCollisionException.cs
- RadioButtonPopupAdapter.cs
- InvokeHandlers.cs
- BinaryMethodMessage.cs
- ConditionalDesigner.cs
- SqlDataSource.cs
- ListDictionary.cs
- ObjectStateFormatter.cs
- ChtmlPageAdapter.cs
- RegionData.cs
- XmlName.cs
- ObjectViewQueryResultData.cs
- DataSourceControlBuilder.cs
- PopOutPanel.cs
- ParagraphVisual.cs
- SessionStateSection.cs
- UnionExpr.cs
- ServiceManager.cs
- OrderPreservingSpoolingTask.cs
- OleCmdHelper.cs
- ContentPosition.cs
- GridSplitter.cs
- CodeSnippetCompileUnit.cs
- MD5CryptoServiceProvider.cs
- ExpandCollapsePattern.cs
- StdValidatorsAndConverters.cs
- DataGridAddNewRow.cs
- BitmapEffectRenderDataResource.cs
- XmlIlGenerator.cs
- PageHandlerFactory.cs
- SynchronizationFilter.cs
- AllMembershipCondition.cs
- DescendantBaseQuery.cs
- ErrorWebPart.cs
- Signature.cs
- ByteStreamGeometryContext.cs
- PrinterUnitConvert.cs
- BooleanFunctions.cs
- FieldAccessException.cs
- KeyEvent.cs
- PatternMatcher.cs
- TemplatedAdorner.cs
- WSFederationHttpBindingCollectionElement.cs
- QueryConverter.cs
- safesecurityhelperavalon.cs
- RadioButtonBaseAdapter.cs
- ReflectTypeDescriptionProvider.cs
- CheckBoxBaseAdapter.cs
- fixedPageContentExtractor.cs
- GeometryDrawing.cs
- AssociationSet.cs
- SqlTypeConverter.cs
- EntityDataSourceContextDisposingEventArgs.cs
- InputProcessorProfilesLoader.cs
- FormatterConverter.cs
- FlowDocumentPage.cs
- TransactionManager.cs
- AdCreatedEventArgs.cs
- xmlglyphRunInfo.cs
- DataBindingCollectionEditor.cs
- TextBox.cs
- StyleSheetComponentEditor.cs
- MouseWheelEventArgs.cs
- StrokeCollectionDefaultValueFactory.cs
- GeometryHitTestParameters.cs
- StringUtil.cs
- XmlFormatExtensionAttribute.cs
- XPathNodeInfoAtom.cs
- XamlPoint3DCollectionSerializer.cs
- ClientBuildManagerCallback.cs
- SortFieldComparer.cs
- ResourceProviderFactory.cs
- Descriptor.cs
- DBConcurrencyException.cs
- SimpleFieldTemplateUserControl.cs
- PartDesigner.cs
- Script.cs
- HttpHandlersSection.cs