[LSASRV]
[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 BOOLEAN Trusted;
51 struct _LSA_DB_OBJECT *ParentObject;
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 IN BOOLEAN Trusted,
92 OUT PLSA_DB_OBJECT *DbObject);
93
94 NTSTATUS
95 LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
96 IN LPWSTR ContainerName,
97 IN LPWSTR ObjectName,
98 IN LSA_DB_OBJECT_TYPE ObjectType,
99 IN ACCESS_MASK DesiredAccess,
100 IN BOOLEAN Trusted,
101 OUT PLSA_DB_OBJECT *DbObject);
102
103 NTSTATUS
104 LsapValidateDbObject(IN LSAPR_HANDLE Handle,
105 IN LSA_DB_OBJECT_TYPE HandleType,
106 IN ACCESS_MASK GrantedAccess,
107 OUT PLSA_DB_OBJECT *DbObject);
108
109 NTSTATUS
110 LsapCloseDbObject(IN PLSA_DB_OBJECT DbObject);
111
112 NTSTATUS
113 LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject);
114
115 NTSTATUS
116 LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject,
117 LPWSTR AttributeName,
118 LPVOID AttributeData,
119 PULONG AttributeSize);
120
121 NTSTATUS
122 LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject,
123 LPWSTR AttributeName,
124 LPVOID AttributeData,
125 ULONG AttributeSize);
126
127 NTSTATUS
128 LsapDeleteObjectAttribute(PLSA_DB_OBJECT DbObject,
129 LPWSTR AttributeName);
130
131 /* lookup.c */
132 NTSTATUS
133 LsapInitSids(VOID);
134
135 ULONG
136 LsapGetRelativeIdFromSid(PSID Sid);
137
138 NTSTATUS
139 LsapLookupNames(DWORD Count,
140 PRPC_UNICODE_STRING Names,
141 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
142 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
143 LSAP_LOOKUP_LEVEL LookupLevel,
144 DWORD *MappedCount,
145 DWORD LookupOptions,
146 DWORD ClientRevision);
147
148 NTSTATUS
149 LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
150 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
151 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
152 LSAP_LOOKUP_LEVEL LookupLevel,
153 DWORD *MappedCount,
154 DWORD LookupOptions,
155 DWORD ClientRevision);
156
157 /* lsarpc.c */
158 VOID
159 LsarStartRpcServer(VOID);
160
161 /* policy.c */
162 NTSTATUS
163 LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject,
164 PLSAPR_POLICY_INFORMATION *PolicyInformation);
165
166 NTSTATUS
167 LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject,
168 PLSAPR_POLICY_INFORMATION *PolicyInformation);
169
170 NTSTATUS
171 LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
172 PLSAPR_POLICY_INFORMATION *PolicyInformation);
173
174 NTSTATUS
175 LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject,
176 PLSAPR_POLICY_INFORMATION *PolicyInformation);
177
178 NTSTATUS
179 LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject,
180 PLSAPR_POLICY_INFORMATION *PolicyInformation);
181
182 NTSTATUS
183 LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject,
184 PLSAPR_POLICY_INFORMATION *PolicyInformation);
185
186 NTSTATUS
187 LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject,
188 PLSAPR_POLICY_INFORMATION *PolicyInformation);
189
190 NTSTATUS
191 LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject,
192 PLSAPR_POLICY_INFORMATION *PolicyInformation);
193
194 NTSTATUS
195 LsarQueryModification(PLSA_DB_OBJECT PolicyObject,
196 PLSAPR_POLICY_INFORMATION *PolicyInformation);
197
198 NTSTATUS
199 LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject,
200 PLSAPR_POLICY_INFORMATION *PolicyInformation);
201
202 NTSTATUS
203 LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject,
204 PLSAPR_POLICY_INFORMATION *PolicyInformation);
205
206 NTSTATUS
207 LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
208 PLSAPR_POLICY_INFORMATION *PolicyInformation);
209
210 NTSTATUS
211 LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
212 PLSAPR_POLICY_INFORMATION *PolicyInformation);
213
214 NTSTATUS
215 LsarSetAuditLog(PLSA_DB_OBJECT PolicyObject,
216 PPOLICY_AUDIT_LOG_INFO Info);
217
218 NTSTATUS
219 LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
220 PLSAPR_POLICY_AUDIT_EVENTS_INFO Info);
221
222 NTSTATUS
223 LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
224 PLSAPR_POLICY_PRIMARY_DOM_INFO Info);
225
226 NTSTATUS
227 LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject,
228 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
229
230 NTSTATUS
231 LsarSetServerRole(PLSA_DB_OBJECT PolicyObject,
232 PPOLICY_LSA_SERVER_ROLE_INFO Info);
233
234 NTSTATUS
235 LsarSetReplicaSource(PLSA_DB_OBJECT PolicyObject,
236 PPOLICY_LSA_REPLICA_SRCE_INFO Info);
237
238 NTSTATUS
239 LsarSetDefaultQuota(PLSA_DB_OBJECT PolicyObject,
240 PPOLICY_DEFAULT_QUOTA_INFO Info);
241
242 NTSTATUS
243 LsarSetModification(PLSA_DB_OBJECT PolicyObject,
244 PPOLICY_MODIFICATION_INFO Info);
245
246 NTSTATUS
247 LsarSetAuditFull(PLSA_DB_OBJECT PolicyObject,
248 PPOLICY_AUDIT_FULL_QUERY_INFO Info);
249
250 NTSTATUS
251 LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject,
252 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
253
254 NTSTATUS
255 LsarSetDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
256 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
257
258 NTSTATUS
259 LsarSetLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
260 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
261
262 /* privileges.c */
263 NTSTATUS
264 LsarpLookupPrivilegeName(PLUID Value,
265 PRPC_UNICODE_STRING *Name);
266
267 NTSTATUS
268 LsarpLookupPrivilegeValue(PRPC_UNICODE_STRING Name,
269 PLUID Value);
270
271 NTSTATUS
272 LsarpEnumeratePrivileges(DWORD *EnumerationContext,
273 PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer,
274 DWORD PreferedMaximumLength);
275
276 NTSTATUS
277 LsapLookupAccountRightName(ULONG RightValue,
278 PRPC_UNICODE_STRING *Name);
279
280 /* registry.h */
281 NTSTATUS
282 LsapRegCloseKey(IN HANDLE KeyHandle);
283
284 NTSTATUS
285 LsapRegCreateKey(IN HANDLE ParentKeyHandle,
286 IN LPCWSTR KeyName,
287 IN ACCESS_MASK DesiredAccess,
288 OUT HANDLE KeyHandle);
289
290 NTSTATUS
291 LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
292 IN LPCWSTR KeyName);
293
294 NTSTATUS
295 LsapRegDeleteKey(IN HANDLE KeyHandle);
296
297 NTSTATUS
298 LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
299 IN ULONG Index,
300 IN ULONG Length,
301 OUT LPWSTR Buffer);
302
303 NTSTATUS
304 LsapRegOpenKey(IN HANDLE ParentKeyHandle,
305 IN LPCWSTR KeyName,
306 IN ACCESS_MASK DesiredAccess,
307 OUT HANDLE KeyHandle);
308
309 NTSTATUS
310 LsapRegQueryKeyInfo(IN HANDLE KeyHandle,
311 OUT PULONG SubKeyCount,
312 OUT PULONG ValueCount);
313
314 NTSTATUS
315 LsapRegDeleteValue(IN HANDLE KeyHandle,
316 IN LPWSTR ValueName);
317
318 NTSTATUS
319 LsapRegEnumerateValue(IN HANDLE KeyHandle,
320 IN ULONG Index,
321 OUT LPWSTR Name,
322 IN OUT PULONG NameLength,
323 OUT PULONG Type OPTIONAL,
324 OUT PVOID Data OPTIONAL,
325 IN OUT PULONG DataLength OPTIONAL);
326
327 NTSTATUS
328 LsapRegQueryValue(IN HANDLE KeyHandle,
329 IN LPWSTR ValueName,
330 OUT PULONG Type OPTIONAL,
331 OUT LPVOID Data OPTIONAL,
332 IN OUT PULONG DataLength OPTIONAL);
333
334 NTSTATUS
335 LsapRegSetValue(IN HANDLE KeyHandle,
336 IN LPWSTR ValueName,
337 IN ULONG Type,
338 IN LPVOID Data,
339 IN ULONG DataLength);
340
341 /* security.c */
342 NTSTATUS
343 LsapCreatePolicySd(PSECURITY_DESCRIPTOR *PolicySd,
344 PULONG PolicySdSize);
345
346 NTSTATUS
347 LsapCreateAccountSd(PSECURITY_DESCRIPTOR *AccountSd,
348 PULONG AccountSdSize);
349
350 NTSTATUS
351 LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd,
352 PULONG SecretSdSize);
353
354 /* EOF */