1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_aclapi.d)
9  */
10 module core.sys.windows.aclapi;
11 version (Windows):
12 
13 version (ANSI) {} else version = Unicode;
14 pragma(lib, "advapi32");
15 
16 import core.sys.windows.accctrl, core.sys.windows.basetyps, core.sys.windows.w32api, core.sys.windows.winnt;
17 
18 extern (Windows) {
19     VOID BuildExplicitAccessWithNameA(PEXPLICIT_ACCESS_A, LPSTR, DWORD,
20       ACCESS_MODE, DWORD);
21     VOID BuildExplicitAccessWithNameW(PEXPLICIT_ACCESS_W, LPWSTR, DWORD,
22       ACCESS_MODE, DWORD);
23     DWORD BuildSecurityDescriptorA(PTRUSTEE_A, PTRUSTEE_A , ULONG,
24       PEXPLICIT_ACCESS_A, ULONG, PEXPLICIT_ACCESS_A, PSECURITY_DESCRIPTOR,
25       PULONG, PSECURITY_DESCRIPTOR*);
26     DWORD BuildSecurityDescriptorW(PTRUSTEE_W, PTRUSTEE_W , ULONG,
27       PEXPLICIT_ACCESS_W, ULONG, PEXPLICIT_ACCESS_W, PSECURITY_DESCRIPTOR,
28       PULONG, PSECURITY_DESCRIPTOR*);
29     VOID BuildTrusteeWithNameA(PTRUSTEE_A, LPSTR);
30     VOID BuildTrusteeWithNameW(PTRUSTEE_W, LPWSTR);
31     VOID BuildTrusteeWithObjectsAndNameA(PTRUSTEE_A, POBJECTS_AND_NAME_A,
32       SE_OBJECT_TYPE, LPSTR, LPSTR, LPSTR);
33     VOID BuildTrusteeWithObjectsAndNameW(PTRUSTEE_W, POBJECTS_AND_NAME_W,
34       SE_OBJECT_TYPE, LPWSTR, LPWSTR, LPWSTR);
35     VOID BuildTrusteeWithObjectsAndSidA(PTRUSTEE_A, POBJECTS_AND_SID,
36       GUID*, GUID*, PSID);
37     VOID BuildTrusteeWithObjectsAndSidW(PTRUSTEE_W, POBJECTS_AND_SID,
38       GUID*, GUID*, PSID);
39     VOID BuildTrusteeWithSidA(PTRUSTEE_A, PSID);
40     VOID BuildTrusteeWithSidW(PTRUSTEE_W, PSID);
41     DWORD GetAuditedPermissionsFromAclA(PACL, PTRUSTEE_A, PACCESS_MASK,
42       PACCESS_MASK);
43     DWORD GetAuditedPermissionsFromAclW(PACL, PTRUSTEE_W, PACCESS_MASK,
44       PACCESS_MASK);
45     DWORD GetEffectiveRightsFromAclA(PACL, PTRUSTEE_A, PACCESS_MASK);
46     DWORD GetEffectiveRightsFromAclW(PACL, PTRUSTEE_W, PACCESS_MASK);
47     DWORD GetExplicitEntriesFromAclA(PACL, PULONG, PEXPLICIT_ACCESS_A*);
48     DWORD GetExplicitEntriesFromAclW(PACL, PULONG, PEXPLICIT_ACCESS_W*);
49     static if (_WIN32_WINNT >= 0x501) {
50         DWORD GetInheritanceSourceA(LPSTR, SE_OBJECT_TYPE,
51           SECURITY_INFORMATION, BOOL, GUID**, DWORD, PACL, void*,
52           PGENERIC_MAPPING, PINHERITED_FROMA);
53         DWORD GetInheritanceSourceW(LPWSTR, SE_OBJECT_TYPE,
54           SECURITY_INFORMATION, BOOL, GUID**, DWORD, PACL, void*,
55           PGENERIC_MAPPING, PINHERITED_FROMW);
56     }
57     DWORD GetNamedSecurityInfoA(LPSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION,
58       PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
59     DWORD GetNamedSecurityInfoW(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION,
60       PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
61     DWORD GetSecurityInfo(HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
62       PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
63     TRUSTEE_FORM GetTrusteeFormA(PTRUSTEE_A);
64     TRUSTEE_FORM GetTrusteeFormW(PTRUSTEE_W);
65     LPSTR GetTrusteeNameA(PTRUSTEE_A);
66     LPWSTR GetTrusteeNameW(PTRUSTEE_W);
67     TRUSTEE_TYPE GetTrusteeTypeA(PTRUSTEE_A);
68     TRUSTEE_TYPE GetTrusteeTypeW(PTRUSTEE_W);
69     DWORD LookupSecurityDescriptorPartsA(PTRUSTEE_A*, PTRUSTEE_A*, PULONG,
70       PEXPLICIT_ACCESS_A*, PULONG, PEXPLICIT_ACCESS_A*,
71       PSECURITY_DESCRIPTOR);
72     DWORD LookupSecurityDescriptorPartsW(PTRUSTEE_W*, PTRUSTEE_W*, PULONG,
73       PEXPLICIT_ACCESS_W*, PULONG, PEXPLICIT_ACCESS_W*,
74       PSECURITY_DESCRIPTOR);
75     DWORD SetEntriesInAclA(ULONG, PEXPLICIT_ACCESS_A, PACL, PACL*);
76     DWORD SetEntriesInAclW(ULONG, PEXPLICIT_ACCESS_W, PACL, PACL*);
77     DWORD SetNamedSecurityInfoA(LPSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION,
78       PSID, PSID, PACL, PACL);
79     DWORD SetNamedSecurityInfoW(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION,
80       PSID, PSID, PACL, PACL);
81     DWORD SetSecurityInfo(HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID,
82       PSID, PACL, PACL);
83     VOID BuildImpersonateExplicitAccessWithNameA(PEXPLICIT_ACCESS_A, LPSTR,
84       PTRUSTEE_A, DWORD, ACCESS_MODE, DWORD);
85     VOID BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W, LPWSTR,
86       PTRUSTEE_W, DWORD, ACCESS_MODE, DWORD);
87     VOID BuildImpersonateTrusteeA(PTRUSTEE_A, PTRUSTEE_A);
88     VOID BuildImpersonateTrusteeW(PTRUSTEE_W, PTRUSTEE_W);
89     PTRUSTEE_A GetMultipleTrusteeA(PTRUSTEE_A);
90     PTRUSTEE_W GetMultipleTrusteeW(PTRUSTEE_W);
91     MULTIPLE_TRUSTEE_OPERATION GetMultipleTrusteeOperationA(PTRUSTEE_A);
92     MULTIPLE_TRUSTEE_OPERATION GetMultipleTrusteeOperationW(PTRUSTEE_W);
93 }
94 
95 version (Unicode) {
96     alias BuildExplicitAccessWithNameW BuildExplicitAccessWithName;
97     alias BuildSecurityDescriptorW BuildSecurityDescriptor;
98     alias BuildTrusteeWithNameW BuildTrusteeWithName;
99     alias BuildTrusteeWithObjectsAndNameW BuildTrusteeWithObjectsAndName;
100     alias BuildTrusteeWithObjectsAndSidW BuildTrusteeWithObjectsAndSid;
101     alias BuildTrusteeWithSidW BuildTrusteeWithSid;
102     alias GetAuditedPermissionsFromAclW GetAuditedPermissionsFromAcl;
103     alias GetEffectiveRightsFromAclW GetEffectiveRightsFromAcl;
104     alias GetExplicitEntriesFromAclW GetExplicitEntriesFromAcl;
105     alias GetNamedSecurityInfoW GetNamedSecurityInfo;
106     alias GetTrusteeFormW GetTrusteeForm;
107     alias GetTrusteeNameW GetTrusteeName;
108     alias GetTrusteeTypeW GetTrusteeType;
109     alias LookupSecurityDescriptorPartsW LookupSecurityDescriptorParts;
110     alias SetEntriesInAclW SetEntriesInAcl;
111     alias SetNamedSecurityInfoW SetNamedSecurityInfo;
112     alias BuildImpersonateExplicitAccessWithNameW
113       BuildImpersonateExplicitAccessWithName;
114     alias BuildImpersonateTrusteeW BuildImpersonateTrustee;
115     alias GetMultipleTrusteeW GetMultipleTrustee;
116     alias GetMultipleTrusteeOperationW GetMultipleTrusteeOperation;
117 } else {
118     alias BuildExplicitAccessWithNameA BuildExplicitAccessWithName;
119     alias BuildSecurityDescriptorA BuildSecurityDescriptor;
120     alias BuildTrusteeWithNameA BuildTrusteeWithName;
121     alias BuildTrusteeWithObjectsAndNameA BuildTrusteeWithObjectsAndName;
122     alias BuildTrusteeWithObjectsAndSidA BuildTrusteeWithObjectsAndSid;
123     alias BuildTrusteeWithSidA BuildTrusteeWithSid;
124     alias GetAuditedPermissionsFromAclA GetAuditedPermissionsFromAcl;
125     alias GetEffectiveRightsFromAclA GetEffectiveRightsFromAcl;
126     alias GetExplicitEntriesFromAclA GetExplicitEntriesFromAcl;
127     alias GetNamedSecurityInfoA GetNamedSecurityInfo;
128     alias GetTrusteeFormA GetTrusteeForm;
129     alias GetTrusteeNameA GetTrusteeName;
130     alias GetTrusteeTypeA GetTrusteeType;
131     alias LookupSecurityDescriptorPartsA LookupSecurityDescriptorParts;
132     alias SetEntriesInAclA SetEntriesInAcl;
133     alias SetNamedSecurityInfoA SetNamedSecurityInfo;
134     alias BuildImpersonateExplicitAccessWithNameA
135       BuildImpersonateExplicitAccessWithName;
136     alias BuildImpersonateTrusteeA BuildImpersonateTrustee;
137     alias GetMultipleTrusteeA GetMultipleTrustee;
138     alias GetMultipleTrusteeOperationA GetMultipleTrusteeOperation;
139 }