Code:
/ DotNET / DotNET / 8.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
- SlipBehavior.cs
- UnionCqlBlock.cs
- TypeDelegator.cs
- DataServices.cs
- Fx.cs
- HtmlHistory.cs
- DefaultValueTypeConverter.cs
- XmlQueryType.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- precedingsibling.cs
- ByteStreamMessageEncoder.cs
- CasesDictionary.cs
- ListView.cs
- MaterialCollection.cs
- FontFamily.cs
- MatrixStack.cs
- QilPatternVisitor.cs
- SizeAnimationBase.cs
- WindowsIdentity.cs
- DatasetMethodGenerator.cs
- SrgsRuleRef.cs
- ContractUtils.cs
- MergeFilterQuery.cs
- ClientOperation.cs
- WindowsListView.cs
- CorrelationActionMessageFilter.cs
- CalendarDay.cs
- CompressEmulationStream.cs
- RadioButtonList.cs
- XmlNamespaceManager.cs
- NoPersistScope.cs
- MDIWindowDialog.cs
- StringArrayEditor.cs
- DesignerDataTableBase.cs
- MonthChangedEventArgs.cs
- Attributes.cs
- SystemException.cs
- DataServiceHostWrapper.cs
- GuidelineSet.cs
- PopupRootAutomationPeer.cs
- ProxyGenerationError.cs
- _ScatterGatherBuffers.cs
- StopStoryboard.cs
- EventMemberCodeDomSerializer.cs
- AutoFocusStyle.xaml.cs
- ObjRef.cs
- FrameworkElementFactory.cs
- SimpleTypeResolver.cs
- TranslateTransform3D.cs
- ParseChildrenAsPropertiesAttribute.cs
- ForwardPositionQuery.cs
- StorageRoot.cs
- IndexedGlyphRun.cs
- Vector.cs
- AutoGeneratedField.cs
- ScriptControlManager.cs
- DynamicControl.cs
- PathParser.cs
- RectKeyFrameCollection.cs
- BuildProvidersCompiler.cs
- LocatorManager.cs
- XmlSchemaElement.cs
- OdbcConnectionStringbuilder.cs
- Font.cs
- TextPointer.cs
- TreeIterator.cs
- DateTimePickerDesigner.cs
- SourceFileInfo.cs
- ProviderUtil.cs
- SafeProcessHandle.cs
- MemberDomainMap.cs
- Tile.cs
- PinnedBufferMemoryStream.cs
- CodePageEncoding.cs
- SecurityContextSecurityTokenAuthenticator.cs
- OraclePermissionAttribute.cs
- ThreadStartException.cs
- Form.cs
- ResourcesBuildProvider.cs
- DBCommandBuilder.cs
- LineSegment.cs
- MessageQueuePermissionAttribute.cs
- TailCallAnalyzer.cs
- ArgumentDesigner.xaml.cs
- EditableTreeList.cs
- Configuration.cs
- GetWinFXPath.cs
- WebPartManagerInternals.cs
- OracleBFile.cs
- AbsoluteQuery.cs
- KeyPressEvent.cs
- ToolTip.cs
- MailDefinition.cs
- KeyConverter.cs
- MenuItemAutomationPeer.cs
- ImageCodecInfo.cs
- ContentElementAutomationPeer.cs
- BindingsCollection.cs
- ListBox.cs
- TimeSpanMinutesConverter.cs