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
- _SSPIWrapper.cs
- FilterException.cs
- MachineKey.cs
- BindingContext.cs
- WmlLinkAdapter.cs
- RouteUrlExpressionBuilder.cs
- XdrBuilder.cs
- xsdvalidator.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- IncrementalHitTester.cs
- ResourceReferenceExpressionConverter.cs
- BamlTreeMap.cs
- DashStyles.cs
- ResourcePermissionBaseEntry.cs
- IPAddress.cs
- HMACSHA512.cs
- DataKeyCollection.cs
- PrimitiveXmlSerializers.cs
- _WinHttpWebProxyDataBuilder.cs
- Material.cs
- KeyBinding.cs
- InputMethodStateChangeEventArgs.cs
- _Events.cs
- DoubleStorage.cs
- PropertyEntry.cs
- Visual3DCollection.cs
- MetadataImporter.cs
- HandledMouseEvent.cs
- COM2Enum.cs
- EventHandlerService.cs
- TemplateControlCodeDomTreeGenerator.cs
- ChangeConflicts.cs
- ObjectDataSourceChooseMethodsPanel.cs
- HttpRuntime.cs
- DocumentViewerHelper.cs
- ClipboardData.cs
- TriggerCollection.cs
- TypeLibConverter.cs
- FilterQuery.cs
- JulianCalendar.cs
- ToolTipService.cs
- SegmentInfo.cs
- XmlNodeWriter.cs
- SoapCodeExporter.cs
- SortQuery.cs
- SmiMetaData.cs
- OracleNumber.cs
- StringConcat.cs
- GeometryValueSerializer.cs
- TemplatePartAttribute.cs
- HtmlObjectListAdapter.cs
- ExpandSegment.cs
- HealthMonitoringSectionHelper.cs
- ArrayTypeMismatchException.cs
- TextCompositionEventArgs.cs
- InstalledFontCollection.cs
- XsdCachingReader.cs
- Evidence.cs
- MediaContext.cs
- StyleBamlRecordReader.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- WindowInteractionStateTracker.cs
- EventRecordWrittenEventArgs.cs
- InstanceContextManager.cs
- UiaCoreApi.cs
- TypeConstant.cs
- PropertyValueUIItem.cs
- MonitorWrapper.cs
- x509store.cs
- _NegoState.cs
- IfAction.cs
- DateTimeFormatInfo.cs
- WebPartDisplayModeEventArgs.cs
- XmlDataImplementation.cs
- SoapElementAttribute.cs
- KnownTypesProvider.cs
- WebPartDisplayModeCancelEventArgs.cs
- SignedXmlDebugLog.cs
- LicenseException.cs
- SurrogateEncoder.cs
- StringDictionary.cs
- DeviceContexts.cs
- DbConnectionPool.cs
- DocumentApplicationJournalEntry.cs
- SchemaDeclBase.cs
- LinkLabelLinkClickedEvent.cs
- StaticTextPointer.cs
- BitmapData.cs
- BlobPersonalizationState.cs
- AmbientLight.cs
- BinaryConverter.cs
- HttpCapabilitiesBase.cs
- OpCopier.cs
- Contracts.cs
- ProjectionCamera.cs
- XPathItem.cs
- BitHelper.cs
- ProfileGroupSettingsCollection.cs
- OuterGlowBitmapEffect.cs
- BitmapCodecInfoInternal.cs