4 samr interface definition
6 import "misc.idl", "lsa.idl", "security.idl";
9 Thanks to Todd Sabin for some information from his samr.idl in acltools
12 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
14 endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
15 pointer_default(unique)
18 typedef bitmap security_secinfo security_secinfo;
20 /* account control (acct_flags) bits */
21 typedef [public,bitmap32bit] bitmap {
22 ACB_DISABLED = 0x00000001, /* 1 = User account disabled */
23 ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */
24 ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */
25 ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */
26 ACB_NORMAL = 0x00000010, /* 1 = Normal user account */
27 ACB_MNS = 0x00000020, /* 1 = MNS logon user account */
28 ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */
29 ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */
30 ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */
31 ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */
32 ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */
33 ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encryped text password is allowed */
34 ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */
35 ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */
36 ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */
37 ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
38 ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
39 ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
40 ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */
43 /* SAM server specific access rights */
45 typedef [bitmap32bit] bitmap {
46 SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
47 SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
48 SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
49 SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
50 SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
51 SAMR_ACCESS_OPEN_DOMAIN = 0x00000020
52 } samr_ConnectAccessMask;
54 const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
56 const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
57 (STANDARD_RIGHTS_REQUIRED_ACCESS |
58 SAMR_ACCESS_ALL_ACCESS);
60 const int GENERIC_RIGHTS_SAM_READ =
61 (STANDARD_RIGHTS_READ_ACCESS |
62 SAMR_ACCESS_ENUM_DOMAINS);
64 const int GENERIC_RIGHTS_SAM_WRITE =
65 (STANDARD_RIGHTS_WRITE_ACCESS |
66 SAMR_ACCESS_CREATE_DOMAIN |
67 SAMR_ACCESS_INITIALIZE_SERVER |
68 SAMR_ACCESS_SHUTDOWN_SERVER);
70 const int GENERIC_RIGHTS_SAM_EXECUTE =
71 (STANDARD_RIGHTS_EXECUTE_ACCESS |
72 SAMR_ACCESS_OPEN_DOMAIN |
73 SAMR_ACCESS_CONNECT_TO_SERVER);
75 typedef [bitmap32bit] bitmap {
76 SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
77 SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
78 SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
79 SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
80 SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
81 SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
82 SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
83 SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
84 SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
85 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
86 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
87 } samr_UserAccessMask;
89 typedef [bitmap32bit] bitmap {
90 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
91 SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
92 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
93 SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
94 SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
95 SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
96 SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
97 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
98 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
99 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
100 SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
101 } samr_DomainAccessMask;
103 typedef [bitmap32bit] bitmap {
104 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
105 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
106 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
107 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
108 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
109 } samr_GroupAccessMask;
111 typedef [bitmap32bit] bitmap {
112 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
113 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
114 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
115 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
116 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
117 } samr_AliasAccessMask;
121 NTSTATUS samr_Connect (
122 /* notice the lack of [string] */
123 [in,unique] uint16 *system_name,
124 [in] samr_ConnectAccessMask access_mask,
125 [out,ref] policy_handle *connect_handle
131 [public] NTSTATUS samr_Close (
132 [in,out,ref] policy_handle *handle
138 NTSTATUS samr_SetSecurity (
139 [in,ref] policy_handle *handle,
140 [in] security_secinfo sec_info,
141 [in,ref] sec_desc_buf *sdbuf
147 NTSTATUS samr_QuerySecurity (
148 [in,ref] policy_handle *handle,
149 [in] security_secinfo sec_info,
150 [out,unique] sec_desc_buf *sdbuf
157 shutdown the SAM - once you call this the SAM will be dead
159 NTSTATUS samr_Shutdown (
160 [in,ref] policy_handle *connect_handle
165 NTSTATUS samr_LookupDomain (
166 [in,ref] policy_handle *connect_handle,
167 [in,ref] lsa_String *domain_name,
168 [out,unique] dom_sid2 *sid
182 [size_is(count)] samr_SamEntry *entries;
185 NTSTATUS samr_EnumDomains (
186 [in,ref] policy_handle *connect_handle,
187 [in,out,ref] uint32 *resume_handle,
188 [in] uint32 buf_size,
189 [out,unique] samr_SamArray *sam,
190 [out] uint32 num_entries
194 /************************/
196 [public] NTSTATUS samr_OpenDomain(
197 [in,ref] policy_handle *connect_handle,
198 [in] samr_DomainAccessMask access_mask,
199 [in,ref] dom_sid2 *sid,
200 [out,ref] policy_handle *domain_handle
203 /************************/
206 typedef [v1_enum] enum {
207 SAMR_ROLE_STANDALONE = 0,
208 SAMR_ROLE_DOMAIN_MEMBER = 1,
209 SAMR_ROLE_DOMAIN_BDC = 2,
210 SAMR_ROLE_DOMAIN_PDC = 3
213 /* password properties flags */
214 typedef [public,bitmap32bit] bitmap {
215 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
216 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
217 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
218 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
219 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
220 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
221 } samr_PasswordProperties;
224 uint16 min_password_length;
225 uint16 password_history_length;
226 samr_PasswordProperties password_properties;
227 /* yes, these are signed. They are in negative 100ns */
228 dlong max_password_age;
229 dlong min_password_age;
233 NTTIME force_logoff_time;
234 lsa_String oem_information; /* comment */
235 lsa_String domain_name;
236 lsa_String primary; /* PDC name if this is a BDC */
244 } samr_DomGeneralInformation;
247 NTTIME force_logoff_time;
251 lsa_String oem_information; /* comment */
252 } samr_DomOEMInformation;
255 lsa_String domain_name;
268 NTTIME domain_create_time;
272 uint32 unknown; /* w2k3 returns 1 */
276 samr_DomGeneralInformation general;
277 hyper lockout_duration;
278 hyper lockout_window;
279 uint16 lockout_threshold;
280 } samr_DomGeneralInformation2;
283 hyper lockout_duration;
284 hyper lockout_window;
285 uint16 lockout_threshold;
290 NTTIME domain_create_time;
295 typedef [switch_type(uint16)] union {
296 [case(1)] samr_DomInfo1 info1;
297 [case(2)] samr_DomGeneralInformation general;
298 [case(3)] samr_DomInfo3 info3;
299 [case(4)] samr_DomOEMInformation oem;
300 [case(5)] samr_DomInfo5 info5;
301 [case(6)] samr_DomInfo6 info6;
302 [case(7)] samr_DomInfo7 info7;
303 [case(8)] samr_DomInfo8 info8;
304 [case(9)] samr_DomInfo9 info9;
305 [case(11)] samr_DomGeneralInformation2 general2;
306 [case(12)] samr_DomInfo12 info12;
307 [case(13)] samr_DomInfo13 info13;
310 NTSTATUS samr_QueryDomainInfo(
311 [in,ref] policy_handle *domain_handle,
313 [out,switch_is(level),unique] samr_DomainInfo *info
316 /************************/
319 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
322 NTSTATUS samr_SetDomainInfo(
323 [in,ref] policy_handle *domain_handle,
325 [in,switch_is(level),ref] samr_DomainInfo *info
329 /************************/
331 NTSTATUS samr_CreateDomainGroup(
332 [in,ref] policy_handle *domain_handle,
333 [in,ref] lsa_String *name,
334 [in] samr_GroupAccessMask access_mask,
335 [out,ref] policy_handle *group_handle,
336 [out,ref] uint32 *rid
340 /************************/
342 NTSTATUS samr_EnumDomainGroups(
343 [in,ref] policy_handle *domain_handle,
344 [in,out,ref] uint32 *resume_handle,
345 [in] uint32 max_size,
346 [out,unique] samr_SamArray *sam,
347 [out] uint32 num_entries
350 /************************/
352 NTSTATUS samr_CreateUser(
353 [in,ref] policy_handle *domain_handle,
354 [in,ref] lsa_String *account_name,
355 [in] samr_UserAccessMask access_mask,
356 [out,ref] policy_handle *user_handle,
357 [out,ref] uint32 *rid
360 /************************/
364 /* w2k3 treats max_size as max_users*54 and sets the
365 resume_handle as the rid of the last user sent
367 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
369 NTSTATUS samr_EnumDomainUsers(
370 [in,ref] policy_handle *domain_handle,
371 [in,out,ref] uint32 *resume_handle,
372 [in] samr_AcctFlags acct_flags,
373 [in] uint32 max_size,
374 [out,unique] samr_SamArray *sam,
375 [out] uint32 num_entries
378 /************************/
380 NTSTATUS samr_CreateDomAlias(
381 [in,ref] policy_handle *domain_handle,
382 [in,ref] lsa_String *alias_name,
383 [in] samr_AliasAccessMask access_mask,
384 [out,ref] policy_handle *alias_handle,
385 [out,ref] uint32 *rid
388 /************************/
390 NTSTATUS samr_EnumDomainAliases(
391 [in,ref] policy_handle *domain_handle,
392 [in,out,ref] uint32 *resume_handle,
393 [in] samr_AcctFlags acct_flags,
394 [out,unique] samr_SamArray *sam,
395 [out] uint32 num_entries
398 /************************/
402 [range(0,1024)] uint32 count;
403 [size_is(count)] uint32 *ids;
406 NTSTATUS samr_GetAliasMembership(
407 [in,ref] policy_handle *domain_handle,
408 [in,ref] lsa_SidArray *sids,
409 [out,ref] samr_Ids *rids
412 /************************/
415 [public] NTSTATUS samr_LookupNames(
416 [in,ref] policy_handle *domain_handle,
417 [in,range(0,1000)] uint32 num_names,
418 [in,size_is(1000),length_is(num_names)] lsa_String names[],
424 /************************/
426 NTSTATUS samr_LookupRids(
427 [in,ref] policy_handle *domain_handle,
428 [in,range(0,1000)] uint32 num_rids,
429 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
430 [out] lsa_Strings names,
434 /************************/
436 NTSTATUS samr_OpenGroup(
437 [in,ref] policy_handle *domain_handle,
438 [in] samr_GroupAccessMask access_mask,
440 [out,ref] policy_handle *group_handle
443 /* Group attributes */
444 typedef [public,bitmap32bit] bitmap {
445 SE_GROUP_MANDATORY = 0x00000001,
446 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
447 SE_GROUP_ENABLED = 0x00000004,
448 SE_GROUP_OWNER = 0x00000008,
449 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
450 SE_GROUP_RESOURCE = 0x20000000,
451 SE_GROUP_LOGON_ID = 0xC0000000
454 /************************/
459 samr_GroupAttrs attributes;
461 lsa_String description;
465 samr_GroupAttrs attributes;
466 } samr_GroupInfoAttributes;
469 lsa_String description;
470 } samr_GroupInfoDescription;
475 GROUPINFOATTRIBUTES = 3,
476 GROUPINFODESCRIPTION = 4,
478 } samr_GroupInfoEnum;
480 typedef [switch_type(samr_GroupInfoEnum)] union {
481 [case(GROUPINFOALL)] samr_GroupInfoAll all;
482 [case(GROUPINFONAME)] lsa_String name;
483 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
484 [case(GROUPINFODESCRIPTION)] lsa_String description;
485 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
488 NTSTATUS samr_QueryGroupInfo(
489 [in,ref] policy_handle *group_handle,
490 [in] samr_GroupInfoEnum level,
491 [out,switch_is(level),unique] samr_GroupInfo *info
494 /************************/
496 NTSTATUS samr_SetGroupInfo(
497 [in,ref] policy_handle *group_handle,
498 [in] samr_GroupInfoEnum level,
499 [in,switch_is(level),ref] samr_GroupInfo *info
502 /************************/
504 NTSTATUS samr_AddGroupMember(
505 [in,ref] policy_handle *group_handle,
510 /************************/
512 NTSTATUS samr_DeleteDomainGroup(
513 [in,out,ref] policy_handle *group_handle
516 /************************/
518 NTSTATUS samr_DeleteGroupMember(
519 [in,ref] policy_handle *group_handle,
524 /************************/
528 [size_is(count)] uint32 *rids;
529 [size_is(count)] uint32 *types;
532 NTSTATUS samr_QueryGroupMember(
533 [in,ref] policy_handle *group_handle,
534 [out,unique] samr_RidTypeArray *rids
538 /************************/
542 win2003 seems to accept any data at all for the two integers
543 below, and doesn't seem to do anything with them that I can
544 see. Weird. I really expected the first integer to be a rid
545 and the second to be the attributes for that rid member.
547 NTSTATUS samr_SetMemberAttributesOfGroup(
548 [in,ref] policy_handle *group_handle,
549 [in] uint32 unknown1,
554 /************************/
556 NTSTATUS samr_OpenAlias (
557 [in,ref] policy_handle *domain_handle,
558 [in] samr_AliasAccessMask access_mask,
560 [out,ref] policy_handle *alias_handle
564 /************************/
570 lsa_String description;
576 ALIASINFODESCRIPTION = 3
577 } samr_AliasInfoEnum;
579 typedef [switch_type(samr_AliasInfoEnum)] union {
580 [case(ALIASINFOALL)] samr_AliasInfoAll all;
581 [case(ALIASINFONAME)] lsa_String name;
582 [case(ALIASINFODESCRIPTION)] lsa_String description;
585 NTSTATUS samr_QueryAliasInfo(
586 [in,ref] policy_handle *alias_handle,
587 [in] samr_AliasInfoEnum level,
588 [out,switch_is(level),unique] samr_AliasInfo *info
591 /************************/
593 NTSTATUS samr_SetAliasInfo(
594 [in,ref] policy_handle *alias_handle,
595 [in] samr_AliasInfoEnum level,
596 [in,switch_is(level),ref] samr_AliasInfo *info
599 /************************/
601 NTSTATUS samr_DeleteDomAlias(
602 [in,out,ref] policy_handle *alias_handle
605 /************************/
607 NTSTATUS samr_AddAliasMember(
608 [in,ref] policy_handle *alias_handle,
609 [in,ref] dom_sid2 *sid
612 /************************/
614 NTSTATUS samr_DeleteAliasMember(
615 [in,ref] policy_handle *alias_handle,
616 [in,ref] dom_sid2 *sid
619 /************************/
621 NTSTATUS samr_GetMembersInAlias(
622 [in,ref] policy_handle *alias_handle,
623 [out,ref] lsa_SidArray *sids
626 /************************/
628 [public] NTSTATUS samr_OpenUser(
629 [in,ref] policy_handle *domain_handle,
630 [in] samr_UserAccessMask access_mask,
632 [out,ref] policy_handle *user_handle
635 /************************/
637 NTSTATUS samr_DeleteUser(
638 [in,out,ref] policy_handle *user_handle
641 /************************/
644 lsa_String account_name;
645 lsa_String full_name;
647 lsa_String description;
653 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
658 /* this is also used in samr and netlogon */
659 typedef [public, flag(NDR_PAHEX)] struct {
660 uint16 units_per_week;
661 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
665 lsa_String account_name;
666 lsa_String full_name;
669 lsa_String home_directory;
670 lsa_String home_drive;
671 lsa_String logon_script;
672 lsa_String profile_path;
673 lsa_String workstations;
676 NTTIME last_password_change;
677 NTTIME allow_password_change;
678 NTTIME force_password_change;
679 samr_LogonHours logon_hours;
680 uint16 bad_password_count;
682 samr_AcctFlags acct_flags;
686 samr_LogonHours logon_hours;
690 lsa_String account_name;
691 lsa_String full_name;
694 lsa_String home_directory;
695 lsa_String home_drive;
696 lsa_String logon_script;
697 lsa_String profile_path;
698 lsa_String description;
699 lsa_String workstations;
702 samr_LogonHours logon_hours;
703 uint16 bad_password_count;
705 NTTIME last_password_change;
707 samr_AcctFlags acct_flags;
711 lsa_String account_name;
712 lsa_String full_name;
716 lsa_String account_name;
720 lsa_String full_name;
728 lsa_String home_directory;
729 lsa_String home_drive;
733 lsa_String logon_script;
737 lsa_String profile_path;
741 lsa_String description;
745 lsa_String workstations;
749 samr_AcctFlags acct_flags;
756 typedef [public, flag(NDR_PAHEX)] struct {
761 samr_Password lm_pwd;
762 samr_Password nt_pwd;
763 boolean8 lm_pwd_active;
764 boolean8 nt_pwd_active;
768 lsa_BinaryString parameters;
771 /* this defines the bits used for fields_present in info21 */
772 typedef [bitmap32bit] bitmap {
773 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
774 SAMR_FIELD_FULL_NAME = 0x00000002,
775 SAMR_FIELD_RID = 0x00000004,
776 SAMR_FIELD_PRIMARY_GID = 0x00000008,
777 SAMR_FIELD_DESCRIPTION = 0x00000010,
778 SAMR_FIELD_COMMENT = 0x00000020,
779 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
780 SAMR_FIELD_HOME_DRIVE = 0x00000080,
781 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
782 SAMR_FIELD_PROFILE_PATH = 0x00000200,
783 SAMR_FIELD_WORKSTATIONS = 0x00000400,
784 SAMR_FIELD_LAST_LOGON = 0x00000800,
785 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
786 SAMR_FIELD_LOGON_HOURS = 0x00002000,
787 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
788 SAMR_FIELD_NUM_LOGONS = 0x00008000,
789 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
790 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
791 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
792 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
793 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
794 SAMR_FIELD_PARAMETERS = 0x00200000,
795 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
796 SAMR_FIELD_CODE_PAGE = 0x00800000,
797 SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
798 SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
799 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
800 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
801 SAMR_FIELD_SEC_DESC = 0x10000000,
802 SAMR_FIELD_OWF_PWD = 0x20000000
803 } samr_FieldsPresent;
805 /* used for 'password_expired' in samr_UserInfo21 */
806 const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
807 const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
812 NTTIME last_password_change;
814 NTTIME allow_password_change;
815 NTTIME force_password_change;
816 lsa_String account_name;
817 lsa_String full_name;
818 lsa_String home_directory;
819 lsa_String home_drive;
820 lsa_String logon_script;
821 lsa_String profile_path;
822 lsa_String description;
823 lsa_String workstations;
825 lsa_BinaryString parameters;
830 [size_is(buf_count)] uint8 *buffer;
833 samr_AcctFlags acct_flags;
834 samr_FieldsPresent fields_present;
835 samr_LogonHours logon_hours;
836 uint16 bad_password_count;
840 uint8 nt_password_set;
841 uint8 lm_password_set;
842 uint8 password_expired;
846 typedef [public, flag(NDR_PAHEX)] struct {
848 } samr_CryptPassword;
851 samr_UserInfo21 info;
852 samr_CryptPassword password;
856 samr_CryptPassword password;
860 typedef [flag(NDR_PAHEX)] struct {
862 } samr_CryptPasswordEx;
865 samr_UserInfo21 info;
866 samr_CryptPasswordEx password;
870 samr_CryptPasswordEx password;
874 typedef [switch_type(uint16)] union {
875 [case(1)] samr_UserInfo1 info1;
876 [case(2)] samr_UserInfo2 info2;
877 [case(3)] samr_UserInfo3 info3;
878 [case(4)] samr_UserInfo4 info4;
879 [case(5)] samr_UserInfo5 info5;
880 [case(6)] samr_UserInfo6 info6;
881 [case(7)] samr_UserInfo7 info7;
882 [case(8)] samr_UserInfo8 info8;
883 [case(9)] samr_UserInfo9 info9;
884 [case(10)] samr_UserInfo10 info10;
885 [case(11)] samr_UserInfo11 info11;
886 [case(12)] samr_UserInfo12 info12;
887 [case(13)] samr_UserInfo13 info13;
888 [case(14)] samr_UserInfo14 info14;
889 [case(16)] samr_UserInfo16 info16;
890 [case(17)] samr_UserInfo17 info17;
891 [case(18)] samr_UserInfo18 info18;
892 [case(20)] samr_UserInfo20 info20;
893 [case(21)] samr_UserInfo21 info21;
894 [case(23)] samr_UserInfo23 info23;
895 [case(24)] samr_UserInfo24 info24;
896 [case(25)] samr_UserInfo25 info25;
897 [case(26)] samr_UserInfo26 info26;
900 [public] NTSTATUS samr_QueryUserInfo(
901 [in,ref] policy_handle *user_handle,
903 [out,unique,switch_is(level)] samr_UserInfo *info
907 /************************/
909 [public] NTSTATUS samr_SetUserInfo(
910 [in,ref] policy_handle *user_handle,
912 [in,ref,switch_is(level)] samr_UserInfo *info
915 /************************/
918 this is a password change interface that doesn't give
919 the server the plaintext password. Depricated.
921 NTSTATUS samr_ChangePasswordUser(
922 [in,ref] policy_handle *user_handle,
923 [in] boolean8 lm_present,
924 [in,unique] samr_Password *old_lm_crypted,
925 [in,unique] samr_Password *new_lm_crypted,
926 [in] boolean8 nt_present,
927 [in,unique] samr_Password *old_nt_crypted,
928 [in,unique] samr_Password *new_nt_crypted,
929 [in] boolean8 cross1_present,
930 [in,unique] samr_Password *nt_cross,
931 [in] boolean8 cross2_present,
932 [in,unique] samr_Password *lm_cross
935 /************************/
938 typedef [public] struct {
940 samr_GroupAttrs attributes;
941 } samr_RidWithAttribute;
943 typedef [public] struct {
945 [size_is(count)] samr_RidWithAttribute *rids;
946 } samr_RidWithAttributeArray;
948 NTSTATUS samr_GetGroupsForUser(
949 [in,ref] policy_handle *user_handle,
950 [out,unique] samr_RidWithAttributeArray *rids
953 /************************/
959 samr_AcctFlags acct_flags;
960 lsa_String account_name;
961 lsa_String description;
962 lsa_String full_name;
963 } samr_DispEntryGeneral;
967 [size_is(count)] samr_DispEntryGeneral *entries;
968 } samr_DispInfoGeneral;
973 samr_AcctFlags acct_flags;
974 lsa_String account_name;
975 lsa_String description;
976 } samr_DispEntryFull;
980 [size_is(count)] samr_DispEntryFull *entries;
986 samr_GroupAttrs acct_flags;
987 lsa_String account_name;
988 lsa_String description;
989 } samr_DispEntryFullGroup;
993 [size_is(count)] samr_DispEntryFullGroup *entries;
994 } samr_DispInfoFullGroups;
998 lsa_AsciiStringLarge account_name;
999 } samr_DispEntryAscii;
1003 [size_is(count)] samr_DispEntryAscii *entries;
1004 } samr_DispInfoAscii;
1006 typedef [switch_type(uint16)] union {
1007 [case(1)] samr_DispInfoGeneral info1;/* users */
1008 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1009 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1010 [case(4)] samr_DispInfoAscii info4; /* users */
1011 [case(5)] samr_DispInfoAscii info5; /* groups */
1014 NTSTATUS samr_QueryDisplayInfo(
1015 [in,ref] policy_handle *domain_handle,
1017 [in] uint32 start_idx,
1018 [in] uint32 max_entries,
1019 [in] uint32 buf_size,
1020 [out] uint32 total_size,
1021 [out] uint32 returned_size,
1022 [out,switch_is(level)] samr_DispInfo info
1026 /************************/
1030 this seems to be an alphabetic search function. The returned index
1031 is the index for samr_QueryDisplayInfo needed to get names occurring
1032 after the specified name. The supplied name does not need to exist
1033 in the database (for example you can supply just a first letter for
1034 searching starting at that letter)
1036 The level corresponds to the samr_QueryDisplayInfo level
1038 NTSTATUS samr_GetDisplayEnumerationIndex(
1039 [in,ref] policy_handle *domain_handle,
1041 [in] lsa_String name,
1047 /************************/
1051 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1053 NTSTATUS samr_TestPrivateFunctionsDomain(
1054 [in,ref] policy_handle *domain_handle
1058 /************************/
1062 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1064 NTSTATUS samr_TestPrivateFunctionsUser(
1065 [in,ref] policy_handle *user_handle
1069 /************************/
1073 uint16 min_password_length;
1074 samr_PasswordProperties password_properties;
1077 [public] NTSTATUS samr_GetUserPwInfo(
1078 [in,ref] policy_handle *user_handle,
1079 [out] samr_PwInfo info
1082 /************************/
1084 NTSTATUS samr_RemoveMemberFromForeignDomain(
1085 [in,ref] policy_handle *domain_handle,
1086 [in,ref] dom_sid2 *sid
1089 /************************/
1093 how is this different from QueryDomainInfo ??
1095 NTSTATUS samr_QueryDomainInfo2(
1096 [in,ref] policy_handle *domain_handle,
1098 [out,unique,switch_is(level)] samr_DomainInfo *info
1101 /************************/
1105 how is this different from QueryUserInfo ??
1107 NTSTATUS samr_QueryUserInfo2(
1108 [in,ref] policy_handle *user_handle,
1110 [out,unique,switch_is(level)] samr_UserInfo *info
1113 /************************/
1117 how is this different from QueryDisplayInfo??
1119 NTSTATUS samr_QueryDisplayInfo2(
1120 [in,ref] policy_handle *domain_handle,
1122 [in] uint32 start_idx,
1123 [in] uint32 max_entries,
1124 [in] uint32 buf_size,
1125 [out] uint32 total_size,
1126 [out] uint32 returned_size,
1127 [out,switch_is(level)] samr_DispInfo info
1130 /************************/
1134 how is this different from GetDisplayEnumerationIndex ??
1136 NTSTATUS samr_GetDisplayEnumerationIndex2(
1137 [in,ref] policy_handle *domain_handle,
1139 [in] lsa_String name,
1144 /************************/
1146 NTSTATUS samr_CreateUser2(
1147 [in,ref] policy_handle *domain_handle,
1148 [in,ref] lsa_String *account_name,
1149 [in] samr_AcctFlags acct_flags,
1150 [in] samr_UserAccessMask access_mask,
1151 [out,ref] policy_handle *user_handle,
1152 [out,ref] uint32 *access_granted,
1153 [out,ref] uint32 *rid
1157 /************************/
1161 another duplicate. There must be a reason ....
1163 NTSTATUS samr_QueryDisplayInfo3(
1164 [in,ref] policy_handle *domain_handle,
1166 [in] uint32 start_idx,
1167 [in] uint32 max_entries,
1168 [in] uint32 buf_size,
1169 [out] uint32 total_size,
1170 [out] uint32 returned_size,
1171 [out,switch_is(level)] samr_DispInfo info
1174 /************************/
1176 NTSTATUS samr_AddMultipleMembersToAlias(
1177 [in,ref] policy_handle *alias_handle,
1178 [in,ref] lsa_SidArray *sids
1181 /************************/
1183 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1184 [in,ref] policy_handle *alias_handle,
1185 [in,ref] lsa_SidArray *sids
1188 /************************/
1191 NTSTATUS samr_OemChangePasswordUser2(
1192 [in,unique] lsa_AsciiString *server,
1193 [in,ref] lsa_AsciiString *account,
1194 [in,unique] samr_CryptPassword *password,
1195 [in,unique] samr_Password *hash
1198 /************************/
1200 NTSTATUS samr_ChangePasswordUser2(
1201 [in,unique] lsa_String *server,
1202 [in,ref] lsa_String *account,
1203 [in,unique] samr_CryptPassword *nt_password,
1204 [in,unique] samr_Password *nt_verifier,
1205 [in] boolean8 lm_change,
1206 [in,unique] samr_CryptPassword *lm_password,
1207 [in,unique] samr_Password *lm_verifier
1210 /************************/
1212 NTSTATUS samr_GetDomPwInfo(
1213 [in,unique] lsa_String *domain_name,
1214 [out] samr_PwInfo info
1217 /************************/
1219 NTSTATUS samr_Connect2(
1220 [in,unique,string,charset(UTF16)] uint16 *system_name,
1221 [in] samr_ConnectAccessMask access_mask,
1222 [out,ref] policy_handle *connect_handle
1225 /************************/
1228 seems to be an exact alias for samr_SetUserInfo()
1230 [public] NTSTATUS samr_SetUserInfo2(
1231 [in,ref] policy_handle *user_handle,
1233 [in,ref,switch_is(level)] samr_UserInfo *info
1236 /************************/
1239 this one is mysterious. I have a few guesses, but nothing working yet
1241 NTSTATUS samr_SetBootKeyInformation(
1242 [in,ref] policy_handle *connect_handle,
1243 [in] uint32 unknown1,
1244 [in] uint32 unknown2,
1245 [in] uint32 unknown3
1248 /************************/
1250 NTSTATUS samr_GetBootKeyInformation(
1251 [in,ref] policy_handle *domain_handle,
1252 [out] uint32 unknown
1255 /************************/
1257 NTSTATUS samr_Connect3(
1258 [in,unique,string,charset(UTF16)] uint16 *system_name,
1259 /* this unknown value seems to be completely ignored by w2k3 */
1260 [in] uint32 unknown,
1261 [in] samr_ConnectAccessMask access_mask,
1262 [out,ref] policy_handle *connect_handle
1265 /************************/
1269 SAMR_CONNECT_PRE_W2K = 1,
1270 SAMR_CONNECT_W2K = 2,
1271 SAMR_CONNECT_AFTER_W2K = 3
1272 } samr_ConnectVersion;
1274 NTSTATUS samr_Connect4(
1275 [in,unique,string,charset(UTF16)] uint16 *system_name,
1276 [in] samr_ConnectVersion client_version,
1277 [in] samr_ConnectAccessMask access_mask,
1278 [out,ref] policy_handle *connect_handle
1281 /************************/
1284 typedef enum samr_RejectReason samr_RejectReason;
1287 samr_RejectReason reason;
1290 } samr_ChangeReject;
1292 NTSTATUS samr_ChangePasswordUser3(
1293 [in,unique] lsa_String *server,
1294 [in,ref] lsa_String *account,
1295 [in,unique] samr_CryptPassword *nt_password,
1296 [in,unique] samr_Password *nt_verifier,
1297 [in] boolean8 lm_change,
1298 [in,unique] samr_CryptPassword *lm_password,
1299 [in,unique] samr_Password *lm_verifier,
1300 [in,unique] samr_CryptPassword *password3,
1301 [out,unique] samr_DomInfo1 *dominfo,
1302 [out,unique] samr_ChangeReject *reject
1305 /************************/
1309 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1310 uint32 unknown2; /* w2k3 gives 0 */
1311 } samr_ConnectInfo1;
1314 [case(1)] samr_ConnectInfo1 info1;
1317 [public] NTSTATUS samr_Connect5(
1318 [in,unique,string,charset(UTF16)] uint16 *system_name,
1319 [in] samr_ConnectAccessMask access_mask,
1320 [in,out] uint32 level,
1321 [in,out,switch_is(level),ref] samr_ConnectInfo *info,
1322 [out,ref] policy_handle *connect_handle
1325 /************************/
1327 NTSTATUS samr_RidToSid(
1328 [in,ref] policy_handle *domain_handle,
1330 [out,unique] dom_sid2 *sid
1334 /************************/
1338 this should set the DSRM password for the server, which is used
1339 when booting into Directory Services Recovery Mode on a DC. Win2003
1340 gives me NT_STATUS_NOT_SUPPORTED
1343 NTSTATUS samr_SetDsrmPassword(
1344 [in,unique] lsa_String *name,
1345 [in] uint32 unknown,
1346 [in,unique] samr_Password *hash
1350 /************************/
1352 /************************/
1353 typedef [bitmap32bit] bitmap {
1354 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1355 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1356 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1357 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1358 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1359 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1360 } samr_ValidateFieldsPresent;
1363 NetValidateAuthentication = 1,
1364 NetValidatePasswordChange= 2,
1365 NetValidatePasswordReset = 3
1366 } samr_ValidatePasswordLevel;
1368 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1369 * identified the mapping of
1370 * - NERR_PasswordFilterError
1371 * - NERR_PasswordExpired and
1372 * - NERR_PasswordCantChange
1377 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1378 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1379 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1380 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1381 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1382 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1383 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1384 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1385 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1386 } samr_ValidationStatus;
1390 [size_is(length)] uint8 *data;
1391 } samr_ValidationBlob;
1394 samr_ValidateFieldsPresent fields_present;
1395 NTTIME_hyper last_password_change;
1396 NTTIME_hyper bad_password_time;
1397 NTTIME_hyper lockout_time;
1398 uint32 bad_pwd_count;
1399 uint32 pwd_history_len;
1400 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1401 } samr_ValidatePasswordInfo;
1404 samr_ValidatePasswordInfo info;
1405 samr_ValidationStatus status;
1406 } samr_ValidatePasswordRepCtr;
1408 typedef [switch_type(uint16)] union {
1409 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1410 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1411 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1412 } samr_ValidatePasswordRep;
1415 samr_ValidatePasswordInfo info;
1416 lsa_StringLarge password;
1417 lsa_StringLarge account;
1418 samr_ValidationBlob hash;
1419 boolean8 pwd_must_change_at_next_logon;
1420 boolean8 clear_lockout;
1421 } samr_ValidatePasswordReq3;
1424 samr_ValidatePasswordInfo info;
1425 lsa_StringLarge password;
1426 lsa_StringLarge account;
1427 samr_ValidationBlob hash;
1428 boolean8 password_matched;
1429 } samr_ValidatePasswordReq2;
1432 samr_ValidatePasswordInfo info;
1433 boolean8 password_matched;
1434 } samr_ValidatePasswordReq1;
1436 typedef [switch_type(uint16)] union {
1437 [case(1)] samr_ValidatePasswordReq1 req1;
1438 [case(2)] samr_ValidatePasswordReq2 req2;
1439 [case(3)] samr_ValidatePasswordReq3 req3;
1440 } samr_ValidatePasswordReq;
1442 NTSTATUS samr_ValidatePassword(
1443 [in] samr_ValidatePasswordLevel level,
1444 [in,switch_is(level)] samr_ValidatePasswordReq req,
1445 [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep