1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use shared::basetsd::SIZE_T;
7 use shared::minwindef::{BOOL, DWORD, PULONG, UCHAR};
8 use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR, PSECURITY_DESCRIPTOR, PSID, SECURITY_INFORMATION};
9 pub const SDDL_REVISION_1: UCHAR = 1;
10 pub const SDDL_REVISION: UCHAR = SDDL_REVISION_1;
11 pub const SDDL_OWNER: &'static str = "O";
12 pub const SDDL_GROUP: &'static str = "G";
13 pub const SDDL_DACL: &'static str = "D";
14 pub const SDDL_SACL: &'static str = "S";
15 pub const SDDL_PROTECTED: &'static str = "P";
16 pub const SDDL_AUTO_INHERIT_REQ: &'static str = "AR";
17 pub const SDDL_AUTO_INHERITED: &'static str = "AI";
18 pub const SDDL_NULL_ACL: &'static str = "NO_ACCESS_CONTROL";
19 pub const SDDL_ACCESS_ALLOWED: &'static str = "A";
20 pub const SDDL_ACCESS_DENIED: &'static str = "D";
21 pub const SDDL_OBJECT_ACCESS_ALLOWED: &'static str = "OA";
22 pub const SDDL_OBJECT_ACCESS_DENIED: &'static str = "OD";
23 pub const SDDL_AUDIT: &'static str = "AU";
24 pub const SDDL_ALARM: &'static str = "AL";
25 pub const SDDL_OBJECT_AUDIT: &'static str = "OU";
26 pub const SDDL_OBJECT_ALARM: &'static str = "OL";
27 pub const SDDL_MANDATORY_LABEL: &'static str = "ML";
28 pub const SDDL_PROCESS_TRUST_LABEL: &'static str = "TL";
29 pub const SDDL_CALLBACK_ACCESS_ALLOWED: &'static str = "XA";
30 pub const SDDL_CALLBACK_ACCESS_DENIED: &'static str = "XD";
31 pub const SDDL_RESOURCE_ATTRIBUTE: &'static str = "RA";
32 pub const SDDL_SCOPED_POLICY_ID: &'static str = "SP";
33 pub const SDDL_CALLBACK_AUDIT: &'static str = "XU";
34 pub const SDDL_CALLBACK_OBJECT_ACCESS_ALLOWED: &'static str = "ZA";
35 pub const SDDL_ACCESS_FILTER: &'static str = "FL";
36 pub const SDDL_INT: &'static str = "TI";
37 pub const SDDL_UINT: &'static str = "TU";
38 pub const SDDL_WSTRING: &'static str = "TS";
39 pub const SDDL_SID: &'static str = "TD";
40 pub const SDDL_BLOB: &'static str = "TX";
41 pub const SDDL_BOOLEAN: &'static str = "TB";
42 pub const SDDL_CONTAINER_INHERIT: &'static str = "CI";
43 pub const SDDL_OBJECT_INHERIT: &'static str = "OI";
44 pub const SDDL_NO_PROPAGATE: &'static str = "NP";
45 pub const SDDL_INHERIT_ONLY: &'static str = "IO";
46 pub const SDDL_INHERITED: &'static str = "ID";
47 pub const SDDL_TRUST_PROTECTED_FILTER: &'static str = "TP";
48 pub const SDDL_AUDIT_SUCCESS: &'static str = "SA";
49 pub const SDDL_AUDIT_FAILURE: &'static str = "FA";
50 pub const SDDL_READ_PROPERTY: &'static str = "RP";
51 pub const SDDL_WRITE_PROPERTY: &'static str = "WP";
52 pub const SDDL_CREATE_CHILD: &'static str = "CC";
53 pub const SDDL_DELETE_CHILD: &'static str = "DC";
54 pub const SDDL_LIST_CHILDREN: &'static str = "LC";
55 pub const SDDL_SELF_WRITE: &'static str = "SW";
56 pub const SDDL_LIST_OBJECT: &'static str = "LO";
57 pub const SDDL_DELETE_TREE: &'static str = "DT";
58 pub const SDDL_CONTROL_ACCESS: &'static str = "CR";
59 pub const SDDL_READ_CONTROL: &'static str = "RC";
60 pub const SDDL_WRITE_DAC: &'static str = "WD";
61 pub const SDDL_WRITE_OWNER: &'static str = "WO";
62 pub const SDDL_STANDARD_DELETE: &'static str = "SD";
63 pub const SDDL_GENERIC_ALL: &'static str = "GA";
64 pub const SDDL_GENERIC_READ: &'static str = "GR";
65 pub const SDDL_GENERIC_WRITE: &'static str = "GW";
66 pub const SDDL_GENERIC_EXECUTE: &'static str = "GX";
67 pub const SDDL_FILE_ALL: &'static str = "FA";
68 pub const SDDL_FILE_READ: &'static str = "FR";
69 pub const SDDL_FILE_WRITE: &'static str = "FW";
70 pub const SDDL_FILE_EXECUTE: &'static str = "FX";
71 pub const SDDL_KEY_ALL: &'static str = "KA";
72 pub const SDDL_KEY_READ: &'static str = "KR";
73 pub const SDDL_KEY_WRITE: &'static str = "KW";
74 pub const SDDL_KEY_EXECUTE: &'static str = "KX";
75 pub const SDDL_NO_WRITE_UP: &'static str = "NW";
76 pub const SDDL_NO_READ_UP: &'static str = "NR";
77 pub const SDDL_NO_EXECUTE_UP: &'static str = "NX";
78 pub const SDDL_ALIAS_SIZE: SIZE_T = 2;
79 pub const SDDL_DOMAIN_ADMINISTRATORS: &'static str = "DA";
80 pub const SDDL_DOMAIN_GUESTS: &'static str = "DG";
81 pub const SDDL_DOMAIN_USERS: &'static str = "DU";
82 pub const SDDL_ENTERPRISE_DOMAIN_CONTROLLERS: &'static str = "ED";
83 pub const SDDL_DOMAIN_DOMAIN_CONTROLLERS: &'static str = "DD";
84 pub const SDDL_DOMAIN_COMPUTERS: &'static str = "DC";
85 pub const SDDL_BUILTIN_ADMINISTRATORS: &'static str = "BA";
86 pub const SDDL_BUILTIN_GUESTS: &'static str = "BG";
87 pub const SDDL_BUILTIN_USERS: &'static str = "BU";
88 pub const SDDL_LOCAL_ADMIN: &'static str = "LA";
89 pub const SDDL_LOCAL_GUEST: &'static str = "LG";
90 pub const SDDL_ACCOUNT_OPERATORS: &'static str = "AO";
91 pub const SDDL_BACKUP_OPERATORS: &'static str = "BO";
92 pub const SDDL_PRINTER_OPERATORS: &'static str = "PO";
93 pub const SDDL_SERVER_OPERATORS: &'static str = "SO";
94 pub const SDDL_AUTHENTICATED_USERS: &'static str = "AU";
95 pub const SDDL_PERSONAL_SELF: &'static str = "PS";
96 pub const SDDL_CREATOR_OWNER: &'static str = "CO";
97 pub const SDDL_CREATOR_GROUP: &'static str = "CG";
98 pub const SDDL_LOCAL_SYSTEM: &'static str = "SY";
99 pub const SDDL_POWER_USERS: &'static str = "PU";
100 pub const SDDL_EVERYONE: &'static str = "WD";
101 pub const SDDL_REPLICATOR: &'static str = "RE";
102 pub const SDDL_INTERACTIVE: &'static str = "IU";
103 pub const SDDL_NETWORK: &'static str = "NU";
104 pub const SDDL_SERVICE: &'static str = "SU";
105 pub const SDDL_RESTRICTED_CODE: &'static str = "RC";
106 pub const SDDL_WRITE_RESTRICTED_CODE: &'static str = "WR";
107 pub const SDDL_ANONYMOUS: &'static str = "AN";
108 pub const SDDL_SCHEMA_ADMINISTRATORS: &'static str = "SA";
109 pub const SDDL_CERT_SERV_ADMINISTRATORS: &'static str = "CA";
110 pub const SDDL_RAS_SERVERS: &'static str = "RS";
111 pub const SDDL_ENTERPRISE_ADMINS: &'static str = "EA";
112 pub const SDDL_GROUP_POLICY_ADMINS: &'static str = "PA";
113 pub const SDDL_ALIAS_PREW2KCOMPACC: &'static str = "RU";
114 pub const SDDL_LOCAL_SERVICE: &'static str = "LS";
115 pub const SDDL_NETWORK_SERVICE: &'static str = "NS";
116 pub const SDDL_REMOTE_DESKTOP: &'static str = "RD";
117 pub const SDDL_NETWORK_CONFIGURATION_OPS: &'static str = "NO";
118 pub const SDDL_PERFMON_USERS: &'static str = "MU";
119 pub const SDDL_PERFLOG_USERS: &'static str = "LU";
120 pub const SDDL_IIS_USERS: &'static str = "IS";
121 pub const SDDL_CRYPTO_OPERATORS: &'static str = "CY";
122 pub const SDDL_OWNER_RIGHTS: &'static str = "OW";
123 pub const SDDL_EVENT_LOG_READERS: &'static str = "ER";
124 pub const SDDL_ENTERPRISE_RO_DCs: &'static str = "RO";
125 pub const SDDL_CERTSVC_DCOM_ACCESS: &'static str = "CD";
126 pub const SDDL_ALL_APP_PACKAGES: &'static str = "AC";
127 pub const SDDL_RDS_REMOTE_ACCESS_SERVERS: &'static str = "RA";
128 pub const SDDL_RDS_ENDPOINT_SERVERS: &'static str = "ES";
129 pub const SDDL_RDS_MANAGEMENT_SERVERS: &'static str = "MS";
130 pub const SDDL_USER_MODE_DRIVERS: &'static str = "UD";
131 pub const SDDL_HYPER_V_ADMINS: &'static str = "HA";
132 pub const SDDL_CLONEABLE_CONTROLLERS: &'static str = "CN";
133 pub const SDDL_ACCESS_CONTROL_ASSISTANCE_OPS: &'static str = "AA";
134 pub const SDDL_REMOTE_MANAGEMENT_USERS: &'static str = "RM";
135 pub const SDDL_AUTHORITY_ASSERTED: &'static str = "AS";
136 pub const SDDL_SERVICE_ASSERTED: &'static str = "SS";
137 pub const SDDL_PROTECTED_USERS: &'static str = "AP";
138 pub const SDDL_KEY_ADMINS: &'static str = "KA";
139 pub const SDDL_ENTERPRISE_KEY_ADMINS: &'static str = "EK";
140 pub const SDDL_ML_LOW: &'static str = "LW";
141 pub const SDDL_ML_MEDIUM: &'static str = "ME";
142 pub const SDDL_ML_MEDIUM_PLUS: &'static str = "MP";
143 pub const SDDL_ML_HIGH: &'static str = "HI";
144 pub const SDDL_ML_SYSTEM: &'static str = "SI";
145 pub const SDDL_SEPERATORC: char = ';';
146 pub const SDDL_DELIMINATORC: char = ':';
147 pub const SDDL_ACE_BEGINC: char = '(';
148 pub const SDDL_ACE_ENDC: char = ')';
149 pub const SDDL_SPACEC: char = ' ';
150 pub const SDDL_ACE_COND_BEGINC: char = '(';
151 pub const SDDL_ACE_COND_ENDC: char = ')';
152 pub const SDDL_ACE_COND_STRING_BEGINC: char = '"';
153 pub const SDDL_ACE_COND_STRING_ENDC: char = '"';
154 pub const SDDL_ACE_COND_COMPOSITEVALUE_BEGINC: char = '{';
155 pub const SDDL_ACE_COND_COMPOSITEVALUE_ENDC: char = '}';
156 pub const SDDL_ACE_COND_COMPOSITEVALUE_SEPERATORC: char = ',';
157 pub const SDDL_ACE_COND_BLOB_PREFIXC: char = '#';
158 pub const SDDL_ACE_COND_SID_BEGINC: char = '(';
159 pub const SDDL_ACE_COND_SID_ENDC: char = ')';
160 pub const SDDL_SEPERATOR: &'static str = ";";
161 pub const SDDL_DELIMINATOR: &'static str = ":";
162 pub const SDDL_ACE_BEGIN: &'static str = "(";
163 pub const SDDL_ACE_END: &'static str = ")";
164 pub const SDDL_ACE_COND_BEGIN: &'static str = "(";
165 pub const SDDL_ACE_COND_END: &'static str = ")";
166 pub const SDDL_SPACE: &'static str = " ";
167 pub const SDDL_ACE_COND_BLOB_PREFIX: &'static str = "#";
168 pub const SDDL_ACE_COND_SID_PREFIX: &'static str = "SID";
169 pub const SDDL_ACE_COND_ATTRIBUTE_PREFIX: &'static str = "@";
170 pub const SDDL_ACE_COND_USER_ATTRIBUTE_PREFIX: &'static str = "@USER.";
171 pub const SDDL_ACE_COND_RESOURCE_ATTRIBUTE_PREFIX: &'static str = "@RESOURCE.";
172 pub const SDDL_ACE_COND_DEVICE_ATTRIBUTE_PREFIX: &'static str = "@DEVICE.";
173 pub const SDDL_ACE_COND_TOKEN_ATTRIBUTE_PREFIX: &'static str = "@TOKEN.";
174 extern "system" {
ConvertSidToStringSidA( Sid: PSID, StringSid: *mut LPSTR, ) -> BOOL175     pub fn ConvertSidToStringSidA(
176         Sid: PSID,
177         StringSid: *mut LPSTR,
178     ) -> BOOL;
ConvertSidToStringSidW( Sid: PSID, StringSid: *mut LPWSTR, ) -> BOOL179     pub fn ConvertSidToStringSidW(
180         Sid: PSID,
181         StringSid: *mut LPWSTR,
182     ) -> BOOL;
ConvertStringSidToSidA( StringSid: LPCSTR, Sid: *mut PSID, ) -> BOOL183     pub fn ConvertStringSidToSidA(
184         StringSid: LPCSTR,
185         Sid: *mut PSID,
186     ) -> BOOL;
ConvertStringSidToSidW( StringSid: LPCWSTR, Sid: *mut PSID, ) -> BOOL187     pub fn ConvertStringSidToSidW(
188         StringSid: LPCWSTR,
189         Sid: *mut PSID,
190     ) -> BOOL;
ConvertStringSecurityDescriptorToSecurityDescriptorA( StringSecurityDescriptor: LPCSTR, StringSDRevision: DWORD, SecurityDescriptor: *mut PSECURITY_DESCRIPTOR, SecurityDescriptorSize: PULONG, ) -> BOOL191     pub fn ConvertStringSecurityDescriptorToSecurityDescriptorA(
192         StringSecurityDescriptor: LPCSTR,
193         StringSDRevision: DWORD,
194         SecurityDescriptor: *mut PSECURITY_DESCRIPTOR,
195         SecurityDescriptorSize: PULONG,
196     ) -> BOOL;
ConvertStringSecurityDescriptorToSecurityDescriptorW( StringSecurityDescriptor: LPCWSTR, StringSDRevision: DWORD, SecurityDescriptor: *mut PSECURITY_DESCRIPTOR, SecurityDescriptorSize: PULONG, ) -> BOOL197     pub fn ConvertStringSecurityDescriptorToSecurityDescriptorW(
198         StringSecurityDescriptor: LPCWSTR,
199         StringSDRevision: DWORD,
200         SecurityDescriptor: *mut PSECURITY_DESCRIPTOR,
201         SecurityDescriptorSize: PULONG,
202     ) -> BOOL;
ConvertSecurityDescriptorToStringSecurityDescriptorA( SecurityDescriptor: PSECURITY_DESCRIPTOR, RequestedStringSDRevision: DWORD, SecurityInformation: SECURITY_INFORMATION, StringSecurityDescriptor: *mut LPSTR, StringSecurityDescriptorLen: PULONG, ) -> BOOL203     pub fn ConvertSecurityDescriptorToStringSecurityDescriptorA(
204         SecurityDescriptor: PSECURITY_DESCRIPTOR,
205         RequestedStringSDRevision: DWORD,
206         SecurityInformation: SECURITY_INFORMATION,
207         StringSecurityDescriptor: *mut LPSTR,
208         StringSecurityDescriptorLen: PULONG,
209     ) -> BOOL;
ConvertSecurityDescriptorToStringSecurityDescriptorW( SecurityDescriptor: PSECURITY_DESCRIPTOR, RequestedStringSDRevision: DWORD, SecurityInformation: SECURITY_INFORMATION, StringSecurityDescriptor: *mut LPWSTR, StringSecurityDescriptorLen: PULONG, ) -> BOOL210     pub fn ConvertSecurityDescriptorToStringSecurityDescriptorW(
211         SecurityDescriptor: PSECURITY_DESCRIPTOR,
212         RequestedStringSDRevision: DWORD,
213         SecurityInformation: SECURITY_INFORMATION,
214         StringSecurityDescriptor: *mut LPWSTR,
215         StringSecurityDescriptorLen: PULONG,
216     ) -> BOOL;
217 }
218