mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
6877fa1e0f
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1590 21ef857c-d57f-4fe0-8362-d861dc6d29cd
41 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|