[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 SamrCloseHandle(IN OUT SAMPR_HANDLE *SamHandle);
190
191 NTSTATUS
192 NTAPI
193 SamrLookupDomainInSamServer(IN SAMPR_HANDLE ServerHandle,
194 IN PRPC_UNICODE_STRING Name,
195 OUT PRPC_SID *DomainId);
196
197 NTSTATUS
198 NTAPI
199 SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle,
200 IN ULONG Count,
201 IN RPC_UNICODE_STRING Names[],
202 OUT PSAMPR_ULONG_ARRAY RelativeIds,
203 OUT PSAMPR_ULONG_ARRAY Use);
204
205 NTSTATUS
206 NTAPI
207 SamrOpenDomain(IN SAMPR_HANDLE ServerHandle,
208 IN ACCESS_MASK DesiredAccess,
209 IN PRPC_SID DomainId,
210 OUT SAMPR_HANDLE *DomainHandle);
211
212 NTSTATUS
213 NTAPI
214 SamrOpenUser(IN SAMPR_HANDLE DomainHandle,
215 IN ACCESS_MASK DesiredAccess,
216 IN ULONG UserId,
217 OUT SAMPR_HANDLE *UserHandle);
218
219 NTSTATUS
220 NTAPI
221 SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle,
222 IN USER_INFORMATION_CLASS UserInformationClass,
223 OUT PSAMPR_USER_INFO_BUFFER *Buffer);
224
225
226 typedef PVOID LSAPR_HANDLE;
227
228 typedef struct _LSAPR_POLICY_AUDIT_EVENTS_INFO
229 {
230 BOOLEAN AuditingMode;
231 DWORD *EventAuditingOptions;
232 DWORD MaximumAuditEventCount;
233 } LSAPR_POLICY_AUDIT_EVENTS_INFO, *PLSAPR_POLICY_AUDIT_EVENTS_INFO;
234
235 typedef struct _LSAPR_POLICY_PRIMARY_DOM_INFO
236 {
237 RPC_UNICODE_STRING Name;
238 PRPC_SID Sid;
239 } LSAPR_POLICY_PRIMARY_DOM_INFO, *PLSAPR_POLICY_PRIMARY_DOM_INFO;
240
241 typedef struct _LSAPR_POLICY_ACCOUNT_DOM_INFO
242 {
243 RPC_UNICODE_STRING DomainName;
244 PRPC_SID Sid;
245 } LSAPR_POLICY_ACCOUNT_DOM_INFO, *PLSAPR_POLICY_ACCOUNT_DOM_INFO;
246
247 typedef struct _LSAPR_POLICY_PD_ACCOUNT_INFO
248 {
249 RPC_UNICODE_STRING Name;
250 } LSAPR_POLICY_PD_ACCOUNT_INFO, *PLSAPR_POLICY_PD_ACCOUNT_INFO;
251
252 typedef struct _POLICY_LSA_REPLICA_SRCE_INFO
253 {
254 RPC_UNICODE_STRING ReplicaSource;
255 RPC_UNICODE_STRING ReplicaAccountName;
256 } POLICY_LSA_REPLICA_SRCE_INFO, *PPOLICY_LSA_REPLICA_SRCE_INFO;
257
258 typedef struct _LSAPR_POLICY_DNS_DOMAIN_INFO
259 {
260 RPC_UNICODE_STRING Name;
261 RPC_UNICODE_STRING DnsDomainName;
262 RPC_UNICODE_STRING DnsForestName;
263 GUID DomainGuid;
264 PRPC_SID Sid;
265 } LSAPR_POLICY_DNS_DOMAIN_INFO, *PLSAPR_POLICY_DNS_DOMAIN_INFO;
266
267 typedef union _LSAPR_POLICY_INFORMATION
268 {
269 POLICY_AUDIT_LOG_INFO PolicyAuditLogInfo;
270 LSAPR_POLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo;
271 LSAPR_POLICY_PRIMARY_DOM_INFO PolicyPrimaryDomInfo;
272 LSAPR_POLICY_PD_ACCOUNT_INFO PolicyPdAccountInfo;
273 LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyAccountDomainInfo;
274 POLICY_LSA_SERVER_ROLE_INFO PolicyServerRoleInfo;
275 POLICY_LSA_REPLICA_SRCE_INFO PolicyReplicaSourceInfo;
276 POLICY_DEFAULT_QUOTA_INFO PolicyDefaultQuotaInfo;
277 POLICY_MODIFICATION_INFO PolicyModificationInfo;
278 POLICY_AUDIT_FULL_SET_INFO PolicyAuditFullSetInfo;
279 POLICY_AUDIT_FULL_QUERY_INFO PolicyAuditFullQueryInfo;
280 LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfo;
281 LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfoInt;
282 LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyLocalAccountDomainInfo;
283 } LSAPR_POLICY_INFORMATION, *PLSAPR_POLICY_INFORMATION;
284
285 VOID
286 NTAPI
287 LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass,
288 IN PLSAPR_POLICY_INFORMATION PolicyInformation);
289
290 NTSTATUS
291 WINAPI
292 LsaIOpenPolicyTrusted(OUT LSAPR_HANDLE *PolicyHandle);
293
294 NTSTATUS
295 WINAPI
296 LsarClose(IN OUT LSAPR_HANDLE *ObjectHandle);
297
298 NTSTATUS
299 WINAPI
300 LsarLookupPrivilegeValue(IN LSAPR_HANDLE PolicyHandle,
301 IN PRPC_UNICODE_STRING Name,
302 OUT PLUID Value);
303
304 NTSTATUS
305 WINAPI
306 LsarQueryInformationPolicy(IN LSAPR_HANDLE PolicyHandle,
307 IN POLICY_INFORMATION_CLASS InformationClass,
308 OUT PLSAPR_POLICY_INFORMATION *PolicyInformation);
309
310 NTSTATUS
311 WINAPI
312 SystemFunction006(LPCSTR password,
313 LPSTR hash);
314
315 NTSTATUS
316 WINAPI
317 SystemFunction007(PUNICODE_STRING string,
318 LPBYTE hash);
319
320 /* EOF */