You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Impersonation/MySafeTokenHandle.cs

27 lines
810 B

6 years ago
using Microsoft.Win32.SafeHandles;
using System.Runtime.ConstrainedExecution;
using System.Security.Permissions;
namespace ZeroLevel.Services.Impersonation
{
/// <summary>
/// Реализация безопасного указателя
/// </summary>
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
internal class MySafeTokenHandle
: SafeHandleZeroOrMinusOneIsInvalid
{
private MySafeTokenHandle()
: base(true)
{
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
override protected bool ReleaseHandle()
{
return ImpersonationNativeMethods.CloseHandle(handle);
}
}
}

Powered by TurnKey Linux.