Code:
/ FX-1434 / FX-1434 / 1.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
- RequestCachePolicy.cs
- Thread.cs
- TextServicesContext.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- XmlName.cs
- CollectionDataContractAttribute.cs
- NullableConverter.cs
- IMembershipProvider.cs
- ScrollChrome.cs
- ContentControl.cs
- TableParagraph.cs
- Compiler.cs
- ProxyWebPartManager.cs
- PersistenceIOParticipant.cs
- SqlCacheDependencyDatabase.cs
- TransformerInfoCollection.cs
- File.cs
- UnsafeNativeMethods.cs
- SystemWebSectionGroup.cs
- IISMapPath.cs
- SemanticAnalyzer.cs
- FlowchartDesigner.xaml.cs
- ProxyWebPart.cs
- WorkflowOwnershipException.cs
- ScriptingRoleServiceSection.cs
- TextRunTypographyProperties.cs
- ListBindableAttribute.cs
- MasterPage.cs
- FixedHighlight.cs
- GeneralTransform3D.cs
- WindowsEditBox.cs
- DataBindingCollectionConverter.cs
- ResourceLoader.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- BamlRecordWriter.cs
- SystemNetHelpers.cs
- BulletedListEventArgs.cs
- ErrorFormatterPage.cs
- InputScopeManager.cs
- HttpHeaderCollection.cs
- EntityDesignerUtils.cs
- DataTableMappingCollection.cs
- PartitionResolver.cs
- PageStatePersister.cs
- ForeignKeyConstraint.cs
- EntityWithKeyStrategy.cs
- StringInfo.cs
- DataServiceResponse.cs
- Clause.cs
- AttachInfo.cs
- Encoder.cs
- FormViewRow.cs
- PropertyBuilder.cs
- UserControlDesigner.cs
- SecurityIdentifierElement.cs
- Multiply.cs
- EntityDataSourceDataSelectionPanel.designer.cs
- UserControlDocumentDesigner.cs
- StringResourceManager.cs
- FixedHyperLink.cs
- ToggleProviderWrapper.cs
- TraceHandler.cs
- SoapIgnoreAttribute.cs
- PersonalizationStateQuery.cs
- OLEDB_Util.cs
- AppSettingsReader.cs
- Attributes.cs
- Expander.cs
- HttpModule.cs
- EventRouteFactory.cs
- FrameworkElementFactoryMarkupObject.cs
- CodeSnippetCompileUnit.cs
- BaseConfigurationRecord.cs
- FollowerQueueCreator.cs
- VScrollBar.cs
- Inflater.cs
- DataServiceQuery.cs
- ChineseLunisolarCalendar.cs
- AmbientProperties.cs
- COAUTHIDENTITY.cs
- UserControl.cs
- SBCSCodePageEncoding.cs
- SecurityPolicySection.cs
- SizeAnimation.cs
- DesignTableCollection.cs
- DBSqlParserTableCollection.cs
- ListenerBinder.cs
- TransportContext.cs
- SQLInt32.cs
- HttpDebugHandler.cs
- wgx_render.cs
- ControlDesigner.cs
- BrushValueSerializer.cs
- Rectangle.cs
- CommandDevice.cs
- AnimatedTypeHelpers.cs
- TCEAdapterGenerator.cs
- TimeSpanValidator.cs
- CombinedHttpChannel.cs
- ServiceBuildProvider.cs