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
- DataMisalignedException.cs
- PageTrueTypeFont.cs
- JournalEntryListConverter.cs
- DataColumnSelectionConverter.cs
- ImportCatalogPart.cs
- TraceListeners.cs
- ContentTextAutomationPeer.cs
- SynchronizedChannelCollection.cs
- safelink.cs
- DataGridViewRowHeaderCell.cs
- StrokeFIndices.cs
- MailDefinition.cs
- EmptyElement.cs
- ListenerElementsCollection.cs
- CollectionBase.cs
- ListViewDeleteEventArgs.cs
- TemplatingOptionsDialog.cs
- DoubleStorage.cs
- ResourcePool.cs
- StringAnimationBase.cs
- PtsCache.cs
- RoleManagerModule.cs
- PackageDigitalSignature.cs
- HttpStreamXmlDictionaryWriter.cs
- FileUtil.cs
- NumericPagerField.cs
- ListChangedEventArgs.cs
- StorageSetMapping.cs
- FrameworkPropertyMetadata.cs
- XpsFontSubsetter.cs
- PrintPreviewGraphics.cs
- Size.cs
- ObjectItemCollection.cs
- TaiwanCalendar.cs
- xsdvalidator.cs
- LocalBuilder.cs
- XmlSigningNodeWriter.cs
- DateBoldEvent.cs
- DescendantOverDescendantQuery.cs
- MsmqReceiveParameters.cs
- XmlObjectSerializerWriteContext.cs
- SR.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- HttpModulesInstallComponent.cs
- HtmlTable.cs
- DesignerVerb.cs
- loginstatus.cs
- ReturnValue.cs
- ScrollViewer.cs
- RepeaterItem.cs
- DataSourceXmlSubItemAttribute.cs
- ScriptResourceHandler.cs
- SuppressMessageAttribute.cs
- RuntimeArgumentHandle.cs
- DBCommandBuilder.cs
- QilTargetType.cs
- CryptoStream.cs
- XamlTypeMapperSchemaContext.cs
- CompiledXpathExpr.cs
- IsolatedStoragePermission.cs
- MbpInfo.cs
- HtmlElement.cs
- SqlCacheDependencyDatabaseCollection.cs
- QilCloneVisitor.cs
- LockCookie.cs
- AxHost.cs
- RuleInfoComparer.cs
- DropDownList.cs
- basenumberconverter.cs
- RoleService.cs
- BaseHashHelper.cs
- StringFunctions.cs
- MetadataCacheItem.cs
- HttpHandlerActionCollection.cs
- HtmlElementEventArgs.cs
- ParseChildrenAsPropertiesAttribute.cs
- SQLDateTimeStorage.cs
- PipelineModuleStepContainer.cs
- WindowsListViewGroupHelper.cs
- DBCSCodePageEncoding.cs
- CategoryGridEntry.cs
- ResourceIDHelper.cs
- SQLBoolean.cs
- CompositeCollection.cs
- _ContextAwareResult.cs
- EastAsianLunisolarCalendar.cs
- ChannelManager.cs
- LineGeometry.cs
- RangeValidator.cs
- EditingCommands.cs
- StreamWriter.cs
- ChannelServices.cs
- OutOfProcStateClientManager.cs
- Visual3DCollection.cs
- PenContexts.cs
- ToggleButtonAutomationPeer.cs
- SecurityTokenValidationException.cs
- StrokeDescriptor.cs
- CompiledELinqQueryState.cs
- BrushProxy.cs