Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeLocalMemHandle.cs / 1305376 / 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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.None)] internal static extern unsafe bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, int StringSDRevision, out SafeLocalMemHandle pSecurityDescriptor, IntPtr SecurityDescriptorSize); [DllImport(ExternDll.Kernel32)] [ResourceExposure(ResourceScope.None)] [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
- CqlParser.cs
- HttpResponseHeader.cs
- OdbcParameterCollection.cs
- XslTransform.cs
- ActivityAction.cs
- InvalidateEvent.cs
- _LocalDataStore.cs
- cookiecollection.cs
- DataListItemEventArgs.cs
- AnnotationResourceChangedEventArgs.cs
- TemplateManager.cs
- DataGridViewAccessibleObject.cs
- EntitySqlException.cs
- DocumentPageTextView.cs
- ConnectionPoint.cs
- DesignerTextBoxAdapter.cs
- SqlMetaData.cs
- CurrentChangingEventManager.cs
- returneventsaver.cs
- InputReferenceExpression.cs
- QueryExtender.cs
- GB18030Encoding.cs
- ResolveDuplex11AsyncResult.cs
- TdsValueSetter.cs
- WindowsIdentity.cs
- CustomPopupPlacement.cs
- SelectingProviderEventArgs.cs
- ToolStripManager.cs
- XPathArrayIterator.cs
- ClientEventManager.cs
- GridViewColumnHeaderAutomationPeer.cs
- NonParentingControl.cs
- UndirectedGraph.cs
- Int64AnimationBase.cs
- ControlBuilder.cs
- connectionpool.cs
- LinqDataSourceContextEventArgs.cs
- Knowncolors.cs
- WinEventQueueItem.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- CompositionAdorner.cs
- QilStrConcatenator.cs
- SafeBitVector32.cs
- BindUriHelper.cs
- Vector3DValueSerializer.cs
- ConfigurationStrings.cs
- TargetConverter.cs
- GeometryCombineModeValidation.cs
- ObjectTypeMapping.cs
- MultilineStringConverter.cs
- RootProfilePropertySettingsCollection.cs
- StickyNoteContentControl.cs
- fixedPageContentExtractor.cs
- InvalidChannelBindingException.cs
- DelayedRegex.cs
- BaseCodeDomTreeGenerator.cs
- ToolStripRenderEventArgs.cs
- PageCatalogPart.cs
- Vector3D.cs
- DrawingCollection.cs
- DrawingState.cs
- HttpListener.cs
- precedingquery.cs
- DataGridPagerStyle.cs
- HtmlHistory.cs
- ThreadExceptionEvent.cs
- RegexGroup.cs
- SelectionPatternIdentifiers.cs
- ExtendedPropertyInfo.cs
- Freezable.cs
- StorageRoot.cs
- Helpers.cs
- HttpResponseHeader.cs
- COAUTHIDENTITY.cs
- SystemGatewayIPAddressInformation.cs
- SelectorAutomationPeer.cs
- IPHostEntry.cs
- TypeForwardedToAttribute.cs
- PathGeometry.cs
- ServiceNameElement.cs
- ContextMenu.cs
- COMException.cs
- UserPreferenceChangedEventArgs.cs
- TypeSystem.cs
- WebBrowserNavigatedEventHandler.cs
- X509AsymmetricSecurityKey.cs
- StatusBarPanelClickEvent.cs
- OutOfProcStateClientManager.cs
- Message.cs
- XmlChildEnumerator.cs
- ExpressionVisitorHelpers.cs
- WeakEventTable.cs
- MD5CryptoServiceProvider.cs
- ParentUndoUnit.cs
- KeyTime.cs
- ListViewItem.cs
- SqlDataSource.cs
- SQLMoney.cs
- remotingproxy.cs
- AppSettingsExpressionEditor.cs