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