xref: /reactos/sdk/include/ddk/ntsam.h (revision c2c66aff)
1 
2 #ifndef _NTSAM_
3 #define _NTSAM_
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #define ALIAS_ADD_MEMBER                0x00000001
10 #define ALIAS_REMOVE_MEMBER             0x00000002
11 #define ALIAS_LIST_MEMBERS              0x00000004
12 #define ALIAS_READ_INFORMATION          0x00000008
13 #define ALIAS_WRITE_ACCOUNT             0x00000010
14 
15 #define ALIAS_READ                     (STANDARD_RIGHTS_READ |\
16                                         ALIAS_LIST_MEMBERS)
17 
18 #define ALIAS_WRITE                    (STANDARD_RIGHTS_WRITE |\
19                                         ALIAS_ADD_MEMBER |\
20                                         ALIAS_REMOVE_MEMBER |\
21                                         ALIAS_WRITE_ACCOUNT)
22 
23 #define ALIAS_EXECUTE                  (STANDARD_RIGHTS_EXECUTE |\
24                                         ALIAS_READ_INFORMATION)
25 
26 #define ALIAS_ALL_ACCESS               (STANDARD_RIGHTS_REQUIRED |\
27                                         ALIAS_ADD_MEMBER |\
28                                         ALIAS_REMOVE_MEMBER |\
29                                         ALIAS_LIST_MEMBERS |\
30                                         ALIAS_READ_INFORMATION |\
31                                         ALIAS_WRITE_ACCOUNT)
32 
33 #define DOMAIN_READ_PASSWORD_PARAMETERS 0x00000001
34 #define DOMAIN_WRITE_PASSWORD_PARAMS    0x00000002
35 #define DOMAIN_READ_OTHER_PARAMETERS    0x00000004
36 #define DOMAIN_WRITE_OTHER_PARAMETERS   0x00000008
37 #define DOMAIN_CREATE_USER              0x00000010
38 #define DOMAIN_CREATE_GROUP             0x00000020
39 #define DOMAIN_CREATE_ALIAS             0x00000040
40 #define DOMAIN_GET_ALIAS_MEMBERSHIP     0x00000080
41 #define DOMAIN_LIST_ACCOUNTS            0x00000100
42 #define DOMAIN_LOOKUP                   0x00000200
43 #define DOMAIN_ADMINISTER_SERVER        0x00000400
44 
45 #define DOMAIN_READ                    (STANDARD_RIGHTS_READ |\
46                                         DOMAIN_READ_OTHER_PARAMETERS |\
47                                         DOMAIN_GET_ALIAS_MEMBERSHIP)
48 
49 #define DOMAIN_WRITE                   (STANDARD_RIGHTS_WRITE |\
50                                         DOMAIN_WRITE_PASSWORD_PARAMS |\
51                                         DOMAIN_WRITE_OTHER_PARAMETERS |\
52                                         DOMAIN_CREATE_USER |\
53                                         DOMAIN_CREATE_GROUP |\
54                                         DOMAIN_CREATE_ALIAS |\
55                                         DOMAIN_ADMINISTER_SERVER)
56 
57 #define DOMAIN_EXECUTE                 (STANDARD_RIGHTS_EXECUTE |\
58                                         DOMAIN_READ_PASSWORD_PARAMETERS |\
59                                         DOMAIN_LIST_ACCOUNTS |\
60                                         DOMAIN_LOOKUP)
61 
62 #define DOMAIN_ALL_ACCESS              (STANDARD_RIGHTS_REQUIRED |\
63                                         DOMAIN_READ_PASSWORD_PARAMETERS |\
64                                         DOMAIN_WRITE_PASSWORD_PARAMS |\
65                                         DOMAIN_READ_OTHER_PARAMETERS |\
66                                         DOMAIN_WRITE_OTHER_PARAMETERS |\
67                                         DOMAIN_CREATE_USER |\
68                                         DOMAIN_CREATE_GROUP |\
69                                         DOMAIN_CREATE_ALIAS |\
70                                         DOMAIN_GET_ALIAS_MEMBERSHIP |\
71                                         DOMAIN_LIST_ACCOUNTS |\
72                                         DOMAIN_LOOKUP |\
73                                         DOMAIN_ADMINISTER_SERVER)
74 
75 #define GROUP_READ_INFORMATION          0x00000001
76 #define GROUP_WRITE_ACCOUNT             0x00000002
77 #define GROUP_ADD_MEMBER                0x00000004
78 #define GROUP_REMOVE_MEMBER             0x00000008
79 #define GROUP_LIST_MEMBERS              0x00000010
80 
81 #define GROUP_READ                     (STANDARD_RIGHTS_READ |\
82                                         GROUP_LIST_MEMBERS)
83 
84 #define GROUP_WRITE                    (STANDARD_RIGHTS_WRITE |\
85                                         GROUP_WRITE_ACCOUNT |\
86                                         GROUP_ADD_MEMBER |\
87                                         GROUP_REMOVE_MEMBER)
88 
89 #define GROUP_EXECUTE                  (STANDARD_RIGHTS_EXECUTE |\
90                                         GROUP_READ_INFORMATION)
91 
92 #define GROUP_ALL_ACCESS               (STANDARD_RIGHTS_REQUIRED |\
93                                         GROUP_READ_INFORMATION |\
94                                         GROUP_WRITE_ACCOUNT |\
95                                         GROUP_ADD_MEMBER |\
96                                         GROUP_REMOVE_MEMBER |\
97                                         GROUP_LIST_MEMBERS)
98 
99 #define SAM_SERVER_CONNECT              0x00000001
100 #define SAM_SERVER_SHUTDOWN             0x00000002
101 #define SAM_SERVER_INITIALIZE           0x00000004
102 #define SAM_SERVER_CREATE_DOMAIN        0x00000008
103 #define SAM_SERVER_ENUMERATE_DOMAINS    0x00000010
104 #define SAM_SERVER_LOOKUP_DOMAIN        0x00000020
105 
106 #define SAM_SERVER_READ                (STANDARD_RIGHTS_READ |\
107                                         SAM_SERVER_ENUMERATE_DOMAINS)
108 
109 #define SAM_SERVER_WRITE               (STANDARD_RIGHTS_WRITE |\
110                                         SAM_SERVER_SHUTDOWN |\
111                                         SAM_SERVER_INITIALIZE |\
112                                         SAM_SERVER_CREATE_DOMAIN)
113 
114 #define SAM_SERVER_EXECUTE             (STANDARD_RIGHTS_EXECUTE |\
115                                         SAM_SERVER_CONNECT |\
116                                         SAM_SERVER_LOOKUP_DOMAIN)
117 
118 #define SAM_SERVER_ALL_ACCESS          (STANDARD_RIGHTS_REQUIRED |\
119                                         SAM_SERVER_CONNECT |\
120                                         SAM_SERVER_SHUTDOWN |\
121                                         SAM_SERVER_INITIALIZE |\
122                                         SAM_SERVER_CREATE_DOMAIN |\
123                                         SAM_SERVER_ENUMERATE_DOMAINS |\
124                                         SAM_SERVER_LOOKUP_DOMAIN)
125 
126 #define USER_READ_GENERAL               0x00000001
127 #define USER_READ_PREFERENCES           0x00000002
128 #define USER_WRITE_PREFERENCES          0x00000004
129 #define USER_READ_LOGON                 0x00000008
130 #define USER_READ_ACCOUNT               0x00000010
131 #define USER_WRITE_ACCOUNT              0x00000020
132 #define USER_CHANGE_PASSWORD            0x00000040
133 #define USER_FORCE_PASSWORD_CHANGE      0x00000080
134 #define USER_LIST_GROUPS                0x00000100
135 #define USER_READ_GROUP_INFORMATION     0x00000200
136 #define USER_WRITE_GROUP_INFORMATION    0x00000400
137 
138 #define USER_READ                      (STANDARD_RIGHTS_READ |\
139                                         USER_READ_PREFERENCES |\
140                                         USER_READ_LOGON |\
141                                         USER_READ_ACCOUNT |\
142                                         USER_LIST_GROUPS |\
143                                         USER_READ_GROUP_INFORMATION)
144 
145 #define USER_WRITE                     (STANDARD_RIGHTS_WRITE |\
146                                         USER_WRITE_PREFERENCES |\
147                                         USER_CHANGE_PASSWORD)
148 
149 #define USER_EXECUTE                   (STANDARD_RIGHTS_EXECUTE |\
150                                         USER_READ_GENERAL |\
151                                         USER_CHANGE_PASSWORD)
152 
153 #define USER_ALL_ACCESS                (STANDARD_RIGHTS_REQUIRED |\
154                                         USER_READ_GENERAL |\
155                                         USER_READ_PREFERENCES |\
156                                         USER_WRITE_PREFERENCES |\
157                                         USER_READ_LOGON |\
158                                         USER_READ_ACCOUNT |\
159                                         USER_WRITE_ACCOUNT |\
160                                         USER_CHANGE_PASSWORD |\
161                                         USER_FORCE_PASSWORD_CHANGE |\
162                                         USER_LIST_GROUPS |\
163                                         USER_READ_GROUP_INFORMATION |\
164                                         USER_WRITE_GROUP_INFORMATION)
165 
166 /* User account control bits */
167 #define USER_ACCOUNT_DISABLED                       0x00000001
168 #define USER_HOME_DIRECTORY_REQUIRED                0x00000002
169 #define USER_PASSWORD_NOT_REQUIRED                  0x00000004
170 #define USER_TEMP_DUPLICATE_ACCOUNT                 0x00000008
171 #define USER_NORMAL_ACCOUNT                         0x00000010
172 #define USER_MNS_LOGON_ACCOUNT                      0x00000020
173 #define USER_INTERDOMAIN_TRUST_ACCOUNT              0x00000040
174 #define USER_WORKSTATION_TRUST_ACCOUNT              0x00000080
175 #define USER_SERVER_TRUST_ACCOUNT                   0x00000100
176 #define USER_DONT_EXPIRE_PASSWORD                   0x00000200
177 #define USER_ACCOUNT_AUTO_LOCKED                    0x00000400
178 #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED        0x00000800
179 #define USER_SMARTCARD_REQUIRED                     0x00001000
180 #define USER_TRUSTED_FOR_DELEGATION                 0x00002000
181 #define USER_NOT_DELEGATED                          0x00004000
182 #define USER_USE_DES_KEY_ONLY                       0x00008000
183 #define USER_DONT_REQUIRE_PREAUTH                   0x00010000
184 #define USER_PASSWORD_EXPIRED                       0x00020000
185 #define USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION 0x00040000
186 #define USER_NO_AUTH_DATA_REQUIRED                  0x00080000
187 #define USER_PARTIAL_SECRETS_ACCOUNT                0x00100000
188 #define USER_USE_AES_KEYS                           0x00200000
189 
190 /* Constants used by LOGON_HOURS.UnitsPerWeek */
191 #define SAM_DAYS_PER_WEEK        (7)
192 #define SAM_HOURS_PER_WEEK       (24 * SAM_DAYS_PER_WEEK)
193 #define SAM_MINUTES_PER_WEEK     (60 * SAM_HOURS_PER_WEEK)
194 
195 /* Flags used by USER_ALL_INFORMATION.WhichField */
196 #define USER_ALL_USERNAME           0x00000001
197 #define USER_ALL_FULLNAME           0x00000002
198 #define USER_ALL_USERID             0x00000004
199 #define USER_ALL_PRIMARYGROUPID     0x00000008
200 #define USER_ALL_ADMINCOMMENT       0x00000010
201 #define USER_ALL_USERCOMMENT        0x00000020
202 #define USER_ALL_HOMEDIRECTORY      0x00000040
203 #define USER_ALL_HOMEDIRECTORYDRIVE 0x00000080
204 #define USER_ALL_SCRIPTPATH         0x00000100
205 #define USER_ALL_PROFILEPATH        0x00000200
206 #define USER_ALL_WORKSTATIONS       0x00000400
207 #define USER_ALL_LASTLOGON          0x00000800
208 #define USER_ALL_LASTLOGOFF         0x00001000
209 #define USER_ALL_LOGONHOURS         0x00002000
210 #define USER_ALL_BADPASSWORDCOUNT   0x00004000
211 #define USER_ALL_LOGONCOUNT         0x00008000
212 #define USER_ALL_PASSWORDCANCHANGE  0x00010000
213 #define USER_ALL_PASSWORDMUSTCHANGE 0x00020000
214 #define USER_ALL_PASSWORDLASTSET    0x00040000
215 #define USER_ALL_ACCOUNTEXPIRES     0x00080000
216 #define USER_ALL_USERACCOUNTCONTROL 0x00100000
217 #define USER_ALL_PARAMETERS         0x00200000
218 #define USER_ALL_COUNTRYCODE        0x00400000
219 #define USER_ALL_CODEPAGE           0x00800000
220 #define USER_ALL_NTPASSWORDPRESENT  0x01000000
221 #define USER_ALL_LMPASSWORDPRESENT  0x02000000
222 #define USER_ALL_PRIVATEDATA        0x04000000
223 #define USER_ALL_PASSWORDEXPIRED    0x08000000
224 #define USER_ALL_SECURITYDESCRIPTOR 0x10000000
225 #define USER_ALL_OWFPASSWORD        0x20000000
226 #define USER_ALL_UNDEFINED_MASK     0xC0000000
227 
228 #define USER_ALL_READ_GENERAL_MASK                0x0000003F
229 #define USER_ALL_READ_LOGON_MASK                  0x0003FFC0
230 #define USER_ALL_READ_ACCOUNT_MASK                0x003C0000
231 #define USER_ALL_READ_PREFERENCES_MASK            0x00C00000
232 #define USER_ALL_READ_TRUSTED_MASK                0x1F000000
233 #define USER_ALL_READ_CANT_MASK                   0xC0000000
234 
235 #define USER_ALL_WRITE_ACCOUNT_MASK               0x003827DB
236 #define USER_ALL_WRITE_PREFERENCES_MASK           0x00C00020
237 #define USER_ALL_WRITE_FORCE_PASSWORD_CHANGE_MASK 0x0B000000
238 #define USER_ALL_WRITE_TRUSTED_MASK               0x1404D800
239 #define USER_ALL_WRITE_CANT_MASK                  0xC0030004
240 
241 /* Values used by USER_PWD_CHANGE_FAILURE_INFORMATION.ExtendedFailureReason */
242 #define SAM_PWD_CHANGE_NO_ERROR                     0
243 #define SAM_PWD_CHANGE_PASSWORD_TOO_SHORT           1
244 #define SAM_PWD_CHANGE_PWD_IN_HISTORY               2
245 #define SAM_PWD_CHANGE_USERNAME_IN_PASSWORD         3
246 #define SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD         4
247 #define SAM_PWD_CHANGE_NOT_COMPLEX                  5
248 #define SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT 6
249 #define SAM_PWD_CHANGE_FAILED_BY_FILTER             7
250 #define SAM_PWD_CHANGE_PASSWORD_TOO_LONG            8
251 #define SAM_PWD_CHANGE_FAILURE_REASON_MAX           8
252 
253 /* Flags used by DOMAIN_PASSWORD_INFORMATION.PasswordProperties */
254 #define DOMAIN_PASSWORD_COMPLEX             0x00000001L
255 #define DOMAIN_PASSWORD_NO_ANON_CHANGE      0x00000002L
256 #define DOMAIN_PASSWORD_NO_CLEAR_CHANGE     0x00000004L
257 #define DOMAIN_LOCKOUT_ADMINS               0x00000008L
258 #define DOMAIN_PASSWORD_STORE_CLEARTEXT     0x00000010L
259 #define DOMAIN_REFUSE_PASSWORD_CHANGE       0x00000020L
260 #define DOMAIN_NO_LM_OWF_CHANGE             0x00000040L
261 
262 typedef PVOID SAM_HANDLE, *PSAM_HANDLE;
263 typedef ULONG SAM_ENUMERATE_HANDLE, *PSAM_ENUMERATE_HANDLE;
264 
265 typedef struct _SAM_RID_ENUMERATION
266 {
267     ULONG RelativeId;
268     UNICODE_STRING Name;
269 } SAM_RID_ENUMERATION, *PSAM_RID_ENUMERATION;
270 
271 typedef struct _SAM_SID_ENUMERATION
272 {
273     PSID Sid;
274     UNICODE_STRING Name;
275 } SAM_SID_ENUMERATION, *PSAM_SID_ENUMERATION;
276 
277 typedef enum _ALIAS_INFORMATION_CLASS
278 {
279     AliasGeneralInformation = 1,
280     AliasNameInformation,
281     AliasAdminCommentInformation
282 } ALIAS_INFORMATION_CLASS, *PALIAS_INFORMATION_CLASS;
283 
284 typedef struct _ALIAS_GENERAL_INFORMATION
285 {
286     UNICODE_STRING Name;
287     ULONG MemberCount;
288     UNICODE_STRING AdminComment;
289 } ALIAS_GENERAL_INFORMATION, *PALIAS_GENERAL_INFORMATION;
290 
291 typedef struct _ALIAS_NAME_INFORMATION
292 {
293     UNICODE_STRING Name;
294 } ALIAS_NAME_INFORMATION, *PALIAS_NAME_INFORMATION;
295 
296 typedef struct _ALIAS_ADM_COMMENT_INFORMATION
297 {
298     UNICODE_STRING AdminComment;
299 } ALIAS_ADM_COMMENT_INFORMATION, *PALIAS_ADM_COMMENT_INFORMATION;
300 
301 typedef enum _DOMAIN_DISPLAY_INFORMATION
302 {
303     DomainDisplayUser = 1,
304     DomainDisplayMachine,
305     DomainDisplayGroup,
306     DomainDisplayOemUser,
307     DomainDisplayOemGroup,
308     DomainDisplayServer
309 } DOMAIN_DISPLAY_INFORMATION, *PDOMAIN_DISPLAY_INFORMATION;
310 
311 typedef enum _DOMAIN_INFORMATION_CLASS
312 {
313     DomainPasswordInformation = 1,
314     DomainGeneralInformation,
315     DomainLogoffInformation,
316     DomainOemInformation,
317     DomainNameInformation,
318     DomainReplicationInformation,
319     DomainServerRoleInformation,
320     DomainModifiedInformation,
321     DomainStateInformation,
322     DomainUasInformation,
323     DomainGeneralInformation2,
324     DomainLockoutInformation,
325     DomainModifiedInformation2
326 } DOMAIN_INFORMATION_CLASS;
327 
328 typedef enum _DOMAIN_SERVER_ENABLE_STATE
329 {
330     DomainServerEnabled = 1,
331     DomainServerDisabled
332 } DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE;
333 
334 typedef enum _DOMAIN_SERVER_ROLE
335 {
336     DomainServerRoleBackup = 2,
337     DomainServerRolePrimary
338 } DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE;
339 
340 #ifndef _DOMAIN_PASSWORD_INFORMATION_DEFINED
341 #define _DOMAIN_PASSWORD_INFORMATION_DEFINED
342 typedef struct _DOMAIN_PASSWORD_INFORMATION
343 {
344     USHORT MinPasswordLength;
345     USHORT PasswordHistoryLength;
346     ULONG PasswordProperties;
347     LARGE_INTEGER MaxPasswordAge;
348     LARGE_INTEGER MinPasswordAge;
349 } DOMAIN_PASSWORD_INFORMATION, *PDOMAIN_PASSWORD_INFORMATION;
350 #endif
351 
352 #include "pshpack4.h"
353 typedef struct _DOMAIN_GENERAL_INFORMATION
354 {
355     LARGE_INTEGER ForceLogoff;
356     UNICODE_STRING OemInformation;
357     UNICODE_STRING DomainName;
358     UNICODE_STRING ReplicaSourceNodeName;
359     LARGE_INTEGER DomainModifiedCount;
360     DOMAIN_SERVER_ENABLE_STATE DomainServerState;
361     DOMAIN_SERVER_ROLE DomainServerRole;
362     BOOLEAN UasCompatibilityRequired;
363     ULONG UserCount;
364     ULONG GroupCount;
365     ULONG AliasCount;
366 } DOMAIN_GENERAL_INFORMATION, *PDOMAIN_GENERAL_INFORMATION;
367 #include "poppack.h"
368 
369 typedef struct _DOMAIN_LOGOFF_INFORMATION
370 {
371     LARGE_INTEGER ForceLogoff;
372 } DOMAIN_LOGOFF_INFORMATION, *PDOMAIN_LOGOFF_INFORMATION;
373 
374 typedef struct _DOMAIN_OEM_INFORMATION
375 {
376     UNICODE_STRING OemInformation;
377 } DOMAIN_OEM_INFORMATION, *PDOMAIN_OEM_INFORMATION;
378 
379 typedef struct _DOMAIN_NAME_INFORMATION
380 {
381     UNICODE_STRING DomainName;
382 } DOMAIN_NAME_INFORMATION, *PDOMAIN_NAME_INFORMATION;
383 
384 typedef struct _DOMAIN_REPLICATION_INFORMATION
385 {
386     UNICODE_STRING ReplicaSourceNodeName;
387 } DOMAIN_REPLICATION_INFORMATION, *PDOMAIN_REPLICATION_INFORMATION;
388 
389 typedef struct _DOMAIN_SERVER_ROLE_INFORMATION
390 {
391     DOMAIN_SERVER_ROLE DomainServerRole;
392 } DOMAIN_SERVER_ROLE_INFORMATION, *PDOMAIN_SERVER_ROLE_INFORMATION;
393 
394 typedef struct _DOMAIN_MODIFIED_INFORMATION
395 {
396     LARGE_INTEGER DomainModifiedCount;
397     LARGE_INTEGER CreationTime;
398 } DOMAIN_MODIFIED_INFORMATION, *PDOMAIN_MODIFIED_INFORMATION;
399 
400 typedef struct _DOMAIN_STATE_INFORMATION
401 {
402     DOMAIN_SERVER_ENABLE_STATE DomainServerState;
403 } DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION;
404 
405 typedef struct _DOMAIN_UAS_INFORMATION
406 {
407     BOOLEAN UasCompatibilityRequired;
408 } DOMAIN_UAS_INFORMATION;
409 
410 #include "pshpack4.h"
411 typedef struct _DOMAIN_GENERAL_INFORMATION2
412 {
413     DOMAIN_GENERAL_INFORMATION I1;
414     LARGE_INTEGER LockoutDuration;
415     LARGE_INTEGER LockoutObservationWindow;
416     USHORT LockoutThreshold;
417 } DOMAIN_GENERAL_INFORMATION2, *PDOMAIN_GENERAL_INFORMATION2;
418 #include "poppack.h"
419 
420 typedef struct _DOMAIN_LOCKOUT_INFORMATION
421 {
422     LARGE_INTEGER LockoutDuration;
423     LARGE_INTEGER LockoutObservationWindow;
424     USHORT LockoutThreshold;
425 } DOMAIN_LOCKOUT_INFORMATION, *PDOMAIN_LOCKOUT_INFORMATION;
426 
427 typedef struct _DOMAIN_MODIFIED_INFORMATION2
428 {
429     LARGE_INTEGER DomainModifiedCount;
430     LARGE_INTEGER CreationTime;
431     LARGE_INTEGER ModifiedCountAtLastPromotion;
432 } DOMAIN_MODIFIED_INFORMATION2, *PDOMAIN_MODIFIED_INFORMATION2;
433 
434 typedef enum _GROUP_INFORMATION_CLASS
435 {
436     GroupGeneralInformation = 1,
437     GroupNameInformation,
438     GroupAttributeInformation,
439     GroupAdminCommentInformation,
440     GroupReplicationInformation
441 } GROUP_INFORMATION_CLASS;
442 
443 typedef struct _GROUP_GENERAL_INFORMATION
444 {
445     UNICODE_STRING Name;
446     ULONG Attributes;
447     ULONG MemberCount;
448     UNICODE_STRING AdminComment;
449 } GROUP_GENERAL_INFORMATION, *PGROUP_GENERAL_INFORMATION;
450 
451 typedef struct _GROUP_NAME_INFORMATION
452 {
453     UNICODE_STRING Name;
454 } GROUP_NAME_INFORMATION, *PGROUP_NAME_INFORMATION;
455 
456 typedef struct _GROUP_ATTRIBUTE_INFORMATION
457 {
458     ULONG Attributes;
459 } GROUP_ATTRIBUTE_INFORMATION, *PGROUP_ATTRIBUTE_INFORMATION;
460 
461 typedef struct GROUP_ADM_COMMENT_INFORMATION
462 {
463     UNICODE_STRING AdminComment;
464 } GROUP_ADM_COMMENT_INFORMATION, *PGROUP_ADM_COMMENT_INFORMATION;
465 
466 typedef struct _GROUP_MEMBERSHIP
467 {
468     ULONG RelativeId;
469     ULONG Attributes;
470 } GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP;
471 
472 typedef struct _LOGON_HOURS
473 {
474     USHORT UnitsPerWeek;
475     PUCHAR LogonHours;
476 } LOGON_HOURS, *PLOGON_HOURS;
477 
478 typedef struct _SR_SECURITY_DESCRIPTOR
479 {
480     ULONG Length;
481     PUCHAR SecurityDescriptor;
482 } SR_SECURITY_DESCRIPTOR, *PSR_SECURITY_DESCRIPTOR;
483 
484 typedef enum _USER_INFORMATION_CLASS
485 {
486     UserGeneralInformation = 1,
487     UserPreferencesInformation,
488     UserLogonInformation,
489     UserLogonHoursInformation,
490     UserAccountInformation,
491     UserNameInformation,
492     UserAccountNameInformation,
493     UserFullNameInformation,
494     UserPrimaryGroupInformation,
495     UserHomeInformation,
496     UserScriptInformation,
497     UserProfileInformation,
498     UserAdminCommentInformation,
499     UserWorkStationsInformation,
500     UserSetPasswordInformation,
501     UserControlInformation,
502     UserExpiresInformation,
503     UserInternal1Information,
504     UserInternal2Information,
505     UserParametersInformation,
506     UserAllInformation,
507     UserInternal3Information,
508     UserInternal4Information,
509     UserInternal5Information,
510     UserInternal4InformationNew,
511     UserInternal5InformationNew,
512     UserInternal6Information,
513     UserExtendedInformation,
514     UserLogonUIInformation,
515 } USER_INFORMATION_CLASS, *PUSER_INFORMATION_CLASS;
516 
517 typedef struct _USER_GENERAL_INFORMATION
518 {
519     UNICODE_STRING UserName;
520     UNICODE_STRING FullName;
521     ULONG PrimaryGroupId;
522     UNICODE_STRING AdminComment;
523     UNICODE_STRING UserComment;
524 } USER_GENERAL_INFORMATION, *PUSER_GENERAL_INFORMATION;
525 
526 typedef struct _USER_PREFERENCES_INFORMATION
527 {
528     UNICODE_STRING UserComment;
529     UNICODE_STRING Reserved1;
530     USHORT CountryCode;
531     USHORT CodePage;
532 } USER_PREFERENCES_INFORMATION, *PUSER_PREFERENCES_INFORMATION;
533 
534 #include "pshpack4.h"
535 typedef struct _USER_LOGON_INFORMATION
536 {
537     UNICODE_STRING UserName;
538     UNICODE_STRING FullName;
539     ULONG UserId;
540     ULONG PrimaryGroupId;
541     UNICODE_STRING HomeDirectory;
542     UNICODE_STRING HomeDirectoryDrive;
543     UNICODE_STRING ScriptPath;
544     UNICODE_STRING ProfilePath;
545     UNICODE_STRING WorkStations;
546     LARGE_INTEGER LastLogon;
547     LARGE_INTEGER LastLogoff;
548     LARGE_INTEGER PasswordLastSet;
549     LARGE_INTEGER PasswordCanChange;
550     LARGE_INTEGER PasswordMustChange;
551     LOGON_HOURS LogonHours;
552     USHORT BadPasswordCount;
553     USHORT LogonCount;
554     ULONG UserAccountControl;
555 } USER_LOGON_INFORMATION, *PUSER_LOGON_INFORMATION;
556 #include "poppack.h"
557 
558 typedef struct _USER_LOGON_HOURS_INFORMATION
559 {
560     LOGON_HOURS LogonHours;
561 } USER_LOGON_HOURS_INFORMATION, *PUSER_LOGON_HOURS_INFORMATION;
562 
563 #include "pshpack4.h"
564 typedef struct _USER_ACCOUNT_INFORMATION
565 {
566     UNICODE_STRING UserName;
567     UNICODE_STRING FullName;
568     ULONG UserId;
569     ULONG PrimaryGroupId;
570     UNICODE_STRING HomeDirectory;
571     UNICODE_STRING HomeDirectoryDrive;
572     UNICODE_STRING ScriptPath;
573     UNICODE_STRING ProfilePath;
574     UNICODE_STRING AdminComment;
575     UNICODE_STRING WorkStations;
576     LARGE_INTEGER LastLogon;
577     LARGE_INTEGER LastLogoff;
578     LOGON_HOURS LogonHours;
579     USHORT BadPasswordCount;
580     USHORT LogonCount;
581     LARGE_INTEGER PasswordLastSet;
582     LARGE_INTEGER AccountExpires;
583     ULONG UserAccountControl;
584 } USER_ACCOUNT_INFORMATION, *PUSER_ACCOUNT_INFORMATION;
585 #include "poppack.h"
586 
587 typedef struct _USER_NAME_INFORMATION
588 {
589     UNICODE_STRING UserName;
590     UNICODE_STRING FullName;
591 } USER_NAME_INFORMATION, *PUSER_NAME_INFORMATION;
592 
593 typedef struct _USER_ACCOUNT_NAME_INFORMATION
594 {
595     UNICODE_STRING UserName;
596 } USER_ACCOUNT_NAME_INFORMATION, *PUSER_ACCOUNT_NAME_INFORMATION;
597 
598 typedef struct _USER_FULL_NAME_INFORMATION
599 {
600     UNICODE_STRING FullName;
601 } USER_FULL_NAME_INFORMATION, *PUSER_FULL_NAME_INFORMATION;
602 
603 typedef struct _USER_PRIMARY_GROUP_INFORMATION
604 {
605     ULONG PrimaryGroupId;
606 } USER_PRIMARY_GROUP_INFORMATION, *PUSER_PRIMARY_GROUP_INFORMATION;
607 
608 typedef struct _USER_HOME_INFORMATION
609 {
610     UNICODE_STRING HomeDirectory;
611     UNICODE_STRING HomeDirectoryDrive;
612 } USER_HOME_INFORMATION, *PUSER_HOME_INFORMATION;
613 
614 typedef struct _USER_SCRIPT_INFORMATION
615 {
616     UNICODE_STRING ScriptPath;
617 } USER_SCRIPT_INFORMATION, *PUSER_SCRIPT_INFORMATION;
618 
619 typedef struct _USER_PROFILE_INFORMATION
620 {
621     UNICODE_STRING ProfilePath;
622 } USER_PROFILE_INFORMATION, *PUSER_PROFILE_INFORMATION;
623 
624 typedef struct _USER_ADMIN_COMMENT_INFORMATION
625 {
626     UNICODE_STRING AdminComment;
627 } USER_ADMIN_COMMENT_INFORMATION, *PUSER_ADMIN_COMMENT_INFORMATION;
628 
629 typedef struct _USER_WORKSTATIONS_INFORMATION
630 {
631     UNICODE_STRING WorkStations;
632 } USER_WORKSTATIONS_INFORMATION, *PUSER_WORKSTATIONS_INFORMATION;
633 
634 typedef struct _USER_SET_PASSWORD_INFORMATION
635 {
636     UNICODE_STRING Password;
637     BOOLEAN PasswordExpired;
638 } USER_SET_PASSWORD_INFORMATION, *PUSER_SET_PASSWORD_INFORMATION;
639 
640 typedef struct _USER_CONTROL_INFORMATION
641 {
642     ULONG UserAccountControl;
643 } USER_CONTROL_INFORMATION, *PUSER_CONTROL_INFORMATION;
644 
645 typedef struct _USER_EXPIRES_INFORMATION
646 {
647     LARGE_INTEGER AccountExpires;
648 } USER_EXPIRES_INFORMATION, *PUSER_EXPIRES_INFORMATION;
649 
650 typedef struct _USER_PARAMETERS_INFORMATION
651 {
652     UNICODE_STRING Parameters;
653 } USER_PARAMETERS_INFORMATION, *PUSER_PARAMETERS_INFORMATION;
654 
655 #include "pshpack4.h"
656 typedef struct _USER_ALL_INFORMATION
657 {
658     LARGE_INTEGER LastLogon;
659     LARGE_INTEGER LastLogoff;
660     LARGE_INTEGER PasswordLastSet;
661     LARGE_INTEGER AccountExpires;
662     LARGE_INTEGER PasswordCanChange;
663     LARGE_INTEGER PasswordMustChange;
664     UNICODE_STRING UserName;
665     UNICODE_STRING FullName;
666     UNICODE_STRING HomeDirectory;
667     UNICODE_STRING HomeDirectoryDrive;
668     UNICODE_STRING ScriptPath;
669     UNICODE_STRING ProfilePath;
670     UNICODE_STRING AdminComment;
671     UNICODE_STRING WorkStations;
672     UNICODE_STRING UserComment;
673     UNICODE_STRING Parameters;
674     UNICODE_STRING LmPassword;
675     UNICODE_STRING NtPassword;
676     UNICODE_STRING PrivateData;
677     SR_SECURITY_DESCRIPTOR SecurityDescriptor;
678     ULONG UserId;
679     ULONG PrimaryGroupId;
680     ULONG UserAccountControl;
681     ULONG WhichFields;
682     LOGON_HOURS LogonHours;
683     USHORT BadPasswordCount;
684     USHORT LogonCount;
685     USHORT CountryCode;
686     USHORT CodePage;
687     BOOLEAN LmPasswordPresent;
688     BOOLEAN NtPasswordPresent;
689     BOOLEAN PasswordExpired;
690     BOOLEAN PrivateDataSensitive;
691 } USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION;
692 #include "poppack.h"
693 
694 typedef struct _USER_PWD_CHANGE_FAILURE_INFORMATION
695 {
696     ULONG ExtendedFailureReason;
697     UNICODE_STRING FilterModuleName;
698 } USER_PWD_CHANGE_FAILURE_INFORMATION, *PUSER_PWD_CHANGE_FAILURE_INFORMATION;
699 
700 #define SAM_SID_COMPATIBILITY_ALL    0
701 #define SAM_SID_COMPATIBILITY_LAX    1
702 #define SAM_SID_COMPATIBILITY_STRICT 2
703 
704 
705 NTSTATUS
706 NTAPI
707 SamAddMemberToAlias(IN SAM_HANDLE AliasHandle,
708                     IN PSID MemberId);
709 
710 NTSTATUS
711 NTAPI
712 SamAddMemberToGroup(IN SAM_HANDLE GroupHandle,
713                     IN ULONG MemberId,
714                     IN ULONG Attributes);
715 
716 NTSTATUS
717 NTAPI
718 SamAddMultipleMembersToAlias(IN SAM_HANDLE AliasHandle,
719                              IN PSID *MemberIds,
720                              IN ULONG MemberCount);
721 
722 NTSTATUS
723 NTAPI
724 SamChangePasswordUser(IN SAM_HANDLE UserHandle,
725                       IN PUNICODE_STRING OldPassword,
726                       IN PUNICODE_STRING NewPassword);
727 
728 NTSTATUS
729 NTAPI
730 SamChangePasswordUser2(IN PUNICODE_STRING ServerName,
731                        IN PUNICODE_STRING UserName,
732                        IN PUNICODE_STRING OldPassword,
733                        IN PUNICODE_STRING NewPassword);
734 
735 NTSTATUS
736 NTAPI
737 SamChangePasswordUser3(IN PUNICODE_STRING ServerName,
738                        IN PUNICODE_STRING UserName,
739                        IN PUNICODE_STRING OldPassword,
740                        IN PUNICODE_STRING NewPassword,
741                        OUT PDOMAIN_PASSWORD_INFORMATION *EffectivePasswordPolicy,
742                        OUT PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo);
743 
744 NTSTATUS
745 NTAPI
746 SamCloseHandle(IN SAM_HANDLE SamHandle);
747 
748 NTSTATUS
749 NTAPI
750 SamConnect(IN OUT PUNICODE_STRING ServerName OPTIONAL,
751            OUT PSAM_HANDLE ServerHandle,
752            IN ACCESS_MASK DesiredAccess,
753            IN POBJECT_ATTRIBUTES ObjectAttributes);
754 
755 NTSTATUS
756 NTAPI
757 SamCreateAliasInDomain(IN SAM_HANDLE DomainHandle,
758                        IN PUNICODE_STRING AccountName,
759                        IN ACCESS_MASK DesiredAccess,
760                        OUT PSAM_HANDLE AliasHandle,
761                        OUT PULONG RelativeId);
762 
763 NTSTATUS
764 NTAPI
765 SamCreateGroupInDomain(IN SAM_HANDLE DomainHandle,
766                        IN PUNICODE_STRING AccountName,
767                        IN ACCESS_MASK DesiredAccess,
768                        OUT PSAM_HANDLE GroupHandle,
769                        OUT PULONG RelativeId);
770 
771 NTSTATUS
772 NTAPI
773 SamCreateUser2InDomain(IN SAM_HANDLE DomainHandle,
774                        IN PUNICODE_STRING AccountName,
775                        IN ULONG AccountType,
776                        IN ACCESS_MASK DesiredAccess,
777                        OUT PSAM_HANDLE UserHandle,
778                        OUT PULONG GrantedAccess,
779                        OUT PULONG RelativeId);
780 
781 NTSTATUS
782 NTAPI
783 SamCreateUserInDomain(IN SAM_HANDLE DomainHandle,
784                       IN PUNICODE_STRING AccountName,
785                       IN ACCESS_MASK DesiredAccess,
786                       OUT PSAM_HANDLE UserHandle,
787                       OUT PULONG RelativeId);
788 
789 NTSTATUS
790 NTAPI
791 SamDeleteAlias(IN SAM_HANDLE AliasHandle);
792 
793 NTSTATUS
794 NTAPI
795 SamDeleteGroup(IN SAM_HANDLE GroupHandle);
796 
797 NTSTATUS
798 NTAPI
799 SamDeleteUser(IN SAM_HANDLE UserHandle);
800 
801 NTSTATUS
802 NTAPI
803 SamEnumerateAliasesInDomain(IN SAM_HANDLE DomainHandle,
804                             IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
805                             OUT PVOID *Buffer,
806                             IN ULONG PreferedMaximumLength,
807                             OUT PULONG CountReturned);
808 
809 NTSTATUS
810 NTAPI
811 SamEnumerateDomainsInSamServer(IN SAM_HANDLE ServerHandle,
812                                IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
813                                OUT PVOID *Buffer,
814                                IN ULONG PreferedMaximumLength,
815                                OUT PULONG CountReturned);
816 
817 NTSTATUS
818 NTAPI
819 SamEnumerateGroupsInDomain(IN SAM_HANDLE DomainHandle,
820                            IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
821                            IN PVOID *Buffer,
822                            IN ULONG PreferedMaximumLength,
823                            OUT PULONG CountReturned);
824 
825 NTSTATUS
826 NTAPI
827 SamEnumerateUsersInDomain(IN SAM_HANDLE DomainHandle,
828                           IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
829                           IN ULONG UserAccountControl,
830                           OUT PVOID *Buffer,
831                           IN ULONG PreferedMaximumLength,
832                           OUT PULONG CountReturned);
833 
834 NTSTATUS
835 NTAPI
836 SamFreeMemory(IN PVOID Buffer);
837 
838 NTSTATUS
839 NTAPI
840 SamGetAliasMembership(IN SAM_HANDLE DomainHandle,
841                       IN ULONG PassedCount,
842                       IN PSID *Sids,
843                       OUT PULONG MembershipCount,
844                       OUT PULONG *Aliases);
845 
846 NTSTATUS
847 NTAPI
848 SamGetCompatibilityMode(IN SAM_HANDLE ObjectHandle,
849                         OUT PULONG Mode);
850 
851 NTSTATUS
852 NTAPI
853 SamGetDisplayEnumerationIndex(IN SAM_HANDLE DomainHandle,
854                               IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
855                               IN PUNICODE_STRING Prefix,
856                               OUT PULONG Index);
857 
858 NTSTATUS
859 NTAPI
860 SamGetGroupsForUser(IN SAM_HANDLE UserHandle,
861                     OUT PGROUP_MEMBERSHIP *Groups,
862                     OUT PULONG MembershipCount);
863 
864 NTSTATUS
865 NTAPI
866 SamGetMembersInAlias(IN SAM_HANDLE AliasHandle,
867                      OUT PSID **MemberIds,
868                      OUT PULONG MemberCount);
869 
870 NTSTATUS
871 NTAPI
872 SamGetMembersInGroup(IN SAM_HANDLE GroupHandle,
873                      OUT PULONG *MemberIds,
874                      OUT PULONG *Attributes,
875                      OUT PULONG MemberCount);
876 
877 NTSTATUS
878 NTAPI
879 SamLookupDomainInSamServer(IN SAM_HANDLE ServerHandle,
880                            IN PUNICODE_STRING Name,
881                            OUT PSID *DomainId);
882 
883 NTSTATUS
884 NTAPI
885 SamLookupIdsInDomain(IN SAM_HANDLE DomainHandle,
886                      IN ULONG Count,
887                      IN PULONG RelativeIds,
888                      OUT PUNICODE_STRING *Names,
889                      OUT PSID_NAME_USE *Use OPTIONAL);
890 
891 NTSTATUS
892 NTAPI
893 SamLookupNamesInDomain(IN SAM_HANDLE DomainHandle,
894                        IN ULONG Count,
895                        IN PUNICODE_STRING Names,
896                        OUT PULONG *RelativeIds,
897                        OUT PSID_NAME_USE *Use);
898 
899 NTSTATUS
900 NTAPI
901 SamOpenAlias(IN SAM_HANDLE DomainHandle,
902              IN ACCESS_MASK DesiredAccess,
903              IN ULONG AliasId,
904              OUT PSAM_HANDLE AliasHandle);
905 
906 NTSTATUS
907 NTAPI
908 SamOpenDomain(IN SAM_HANDLE ServerHandle,
909               IN ACCESS_MASK DesiredAccess,
910               IN PSID DomainId,
911               OUT PSAM_HANDLE DomainHandle);
912 
913 NTSTATUS
914 NTAPI
915 SamOpenGroup(IN SAM_HANDLE DomainHandle,
916              IN ACCESS_MASK DesiredAccess,
917              IN ULONG GroupId,
918              OUT PSAM_HANDLE GroupHandle);
919 
920 NTSTATUS
921 NTAPI
922 SamOpenUser(IN SAM_HANDLE DomainHandle,
923             IN ACCESS_MASK DesiredAccess,
924             IN ULONG UserId,
925             OUT PSAM_HANDLE UserHandle);
926 
927 NTSTATUS
928 NTAPI
929 SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle,
930                            IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
931                            IN ULONG Index,
932                            IN ULONG EntryCount,
933                            IN ULONG PreferredMaximumLength,
934                            OUT PULONG TotalAvailable,
935                            OUT PULONG TotalReturned,
936                            OUT PULONG ReturnedEntryCount,
937                            OUT PVOID *SortedBuffer);
938 
939 NTSTATUS
940 NTAPI
941 SamQueryInformationAlias(IN SAM_HANDLE AliasHandle,
942                          IN ALIAS_INFORMATION_CLASS AliasInformationClass,
943                          OUT PVOID *Buffer);
944 
945 NTSTATUS
946 NTAPI
947 SamQueryInformationDomain(IN SAM_HANDLE DomainHandle,
948                           IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
949                           OUT PVOID *Buffer);
950 
951 NTSTATUS
952 NTAPI
953 SamQueryInformationGroup(IN SAM_HANDLE GroupHandle,
954                          IN GROUP_INFORMATION_CLASS GroupInformationClass,
955                          OUT PVOID *Buffer);
956 
957 NTSTATUS
958 NTAPI
959 SamQueryInformationUser(IN SAM_HANDLE UserHandle,
960                         IN USER_INFORMATION_CLASS UserInformationClass,
961                         OUT PVOID *Buffer);
962 
963 NTSTATUS
964 NTAPI
965 SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle,
966                        IN SECURITY_INFORMATION SecurityInformation,
967                        OUT PSECURITY_DESCRIPTOR *SecurityDescriptor);
968 
969 NTSTATUS
970 NTAPI
971 SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle,
972                          IN PSID MemberId);
973 
974 NTSTATUS
975 NTAPI
976 SamRemoveMemberFromForeignDomain(IN SAM_HANDLE DomainHandle,
977                                  IN PSID MemberId);
978 
979 NTSTATUS
980 NTAPI
981 SamRemoveMemberFromGroup(IN SAM_HANDLE GroupHandle,
982                          IN ULONG MemberId);
983 
984 NTSTATUS
985 NTAPI
986 SamRemoveMultipleMembersFromAlias(IN SAM_HANDLE AliasHandle,
987                                   IN PSID *MemberIds,
988                                   IN ULONG MemberCount);
989 
990 NTSTATUS
991 NTAPI
992 SamRidToSid(IN SAM_HANDLE ObjectHandle,
993             IN ULONG Rid,
994             OUT PSID *Sid);
995 
996 NTSTATUS
997 NTAPI
998 SamSetInformationAlias(IN SAM_HANDLE AliasHandle,
999                        IN ALIAS_INFORMATION_CLASS AliasInformationClass,
1000                        IN PVOID Buffer);
1001 
1002 NTSTATUS
1003 NTAPI
1004 SamSetInformationDomain(IN SAM_HANDLE DomainHandle,
1005                         IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
1006                         IN PVOID Buffer);
1007 
1008 NTSTATUS
1009 NTAPI
1010 SamSetInformationGroup(IN SAM_HANDLE GroupHandle,
1011                        IN GROUP_INFORMATION_CLASS GroupInformationClass,
1012                        IN PVOID Buffer);
1013 
1014 NTSTATUS
1015 NTAPI
1016 SamSetInformationUser(IN SAM_HANDLE UserHandle,
1017                       IN USER_INFORMATION_CLASS UserInformationClass,
1018                       IN PVOID Buffer);
1019 
1020 NTSTATUS
1021 NTAPI
1022 SamSetMemberAttributesOfGroup(IN SAM_HANDLE GroupHandle,
1023                               IN ULONG MemberId,
1024                               IN ULONG Attributes);
1025 
1026 NTSTATUS
1027 NTAPI
1028 SamSetSecurityObject(IN SAM_HANDLE ObjectHandle,
1029                      IN SECURITY_INFORMATION SecurityInformation,
1030                      IN PSECURITY_DESCRIPTOR SecurityDescriptor);
1031 
1032 NTSTATUS
1033 NTAPI
1034 SamShutdownSamServer(IN SAM_HANDLE ServerHandle);
1035 
1036 #ifdef __cplusplus
1037 }
1038 #endif
1039 
1040 #endif /* _NTSAM_ */
1041