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
- SimpleWorkerRequest.cs
- ControlPropertyNameConverter.cs
- TypePresenter.xaml.cs
- Compilation.cs
- Connection.cs
- GroupDescription.cs
- PackagePart.cs
- MenuTracker.cs
- MetaTableHelper.cs
- StackOverflowException.cs
- XmlAnyElementAttribute.cs
- OTFRasterizer.cs
- NullableConverter.cs
- ScalarType.cs
- SafeCancelMibChangeNotify.cs
- TextEndOfSegment.cs
- CategoryState.cs
- ToolStripProgressBar.cs
- SvcMapFileSerializer.cs
- StrongNameIdentityPermission.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ValidationError.cs
- HashSet.cs
- ViewValidator.cs
- DecoderNLS.cs
- ObfuscateAssemblyAttribute.cs
- DllNotFoundException.cs
- TableLayoutSettings.cs
- EventProviderWriter.cs
- CalendarItem.cs
- TabControlEvent.cs
- ToolStripSettings.cs
- RelationshipType.cs
- FilePrompt.cs
- CleanUpVirtualizedItemEventArgs.cs
- DataTableTypeConverter.cs
- BitmapMetadataBlob.cs
- smtpconnection.cs
- WriterOutput.cs
- JsonClassDataContract.cs
- ToolStripContainer.cs
- ContextProperty.cs
- CssTextWriter.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- Single.cs
- BuildResultCache.cs
- PropertyDescriptorGridEntry.cs
- RawStylusInputCustomData.cs
- BoolLiteral.cs
- LessThan.cs
- SafeNativeMethodsOther.cs
- LogExtent.cs
- Executor.cs
- InputChannelBinder.cs
- CommandConverter.cs
- XMLSchema.cs
- Stack.cs
- LicenseProviderAttribute.cs
- OpCodes.cs
- SiteMapProvider.cs
- SqlDependency.cs
- EditingContext.cs
- ScriptingRoleServiceSection.cs
- ListSortDescriptionCollection.cs
- ComponentManagerBroker.cs
- FloaterParaClient.cs
- DataGridTextColumn.cs
- WindowsMenu.cs
- CodeExporter.cs
- Opcode.cs
- CollectionBuilder.cs
- XPathPatternBuilder.cs
- cookieexception.cs
- hresults.cs
- SystemColorTracker.cs
- ToolStripGripRenderEventArgs.cs
- ClassGenerator.cs
- CodeTypeMember.cs
- Tokenizer.cs
- ControlAdapter.cs
- UnsafeNativeMethods.cs
- IisHelper.cs
- ObjectDataSourceDisposingEventArgs.cs
- LogEntryUtils.cs
- MappingItemCollection.cs
- Convert.cs
- FieldAccessException.cs
- AddingNewEventArgs.cs
- DesignerAttribute.cs
- SQLMoneyStorage.cs
- MessageFault.cs
- WriteFileContext.cs
- HtmlInputSubmit.cs
- SuppressIldasmAttribute.cs
- Converter.cs
- ScriptHandlerFactory.cs
- CodeCompileUnit.cs
- SecurityKeyUsage.cs
- XPathEmptyIterator.cs
- StorageBasedPackageProperties.cs