[SECUR32][LSASRV][LSALIB]
[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 /* lookup.c */
170 NTSTATUS
171 LsapInitSids(VOID);
172
173 ULONG
174 LsapGetRelativeIdFromSid(PSID Sid);
175
176 NTSTATUS
177 LsapLookupNames(DWORD Count,
178 PRPC_UNICODE_STRING Names,
179 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
180 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
181 LSAP_LOOKUP_LEVEL LookupLevel,
182 DWORD *MappedCount,
183 DWORD LookupOptions,
184 DWORD ClientRevision);
185
186 NTSTATUS
187 LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
188 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
189 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
190 LSAP_LOOKUP_LEVEL LookupLevel,
191 DWORD *MappedCount,
192 DWORD LookupOptions,
193 DWORD ClientRevision);
194
195 /* lsarpc.c */
196 VOID
197 LsarStartRpcServer(VOID);
198
199 /* policy.c */
200 NTSTATUS
201 LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject,
202 PLSAPR_POLICY_INFORMATION *PolicyInformation);
203
204 NTSTATUS
205 LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject,
206 PLSAPR_POLICY_INFORMATION *PolicyInformation);
207
208 NTSTATUS
209 LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
210 PLSAPR_POLICY_INFORMATION *PolicyInformation);
211
212 NTSTATUS
213 LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject,
214 PLSAPR_POLICY_INFORMATION *PolicyInformation);
215
216 NTSTATUS
217 LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject,
218 PLSAPR_POLICY_INFORMATION *PolicyInformation);
219
220 NTSTATUS
221 LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject,
222 PLSAPR_POLICY_INFORMATION *PolicyInformation);
223
224 NTSTATUS
225 LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject,
226 PLSAPR_POLICY_INFORMATION *PolicyInformation);
227
228 NTSTATUS
229 LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject,
230 PLSAPR_POLICY_INFORMATION *PolicyInformation);
231
232 NTSTATUS
233 LsarQueryModification(PLSA_DB_OBJECT PolicyObject,
234 PLSAPR_POLICY_INFORMATION *PolicyInformation);
235
236 NTSTATUS
237 LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject,
238 PLSAPR_POLICY_INFORMATION *PolicyInformation);
239
240 NTSTATUS
241 LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject,
242 PLSAPR_POLICY_INFORMATION *PolicyInformation);
243
244 NTSTATUS
245 LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
246 PLSAPR_POLICY_INFORMATION *PolicyInformation);
247
248 NTSTATUS
249 LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
250 PLSAPR_POLICY_INFORMATION *PolicyInformation);
251
252 NTSTATUS
253 LsarSetAuditLog(PLSA_DB_OBJECT PolicyObject,
254 PPOLICY_AUDIT_LOG_INFO Info);
255
256 NTSTATUS
257 LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
258 PLSAPR_POLICY_AUDIT_EVENTS_INFO Info);
259
260 NTSTATUS
261 LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject,
262 PLSAPR_POLICY_PRIMARY_DOM_INFO Info);
263
264 NTSTATUS
265 LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject,
266 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
267
268 NTSTATUS
269 LsarSetServerRole(PLSA_DB_OBJECT PolicyObject,
270 PPOLICY_LSA_SERVER_ROLE_INFO Info);
271
272 NTSTATUS
273 LsarSetReplicaSource(PLSA_DB_OBJECT PolicyObject,
274 PPOLICY_LSA_REPLICA_SRCE_INFO Info);
275
276 NTSTATUS
277 LsarSetDefaultQuota(PLSA_DB_OBJECT PolicyObject,
278 PPOLICY_DEFAULT_QUOTA_INFO Info);
279
280 NTSTATUS
281 LsarSetModification(PLSA_DB_OBJECT PolicyObject,
282 PPOLICY_MODIFICATION_INFO Info);
283
284 NTSTATUS
285 LsarSetAuditFull(PLSA_DB_OBJECT PolicyObject,
286 PPOLICY_AUDIT_FULL_QUERY_INFO Info);
287
288 NTSTATUS
289 LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject,
290 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
291
292 NTSTATUS
293 LsarSetDnsDomainInt(PLSA_DB_OBJECT PolicyObject,
294 PLSAPR_POLICY_DNS_DOMAIN_INFO Info);
295
296 NTSTATUS
297 LsarSetLocalAccountDomain(PLSA_DB_OBJECT PolicyObject,
298 PLSAPR_POLICY_ACCOUNT_DOM_INFO Info);
299
300 /* privileges.c */
301 NTSTATUS
302 LsarpLookupPrivilegeName(PLUID Value,
303 PRPC_UNICODE_STRING *Name);
304
305 NTSTATUS
306 LsarpLookupPrivilegeValue(PRPC_UNICODE_STRING Name,
307 PLUID Value);
308
309 NTSTATUS
310 LsarpEnumeratePrivileges(DWORD *EnumerationContext,
311 PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer,
312 DWORD PreferedMaximumLength);
313
314 NTSTATUS
315 LsapLookupAccountRightName(ULONG RightValue,
316 PRPC_UNICODE_STRING *Name);
317
318 /* registry.h */
319 NTSTATUS
320 LsapRegCloseKey(IN HANDLE KeyHandle);
321
322 NTSTATUS
323 LsapRegCreateKey(IN HANDLE ParentKeyHandle,
324 IN LPCWSTR KeyName,
325 IN ACCESS_MASK DesiredAccess,
326 OUT HANDLE KeyHandle);
327
328 NTSTATUS
329 LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
330 IN LPCWSTR KeyName);
331
332 NTSTATUS
333 LsapRegDeleteKey(IN HANDLE KeyHandle);
334
335 NTSTATUS
336 LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
337 IN ULONG Index,
338 IN ULONG Length,
339 OUT LPWSTR Buffer);
340
341 NTSTATUS
342 LsapRegOpenKey(IN HANDLE ParentKeyHandle,
343 IN LPCWSTR KeyName,
344 IN ACCESS_MASK DesiredAccess,
345 OUT HANDLE KeyHandle);
346
347 NTSTATUS
348 LsapRegQueryKeyInfo(IN HANDLE KeyHandle,
349 OUT PULONG SubKeyCount,
350 OUT PULONG ValueCount);
351
352 NTSTATUS
353 LsapRegDeleteValue(IN HANDLE KeyHandle,
354 IN LPWSTR ValueName);
355
356 NTSTATUS
357 LsapRegEnumerateValue(IN HANDLE KeyHandle,
358 IN ULONG Index,
359 OUT LPWSTR Name,
360 IN OUT PULONG NameLength,
361 OUT PULONG Type OPTIONAL,
362 OUT PVOID Data OPTIONAL,
363 IN OUT PULONG DataLength OPTIONAL);
364
365 NTSTATUS
366 LsapRegQueryValue(IN HANDLE KeyHandle,
367 IN LPWSTR ValueName,
368 OUT PULONG Type OPTIONAL,
369 OUT LPVOID Data OPTIONAL,
370 IN OUT PULONG DataLength OPTIONAL);
371
372 NTSTATUS
373 LsapRegSetValue(IN HANDLE KeyHandle,
374 IN LPWSTR ValueName,
375 IN ULONG Type,
376 IN LPVOID Data,
377 IN ULONG DataLength);
378
379 /* security.c */
380 NTSTATUS
381 LsapCreatePolicySd(PSECURITY_DESCRIPTOR *PolicySd,
382 PULONG PolicySdSize);
383
384 NTSTATUS
385 LsapCreateAccountSd(PSECURITY_DESCRIPTOR *AccountSd,
386 PULONG AccountSdSize);
387
388 NTSTATUS
389 LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd,
390 PULONG SecretSdSize);
391
392 /* session.c */
393 VOID
394 LsapInitLogonSessions(VOID);
395
396 NTSTATUS
397 NTAPI
398 LsapCreateLogonSession(IN PLUID LogonId);
399
400 NTSTATUS
401 NTAPI
402 LsapDeleteLogonSession(IN PLUID LogonId);
403
404 NTSTATUS
405 LsapSetLogonSessionData(IN PLUID LogonId);
406
407 NTSTATUS
408 LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg);
409
410 /* utils.c */
411 INT
412 LsapLoadString(HINSTANCE hInstance,
413 UINT uId,
414 LPWSTR lpBuffer,
415 INT nBufferMax);
416
417 PSID
418 LsapAppendRidToSid(
419 PSID SrcSid,
420 ULONG Rid);
421
422 #endif /* _LSASRV_H */