Skip to content

Commit 89b49e0

Browse files
author
James Forshaw
committed
Minor cleanups of the control.
1 parent 2531ef8 commit 89b49e0

File tree

3 files changed

+71
-35
lines changed

3 files changed

+71
-35
lines changed

NtApiDotNet/Forms/AclViewerControl.Designer.cs

Lines changed: 44 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NtApiDotNet/Forms/AclViewerControl.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,22 @@ private void copyConditionToolStripMenuItem_Click(object sender, EventArgs e)
237237
CopyToClipboard(ace.Condition);
238238
}
239239
}
240+
241+
private void copyACESDDLToolStripMenuItem_Click(object sender, EventArgs e)
242+
{
243+
Ace ace = GetSelectedAce();
244+
if (ace == null)
245+
{
246+
return;
247+
}
248+
249+
SecurityDescriptor sd = new SecurityDescriptor
250+
{
251+
Dacl = new Acl() { ace }
252+
};
253+
254+
// Copy and remove the DACL prefix.
255+
CopyToClipboard(sd.ToSddl().Substring(2));
256+
}
240257
}
241258
}

NtApiDotNet/Forms/SecurityDescriptorViewerControl.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// project.
1919

2020
using System;
21+
using System.Linq;
2122
using System.Windows.Forms;
2223

2324
namespace NtApiDotNet.Forms
@@ -83,7 +84,15 @@ public void SetSecurityDescriptor(SecurityDescriptor security_descriptor, Type a
8384
AddAclTab(tabPageSACL, aclViewerControlSacl, security_descriptor.Sacl, access_type, mapping, valid_access);
8485
SetSidLabel(lblOwnerValue, security_descriptor.Owner);
8586
SetSidLabel(lblGroupValue, security_descriptor.Group);
86-
lblIntegrityValue.Text = security_descriptor.IntegrityLevel.ToString();
87+
if (security_descriptor.Sacl != null && !security_descriptor.Sacl.NullAcl
88+
&& security_descriptor.Sacl.Where(a => a.Type == AceType.MandatoryLabel).Count() > 0)
89+
{
90+
lblIntegrityValue.Text = security_descriptor.IntegrityLevel.ToString();
91+
}
92+
else
93+
{
94+
lblIntegrityValue.Text = "N/A";
95+
}
8796
}
8897

8998
/// <summary>

0 commit comments

Comments
 (0)