xref: /reactos/sdk/include/psdk/sddl.h (revision c2c66aff)
1 /*
2  * Copyright (C) 2003 Ulrich Czekalla for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #ifndef __SDDL_H__
20 #define __SDDL_H__
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*
28  * SDDL Version information
29  */
30 #define SDDL_REVISION_1     1
31 #define SDDL_REVISION       SDDL_REVISION_1
32 
33 /*
34  * SDDL Component tags
35  */
36 #define SDDL_OWNER                          TEXT("O")
37 #define SDDL_GROUP                          TEXT("G")
38 #define SDDL_DACL                           TEXT("D")
39 #define SDDL_SACL                           TEXT("S")
40 
41 /*
42  * SDDL Security descriptor controls
43  */
44 #define SDDL_PROTECTED                      TEXT("P")
45 #define SDDL_AUTO_INHERIT_REQ               TEXT("AR")
46 #define SDDL_AUTO_INHERITED                 TEXT("AI")
47 
48 /*
49  * SDDL Rights
50  */
51 #define SDDL_READ_PROPERTY                  TEXT("RP")
52 #define SDDL_WRITE_PROPERTY                 TEXT("WP")
53 #define SDDL_CREATE_CHILD                   TEXT("CC")
54 #define SDDL_DELETE_CHILD                   TEXT("DC")
55 #define SDDL_LIST_CHILDREN                  TEXT("LC")
56 #define SDDL_SELF_WRITE                     TEXT("SW")
57 #define SDDL_LIST_OBJECT                    TEXT("LO")
58 #define SDDL_DELETE_TREE                    TEXT("DT")
59 #define SDDL_CONTROL_ACCESS                 TEXT("CR")
60 #define SDDL_READ_CONTROL                   TEXT("RC")
61 #define SDDL_WRITE_DAC                      TEXT("WD")
62 #define SDDL_WRITE_OWNER                    TEXT("WO")
63 #define SDDL_STANDARD_DELETE                TEXT("SD")
64 #define SDDL_GENERIC_ALL                    TEXT("GA")
65 #define SDDL_GENERIC_READ                   TEXT("GR")
66 #define SDDL_GENERIC_WRITE                  TEXT("GW")
67 #define SDDL_GENERIC_EXECUTE                TEXT("GX")
68 #define SDDL_FILE_ALL                       TEXT("FA")
69 #define SDDL_FILE_READ                      TEXT("FR")
70 #define SDDL_FILE_WRITE                     TEXT("FW")
71 #define SDDL_FILE_EXECUTE                   TEXT("FX")
72 #define SDDL_KEY_ALL                        TEXT("KA")
73 #define SDDL_KEY_READ                       TEXT("KR")
74 #define SDDL_KEY_WRITE                      TEXT("KW")
75 #define SDDL_KEY_EXECUTE                    TEXT("KX")
76 
77 #define SDDL_ALIAS_SIZE                     2
78 
79 /*
80  * SDDL User aliases
81  */
82 #define SDDL_DOMAIN_ADMINISTRATORS          TEXT("DA")
83 #define SDDL_DOMAIN_GUESTS                  TEXT("DG")
84 #define SDDL_DOMAIN_USERS                   TEXT("DU")
85 #define SDDL_ENTERPRISE_DOMAIN_CONTROLLERS  TEXT("ED")
86 #define SDDL_DOMAIN_DOMAIN_CONTROLLERS      TEXT("DD")
87 #define SDDL_DOMAIN_COMPUTERS               TEXT("DC")
88 #define SDDL_BUILTIN_ADMINISTRATORS         TEXT("BA")
89 #define SDDL_BUILTIN_GUESTS                 TEXT("BG")
90 #define SDDL_BUILTIN_USERS                  TEXT("BU")
91 #define SDDL_LOCAL_ADMIN                    TEXT("LA")
92 #define SDDL_LOCAL_GUEST                    TEXT("LG")
93 #define SDDL_ACCOUNT_OPERATORS              TEXT("AO")
94 #define SDDL_BACKUP_OPERATORS               TEXT("BO")
95 #define SDDL_PRINTER_OPERATORS              TEXT("PO")
96 #define SDDL_SERVER_OPERATORS               TEXT("SO")
97 #define SDDL_AUTHENTICATED_USERS            TEXT("AU")
98 #define SDDL_PERSONAL_SELF                  TEXT("PS")
99 #define SDDL_CREATOR_OWNER                  TEXT("CO")
100 #define SDDL_CREATOR_GROUP                  TEXT("CG")
101 #define SDDL_LOCAL_SYSTEM                   TEXT("SY")
102 #define SDDL_POWER_USERS                    TEXT("PU")
103 #define SDDL_EVERYONE                       TEXT("WD")
104 #define SDDL_REPLICATOR                     TEXT("RE")
105 #define SDDL_INTERACTIVE                    TEXT("IU")
106 #define SDDL_NETWORK                        TEXT("NU")
107 #define SDDL_SERVICE                        TEXT("SU")
108 #define SDDL_RESTRICTED_CODE                TEXT("RC")
109 #define SDDL_ANONYMOUS                      TEXT("AN")
110 #define SDDL_SCHEMA_ADMINISTRATORS          TEXT("SA")
111 #define SDDL_CERT_SERV_ADMINISTRATORS       TEXT("CA")
112 #define SDDL_RAS_SERVERS                    TEXT("RS")
113 #define SDDL_ENTERPRISE_ADMINS              TEXT("EA")
114 #define SDDL_GROUP_POLICY_ADMINS            TEXT("PA")
115 #define SDDL_ALIAS_PREW2KCOMPACC            TEXT("RU")
116 #define SDDL_LOCAL_SERVICE                  TEXT("LS")
117 #define SDDL_NETWORK_SERVICE                TEXT("NS")
118 #define SDDL_REMOTE_DESKTOP                 TEXT("RD")
119 #define SDDL_NETWORK_CONFIGURATION_OPS      TEXT("NO")
120 #define SDDL_PERFMON_USERS                  TEXT("MU")
121 #define SDDL_PERFLOG_USERS                  TEXT("LU")
122 
123 /*
124  * SDDL Separators - character version
125  */
126 #define SDDL_SEPERATORC                     TEXT(';')
127 #define SDDL_DELIMINATORC                   TEXT(':')
128 #define SDDL_ACE_BEGINC                     TEXT('(')
129 #define SDDL_ACE_ENDC                       TEXT(')')
130 
131 /*
132  * SDDL Separators - string version
133  */
134 #define SDDL_SEPERATOR                     TEXT(";")
135 #define SDDL_DELIMINATOR                   TEXT(":")
136 #define SDDL_ACE_BEGIN                     TEXT("(")
137 #define SDDL_ACE_END                       TEXT(")")
138 
139 BOOL WINAPI ConvertSidToStringSidA( PSID, LPSTR* );
140 BOOL WINAPI ConvertSidToStringSidW( PSID, LPWSTR* );
141 BOOL WINAPI ConvertStringSidToSidA( LPCSTR, PSID* );
142 BOOL WINAPI ConvertStringSidToSidW( LPCWSTR, PSID* );
143 BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
144     LPCSTR, DWORD, PSECURITY_DESCRIPTOR*, PULONG );
145 BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(
146     LPCWSTR, DWORD, PSECURITY_DESCRIPTOR*, PULONG );
147 BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA(
148     PSECURITY_DESCRIPTOR, DWORD, SECURITY_INFORMATION, LPSTR*, PULONG );
149 BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(
150     PSECURITY_DESCRIPTOR, DWORD, SECURITY_INFORMATION, LPWSTR*, PULONG );
151 
152 #ifdef UNICODE
153 #define ConvertSidToStringSid ConvertSidToStringSidW
154 #define ConvertStringSidToSid ConvertStringSidToSidW
155 #define ConvertStringSecurityDescriptorToSecurityDescriptor \
156     ConvertStringSecurityDescriptorToSecurityDescriptorW
157 #define ConvertSecurityDescriptorToStringSecurityDescriptor \
158     ConvertSecurityDescriptorToStringSecurityDescriptorW
159 #else /* UNICODE */
160 #define ConvertSidToStringSid ConvertSidToStringSidA
161 #define ConvertStringSidToSid ConvertStringSidToSidA
162 #define ConvertStringSecurityDescriptorToSecurityDescriptor \
163     ConvertStringSecurityDescriptorToSecurityDescriptorA
164 #define ConvertSecurityDescriptorToStringSecurityDescriptor \
165     ConvertSecurityDescriptorToStringSecurityDescriptorA
166 #endif /* UNICODE */
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif  /* __SDDL_H__ */
173