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
- MonthCalendar.cs
- DbProviderConfigurationHandler.cs
- ClockController.cs
- HttpRequest.cs
- InputLanguageSource.cs
- SettingsPropertyWrongTypeException.cs
- HttpRequest.cs
- SqlDataSourceStatusEventArgs.cs
- ChannelSinkStacks.cs
- DiagnosticsConfigurationHandler.cs
- InlineCollection.cs
- TableCellAutomationPeer.cs
- RelationshipEntry.cs
- BindUriHelper.cs
- EditingMode.cs
- HtmlValidationSummaryAdapter.cs
- DataServiceClientException.cs
- IssuerInformation.cs
- EllipseGeometry.cs
- Configuration.cs
- PartitionResolver.cs
- GridViewDeleteEventArgs.cs
- CodeCastExpression.cs
- ImplicitInputBrush.cs
- WorkflowDataContext.cs
- GenericFlowSwitchHelper.cs
- DateTime.cs
- AddInController.cs
- SplineKeyFrames.cs
- ParameterElementCollection.cs
- ListSortDescriptionCollection.cs
- WebFormDesignerActionService.cs
- RewritingValidator.cs
- SkewTransform.cs
- Dynamic.cs
- SiteMapDataSource.cs
- StyleSelector.cs
- ExceptionUtil.cs
- SaveFileDialog.cs
- InfoCardListRequest.cs
- ClassGenerator.cs
- RequestCacheEntry.cs
- recordstate.cs
- GeometryDrawing.cs
- PhonemeConverter.cs
- EncryptedKey.cs
- NumberSubstitution.cs
- wmiprovider.cs
- OleDbInfoMessageEvent.cs
- ComponentResourceManager.cs
- DockPatternIdentifiers.cs
- ExceptQueryOperator.cs
- MetadataExporter.cs
- RestHandlerFactory.cs
- XmlComment.cs
- NodeFunctions.cs
- DocumentPageViewAutomationPeer.cs
- WebEvents.cs
- FontStyleConverter.cs
- ForwardPositionQuery.cs
- SamlAttributeStatement.cs
- WebPartsPersonalization.cs
- GestureRecognizer.cs
- MediaCommands.cs
- InplaceBitmapMetadataWriter.cs
- OdbcConnectionHandle.cs
- FixedPage.cs
- GridView.cs
- TileBrush.cs
- ContextBase.cs
- SecurityPolicySection.cs
- Transform.cs
- WorkflowServiceHostFactory.cs
- GestureRecognitionResult.cs
- InlineCollection.cs
- SpeechDetectedEventArgs.cs
- MaskedTextProvider.cs
- MailMessage.cs
- XmlEntityReference.cs
- UnsafeNativeMethods.cs
- NonBatchDirectoryCompiler.cs
- _NetRes.cs
- GroupDescription.cs
- DtdParser.cs
- DBCSCodePageEncoding.cs
- Literal.cs
- Parser.cs
- Point3DCollectionValueSerializer.cs
- WebServiceFaultDesigner.cs
- GeneralTransform2DTo3D.cs
- IsolatedStorageFile.cs
- XmlComplianceUtil.cs
- BoolExpressionVisitors.cs
- FlowDocumentView.cs
- AsyncStreamReader.cs
- AlphabeticalEnumConverter.cs
- SafeNativeMethods.cs
- SqlTriggerContext.cs
- ZoneLinkButton.cs
- UIElementParagraph.cs