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