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