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