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