33af276382fe5d7bd21143c2b9812cfe988c0e96
[reactos.git] / reactos / dll / win32 / lsasrv / lsasrv.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Local Security Authority (LSA) Server
4 * FILE: reactos/dll/win32/lsasrv/lsasrv.h
5 * PURPOSE: Common header file
6 *
7 * PROGRAMMERS: Eric Kohl
8 */
9
10 #define WIN32_NO_STATUS
11 #include <windows.h>
12 #define NTOS_MODE_USER
13 #include <ndk/cmfuncs.h>
14 #include <ndk/kefuncs.h>
15 #include <ndk/lpctypes.h>
16 #include <ndk/lpcfuncs.h>
17 #include <ndk/obfuncs.h>
18 #include <ndk/rtlfuncs.h>
19 #include <ndk/setypes.h>
20
21 #include <ntsam.h>
22 #include <ntlsa.h>
23 #include <ntsecapi.h>
24 #include <sddl.h>
25
26 #include <string.h>
27
28 #include "lsass.h"
29 #include "lsa_s.h"
30
31 #include <wine/debug.h>
32
33
34 typedef enum _LSA_DB_OBJECT_TYPE
35 {
36 LsaDbIgnoreObject,
37 LsaDbPolicyObject,
38 LsaDbAccountObject,
39 LsaDbDomainObject,
40 LsaDbSecretObject
41 } LSA_DB_OBJECT_TYPE, *PLSA_DB_OBJECT_TYPE;
42
43 typedef struct _LSA_DB_OBJECT
44 {
45 ULONG Signature;
46 LSA_DB_OBJECT_TYPE ObjectType;
47 ULONG RefCount;
48 ACCESS_MASK Access;
49 HANDLE KeyHandle;
50 struct _LSA_DB_OBJECT *ParentObject;
51 WCHAR Name[0];
52 } LSA_DB_OBJECT, *PLSA_DB_OBJECT;
53
54 #define LSAP_DB_SIGNATURE 0x12345678
55
56
57 typedef struct _LSAP_POLICY_AUDIT_EVENTS_DATA
58 {
59 BOOLEAN AuditingMode;
60 DWORD MaximumAuditEventCount;
61 DWORD AuditEvents[0];
62 } LSAP_POLICY_AUDIT_EVENTS_DATA, *PLSAP_POLICY_AUDIT_EVENTS_DATA;
63
64
65 extern SID_IDENTIFIER_AUTHORITY NullSidAuthority;
66 extern SID_IDENTIFIER_AUTHORITY WorldSidAuthority;
67 extern SID_IDENTIFIER_AUTHORITY LocalSidAuthority;
68 extern SID_IDENTIFIER_AUTHORITY CreatorSidAuthority;
69 extern SID_IDENTIFIER_AUTHORITY NtAuthority;
70
71 extern PSID BuiltinDomainSid;
72 extern UNICODE_STRING BuiltinDomainName;
73 extern PSID AccountDomainSid;
74 extern UNICODE_STRING AccountDomainName;
75
76
77 /* authport.c */
78 NTSTATUS
79 StartAuthenticationPort(VOID);
80
81 /* database.c */
82 NTSTATUS
83 LsapInitDatabase(VOID);
84
85 NTSTATUS
86 LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject,
87 IN LPWSTR ContainerName,
88 IN LPWSTR ObjectName,
89 IN LSA_DB_OBJECT_TYPE HandleType,
90 IN ACCESS_MASK DesiredAccess,
91 OUT PLSA_DB_OBJECT *DbObject);
92
93 NTSTATUS
94 LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
95 IN LPWSTR ContainerName,
96 IN LPWSTR ObjectName,
97 IN LSA_DB_OBJECT_TYPE ObjectType,
98 IN ACCESS_MASK DesiredAccess,
99 OUT PLSA_DB_OBJECT *DbObject);
100
101 NTSTATUS
102 LsapValidateDbObject(IN LSAPR_HANDLE Handle,
103 IN LSA_DB_OBJECT_TYPE HandleType,
104 IN ACCESS_MASK GrantedAccess,
105 OUT PLSA_DB_OBJECT *DbObject);
106
107 NTSTATUS
108 LsapCloseDbObject(IN PLSA_DB_OBJECT DbObject);
109
110 NTSTATUS
111 LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject);
112
113 NTSTATUS
114 LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject,
115 LPWSTR AttributeName,
116 LPVOID AttributeData,
117 PULONG AttributeSize);
118
119 NTSTATUS
120 LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject,
121 LPWSTR AttributeName,
122 LPVOID AttributeData,
123 ULONG AttributeSize);
124
125 /* lookup.c */
126 NTSTATUS
127 LsapInitSids(VOID);
128
129 ULONG
130 LsapGetRelativeIdFromSid(PSID Sid);
131
132 NTSTATUS
133 LsapLookupNames(DWORD Count,
134 PRPC_UNICODE_STRING Names,
135 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
136 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
137 LSAP_LOOKUP_LEVEL LookupLevel,
138 DWORD *MappedCount,
139 DWORD LookupOptions,
140 DWORD ClientRevision);
141
142 NTSTATUS
143 LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
144 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
145 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
146 LSAP_LOOKUP_LEVEL LookupLevel,
147 DWORD *MappedCount,
148 DWORD LookupOptions,
149 DWORD ClientRevision);
150
151 /* lsarpc.c */
152 VOID
153 LsarStartRpcServer(VOID);
154
155 /* policy.c */
156 NTSTATUS
157 LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject,
158 PLSAPR_POLICY_INFORMATION *PolicyInformation);
159
160 NTSTATUS
161 LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject,
162 PLSAPR_POLICY_INFORMATION *PolicyInformation);
163
164 NTSTATUS
165 LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
166 PLSAPR_POLICY_INFORMATION *PolicyInformation);
167
168 NTSTATUS
169 LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject,
170 PLSAPR_POLICY_INFORMATION *PolicyInformation);
171
172 NTSTATUS
173 LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject,
174 PLSAPR_POLICY_INFORMATION *PolicyInformation);
175
176 NTSTATUS
177 LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject,
178 PLSAPR_POLICY_INFORMATION *PolicyInformation);
179
180 NTSTATUS
181 LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject,
182 PLSAPR_POLICY_INFORMATION *PolicyInformation);
183
184 NTSTATUS
185 LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject,
186 PLSAPR_POLICY_INFORMATION *PolicyInformation);
187
188 NTSTATUS
189 LsarQueryModification(PLSA_DB_OBJECT PolicyObject,
190 PLSAPR_POLICY_INFORMATION *PolicyInformation);
191
192 NTSTATUS
193 LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject,
194 PLSAPR_POLICY_INFORMATION *PolicyInformation);
195
196 NTSTATUS
197 LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject,
198 PLSAPR_POLICY_INFORMATION *PolicyInformation);
199
200 NTSTATUS
201 LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
202 PLSAPR_POLICY_INFORMATION *PolicyInformation);
203
204 NTSTATUS
205 LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
206 PLSAPR_POLICY_INFORMATION *PolicyInformation);
207
208 NTSTATUS
209 LsarSetAuditLog(PLSA_DB_OBJECT PolicyObject,
210 PPOLICY_AUDIT_LOG_INFO Info);
211
212 NTSTATUS
213 LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
214 PLSAPR_POLICY_AUDIT_EVENTS_INFO Info);
215
216 NTSTATUS
217 LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
218 PLSAPR_POLICY_PRIMARY_DOM_INFO Info);
219
220 NTSTATUS
221 LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject,
222 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
223
224 NTSTATUS
225 LsarSetServerRole(PLSA_DB_OBJECT PolicyObject,
226 PPOLICY_LSA_SERVER_ROLE_INFO Info);
227
228 NTSTATUS
229 LsarSetReplicaSource(PLSA_DB_OBJECT PolicyObject,
230 PPOLICY_LSA_REPLICA_SRCE_INFO Info);
231
232 NTSTATUS
233 LsarSetDefaultQuota(PLSA_DB_OBJECT PolicyObject,
234 PPOLICY_DEFAULT_QUOTA_INFO Info);
235
236 NTSTATUS
237 LsarSetModification(PLSA_DB_OBJECT PolicyObject,
238 PPOLICY_MODIFICATION_INFO Info);
239
240 NTSTATUS
241 LsarSetAuditFull(PLSA_DB_OBJECT PolicyObject,
242 PPOLICY_AUDIT_FULL_QUERY_INFO Info);
243
244 NTSTATUS
245 LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject,
246 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
247
248 NTSTATUS
249 LsarSetDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
250 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
251
252 NTSTATUS
253 LsarSetLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
254 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
255
256 /* privileges.c */
257 NTSTATUS
258 LsarpLookupPrivilegeName(PLUID Value,
259 PRPC_UNICODE_STRING *Name);
260
261 NTSTATUS
262 LsarpLookupPrivilegeValue(PRPC_UNICODE_STRING Name,
263 PLUID Value);
264
265 NTSTATUS
266 LsarpEnumeratePrivileges(DWORD *EnumerationContext,
267 PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer,
268 DWORD PreferedMaximumLength);
269
270 NTSTATUS
271 LsapLookupAccountRightName(ULONG RightValue,
272 PRPC_UNICODE_STRING *Name);
273
274 /* registry.h */
275 NTSTATUS
276 LsapRegCloseKey(IN HANDLE KeyHandle);
277
278 NTSTATUS
279 LsapRegCreateKey(IN HANDLE ParentKeyHandle,
280 IN LPCWSTR KeyName,
281 IN ACCESS_MASK DesiredAccess,
282 OUT HANDLE KeyHandle);
283
284 NTSTATUS
285 LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
286 IN LPCWSTR KeyName);
287
288 NTSTATUS
289 LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
290 IN ULONG Index,
291 IN ULONG Length,
292 OUT LPWSTR Buffer);
293
294 NTSTATUS
295 LsapRegOpenKey(IN HANDLE ParentKeyHandle,
296 IN LPCWSTR KeyName,
297 IN ACCESS_MASK DesiredAccess,
298 OUT HANDLE KeyHandle);
299
300 NTSTATUS
301 LsapRegQueryKeyInfo(IN HANDLE KeyHandle,
302 OUT PULONG SubKeyCount,
303 OUT PULONG ValueCount);
304
305 NTSTATUS
306 LsapRegDeleteValue(IN HANDLE KeyHandle,
307 IN LPWSTR ValueName);
308
309 NTSTATUS
310 LsapRegEnumerateValue(IN HANDLE KeyHandle,
311 IN ULONG Index,
312 OUT LPWSTR Name,
313 IN OUT PULONG NameLength,
314 OUT PULONG Type OPTIONAL,
315 OUT PVOID Data OPTIONAL,
316 IN OUT PULONG DataLength OPTIONAL);
317
318 NTSTATUS
319 LsapRegQueryValue(IN HANDLE KeyHandle,
320 IN LPWSTR ValueName,
321 OUT PULONG Type OPTIONAL,
322 OUT LPVOID Data OPTIONAL,
323 IN OUT PULONG DataLength OPTIONAL);
324
325 NTSTATUS
326 LsapRegSetValue(IN HANDLE KeyHandle,
327 IN LPWSTR ValueName,
328 IN ULONG Type,
329 IN LPVOID Data,
330 IN ULONG DataLength);
331
332 /* security.c */
333 NTSTATUS
334 LsapCreatePolicySd(PSECURITY_DESCRIPTOR *PolicySd,
335 PULONG PolicySdSize);
336
337 NTSTATUS
338 LsapCreateAccountSd(PSECURITY_DESCRIPTOR *AccountSd,
339 PULONG AccountSdSize);
340
341 NTSTATUS
342 LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd,
343 PULONG SecretSdSize);
344
345 /* EOF */