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 typedef [bitmap32bit] bitmap {
44 SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
45 SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
46 SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
47 SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
48 SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
49 SAMR_ACCESS_OPEN_DOMAIN = 0x00000020
50 } samr_ConnectAccessMask;
52 typedef [bitmap32bit] bitmap {
53 SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
54 SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
55 SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
56 SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
57 SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
58 SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
59 SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
60 SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
61 SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
62 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
63 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
64 } samr_UserAccessMask;
66 typedef [bitmap32bit] bitmap {
67 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
68 SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
69 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
70 SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
71 SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
72 SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
73 SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
74 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
75 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
76 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
77 SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
78 } samr_DomainAccessMask;
80 typedef [bitmap32bit] bitmap {
81 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
82 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
83 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
84 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
85 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
86 } samr_GroupAccessMask;
88 typedef [bitmap32bit] bitmap {
89 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
90 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
91 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
92 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
93 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
94 } samr_AliasAccessMask;
98 NTSTATUS samr_Connect (
99 /* notice the lack of [string] */
100 [in,unique] uint16 *system_name,
101 [in] samr_ConnectAccessMask access_mask,
102 [out,ref] policy_handle *connect_handle
108 [public] NTSTATUS samr_Close (
109 [in,out,ref] policy_handle *handle
115 NTSTATUS samr_SetSecurity (
116 [in,ref] policy_handle *handle,
117 [in] security_secinfo sec_info,
118 [in,ref] sec_desc_buf *sdbuf
124 NTSTATUS samr_QuerySecurity (
125 [in,ref] policy_handle *handle,
126 [in] security_secinfo sec_info,
127 [out,ref] sec_desc_buf **sdbuf
134 shutdown the SAM - once you call this the SAM will be dead
136 NTSTATUS samr_Shutdown (
137 [in,ref] policy_handle *connect_handle
142 NTSTATUS samr_LookupDomain (
143 [in,ref] policy_handle *connect_handle,
144 [in,ref] lsa_String *domain_name,
145 [out,ref] dom_sid2 **sid
159 [size_is(count)] samr_SamEntry *entries;
162 NTSTATUS samr_EnumDomains (
163 [in] policy_handle *connect_handle,
164 [in,out,ref] uint32 *resume_handle,
165 [out,ref] samr_SamArray **sam,
166 [in] uint32 buf_size,
167 [out,ref] uint32 *num_entries
171 /************************/
173 [public] NTSTATUS samr_OpenDomain(
174 [in,ref] policy_handle *connect_handle,
175 [in] samr_DomainAccessMask access_mask,
176 [in,ref] dom_sid2 *sid,
177 [out,ref] policy_handle *domain_handle
180 /************************/
183 typedef [v1_enum] enum {
184 SAMR_ROLE_STANDALONE = 0,
185 SAMR_ROLE_DOMAIN_MEMBER = 1,
186 SAMR_ROLE_DOMAIN_BDC = 2,
187 SAMR_ROLE_DOMAIN_PDC = 3
190 /* password properties flags */
191 typedef [public,bitmap32bit] bitmap {
192 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
193 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
194 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
195 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
196 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
197 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
198 } samr_PasswordProperties;
201 uint16 min_password_length;
202 uint16 password_history_length;
203 samr_PasswordProperties password_properties;
204 /* yes, these are signed. They are in negative 100ns */
205 dlong max_password_age;
206 dlong min_password_age;
210 NTTIME force_logoff_time;
212 lsa_String domain_name;
213 lsa_String primary; /* PDC name if this is a BDC */
224 NTTIME force_logoff_time;
232 lsa_String domain_name;
245 NTTIME domain_create_time;
249 uint32 unknown; /* w2k3 returns 1 */
254 hyper lockout_duration;
255 hyper lockout_window;
256 uint16 lockout_threshold;
260 hyper lockout_duration;
261 hyper lockout_window;
262 uint16 lockout_threshold;
267 NTTIME domain_create_time;
272 typedef [switch_type(uint16)] union {
273 [case(1)] samr_DomInfo1 info1;
274 [case(2)] samr_DomInfo2 info2;
275 [case(3)] samr_DomInfo3 info3;
276 [case(4)] samr_DomInfo4 info4;
277 [case(5)] samr_DomInfo5 info5;
278 [case(6)] samr_DomInfo6 info6;
279 [case(7)] samr_DomInfo7 info7;
280 [case(8)] samr_DomInfo8 info8;
281 [case(9)] samr_DomInfo9 info9;
282 [case(11)] samr_DomInfo11 info11;
283 [case(12)] samr_DomInfo12 info12;
284 [case(13)] samr_DomInfo13 info13;
287 NTSTATUS samr_QueryDomainInfo(
288 [in,ref] policy_handle *domain_handle,
290 [out,ref,switch_is(level)] samr_DomainInfo **info
293 /************************/
296 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
299 NTSTATUS samr_SetDomainInfo(
300 [in,ref] policy_handle *domain_handle,
302 [in,switch_is(level),ref] samr_DomainInfo *info
306 /************************/
308 NTSTATUS samr_CreateDomainGroup(
309 [in,ref] policy_handle *domain_handle,
310 [in,ref] lsa_String *name,
311 [in] samr_GroupAccessMask access_mask,
312 [out,ref] policy_handle *group_handle,
313 [out,ref] uint32 *rid
317 /************************/
319 NTSTATUS samr_EnumDomainGroups(
320 [in] policy_handle *domain_handle,
321 [in,out,ref] uint32 *resume_handle,
322 [out,ref] samr_SamArray **sam,
323 [in] uint32 max_size,
324 [out,ref] uint32 *num_entries
327 /************************/
329 NTSTATUS samr_CreateUser(
330 [in,ref] policy_handle *domain_handle,
331 [in,ref] lsa_String *account_name,
332 [in] samr_UserAccessMask access_mask,
333 [out,ref] policy_handle *user_handle,
334 [out,ref] uint32 *rid
337 /************************/
341 /* w2k3 treats max_size as max_users*54 and sets the
342 resume_handle as the rid of the last user sent
344 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
346 NTSTATUS samr_EnumDomainUsers(
347 [in] policy_handle *domain_handle,
348 [in,out,ref] uint32 *resume_handle,
349 [in] samr_AcctFlags acct_flags,
350 [out,ref] samr_SamArray **sam,
351 [in] uint32 max_size,
352 [out,ref] uint32 *num_entries
355 /************************/
357 NTSTATUS samr_CreateDomAlias(
358 [in,ref] policy_handle *domain_handle,
359 [in,ref] lsa_String *alias_name,
360 [in] samr_AliasAccessMask access_mask,
361 [out,ref] policy_handle *alias_handle,
362 [out,ref] uint32 *rid
365 /************************/
367 NTSTATUS samr_EnumDomainAliases(
368 [in] policy_handle *domain_handle,
369 [in,out,ref] uint32 *resume_handle,
370 [out,ref] samr_SamArray **sam,
371 [in] uint32 max_size,
372 [out,ref] uint32 *num_entries
375 /************************/
379 [range(0,1024)] uint32 count;
380 [size_is(count)] uint32 *ids;
383 NTSTATUS samr_GetAliasMembership(
384 [in,ref] policy_handle *domain_handle,
385 [in,ref] lsa_SidArray *sids,
386 [out,ref] samr_Ids *rids
389 /************************/
392 [public] NTSTATUS samr_LookupNames(
393 [in,ref] policy_handle *domain_handle,
394 [in,range(0,1000)] uint32 num_names,
395 [in,size_is(1000),length_is(num_names)] lsa_String names[],
396 [out,ref] samr_Ids *rids,
397 [out,ref] samr_Ids *types
401 /************************/
403 NTSTATUS samr_LookupRids(
404 [in,ref] policy_handle *domain_handle,
405 [in,range(0,1000)] uint32 num_rids,
406 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
407 [out,ref] lsa_Strings *names,
408 [out,ref] samr_Ids *types
411 /************************/
413 NTSTATUS samr_OpenGroup(
414 [in,ref] policy_handle *domain_handle,
415 [in] samr_GroupAccessMask access_mask,
417 [out,ref] policy_handle *group_handle
420 /* Group attributes */
421 typedef [public,bitmap32bit] bitmap {
422 SE_GROUP_MANDATORY = 0x00000001,
423 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
424 SE_GROUP_ENABLED = 0x00000004,
425 SE_GROUP_OWNER = 0x00000008,
426 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
427 SE_GROUP_RESOURCE = 0x20000000,
428 SE_GROUP_LOGON_ID = 0xC0000000
431 /************************/
436 samr_GroupAttrs attributes;
438 lsa_String description;
442 samr_GroupAttrs attributes;
443 } samr_GroupInfoAttributes;
446 lsa_String description;
447 } samr_GroupInfoDescription;
452 GROUPINFOATTRIBUTES = 3,
453 GROUPINFODESCRIPTION = 4,
455 } samr_GroupInfoEnum;
457 typedef [switch_type(samr_GroupInfoEnum)] union {
458 [case(GROUPINFOALL)] samr_GroupInfoAll all;
459 [case(GROUPINFONAME)] lsa_String name;
460 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
461 [case(GROUPINFODESCRIPTION)] lsa_String description;
462 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
465 NTSTATUS samr_QueryGroupInfo(
466 [in,ref] policy_handle *group_handle,
467 [in] samr_GroupInfoEnum level,
468 [out,ref,switch_is(level)] samr_GroupInfo **info
471 /************************/
473 NTSTATUS samr_SetGroupInfo(
474 [in,ref] policy_handle *group_handle,
475 [in] samr_GroupInfoEnum level,
476 [in,switch_is(level),ref] samr_GroupInfo *info
479 /************************/
481 NTSTATUS samr_AddGroupMember(
482 [in,ref] policy_handle *group_handle,
487 /************************/
489 NTSTATUS samr_DeleteDomainGroup(
490 [in,out,ref] policy_handle *group_handle
493 /************************/
495 NTSTATUS samr_DeleteGroupMember(
496 [in,ref] policy_handle *group_handle,
501 /************************/
505 [size_is(count)] uint32 *rids;
506 [size_is(count)] uint32 *types;
509 NTSTATUS samr_QueryGroupMember(
510 [in,ref] policy_handle *group_handle,
511 [out,ref] samr_RidTypeArray **rids
515 /************************/
519 win2003 seems to accept any data at all for the two integers
520 below, and doesn't seem to do anything with them that I can
521 see. Weird. I really expected the first integer to be a rid
522 and the second to be the attributes for that rid member.
524 NTSTATUS samr_SetMemberAttributesOfGroup(
525 [in,ref] policy_handle *group_handle,
526 [in] uint32 unknown1,
531 /************************/
533 NTSTATUS samr_OpenAlias (
534 [in,ref] policy_handle *domain_handle,
535 [in] samr_AliasAccessMask access_mask,
537 [out,ref] policy_handle *alias_handle
541 /************************/
547 lsa_String description;
553 ALIASINFODESCRIPTION = 3
554 } samr_AliasInfoEnum;
556 typedef [switch_type(samr_AliasInfoEnum)] union {
557 [case(ALIASINFOALL)] samr_AliasInfoAll all;
558 [case(ALIASINFONAME)] lsa_String name;
559 [case(ALIASINFODESCRIPTION)] lsa_String description;
562 NTSTATUS samr_QueryAliasInfo(
563 [in,ref] policy_handle *alias_handle,
564 [in] samr_AliasInfoEnum level,
565 [out,ref,switch_is(level)] samr_AliasInfo **info
568 /************************/
570 NTSTATUS samr_SetAliasInfo(
571 [in,ref] policy_handle *alias_handle,
572 [in] samr_AliasInfoEnum level,
573 [in,switch_is(level),ref] samr_AliasInfo *info
576 /************************/
578 NTSTATUS samr_DeleteDomAlias(
579 [in,out,ref] policy_handle *alias_handle
582 /************************/
584 NTSTATUS samr_AddAliasMember(
585 [in,ref] policy_handle *alias_handle,
586 [in,ref] dom_sid2 *sid
589 /************************/
591 NTSTATUS samr_DeleteAliasMember(
592 [in,ref] policy_handle *alias_handle,
593 [in,ref] dom_sid2 *sid
596 /************************/
598 NTSTATUS samr_GetMembersInAlias(
599 [in,ref] policy_handle *alias_handle,
600 [out,ref] lsa_SidArray *sids
603 /************************/
605 [public] NTSTATUS samr_OpenUser(
606 [in,ref] policy_handle *domain_handle,
607 [in] samr_UserAccessMask access_mask,
609 [out,ref] policy_handle *user_handle
612 /************************/
614 NTSTATUS samr_DeleteUser(
615 [in,out,ref] policy_handle *user_handle
618 /************************/
621 lsa_String account_name;
622 lsa_String full_name;
624 lsa_String description;
630 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
635 /* this is also used in samr and netlogon */
636 typedef [public, flag(NDR_PAHEX)] struct {
637 uint16 units_per_week;
638 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
642 lsa_String account_name;
643 lsa_String full_name;
646 lsa_String home_directory;
647 lsa_String home_drive;
648 lsa_String logon_script;
649 lsa_String profile_path;
650 lsa_String workstations;
653 NTTIME last_password_change;
654 NTTIME allow_password_change;
655 NTTIME force_password_change;
656 samr_LogonHours logon_hours;
657 uint16 bad_password_count;
659 samr_AcctFlags acct_flags;
663 samr_LogonHours logon_hours;
667 lsa_String account_name;
668 lsa_String full_name;
671 lsa_String home_directory;
672 lsa_String home_drive;
673 lsa_String logon_script;
674 lsa_String profile_path;
675 lsa_String description;
676 lsa_String workstations;
679 samr_LogonHours logon_hours;
680 uint16 bad_password_count;
682 NTTIME last_password_change;
684 samr_AcctFlags acct_flags;
688 lsa_String account_name;
689 lsa_String full_name;
693 lsa_String account_name;
697 lsa_String full_name;
705 lsa_String home_directory;
706 lsa_String home_drive;
710 lsa_String logon_script;
714 lsa_String profile_path;
718 lsa_String description;
722 lsa_String workstations;
726 samr_AcctFlags acct_flags;
733 typedef [public, flag(NDR_PAHEX)] struct {
738 samr_Password lm_pwd;
739 samr_Password nt_pwd;
740 boolean8 lm_pwd_active;
741 boolean8 nt_pwd_active;
745 lsa_String parameters;
748 /* this defines the bits used for fields_present in info21 */
749 typedef [bitmap32bit] bitmap {
750 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
751 SAMR_FIELD_FULL_NAME = 0x00000002,
752 SAMR_FIELD_RID = 0x00000004,
753 SAMR_FIELD_PRIMARY_GID = 0x00000008,
754 SAMR_FIELD_DESCRIPTION = 0x00000010,
755 SAMR_FIELD_COMMENT = 0x00000020,
756 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
757 SAMR_FIELD_HOME_DRIVE = 0x00000080,
758 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
759 SAMR_FIELD_PROFILE_PATH = 0x00000200,
760 SAMR_FIELD_WORKSTATIONS = 0x00000400,
761 SAMR_FIELD_LAST_LOGON = 0x00000800,
762 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
763 SAMR_FIELD_LOGON_HOURS = 0x00002000,
764 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
765 SAMR_FIELD_NUM_LOGONS = 0x00008000,
766 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
767 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
768 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
769 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
770 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
771 SAMR_FIELD_PARAMETERS = 0x00200000,
772 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
773 SAMR_FIELD_CODE_PAGE = 0x00800000,
774 SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
775 SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
776 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
777 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
778 SAMR_FIELD_SEC_DESC = 0x10000000,
779 SAMR_FIELD_OWF_PWD = 0x20000000
780 } samr_FieldsPresent;
785 NTTIME last_password_change;
787 NTTIME allow_password_change;
788 NTTIME force_password_change;
789 lsa_String account_name;
790 lsa_String full_name;
791 lsa_String home_directory;
792 lsa_String home_drive;
793 lsa_String logon_script;
794 lsa_String profile_path;
795 lsa_String description;
796 lsa_String workstations;
798 lsa_String parameters;
803 [size_is(buf_count)] uint8 *buffer;
806 samr_AcctFlags acct_flags;
807 samr_FieldsPresent fields_present;
808 samr_LogonHours logon_hours;
809 uint16 bad_password_count;
813 uint8 nt_password_set;
814 uint8 lm_password_set;
815 uint8 password_expired;
819 typedef [public, flag(NDR_PAHEX)] struct {
821 } samr_CryptPassword;
824 samr_UserInfo21 info;
825 samr_CryptPassword password;
829 samr_CryptPassword password;
833 typedef [flag(NDR_PAHEX)] struct {
835 } samr_CryptPasswordEx;
838 samr_UserInfo21 info;
839 samr_CryptPasswordEx password;
843 samr_CryptPasswordEx password;
847 typedef [switch_type(uint16)] union {
848 [case(1)] samr_UserInfo1 info1;
849 [case(2)] samr_UserInfo2 info2;
850 [case(3)] samr_UserInfo3 info3;
851 [case(4)] samr_UserInfo4 info4;
852 [case(5)] samr_UserInfo5 info5;
853 [case(6)] samr_UserInfo6 info6;
854 [case(7)] samr_UserInfo7 info7;
855 [case(8)] samr_UserInfo8 info8;
856 [case(9)] samr_UserInfo9 info9;
857 [case(10)] samr_UserInfo10 info10;
858 [case(11)] samr_UserInfo11 info11;
859 [case(12)] samr_UserInfo12 info12;
860 [case(13)] samr_UserInfo13 info13;
861 [case(14)] samr_UserInfo14 info14;
862 [case(16)] samr_UserInfo16 info16;
863 [case(17)] samr_UserInfo17 info17;
864 [case(18)] samr_UserInfo18 info18;
865 [case(20)] samr_UserInfo20 info20;
866 [case(21)] samr_UserInfo21 info21;
867 [case(23)] samr_UserInfo23 info23;
868 [case(24)] samr_UserInfo24 info24;
869 [case(25)] samr_UserInfo25 info25;
870 [case(26)] samr_UserInfo26 info26;
873 [public] NTSTATUS samr_QueryUserInfo(
874 [in,ref] policy_handle *user_handle,
876 [out,ref,switch_is(level)] samr_UserInfo *info
880 /************************/
882 [public] NTSTATUS samr_SetUserInfo(
883 [in,ref] policy_handle *user_handle,
885 [in,ref,switch_is(level)] samr_UserInfo *info
888 /************************/
891 this is a password change interface that doesn't give
892 the server the plaintext password. Depricated.
894 NTSTATUS samr_ChangePasswordUser(
895 [in,ref] policy_handle *user_handle,
896 [in] boolean8 lm_present,
897 [in,unique] samr_Password *old_lm_crypted,
898 [in,unique] samr_Password *new_lm_crypted,
899 [in] boolean8 nt_present,
900 [in,unique] samr_Password *old_nt_crypted,
901 [in,unique] samr_Password *new_nt_crypted,
902 [in] boolean8 cross1_present,
903 [in,unique] samr_Password *nt_cross,
904 [in] boolean8 cross2_present,
905 [in,unique] samr_Password *lm_cross
908 /************************/
911 typedef [public] struct {
913 samr_GroupAttrs attributes;
914 } samr_RidWithAttribute;
916 typedef [public] struct {
918 [size_is(count)] samr_RidWithAttribute *rids;
919 } samr_RidWithAttributeArray;
921 NTSTATUS samr_GetGroupsForUser(
922 [in,ref] policy_handle *user_handle,
923 [out,ref] samr_RidWithAttributeArray **rids
926 /************************/
932 samr_AcctFlags acct_flags;
933 lsa_String account_name;
934 lsa_String description;
935 lsa_String full_name;
936 } samr_DispEntryGeneral;
940 [size_is(count)] samr_DispEntryGeneral *entries;
941 } samr_DispInfoGeneral;
946 samr_AcctFlags acct_flags;
947 lsa_String account_name;
948 lsa_String description;
949 } samr_DispEntryFull;
953 [size_is(count)] samr_DispEntryFull *entries;
959 samr_GroupAttrs acct_flags;
960 lsa_String account_name;
961 lsa_String description;
962 } samr_DispEntryFullGroup;
966 [size_is(count)] samr_DispEntryFullGroup *entries;
967 } samr_DispInfoFullGroups;
971 lsa_AsciiString account_name;
972 } samr_DispEntryAscii;
976 [size_is(count)] samr_DispEntryAscii *entries;
977 } samr_DispInfoAscii;
979 typedef [switch_type(uint16)] union {
980 [case(1)] samr_DispInfoGeneral info1;/* users */
981 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
982 [case(3)] samr_DispInfoFullGroups info3; /* groups */
983 [case(4)] samr_DispInfoAscii info4; /* users */
984 [case(5)] samr_DispInfoAscii info5; /* groups */
987 NTSTATUS samr_QueryDisplayInfo(
988 [in,ref] policy_handle *domain_handle,
990 [in] uint32 start_idx,
991 [in] uint32 max_entries,
992 [in] uint32 buf_size,
993 [out,ref] uint32 *total_size,
994 [out,ref] uint32 *returned_size,
995 [out,ref,switch_is(level)] samr_DispInfo *info
999 /************************/
1003 this seems to be an alphabetic search function. The returned index
1004 is the index for samr_QueryDisplayInfo needed to get names occurring
1005 after the specified name. The supplied name does not need to exist
1006 in the database (for example you can supply just a first letter for
1007 searching starting at that letter)
1009 The level corresponds to the samr_QueryDisplayInfo level
1011 NTSTATUS samr_GetDisplayEnumerationIndex(
1012 [in,ref] policy_handle *domain_handle,
1014 [in] lsa_String name,
1015 [out,ref] uint32 *idx
1020 /************************/
1024 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1026 NTSTATUS samr_TestPrivateFunctionsDomain(
1027 [in,ref] policy_handle *domain_handle
1031 /************************/
1035 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1037 NTSTATUS samr_TestPrivateFunctionsUser(
1038 [in,ref] policy_handle *user_handle
1042 /************************/
1046 uint16 min_password_length;
1047 samr_PasswordProperties password_properties;
1050 [public] NTSTATUS samr_GetUserPwInfo(
1051 [in,ref] policy_handle *user_handle,
1052 [out,ref] samr_PwInfo *info
1055 /************************/
1057 NTSTATUS samr_RemoveMemberFromForeignDomain(
1058 [in,ref] policy_handle *domain_handle,
1059 [in,ref] dom_sid2 *sid
1062 /************************/
1066 how is this different from QueryDomainInfo ??
1068 NTSTATUS samr_QueryDomainInfo2(
1069 [in,ref] policy_handle *domain_handle,
1071 [out,ref,switch_is(level)] samr_DomainInfo **info
1074 /************************/
1078 how is this different from QueryUserInfo ??
1080 NTSTATUS samr_QueryUserInfo2(
1081 [in,ref] policy_handle *user_handle,
1083 [out,ref,switch_is(level)] samr_UserInfo *info
1086 /************************/
1090 how is this different from QueryDisplayInfo??
1092 NTSTATUS samr_QueryDisplayInfo2(
1093 [in,ref] policy_handle *domain_handle,
1095 [in] uint32 start_idx,
1096 [in] uint32 max_entries,
1097 [in] uint32 buf_size,
1098 [out,ref] uint32 *total_size,
1099 [out,ref] uint32 *returned_size,
1100 [out,ref,switch_is(level)] samr_DispInfo *info
1103 /************************/
1107 how is this different from GetDisplayEnumerationIndex ??
1109 NTSTATUS samr_GetDisplayEnumerationIndex2(
1110 [in,ref] policy_handle *domain_handle,
1112 [in] lsa_String name,
1113 [out,ref] uint32 *idx
1117 /************************/
1119 NTSTATUS samr_CreateUser2(
1120 [in,ref] policy_handle *domain_handle,
1121 [in,ref] lsa_String *account_name,
1122 [in] samr_AcctFlags acct_flags,
1123 [in] samr_UserAccessMask access_mask,
1124 [out,ref] policy_handle *user_handle,
1125 [out,ref] uint32 *access_granted,
1126 [out,ref] uint32 *rid
1130 /************************/
1134 another duplicate. There must be a reason ....
1136 NTSTATUS samr_QueryDisplayInfo3(
1137 [in,ref] policy_handle *domain_handle,
1139 [in] uint32 start_idx,
1140 [in] uint32 max_entries,
1141 [in] uint32 buf_size,
1142 [out,ref] uint32 *total_size,
1143 [out,ref] uint32 *returned_size,
1144 [out,ref,switch_is(level)] samr_DispInfo *info
1147 /************************/
1149 NTSTATUS samr_AddMultipleMembersToAlias(
1150 [in,ref] policy_handle *alias_handle,
1151 [in,ref] lsa_SidArray *sids
1154 /************************/
1156 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1157 [in,ref] policy_handle *alias_handle,
1158 [in,ref] lsa_SidArray *sids
1161 /************************/
1164 NTSTATUS samr_OemChangePasswordUser2(
1165 [in,unique] lsa_AsciiString *server,
1166 [in,ref] lsa_AsciiString *account,
1167 [in,unique] samr_CryptPassword *password,
1168 [in,unique] samr_Password *hash
1171 /************************/
1173 NTSTATUS samr_ChangePasswordUser2(
1174 [in,unique] lsa_String *server,
1175 [in,ref] lsa_String *account,
1176 [in,unique] samr_CryptPassword *nt_password,
1177 [in,unique] samr_Password *nt_verifier,
1178 [in] boolean8 lm_change,
1179 [in,unique] samr_CryptPassword *lm_password,
1180 [in,unique] samr_Password *lm_verifier
1183 /************************/
1185 NTSTATUS samr_GetDomPwInfo(
1186 [in,unique] lsa_String *domain_name,
1187 [out,ref] samr_PwInfo *info
1190 /************************/
1192 NTSTATUS samr_Connect2(
1193 [in,unique,string,charset(UTF16)] uint16 *system_name,
1194 [in] samr_ConnectAccessMask access_mask,
1195 [out,ref] policy_handle *connect_handle
1198 /************************/
1201 seems to be an exact alias for samr_SetUserInfo()
1203 [public] NTSTATUS samr_SetUserInfo2(
1204 [in,ref] policy_handle *user_handle,
1206 [in,ref,switch_is(level)] samr_UserInfo *info
1209 /************************/
1212 this one is mysterious. I have a few guesses, but nothing working yet
1214 NTSTATUS samr_SetBootKeyInformation(
1215 [in,ref] policy_handle *connect_handle,
1216 [in] uint32 unknown1,
1217 [in] uint32 unknown2,
1218 [in] uint32 unknown3
1221 /************************/
1223 NTSTATUS samr_GetBootKeyInformation(
1224 [in,ref] policy_handle *domain_handle,
1225 [out,ref] uint32 *unknown
1228 /************************/
1230 NTSTATUS samr_Connect3(
1231 [in,unique,string,charset(UTF16)] uint16 *system_name,
1232 /* this unknown value seems to be completely ignored by w2k3 */
1233 [in] uint32 unknown,
1234 [in] samr_ConnectAccessMask access_mask,
1235 [out,ref] policy_handle *connect_handle
1238 /************************/
1242 SAMR_CONNECT_PRE_W2K = 1,
1243 SAMR_CONNECT_W2K = 2,
1244 SAMR_CONNECT_AFTER_W2K = 3
1245 } samr_ConnectVersion;
1247 NTSTATUS samr_Connect4(
1248 [in,unique,string,charset(UTF16)] uint16 *system_name,
1249 [in] samr_ConnectVersion client_version,
1250 [in] samr_ConnectAccessMask access_mask,
1251 [out,ref] policy_handle *connect_handle
1254 /************************/
1257 typedef enum samr_RejectReason samr_RejectReason;
1260 samr_RejectReason reason;
1263 } samr_ChangeReject;
1265 NTSTATUS samr_ChangePasswordUser3(
1266 [in,unique] lsa_String *server,
1267 [in,ref] lsa_String *account,
1268 [in,unique] samr_CryptPassword *nt_password,
1269 [in,unique] samr_Password *nt_verifier,
1270 [in] boolean8 lm_change,
1271 [in,unique] samr_CryptPassword *lm_password,
1272 [in,unique] samr_Password *lm_verifier,
1273 [in,unique] samr_CryptPassword *password3,
1274 [out,ref] samr_DomInfo1 **dominfo,
1275 [out,ref] samr_ChangeReject **reject
1278 /************************/
1282 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1283 uint32 unknown2; /* w2k3 gives 0 */
1284 } samr_ConnectInfo1;
1287 [case(1)] samr_ConnectInfo1 info1;
1290 [public] NTSTATUS samr_Connect5(
1291 [in,unique,string,charset(UTF16)] uint16 *system_name,
1292 [in] samr_ConnectAccessMask access_mask,
1293 [in] uint32 level_in,
1294 [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
1295 [out,ref] uint32 *level_out,
1296 [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
1297 [out,ref] policy_handle *connect_handle
1300 /************************/
1302 NTSTATUS samr_RidToSid(
1303 [in,ref] policy_handle *domain_handle,
1305 [out,ref] dom_sid2 *sid
1309 /************************/
1313 this should set the DSRM password for the server, which is used
1314 when booting into Directory Services Recovery Mode on a DC. Win2003
1315 gives me NT_STATUS_NOT_SUPPORTED
1318 NTSTATUS samr_SetDsrmPassword(
1319 [in,unique] lsa_String *name,
1320 [in] uint32 unknown,
1321 [in,unique] samr_Password *hash
1325 /************************/
1327 /************************/
1328 typedef [bitmap32bit] bitmap {
1329 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1330 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1331 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1332 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1333 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1334 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1335 } samr_ValidateFieldsPresent;
1338 NetValidateAuthentication = 1,
1339 NetValidatePasswordChange= 2,
1340 NetValidatePasswordReset = 3
1341 } samr_ValidatePasswordLevel;
1343 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1344 * identified the mapping of
1345 * - NERR_PasswordFilterError
1346 * - NERR_PasswordExpired and
1347 * - NERR_PasswordCantChange
1352 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1353 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1354 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1355 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1356 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1357 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1358 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1359 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1360 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1361 } samr_ValidationStatus;
1365 [size_is(length)] uint8 *data;
1366 } samr_ValidationBlob;
1369 samr_ValidateFieldsPresent fields_present;
1370 NTTIME_hyper last_password_change;
1371 NTTIME_hyper bad_password_time;
1372 NTTIME_hyper lockout_time;
1373 uint32 bad_pwd_count;
1374 uint32 pwd_history_len;
1375 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1376 } samr_ValidatePasswordInfo;
1379 samr_ValidatePasswordInfo info;
1380 samr_ValidationStatus status;
1381 } samr_ValidatePasswordRepCtr;
1383 typedef [switch_type(uint16)] union {
1384 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1385 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1386 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1387 } samr_ValidatePasswordRep;
1390 samr_ValidatePasswordInfo info;
1391 lsa_StringLarge password;
1392 lsa_StringLarge account;
1393 samr_ValidationBlob hash;
1394 boolean8 pwd_must_change_at_next_logon;
1395 boolean8 clear_lockout;
1396 } samr_ValidatePasswordReq3;
1399 samr_ValidatePasswordInfo info;
1400 lsa_StringLarge password;
1401 lsa_StringLarge account;
1402 samr_ValidationBlob hash;
1403 boolean8 password_matched;
1404 } samr_ValidatePasswordReq2;
1407 samr_ValidatePasswordInfo info;
1408 boolean8 password_matched;
1409 } samr_ValidatePasswordReq1;
1411 typedef [switch_type(uint16)] union {
1412 [case(1)] samr_ValidatePasswordReq1 req1;
1413 [case(2)] samr_ValidatePasswordReq2 req2;
1414 [case(3)] samr_ValidatePasswordReq3 req3;
1415 } samr_ValidatePasswordReq;
1417 NTSTATUS samr_ValidatePassword(
1418 [in] samr_ValidatePasswordLevel level,
1419 [in,switch_is(level)] samr_ValidatePasswordReq req,
1420 [out,ref,switch_is(level)] samr_ValidatePasswordRep *rep