[MSV1_0]
[reactos.git] / reactos / dll / win32 / msv1_0 / msv1_0.h
1 /*
2 * PROJECT: Authentication Package DLL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/msv1_0/msv1_0.h
5 * PURPOSE: Common header file
6 * COPYRIGHT: Copyright 2013 Eric Kohl
7 */
8
9 #define WIN32_NO_STATUS
10 #define _INC_WINDOWS
11 #define COM_NO_WINDOWS_H
12 #include <stdarg.h>
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winreg.h>
16 #define NTOS_MODE_USER
17 #include <ndk/cmfuncs.h>
18 #include <ndk/kefuncs.h>
19 #include <ndk/lpctypes.h>
20 #include <ndk/lpcfuncs.h>
21 #include <ndk/mmfuncs.h>
22 #include <ndk/obfuncs.h>
23 #include <ndk/psfuncs.h>
24 #include <ndk/rtlfuncs.h>
25 #include <ndk/setypes.h>
26 #include <ndk/sefuncs.h>
27
28 #include <sspi.h>
29 #include <ntsecapi.h>
30 #include <ntsecpkg.h>
31 #include <ntsam.h>
32 #include <ntlsa.h>
33
34 #include <samsrv/samsrv.h>
35 //#include <lsass/lsasrv.h>
36
37 #include <wine/debug.h>
38
39
40 #define FIXUP_POINTER(Pointer, Offset) ((Pointer != NULL) ? ((PWSTR)((ULONG_PTR)Pointer + Offset)) : NULL)
41
42
43 typedef struct _RPC_SID
44 {
45 UCHAR Revision;
46 UCHAR SubAuthorityCount;
47 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
48 DWORD SubAuthority[];
49 } RPC_SID, *PRPC_SID;
50
51 typedef struct _RPC_UNICODE_STRING
52 {
53 unsigned short Length;
54 unsigned short MaximumLength;
55 wchar_t *Buffer;
56 } RPC_UNICODE_STRING, *PRPC_UNICODE_STRING;
57
58 typedef wchar_t *PSAMPR_SERVER_NAME;
59 typedef void *SAMPR_HANDLE;
60
61 typedef struct _OLD_LARGE_INTEGER
62 {
63 unsigned long LowPart;
64 long HighPart;
65 } OLD_LARGE_INTEGER, *POLD_LARGE_INTEGER;
66
67 typedef struct RPC_SHORT_BLOB
68 {
69 unsigned short Length;
70 unsigned short MaximumLength;
71 unsigned short *Buffer;
72 } RPC_SHORT_BLOB, *PRPC_SHORT_BLOB;
73
74 typedef struct _SAMPR_SR_SECURITY_DESCRIPTOR
75 {
76 unsigned long Length;
77 unsigned char *SecurityDescriptor;
78 } SAMPR_SR_SECURITY_DESCRIPTOR, *PSAMPR_SR_SECURITY_DESCRIPTOR;
79
80 typedef struct _ENCRYPTED_LM_OWF_PASSWORD
81 {
82 char data[16];
83 } ENCRYPTED_LM_OWF_PASSWORD, *PENCRYPTED_LM_OWF_PASSWORD, ENCRYPTED_NT_OWF_PASSWORD, *PENCRYPTED_NT_OWF_PASSWORD;
84
85 typedef struct _SAMPR_ULONG_ARRAY
86 {
87 ULONG Count;
88 PULONG Element;
89 } SAMPR_ULONG_ARRAY, *PSAMPR_ULONG_ARRAY;
90
91 typedef struct _SAMPR_LOGON_HOURS
92 {
93 unsigned short UnitsPerWeek;
94 unsigned char *LogonHours;
95 } SAMPR_LOGON_HOURS, *PSAMPR_LOGON_HOURS;
96
97 typedef struct _SAMPR_USER_ALL_INFORMATION
98 {
99 OLD_LARGE_INTEGER LastLogon;
100 OLD_LARGE_INTEGER LastLogoff;
101 OLD_LARGE_INTEGER PasswordLastSet;
102 OLD_LARGE_INTEGER AccountExpires;
103 OLD_LARGE_INTEGER PasswordCanChange;
104 OLD_LARGE_INTEGER PasswordMustChange;
105 RPC_UNICODE_STRING UserName;
106 RPC_UNICODE_STRING FullName;
107 RPC_UNICODE_STRING HomeDirectory;
108 RPC_UNICODE_STRING HomeDirectoryDrive;
109 RPC_UNICODE_STRING ScriptPath;
110 RPC_UNICODE_STRING ProfilePath;
111 RPC_UNICODE_STRING AdminComment;
112 RPC_UNICODE_STRING WorkStations;
113 RPC_UNICODE_STRING UserComment;
114 RPC_UNICODE_STRING Parameters;
115 RPC_SHORT_BLOB LmOwfPassword;
116 RPC_SHORT_BLOB NtOwfPassword;
117 RPC_UNICODE_STRING PrivateData;
118 SAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor;
119 unsigned long UserId;
120 unsigned long PrimaryGroupId;
121 unsigned long UserAccountControl;
122 unsigned long WhichFields;
123 SAMPR_LOGON_HOURS LogonHours;
124 unsigned short BadPasswordCount;
125 unsigned short LogonCount;
126 unsigned short CountryCode;
127 unsigned short CodePage;
128 unsigned char LmPasswordPresent;
129 unsigned char NtPasswordPresent;
130 unsigned char PasswordExpired;
131 unsigned char PrivateDataSensitive;
132 } SAMPR_USER_ALL_INFORMATION, *PSAMPR_USER_ALL_INFORMATION;
133
134 typedef union _SAMPR_USER_INFO_BUFFER
135 {
136 #if 0
137 SAMPR_USER_GENERAL_INFORMATION General;
138 SAMPR_USER_PREFERENCES_INFORMATION Preferences;
139 SAMPR_USER_LOGON_INFORMATION Logon;
140 SAMPR_USER_LOGON_HOURS_INFORMATION LogonHours;
141 SAMPR_USER_ACCOUNT_INFORMATION Account;
142 SAMPR_USER_NAME_INFORMATION Name;
143 SAMPR_USER_A_NAME_INFORMATION AccountName;
144 SAMPR_USER_F_NAME_INFORMATION FullName;
145 USER_PRIMARY_GROUP_INFORMATION PrimaryGroup;
146 SAMPR_USER_HOME_INFORMATION Home;
147 SAMPR_USER_SCRIPT_INFORMATION Script;
148 SAMPR_USER_PROFILE_INFORMATION Profile;
149 SAMPR_USER_ADMIN_COMMENT_INFORMATION AdminComment;
150 SAMPR_USER_WORKSTATIONS_INFORMATION WorkStations;
151 SAMPR_USER_SET_PASSWORD_INFORMATION SetPassword;
152 USER_CONTROL_INFORMATION Control;
153 USER_EXPIRES_INFORMATION Expires;
154 SAMPR_USER_INTERNAL1_INFORMATION Internal1;
155 SAMPR_USER_PARAMETERS_INFORMATION Parameters;
156 #endif
157 SAMPR_USER_ALL_INFORMATION All;
158 #if 0
159 SAMPR_USER_INTERNAL4_INFORMATION Internal4;
160 SAMPR_USER_INTERNAL5_INFORMATION Internal5;
161 SAMPR_USER_INTERNAL4_INFORMATION_NEW Internal4New;
162 SAMPR_USER_INTERNAL5_INFORMATION_NEW Internal5New;
163 #endif
164 } SAMPR_USER_INFO_BUFFER, *PSAMPR_USER_INFO_BUFFER;
165
166
167 NTSTATUS
168 NTAPI
169 SamIConnect(IN PSAMPR_SERVER_NAME ServerName,
170 OUT SAMPR_HANDLE *ServerHandle,
171 IN ACCESS_MASK DesiredAccess,
172 IN BOOLEAN Trusted);
173
174 VOID
175 NTAPI
176 SamIFreeVoid(PVOID Ptr);
177
178 VOID
179 NTAPI
180 SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr);
181
182 VOID
183 NTAPI
184 SamIFree_SAMPR_USER_INFO_BUFFER(PSAMPR_USER_INFO_BUFFER Ptr,
185 USER_INFORMATION_CLASS InformationClass);
186
187 NTSTATUS
188 NTAPI
189 SamrChangePasswordUser(IN SAMPR_HANDLE UserHandle,
190 IN unsigned char LmPresent,
191 IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm,
192 IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm,
193 IN unsigned char NtPresent,
194 IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt,
195 IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt,
196 IN unsigned char NtCrossEncryptionPresent,
197 IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm,
198 IN unsigned char LmCrossEncryptionPresent,
199 IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt);
200
201 NTSTATUS
202 NTAPI
203 SamrCloseHandle(IN OUT SAMPR_HANDLE *SamHandle);
204
205 NTSTATUS
206 NTAPI
207 SamrLookupDomainInSamServer(IN SAMPR_HANDLE ServerHandle,
208 IN PRPC_UNICODE_STRING Name,
209 OUT PRPC_SID *DomainId);
210
211 NTSTATUS
212 NTAPI
213 SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle,
214 IN ULONG Count,
215 IN RPC_UNICODE_STRING Names[],
216 OUT PSAMPR_ULONG_ARRAY RelativeIds,
217 OUT PSAMPR_ULONG_ARRAY Use);
218
219 NTSTATUS
220 NTAPI
221 SamrOpenDomain(IN SAMPR_HANDLE ServerHandle,
222 IN ACCESS_MASK DesiredAccess,
223 IN PRPC_SID DomainId,
224 OUT SAMPR_HANDLE *DomainHandle);
225
226 NTSTATUS
227 NTAPI
228 SamrOpenUser(IN SAMPR_HANDLE DomainHandle,
229 IN ACCESS_MASK DesiredAccess,
230 IN ULONG UserId,
231 OUT SAMPR_HANDLE *UserHandle);
232
233 NTSTATUS
234 NTAPI
235 SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle,
236 IN USER_INFORMATION_CLASS UserInformationClass,
237 OUT PSAMPR_USER_INFO_BUFFER *Buffer);
238
239
240 typedef PVOID LSAPR_HANDLE;
241
242 typedef struct _LSAPR_POLICY_AUDIT_EVENTS_INFO
243 {
244 BOOLEAN AuditingMode;
245 DWORD *EventAuditingOptions;
246 DWORD MaximumAuditEventCount;
247 } LSAPR_POLICY_AUDIT_EVENTS_INFO, *PLSAPR_POLICY_AUDIT_EVENTS_INFO;
248
249 typedef struct _LSAPR_POLICY_PRIMARY_DOM_INFO
250 {
251 RPC_UNICODE_STRING Name;
252 PRPC_SID Sid;
253 } LSAPR_POLICY_PRIMARY_DOM_INFO, *PLSAPR_POLICY_PRIMARY_DOM_INFO;
254
255 typedef struct _LSAPR_POLICY_ACCOUNT_DOM_INFO
256 {
257 RPC_UNICODE_STRING DomainName;
258 PRPC_SID Sid;
259 } LSAPR_POLICY_ACCOUNT_DOM_INFO, *PLSAPR_POLICY_ACCOUNT_DOM_INFO;
260
261 typedef struct _LSAPR_POLICY_PD_ACCOUNT_INFO
262 {
263 RPC_UNICODE_STRING Name;
264 } LSAPR_POLICY_PD_ACCOUNT_INFO, *PLSAPR_POLICY_PD_ACCOUNT_INFO;
265
266 typedef struct _POLICY_LSA_REPLICA_SRCE_INFO
267 {
268 RPC_UNICODE_STRING ReplicaSource;
269 RPC_UNICODE_STRING ReplicaAccountName;
270 } POLICY_LSA_REPLICA_SRCE_INFO, *PPOLICY_LSA_REPLICA_SRCE_INFO;
271
272 typedef struct _LSAPR_POLICY_DNS_DOMAIN_INFO
273 {
274 RPC_UNICODE_STRING Name;
275 RPC_UNICODE_STRING DnsDomainName;
276 RPC_UNICODE_STRING DnsForestName;
277 GUID DomainGuid;
278 PRPC_SID Sid;
279 } LSAPR_POLICY_DNS_DOMAIN_INFO, *PLSAPR_POLICY_DNS_DOMAIN_INFO;
280
281 typedef union _LSAPR_POLICY_INFORMATION
282 {
283 POLICY_AUDIT_LOG_INFO PolicyAuditLogInfo;
284 LSAPR_POLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo;
285 LSAPR_POLICY_PRIMARY_DOM_INFO PolicyPrimaryDomInfo;
286 LSAPR_POLICY_PD_ACCOUNT_INFO PolicyPdAccountInfo;
287 LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyAccountDomainInfo;
288 POLICY_LSA_SERVER_ROLE_INFO PolicyServerRoleInfo;
289 POLICY_LSA_REPLICA_SRCE_INFO PolicyReplicaSourceInfo;
290 POLICY_DEFAULT_QUOTA_INFO PolicyDefaultQuotaInfo;
291 POLICY_MODIFICATION_INFO PolicyModificationInfo;
292 POLICY_AUDIT_FULL_SET_INFO PolicyAuditFullSetInfo;
293 POLICY_AUDIT_FULL_QUERY_INFO PolicyAuditFullQueryInfo;
294 LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfo;
295 LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfoInt;
296 LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyLocalAccountDomainInfo;
297 } LSAPR_POLICY_INFORMATION, *PLSAPR_POLICY_INFORMATION;
298
299 VOID
300 NTAPI
301 LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass,
302 IN PLSAPR_POLICY_INFORMATION PolicyInformation);
303
304 NTSTATUS
305 WINAPI
306 LsaIOpenPolicyTrusted(OUT LSAPR_HANDLE *PolicyHandle);
307
308 NTSTATUS
309 WINAPI
310 LsarClose(IN OUT LSAPR_HANDLE *ObjectHandle);
311
312 NTSTATUS
313 WINAPI
314 LsarLookupPrivilegeValue(IN LSAPR_HANDLE PolicyHandle,
315 IN PRPC_UNICODE_STRING Name,
316 OUT PLUID Value);
317
318 NTSTATUS
319 WINAPI
320 LsarQueryInformationPolicy(IN LSAPR_HANDLE PolicyHandle,
321 IN POLICY_INFORMATION_CLASS InformationClass,
322 OUT PLSAPR_POLICY_INFORMATION *PolicyInformation);
323
324 NTSTATUS
325 WINAPI
326 SystemFunction006(LPCSTR password,
327 LPSTR hash);
328
329 NTSTATUS
330 WINAPI
331 SystemFunction007(PUNICODE_STRING string,
332 LPBYTE hash);
333
334 NTSTATUS
335 WINAPI
336 SystemFunction012(const BYTE *in,
337 const BYTE *key,
338 LPBYTE out);
339
340 /* EOF */