Skip to content

Commit 7a03b0c

Browse files
TravisEz13daxian-dbw
authored andcommitted
Use supported API to set CAPID in the SACL (PowerShell#4496)
1 parent b63a25c commit 7a03b0c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Microsoft.PowerShell.Security/security/AclCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ private IntPtr GetSaclWithCapId(string capStr)
11941194
}
11951195

11961196
// Add CAPID to the SACL.
1197-
rs = NativeMethods.RtlAddScopedPolicyIDAce(
1197+
rs = NativeMethods.AddScopedPolicyIDAce(
11981198
pSacl,
11991199
NativeMethods.ACL_REVISION,
12001200
NativeMethods.SUB_CONTAINERS_AND_OBJECTS_INHERIT,

src/System.Management.Automation/security/nativeMethods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,8 +1786,8 @@ internal static extern bool InitializeAcl(
17861786
uint nAclLength,
17871787
uint dwAclRevision);
17881788

1789-
[DllImport("ntdll.dll", CharSet = CharSet.Unicode)]
1790-
internal static extern uint RtlAddScopedPolicyIDAce(
1789+
[DllImport("api-ms-win-security-base-l1-2-0.dll", CharSet = CharSet.Unicode)]
1790+
internal static extern uint AddScopedPolicyIDAce(
17911791
IntPtr Acl,
17921792
uint AceRevision,
17931793
uint AceFlags,

0 commit comments

Comments
 (0)