Files
mirror-processhacker/trunk/ProcessHacker.Native/Security/AccessControl/AbsoluteSecurityDescriptor.cs
T
wj32 6877fa1e0f finally completed the basic access control classes
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1590 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-07-12 11:33:44 +00:00

41 lines
1.2 KiB
C#

using System;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Security.AccessControl
{
public sealed class AbsoluteSecurityDescriptor : SecurityDescriptor
{
private MemoryAlloc _memory;
public AbsoluteSecurityDescriptor()
{
NtStatus status;
this.Memory = _memory = new MemoryAlloc(Win32.SecurityDescriptorMinLength);
if ((status = Win32.RtlCreateSecurityDescriptor(
this.Memory,
Win32.SecurityDescriptorRevision
)) >= NtStatus.Error)
{
// Free the allocated memory and disable ownership.
_memory.Dispose();
this.DisableOwnership(false);
}
}
public AbsoluteSecurityDescriptor(IntPtr memory)
{
this.Memory = _memory = new MemoryAlloc(memory, false);
this.Read();
}
protected override void DisposeObject(bool disposing)
{
_memory.Dispose(disposing);
base.DisableOwnership(disposing);
}
}
}