Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- OracleTransaction.cs
- Trustee.cs
- BamlMapTable.cs
- Page.cs
- StatusBarDrawItemEvent.cs
- SubMenuStyleCollectionEditor.cs
- Set.cs
- MulticastDelegate.cs
- SmtpReplyReader.cs
- Opcode.cs
- ConfigurationManager.cs
- handlecollector.cs
- SafeNativeMethodsMilCoreApi.cs
- FormatVersion.cs
- Application.cs
- DecimalAnimation.cs
- assertwrapper.cs
- Int16Animation.cs
- DataMemberConverter.cs
- EntryPointNotFoundException.cs
- DBConnection.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- RemotingException.cs
- AsyncStreamReader.cs
- SelectionWordBreaker.cs
- MetadataSerializer.cs
- DES.cs
- DBParameter.cs
- Hex.cs
- ContentPosition.cs
- FileSystemInfo.cs
- XamlFigureLengthSerializer.cs
- NativeMethodsOther.cs
- MergeFailedEvent.cs
- ParentControlDesigner.cs
- SequenceDesignerAccessibleObject.cs
- SemanticAnalyzer.cs
- BitSet.cs
- ToolStripItemDataObject.cs
- InputBindingCollection.cs
- DataGridColumn.cs
- Int32Converter.cs
- XmlWrappingReader.cs
- smtppermission.cs
- WebConfigurationFileMap.cs
- SerializationObjectManager.cs
- StaticExtension.cs
- fixedPageContentExtractor.cs
- CmsUtils.cs
- ViewStateChangedEventArgs.cs
- XmlAttributeOverrides.cs
- EncodingNLS.cs
- RemotingAttributes.cs
- TaskbarItemInfo.cs
- LicenseException.cs
- OleDbCommandBuilder.cs
- HebrewCalendar.cs
- XmlElementList.cs
- SpotLight.cs
- TableSectionStyle.cs
- SHA1Managed.cs
- StylusSystemGestureEventArgs.cs
- WebZone.cs
- ClientUrlResolverWrapper.cs
- ResourceCollectionInfo.cs
- ReadOnlyCollection.cs
- SerialPort.cs
- ActivationServices.cs
- DrawingVisualDrawingContext.cs
- DesignerProperties.cs
- SerializationFieldInfo.cs
- Util.cs
- ManagedWndProcTracker.cs
- DataRecordObjectView.cs
- CreateUserErrorEventArgs.cs
- Timer.cs
- OracleConnectionStringBuilder.cs
- MemoryPressure.cs
- XsdBuilder.cs
- DataStreamFromComStream.cs
- BroadcastEventHelper.cs
- WindowsNonControl.cs
- Point3DAnimationBase.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- PrefixQName.cs
- HostedElements.cs
- DBParameter.cs
- UriTemplateLiteralQueryValue.cs
- TreeWalker.cs
- DelegatingStream.cs
- FormViewCommandEventArgs.cs
- BorderGapMaskConverter.cs
- LineServicesCallbacks.cs
- TabItemAutomationPeer.cs
- ToolStripItemCollection.cs
- _Win32.cs
- MetadataHelper.cs
- AmbientValueAttribute.cs
- MailSettingsSection.cs
- ActivitySurrogateSelector.cs