Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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; } } } // 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
- ReferencedAssembly.cs
- CfgParser.cs
- InvokeWebService.cs
- StoreItemCollection.cs
- SimpleTextLine.cs
- nulltextcontainer.cs
- SplitterPanel.cs
- SyndicationPerson.cs
- HyperLink.cs
- NGCSerializationManager.cs
- ToolStripItemImageRenderEventArgs.cs
- TimeoutStream.cs
- DataList.cs
- Win32.cs
- InkCanvas.cs
- Stylesheet.cs
- OleDbWrapper.cs
- SchemaEntity.cs
- WebPartZone.cs
- AlphaSortedEnumConverter.cs
- DESCryptoServiceProvider.cs
- CachedFontFamily.cs
- HttpWebRequestElement.cs
- sqlinternaltransaction.cs
- GuidTagList.cs
- Listbox.cs
- TimeZoneInfo.cs
- M3DUtil.cs
- SoapFormatter.cs
- DetailsViewAutoFormat.cs
- WhereQueryOperator.cs
- ConfigPathUtility.cs
- PackWebRequest.cs
- Matrix3DStack.cs
- Conditional.cs
- DocumentReferenceCollection.cs
- DataSourceXmlElementAttribute.cs
- SpeechSeg.cs
- MachineKeySection.cs
- ClientConfigurationHost.cs
- AsmxEndpointPickerExtension.cs
- ArraySubsetEnumerator.cs
- TextFindEngine.cs
- CodeGotoStatement.cs
- EmbeddedMailObject.cs
- EncryptedData.cs
- AppearanceEditorPart.cs
- Label.cs
- InvalidDocumentContentsException.cs
- MimeBasePart.cs
- ComponentCodeDomSerializer.cs
- Operator.cs
- FixedStringLookup.cs
- Models.cs
- TemplateControlBuildProvider.cs
- Parsers.cs
- TypeInitializationException.cs
- SQLBytes.cs
- URLEditor.cs
- Authorization.cs
- RadioButton.cs
- ConnectionManagementElementCollection.cs
- DataGridTableCollection.cs
- OdbcConnectionFactory.cs
- SafeLibraryHandle.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- BinaryCommonClasses.cs
- SQLBytesStorage.cs
- PropertyMetadata.cs
- XmlHierarchyData.cs
- LinearGradientBrush.cs
- HitTestDrawingContextWalker.cs
- ErrorStyle.cs
- PropertyGridDesigner.cs
- XmlSchemaGroup.cs
- ScriptingScriptResourceHandlerSection.cs
- ValueChangedEventManager.cs
- Size.cs
- BuilderPropertyEntry.cs
- CodeNamespaceCollection.cs
- UnauthorizedWebPart.cs
- ParserHooks.cs
- ExceptionHandlerDesigner.cs
- TdsParser.cs
- ValueUnavailableException.cs
- XmlUtil.cs
- TimeSpanOrInfiniteConverter.cs
- ToolStripScrollButton.cs
- ByteStack.cs
- DetailsViewDeleteEventArgs.cs
- EncryptedData.cs
- MenuItemStyle.cs
- ColumnBinding.cs
- XmlSchemaObjectTable.cs
- Calendar.cs
- PointUtil.cs
- SolidBrush.cs
- Style.cs
- PathGeometry.cs
- SqlDuplicator.cs