From 7a03b0c7b98faf638bcace07de08a1abdca060e7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 4 Aug 2017 12:29:00 -0700 Subject: [PATCH] Use supported API to set CAPID in the SACL (#4496) --- src/Microsoft.PowerShell.Security/security/AclCommands.cs | 2 +- src/System.Management.Automation/security/nativeMethods.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.PowerShell.Security/security/AclCommands.cs b/src/Microsoft.PowerShell.Security/security/AclCommands.cs index fd93a86951..3d1a73f635 100644 --- a/src/Microsoft.PowerShell.Security/security/AclCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/AclCommands.cs @@ -1194,7 +1194,7 @@ namespace Microsoft.PowerShell.Commands } // Add CAPID to the SACL. - rs = NativeMethods.RtlAddScopedPolicyIDAce( + rs = NativeMethods.AddScopedPolicyIDAce( pSacl, NativeMethods.ACL_REVISION, NativeMethods.SUB_CONTAINERS_AND_OBJECTS_INHERIT, diff --git a/src/System.Management.Automation/security/nativeMethods.cs b/src/System.Management.Automation/security/nativeMethods.cs index e1465e8fde..49561ae58d 100644 --- a/src/System.Management.Automation/security/nativeMethods.cs +++ b/src/System.Management.Automation/security/nativeMethods.cs @@ -1786,8 +1786,8 @@ namespace System.Management.Automation.Security uint nAclLength, uint dwAclRevision); - [DllImport("ntdll.dll", CharSet = CharSet.Unicode)] - internal static extern uint RtlAddScopedPolicyIDAce( + [DllImport("api-ms-win-security-base-l1-2-0.dll", CharSet = CharSet.Unicode)] + internal static extern uint AddScopedPolicyIDAce( IntPtr Acl, uint AceRevision, uint AceFlags,