[NTOSKRNL][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 #ifndef _LSASRV_H
11 #define _LSASRV_H
12
13 #include <stdarg.h>
14
15 #define WIN32_NO_STATUS
16 #define _INC_WINDOWS
17 #define COM_NO_WINDOWS_H
18
19 #include <windef.h>
20 #include <winbase.h>
21 #include <winreg.h>
22
23 #define NTOS_MODE_USER
24 #include <ndk/cmfuncs.h>
25 #include <ndk/kefuncs.h>
26 #include <ndk/mmfuncs.h>
27 #include <ndk/obfuncs.h>
28 #include <ndk/psfuncs.h>
29 #include <ndk/rtlfuncs.h>
30 #include <ndk/setypes.h>
31
32 #include <ntsam.h>
33 #include <ntlsa.h>
34 #include <sddl.h>
35
36 #include <lsass.h>
37 #include <lsa_s.h>
38
39 #include <wine/debug.h>
40 WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
41
42 typedef enum _LSA_DB_OBJECT_TYPE
43 {
44 LsaDbIgnoreObject,
45 LsaDbPolicyObject,
46 LsaDbAccountObject,
47 LsaDbDomainObject,
48 LsaDbSecretObject
49 } LSA_DB_OBJECT_TYPE, *PLSA_DB_OBJECT_TYPE;
50
51 typedef struct _LSA_DB_OBJECT
52 {
53 ULONG Signature;
54 LSA_DB_OBJECT_TYPE ObjectType;
55 ULONG RefCount;
56 ACCESS_MASK Access;
57 HANDLE KeyHandle;
58 BOOLEAN Trusted;
59 struct _LSA_DB_OBJECT *ParentObject;
60 } LSA_DB_OBJECT, *PLSA_DB_OBJECT;
61
62 #define LSAP_DB_SIGNATURE 0x12345678
63
64 #define POLICY_AUDIT_EVENT_TYPE_COUNT (AuditCategoryAccountLogon - AuditCategorySystem + 1)
65 typedef struct _LSAP_POLICY_AUDIT_EVENTS_DATA
66 {
67 BOOLEAN AuditingMode;
68 DWORD AuditEvents[POLICY_AUDIT_EVENT_TYPE_COUNT];
69 DWORD MaximumAuditEventCount;
70 } LSAP_POLICY_AUDIT_EVENTS_DATA, *PLSAP_POLICY_AUDIT_EVENTS_DATA;
71
72 typedef struct _LSAP_LOGON_CONTEXT
73 {
74 LIST_ENTRY Entry;
75 HANDLE ClientProcessHandle;
76 HANDLE ConnectionHandle;
77 } LSAP_LOGON_CONTEXT, *PLSAP_LOGON_CONTEXT;
78
79 extern SID_IDENTIFIER_AUTHORITY NullSidAuthority;
80 extern SID_IDENTIFIER_AUTHORITY WorldSidAuthority;
81 extern SID_IDENTIFIER_AUTHORITY LocalSidAuthority;
82 extern SID_IDENTIFIER_AUTHORITY CreatorSidAuthority;
83 extern SID_IDENTIFIER_AUTHORITY NtAuthority;
84
85 extern PSID BuiltinDomainSid;
86 extern UNICODE_STRING BuiltinDomainName;
87 extern PSID AccountDomainSid;
88 extern UNICODE_STRING AccountDomainName;
89
90 extern PSID LsapWorldSid;
91 extern PSID LsapNetworkSid;
92 extern PSID LsapBatchSid;
93 extern PSID LsapInteractiveSid;
94 extern PSID LsapServiceSid;
95 extern PSID LsapLocalSystemSid;
96 extern PSID LsapAdministratorsSid;
97
98
99 /* authpackage.c */
100 NTSTATUS
101 LsapInitAuthPackages(VOID);
102
103 NTSTATUS
104 LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg,
105 PLSAP_LOGON_CONTEXT LogonContext);
106
107 NTSTATUS
108 LsapCallAuthenticationPackage(PLSA_API_MSG RequestMsg,
109 PLSAP_LOGON_CONTEXT LogonContext);
110
111 NTSTATUS
112 LsapLogonUser(PLSA_API_MSG RequestMsg,
113 PLSAP_LOGON_CONTEXT LogonContext);
114
115 /* authport.c */
116 NTSTATUS
117 StartAuthenticationPort(VOID);
118
119 /* database.c */
120 NTSTATUS
121 LsapInitDatabase(VOID);
122
123 NTSTATUS
124 LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject,
125 IN LPWSTR ContainerName,
126 IN LPWSTR ObjectName,
127 IN LSA_DB_OBJECT_TYPE HandleType,
128 IN ACCESS_MASK DesiredAccess,
129 IN BOOLEAN Trusted,
130 OUT PLSA_DB_OBJECT *DbObject);
131
132 NTSTATUS
133 LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
134 IN LPWSTR ContainerName,
135 IN LPWSTR ObjectName,
136 IN LSA_DB_OBJECT_TYPE ObjectType,
137 IN ACCESS_MASK DesiredAccess,
138 IN BOOLEAN Trusted,
139 OUT PLSA_DB_OBJECT *DbObject);
140
141 NTSTATUS
142 LsapValidateDbObject(IN LSAPR_HANDLE Handle,
143 IN LSA_DB_OBJECT_TYPE HandleType,
144 IN ACCESS_MASK GrantedAccess,
145 OUT PLSA_DB_OBJECT *DbObject);
146
147 NTSTATUS
148 LsapCloseDbObject(IN PLSA_DB_OBJECT DbObject);
149
150 NTSTATUS
151 LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject);
152
153 NTSTATUS
154 LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject,
155 LPWSTR AttributeName,
156 LPVOID AttributeData,
157 PULONG AttributeSize);
158
159 NTSTATUS
160 LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject,
161 LPWSTR AttributeName,
162 LPVOID AttributeData,
163 ULONG AttributeSize);
164
165 NTSTATUS
166 LsapDeleteObjectAttribute(PLSA_DB_OBJECT DbObject,
167 LPWSTR AttributeName);
168
169 /* dssetup.c */
170 VOID
171 DsSetupInit(VOID);
172
173 /* lookup.c */
174 NTSTATUS
175 LsapInitSids(VOID);
176
177 ULONG
178 LsapGetRelativeIdFromSid(PSID Sid);
179
180 NTSTATUS
181 LsapLookupNames(DWORD Count,
182 PRPC_UNICODE_STRING Names,
183 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
184 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
185 LSAP_LOOKUP_LEVEL LookupLevel,
186 DWORD *MappedCount,
187 DWORD LookupOptions,
188 DWORD ClientRevision);
189
190 NTSTATUS
191 LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
192 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
193 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
194 LSAP_LOOKUP_LEVEL LookupLevel,
195 DWORD *MappedCount,
196 DWORD LookupOptions,
197 DWORD ClientRevision);
198
199 /* lsarpc.c */
200 VOID
201 LsarStartRpcServer(VOID);
202
203 /* policy.c */
204 NTSTATUS
205 LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject,
206 PLSAPR_POLICY_INFORMATION *PolicyInformation);
207
208 NTSTATUS
209 LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject,
210 PLSAPR_POLICY_INFORMATION *PolicyInformation);
211
212 NTSTATUS
213 LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
214 PLSAPR_POLICY_INFORMATION *PolicyInformation);
215
216 NTSTATUS
217 LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject,
218 PLSAPR_POLICY_INFORMATION *PolicyInformation);
219
220 NTSTATUS
221 LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject,
222 PLSAPR_POLICY_INFORMATION *PolicyInformation);
223
224 NTSTATUS
225 LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject,
226 PLSAPR_POLICY_INFORMATION *PolicyInformation);
227
228 NTSTATUS
229 LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject,
230 PLSAPR_POLICY_INFORMATION *PolicyInformation);
231
232 NTSTATUS
233 LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject,
234 PLSAPR_POLICY_INFORMATION *PolicyInformation);
235
236 NTSTATUS
237 LsarQueryModification(PLSA_DB_OBJECT PolicyObject,
238 PLSAPR_POLICY_INFORMATION *PolicyInformation);
239
240 NTSTATUS
241 LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject,
242 PLSAPR_POLICY_INFORMATION *PolicyInformation);
243
244 NTSTATUS
245 LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject,
246 PLSAPR_POLICY_INFORMATION *PolicyInformation);
247
248 NTSTATUS
249 LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
250 PLSAPR_POLICY_INFORMATION *PolicyInformation);
251
252 NTSTATUS
253 LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
254 PLSAPR_POLICY_INFORMATION *PolicyInformation);
255
256 NTSTATUS
257 LsarSetAuditLog(PLSA_DB_OBJECT PolicyObject,
258 PPOLICY_AUDIT_LOG_INFO Info);
259
260 NTSTATUS
261 LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
262 PLSAPR_POLICY_AUDIT_EVENTS_INFO Info);
263
264 NTSTATUS
265 LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
266 PLSAPR_POLICY_PRIMARY_DOM_INFO Info);
267
268 NTSTATUS
269 LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject,
270 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
271
272 NTSTATUS
273 LsarSetServerRole(PLSA_DB_OBJECT PolicyObject,
274 PPOLICY_LSA_SERVER_ROLE_INFO Info);
275
276 NTSTATUS
277 LsarSetReplicaSource(PLSA_DB_OBJECT PolicyObject,
278 PPOLICY_LSA_REPLICA_SRCE_INFO Info);
279
280 NTSTATUS
281 LsarSetDefaultQuota(PLSA_DB_OBJECT PolicyObject,
282 PPOLICY_DEFAULT_QUOTA_INFO Info);
283
284 NTSTATUS
285 LsarSetModification(PLSA_DB_OBJECT PolicyObject,
286 PPOLICY_MODIFICATION_INFO Info);
287
288 NTSTATUS
289 LsarSetAuditFull(PLSA_DB_OBJECT PolicyObject,
290 PPOLICY_AUDIT_FULL_QUERY_INFO Info);
291
292 NTSTATUS
293 LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject,
294 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
295
296 NTSTATUS
297 LsarSetDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
298 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
299
300 NTSTATUS
301 LsarSetLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
302 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
303
304 /* privileges.c */
305 NTSTATUS
306 LsarpLookupPrivilegeName(PLUID Value,
307 PRPC_UNICODE_STRING *Name);
308
309 NTSTATUS
310 LsarpLookupPrivilegeDisplayName(PRPC_UNICODE_STRING Name,
311 USHORT ClientLanguage,
312 USHORT ClientSystemDefaultLanguage,
313 PRPC_UNICODE_STRING *DisplayName,
314 USHORT *LanguageReturned);
315
316 NTSTATUS
317 LsarpLookupPrivilegeValue(PRPC_UNICODE_STRING Name,
318 PLUID Value);
319
320 NTSTATUS
321 LsarpEnumeratePrivileges(DWORD *EnumerationContext,
322 PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer,
323 DWORD PreferedMaximumLength);
324
325 NTSTATUS
326 LsapLookupAccountRightName(ULONG RightValue,
327 PRPC_UNICODE_STRING *Name);
328
329 /* registry.h */
330 NTSTATUS
331 LsapRegCloseKey(IN HANDLE KeyHandle);
332
333 NTSTATUS
334 LsapRegCreateKey(IN HANDLE ParentKeyHandle,
335 IN LPCWSTR KeyName,
336 IN ACCESS_MASK DesiredAccess,
337 OUT HANDLE KeyHandle);
338
339 NTSTATUS
340 LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
341 IN LPCWSTR KeyName);
342
343 NTSTATUS
344 LsapRegDeleteKey(IN HANDLE KeyHandle);
345
346 NTSTATUS
347 LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
348 IN ULONG Index,
349 IN ULONG Length,
350 OUT LPWSTR Buffer);
351
352 NTSTATUS
353 LsapRegOpenKey(IN HANDLE ParentKeyHandle,
354 IN LPCWSTR KeyName,
355 IN ACCESS_MASK DesiredAccess,
356 OUT HANDLE KeyHandle);
357
358 NTSTATUS
359 LsapRegQueryKeyInfo(IN HANDLE KeyHandle,
360 OUT PULONG SubKeyCount,
361 OUT PULONG ValueCount);
362
363 NTSTATUS
364 LsapRegDeleteValue(IN HANDLE KeyHandle,
365 IN LPWSTR ValueName);
366
367 NTSTATUS
368 LsapRegEnumerateValue(IN HANDLE KeyHandle,
369 IN ULONG Index,
370 OUT LPWSTR Name,
371 IN OUT PULONG NameLength,
372 OUT PULONG Type OPTIONAL,
373 OUT PVOID Data OPTIONAL,
374 IN OUT PULONG DataLength OPTIONAL);
375
376 NTSTATUS
377 LsapRegQueryValue(IN HANDLE KeyHandle,
378 IN LPWSTR ValueName,
379 OUT PULONG Type OPTIONAL,
380 OUT LPVOID Data OPTIONAL,
381 IN OUT PULONG DataLength OPTIONAL);
382
383 NTSTATUS
384 LsapRegSetValue(IN HANDLE KeyHandle,
385 IN LPWSTR ValueName,
386 IN ULONG Type,
387 IN LPVOID Data,
388 IN ULONG DataLength);
389
390 /* security.c */
391 NTSTATUS
392 LsapCreatePolicySd(PSECURITY_DESCRIPTOR *PolicySd,
393 PULONG PolicySdSize);
394
395 NTSTATUS
396 LsapCreateAccountSd(PSECURITY_DESCRIPTOR *AccountSd,
397 PULONG AccountSdSize);
398
399 NTSTATUS
400 LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd,
401 PULONG SecretSdSize);
402
403 /* session.c */
404 VOID
405 LsapInitLogonSessions(VOID);
406
407 NTSTATUS
408 NTAPI
409 LsapCreateLogonSession(IN PLUID LogonId);
410
411 NTSTATUS
412 NTAPI
413 LsapDeleteLogonSession(IN PLUID LogonId);
414
415 NTSTATUS
416 LsapSetLogonSessionData(IN PLUID LogonId);
417
418 NTSTATUS
419 LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg);
420
421 NTSTATUS
422 LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg);
423
424 /* srm.c */
425 NTSTATUS
426 LsapRmInitializeServer(VOID);
427
428 /* utils.c */
429 INT
430 LsapLoadString(HINSTANCE hInstance,
431 UINT uId,
432 LPWSTR lpBuffer,
433 INT nBufferMax);
434
435 PSID
436 LsapAppendRidToSid(
437 PSID SrcSid,
438 ULONG Rid);
439
440 #endif /* _LSASRV_H */