aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/WixToolset.DUtil/inc/aclutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/aclutil.h')
-rw-r--r--src/libs/dutil/WixToolset.DUtil/inc/aclutil.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/aclutil.h b/src/libs/dutil/WixToolset.DUtil/inc/aclutil.h
new file mode 100644
index 00000000..ac03f9a8
--- /dev/null
+++ b/src/libs/dutil/WixToolset.DUtil/inc/aclutil.h
@@ -0,0 +1,154 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <aclapi.h>
6#include <sddl.h>
7
8#define ReleaseSid(x) if (x) { AclFreeSid(x); }
9#define ReleaseNullSid(x) if (x) { AclFreeSid(x); x = NULL; }
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15// structs
16struct ACL_ACCESS
17{
18 BOOL fDenyAccess;
19 DWORD dwAccessMask;
20
21 // TODO: consider using a union
22 LPCWSTR pwzAccountName; // NOTE: the last three items in this structure are ignored if this is not NULL
23
24 SID_IDENTIFIER_AUTHORITY sia; // used if pwzAccountName is NULL
25 BYTE nSubAuthorityCount;
26 DWORD nSubAuthority[8];
27};
28
29struct ACL_ACE
30{
31 DWORD dwFlags;
32 DWORD dwMask;
33 PSID psid;
34};
35
36
37// functions
38HRESULT DAPI AclCheckAccess(
39 __in HANDLE hToken,
40 __in ACL_ACCESS* paa
41 );
42HRESULT DAPI AclCheckAdministratorAccess(
43 __in HANDLE hToken
44 );
45HRESULT DAPI AclCheckLocalSystemAccess(
46 __in HANDLE hToken
47 );
48
49HRESULT DAPI AclGetWellKnownSid(
50 __in WELL_KNOWN_SID_TYPE wkst,
51 __deref_out PSID* ppsid
52 );
53HRESULT DAPI AclGetAccountSid(
54 __in_opt LPCWSTR wzSystem,
55 __in_z LPCWSTR wzAccount,
56 __deref_out PSID* ppsid
57 );
58HRESULT DAPI AclGetAccountSidString(
59 __in_z LPCWSTR wzSystem,
60 __in_z LPCWSTR wzAccount,
61 __deref_out_z LPWSTR* ppwzSid
62 );
63
64HRESULT DAPI AclCreateDacl(
65 __in_ecount(cDeny) ACL_ACE rgaaDeny[],
66 __in DWORD cDeny,
67 __in_ecount(cAllow) ACL_ACE rgaaAllow[],
68 __in DWORD cAllow,
69 __deref_out ACL** ppAcl
70 );
71HRESULT DAPI AclAddToDacl(
72 __in ACL* pAcl,
73 __in_ecount_opt(cDeny) const ACL_ACE rgaaDeny[],
74 __in DWORD cDeny,
75 __in_ecount_opt(cAllow) const ACL_ACE rgaaAllow[],
76 __in DWORD cAllow,
77 __deref_out ACL** ppAclNew
78 );
79HRESULT DAPI AclMergeDacls(
80 __in const ACL* pAcl1,
81 __in const ACL* pAcl2,
82 __deref_out ACL** ppAclNew
83 );
84HRESULT DAPI AclCreateDaclOld(
85 __in_ecount(cAclAccesses) ACL_ACCESS* paa,
86 __in DWORD cAclAccesses,
87 __deref_out ACL** ppAcl
88 );
89HRESULT DAPI AclCreateSecurityDescriptor(
90 __in_ecount(cAclAccesses) ACL_ACCESS* paa,
91 __in DWORD cAclAccesses,
92 __deref_out SECURITY_DESCRIPTOR** ppsd
93 );
94HRESULT DAPI AclCreateSecurityDescriptorFromDacl(
95 __in ACL* pACL,
96 __deref_out SECURITY_DESCRIPTOR** ppsd
97 );
98HRESULT __cdecl AclCreateSecurityDescriptorFromString(
99 __deref_out SECURITY_DESCRIPTOR** ppsd,
100 __in_z __format_string LPCWSTR wzSddlFormat,
101 ...
102 );
103HRESULT DAPI AclDuplicateSecurityDescriptor(
104 __in SECURITY_DESCRIPTOR* psd,
105 __deref_out SECURITY_DESCRIPTOR** ppsd
106 );
107HRESULT DAPI AclGetSecurityDescriptor(
108 __in_z LPCWSTR wzObject,
109 __in SE_OBJECT_TYPE sot,
110 __in SECURITY_INFORMATION securityInformation,
111 __deref_out SECURITY_DESCRIPTOR** ppsd
112 );
113HRESULT DAPI AclSetSecurityWithRetry(
114 __in_z LPCWSTR wzObject,
115 __in SE_OBJECT_TYPE sot,
116 __in SECURITY_INFORMATION securityInformation,
117 __in_opt PSID psidOwner,
118 __in_opt PSID psidGroup,
119 __in_opt PACL pDacl,
120 __in_opt PACL pSacl,
121 __in DWORD cRetry,
122 __in DWORD dwWaitMilliseconds
123 );
124
125HRESULT DAPI AclFreeSid(
126 __in PSID psid
127 );
128HRESULT DAPI AclFreeDacl(
129 __in ACL* pACL
130 );
131HRESULT DAPI AclFreeSecurityDescriptor(
132 __in SECURITY_DESCRIPTOR* psd
133 );
134
135HRESULT DAPI AclAddAdminToSecurityDescriptor(
136 __in SECURITY_DESCRIPTOR* pSecurity,
137 __deref_out SECURITY_DESCRIPTOR** ppSecurityNew
138 );
139
140// Following code in acl2util.cpp due to dependency on crypt32.dll.
141HRESULT DAPI AclCalculateServiceSidString(
142 __in LPCWSTR wzServiceName,
143 __in SIZE_T cchServiceName,
144 __deref_out_z LPWSTR* psczSid
145 );
146HRESULT DAPI AclGetAccountSidStringEx(
147 __in_z LPCWSTR wzSystem,
148 __in_z LPCWSTR wzAccount,
149 __deref_out_z LPWSTR* psczSid
150 );
151
152#ifdef __cplusplus
153}
154#endif