2 Unix SMB/Netbios implementation.
4 SMB parameters and setup
5 Copyright (C) Andrew Tridgell 1992-1998
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
7 Copyright (C) Paul Ashton 1997-1998
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
31 /*******************************************************************
32 the following information comes from a QuickView on samsrv.dll,
33 and gives an idea of exactly what is needed:
35 x SamrAddMemberToAlias
36 x SamrAddMemberToGroup
37 SamrAddMultipleMembersToAlias
38 x SamrChangePasswordUser
41 x SamrCreateAliasInDomain
42 x SamrCreateGroupInDomain
43 x SamrCreateUserInDomain
47 x SamrEnumerateAliasesInDomain
48 SamrEnumerateDomainsInSamServer
49 x SamrEnumerateGroupsInDomain
50 x SamrEnumerateUsersInDomain
51 SamrGetUserDomainPasswordInformation
52 SamrLookupDomainInSamServer
53 ? SamrLookupIdsInDomain
54 x SamrLookupNamesInDomain
59 x SamrQueryDisplayInformation
60 x SamrQueryInformationAlias
61 SamrQueryInformationDomain
62 ? SamrQueryInformationUser
63 SamrQuerySecurityObject
64 SamrRemoveMemberFromAlias
65 SamrRemoveMemberFromForiegnDomain
66 SamrRemoveMemberFromGroup
67 SamrRemoveMultipleMembersFromAlias
68 x SamrSetInformationAlias
69 SamrSetInformationDomain
70 x SamrSetInformationGroup
71 x SamrSetInformationUser
72 SamrSetMemberAttributesOfGroup
75 SamrTestPrivateFunctionsDomain
76 SamrTestPrivateFunctionsUser
78 ********************************************************************/
80 #define SAMR_CONNECT_ANON 0x00
81 #define SAMR_CLOSE_HND 0x01
83 #define SAMR_UNKNOWN_3 0x03
84 #define SAMR_LOOKUP_DOMAIN 0x05
85 #define SAMR_OPEN_DOMAIN 0x07
87 #define SAMR_QUERY_DOMAIN_INFO 0x08
89 #define SAMR_CREATE_DOM_GROUP 0x0a
90 #define SAMR_ENUM_DOM_GROUPS 0x0b
91 #define SAMR_ENUM_DOM_USERS 0x0d
92 #define SAMR_CREATE_DOM_ALIAS 0x0e
93 #define SAMR_ENUM_DOM_ALIASES 0x0f
94 #define SAMR_QUERY_USERALIASES 0x10
96 #define SAMR_LOOKUP_NAMES 0x11
97 #define SAMR_LOOKUP_RIDS 0x12
99 #define SAMR_OPEN_GROUP 0x13
100 #define SAMR_QUERY_GROUPINFO 0x14
101 #define SAMR_SET_GROUPINFO 0x15
102 #define SAMR_ADD_GROUPMEM 0x16
103 #define SAMR_DELETE_DOM_GROUP 0x17
104 #define SAMR_DEL_GROUPMEM 0x18
105 #define SAMR_QUERY_GROUPMEM 0x19
107 #define SAMR_OPEN_ALIAS 0x1b
108 #define SAMR_QUERY_ALIASINFO 0x1c
109 #define SAMR_SET_ALIASINFO 0x1d
110 #define SAMR_DELETE_DOM_ALIAS 0x1e
111 #define SAMR_ADD_ALIASMEM 0x1f
112 #define SAMR_DEL_ALIASMEM 0x20
113 #define SAMR_QUERY_ALIASMEM 0x21
115 #define SAMR_OPEN_USER 0x22
116 #define SAMR_CREATE_USER 0x32
117 #define SAMR_SET_USERINFO 0x3A
119 #define SAMR_QUERY_USERINFO 0x24
120 #define SAMR_QUERY_USERGROUPS 0x27
121 #define SAMR_QUERY_DISPINFO 0x28
123 #define SAMR_UNKNOWN_2C 0x2c
124 #define SAMR_QUERY_DISPINFO3 0x30 /* Alias for SAMR_QUERY_DISPINFO
126 #define SAMR_QUERY_DISPINFO4 0x33 /* Alias for SAMR_QUERY_DISPINFO
128 #define SAMR_UNKNOWN_34 0x34
130 #define SAMR_CHGPASSWD_USER 0x37
131 #define SAMR_UNKNOWN_38 0x38
133 #define SAMR_CONNECT 0x39
136 typedef struct logon_hours_info
138 uint32 len; /* normally 21 bytes */
143 /* SAM_USER_INFO_23 */
144 typedef struct sam_user_info_23
146 NTTIME logon_time; /* logon time */
147 NTTIME logoff_time; /* logoff time */
148 NTTIME kickoff_time; /* kickoff time */
149 NTTIME pass_last_set_time; /* password last set time */
150 NTTIME pass_can_change_time; /* password can change time */
151 NTTIME pass_must_change_time; /* password must change time */
153 UNIHDR hdr_user_name; /* NULL - user name unicode string header */
154 UNIHDR hdr_full_name; /* user's full name unicode string header */
155 UNIHDR hdr_home_dir; /* home directory unicode string header */
156 UNIHDR hdr_dir_drive; /* home drive unicode string header */
157 UNIHDR hdr_logon_script; /* logon script unicode string header */
158 UNIHDR hdr_profile_path; /* profile path unicode string header */
159 UNIHDR hdr_acct_desc ; /* user description */
160 UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
161 UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
162 UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
164 uint8 lm_pwd[16]; /* lm user passwords */
165 uint8 nt_pwd[16]; /* nt user passwords */
167 uint32 user_rid; /* Primary User ID */
168 uint32 group_rid; /* Primary Group ID */
170 uint16 acb_info; /* account info (ACB_xxxx bit-mask) */
173 uint32 unknown_3; /* 0x09f8 27fa */
175 uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
177 uint32 ptr_logon_hrs; /* pointer to logon hours */
181 uint32 unknown_5; /* 0x0001 0000 */
185 UNISTR2 uni_user_name; /* NULL - username unicode string */
186 UNISTR2 uni_full_name; /* user's full name unicode string */
187 UNISTR2 uni_home_dir; /* home directory unicode string */
188 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
189 UNISTR2 uni_logon_script; /* logon script unicode string */
190 UNISTR2 uni_profile_path; /* profile path unicode string */
191 UNISTR2 uni_acct_desc ; /* user description unicode string */
192 UNISTR2 uni_workstations; /* login from workstations unicode string */
193 UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
194 UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
196 uint32 unknown_6; /* 0x0000 04ec */
204 /* SAM_USER_INFO_21 */
205 typedef struct sam_user_info_21
207 NTTIME logon_time; /* logon time */
208 NTTIME logoff_time; /* logoff time */
209 NTTIME kickoff_time; /* kickoff time */
210 NTTIME pass_last_set_time; /* password last set time */
211 NTTIME pass_can_change_time; /* password can change time */
212 NTTIME pass_must_change_time; /* password must change time */
214 UNIHDR hdr_user_name; /* username unicode string header */
215 UNIHDR hdr_full_name; /* user's full name unicode string header */
216 UNIHDR hdr_home_dir; /* home directory unicode string header */
217 UNIHDR hdr_dir_drive; /* home drive unicode string header */
218 UNIHDR hdr_logon_script; /* logon script unicode string header */
219 UNIHDR hdr_profile_path; /* profile path unicode string header */
220 UNIHDR hdr_acct_desc ; /* user description */
221 UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
222 UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
223 UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
225 uint8 lm_pwd[16]; /* lm user passwords */
226 uint8 nt_pwd[16]; /* nt user passwords */
228 uint32 user_rid; /* Primary User ID */
229 uint32 group_rid; /* Primary Group ID */
231 uint16 acb_info; /* account info (ACB_xxxx bit-mask) */
234 uint32 unknown_3; /* 0x00ff ffff */
236 uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
238 uint32 ptr_logon_hrs; /* unknown pointer */
240 uint32 unknown_5; /* 0x0002 0000 */
244 UNISTR2 uni_user_name; /* username unicode string */
245 UNISTR2 uni_full_name; /* user's full name unicode string */
246 UNISTR2 uni_home_dir; /* home directory unicode string */
247 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
248 UNISTR2 uni_logon_script; /* logon script unicode string */
249 UNISTR2 uni_profile_path; /* profile path unicode string */
250 UNISTR2 uni_acct_desc ; /* user description unicode string */
251 UNISTR2 uni_workstations; /* login from workstations unicode string */
252 UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
253 UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
255 uint32 unknown_6; /* 0x0000 04ec */
263 /* SAM_USER_INFO_11 */
264 typedef struct sam_user_info_11
266 uint8 padding_0[16]; /* 0 - padding 16 bytes */
267 NTTIME expiry; /* expiry time or something? */
268 uint8 padding_1[24]; /* 0 - padding 24 bytes */
270 UNIHDR hdr_mach_acct; /* unicode header for machine account */
271 uint32 padding_2; /* 0 - padding 4 bytes */
273 uint32 ptr_1; /* pointer */
274 uint8 padding_3[32]; /* 0 - padding 32 bytes */
275 uint32 padding_4; /* 0 - padding 4 bytes */
277 uint32 ptr_2; /* pointer */
278 uint32 padding_5; /* 0 - padding 4 bytes */
280 uint32 ptr_3; /* pointer */
281 uint8 padding_6[32]; /* 0 - padding 32 bytes */
283 uint32 rid_user; /* user RID */
284 uint32 rid_group; /* group RID */
286 uint16 acct_ctrl; /* 0080 - ACB_XXXX */
287 uint16 unknown_3; /* 16 bit padding */
289 uint16 unknown_4; /* 0x003f - 16 bit unknown */
290 uint16 unknown_5; /* 0x003c - 16 bit unknown */
292 uint8 padding_7[16]; /* 0 - padding 16 bytes */
293 uint32 padding_8; /* 0 - padding 4 bytes */
295 UNISTR2 uni_mach_acct; /* unicode string for machine account */
297 uint8 padding_9[48]; /* 0 - padding 48 bytes */
302 /* SAM_USER_INFO_10 */
303 typedef struct sam_user_info_10
311 /* SAMR_Q_CLOSE_HND - probably a policy handle close */
312 typedef struct q_samr_close_hnd_info
314 POLICY_HND pol; /* policy handle */
319 /* SAMR_R_CLOSE_HND - probably a policy handle close */
320 typedef struct r_samr_close_hnd_info
322 POLICY_HND pol; /* policy handle */
323 uint32 status; /* return status */
328 /****************************************************************************
329 SAMR_Q_UNKNOWN_2C - a "set user info" occurs just after this
330 *****************************************************************************/
332 /* SAMR_Q_UNKNOWN_2C */
333 typedef struct q_samr_unknown_2c_info
335 POLICY_HND user_pol; /* policy handle */
340 /****************************************************************************
341 SAMR_R_UNKNOWN_2C - a "set user info" occurs just after this
342 *****************************************************************************/
344 /* SAMR_R_UNKNOWN_2C */
345 typedef struct r_samr_unknown_2c_info
347 uint32 unknown_0; /* 0x0016 0000 */
348 uint32 unknown_1; /* 0x0000 0000 */
354 /****************************************************************************
355 SAMR_Q_UNKNOWN_3 - info level 4. returns SIDs.
356 *****************************************************************************/
358 /* SAMR_Q_UNKNOWN_3 - probably get domain info... */
359 typedef struct q_samr_unknown_3_info
361 POLICY_HND user_pol; /* policy handle */
362 uint16 switch_value; /* 0x0000 0004 */
368 0x14 0x035b 0x0002 S-1-1
369 0x18 0x07ff 0x000f S-1-5-20-DOMAIN_ALIAS_RID_ADMINS
370 0x18 0x07ff 0x000f S-1-5-20-DOMAIN_ALIAS_RID_ACCOUNT_OPS
371 0x24 0x0044 0x0002 S-1-5-21-nnn-nnn-nnn-0x03f1
375 0x24 0x0044 0x0002 S-1-5-21-nnn-nnn-nnn-0x03ee
376 0x18 0x07ff 0x000f S-1-5-20-DOMAIN_ALIAS_RID_ADMINS
377 0x14 0x035b 0x0002 S-1-1
380 /* DOM_SID3 - security id */
381 typedef struct sid_info_3
383 uint16 len; /* length, bytes, including length of len :-) */
391 #define MAX_SAM_SIDS 15
394 typedef struct sid_stuff_info
396 uint16 unknown_2; /* 0x0001 */
397 uint16 unknown_3; /* 0x8004 */
401 uint32 unknown_4; /* 0x0000 0014 */
402 uint32 unknown_5; /* 0x0000 0014 */
404 uint16 unknown_6; /* 0x0002 */
405 uint16 unknown_7; /* 0x5800 */
411 DOM_SID3 sid[MAX_SAM_SIDS];
415 /* SAMR_R_UNKNOWN_3 - probably an open */
416 typedef struct r_samr_unknown_3_info
419 uint32 sid_stuff_len0;
422 uint32 sid_stuff_len1;
424 SAM_SID_STUFF sid_stuff;
426 uint32 status; /* return status */
431 /****************************************************************************
432 SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
433 *****************************************************************************/
435 /* SAMR_Q_QUERY_DOMAIN_INFO - */
436 typedef struct q_samr_query_domain_info
438 POLICY_HND domain_pol; /* policy handle */
439 uint16 switch_value; /* 0x0002, 0x0001 */
441 } SAMR_Q_QUERY_DOMAIN_INFO;
443 typedef struct sam_unknown_info_6_info
445 uint32 unknown_0; /* 0x0000 0000 */
447 uint32 ptr_0; /* pointer to unknown structure */
448 uint8 padding[12]; /* 12 bytes zeros */
452 typedef struct sam_unknown_info_7_info
454 uint16 unknown_0; /* 0x0003 */
458 typedef struct sam_unknown_info_2_inf
460 uint32 unknown_0; /* 0x0000 0000 */
461 uint32 unknown_1; /* 0x8000 0000 */
462 uint32 unknown_2; /* 0x0000 0000 */
464 uint32 ptr_0; /* pointer to unknown structure */
465 UNIHDR hdr_domain; /* domain name unicode header */
466 UNIHDR hdr_server; /* server name unicode header */
468 /* put all the data in here, at the moment, including what the above
469 pointer is referring to
472 uint32 seq_num; /* some sort of incrementing sequence number? */
473 uint32 unknown_3; /* 0x0000 0000 */
475 uint32 unknown_4; /* 0x0000 0001 */
476 uint32 unknown_5; /* 0x0000 0003 */
477 uint32 unknown_6; /* 0x0000 0001 */
478 uint32 num_domain_usrs; /* number of users in domain */
479 uint32 num_domain_grps; /* number of domain groups in domain */
480 uint32 num_local_grps; /* number of local groups in domain */
482 uint8 padding[12]; /* 12 bytes zeros */
484 UNISTR2 uni_domain; /* domain name unicode string */
485 UNISTR2 uni_server; /* server name unicode string */
489 typedef struct sam_unknown_info_1_inf
491 uint8 padding[12]; /* 12 bytes zeros */
492 uint32 unknown_1; /* 0x8000 0000 */
493 uint32 unknown_2; /* 0x0000 0000 */
494 uint32 unknown_3; /* 0x0000 0000 */
499 typedef struct sam_unknown_ctr_info
513 /* SAMR_R_QUERY_DOMAIN_INFO - */
514 typedef struct r_samr_query_domain_info
517 uint16 switch_value; /* same as in query */
521 uint32 status; /* return status */
523 } SAMR_R_QUERY_DOMAIN_INFO;
526 /* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
527 typedef struct q_samr_lookup_domain_info
529 POLICY_HND connect_pol;
534 } SAMR_Q_LOOKUP_DOMAIN;
537 /* SAMR_R_LOOKUP_DOMAIN */
538 typedef struct r_samr_lookup_domain_info
545 } SAMR_R_LOOKUP_DOMAIN;
548 /****************************************************************************
549 SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
551 0x0000 03f1 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
552 0x0000 0200 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
553 *****************************************************************************/
555 /* SAMR_Q_OPEN_DOMAIN */
556 typedef struct q_samr_open_domain_info
558 POLICY_HND connect_pol; /* policy handle */
559 uint32 flags; /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
560 DOM_SID2 dom_sid; /* domain SID */
562 } SAMR_Q_OPEN_DOMAIN;
565 /* SAMR_R_OPEN_DOMAIN - probably an open */
566 typedef struct r_samr_open_domain_info
568 POLICY_HND domain_pol; /* policy handle associated with the SID */
569 uint32 status; /* return status */
571 } SAMR_R_OPEN_DOMAIN;
574 #define MAX_SAM_ENTRIES 250
576 typedef struct samr_entry_info
584 /* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
585 typedef struct q_samr_enum_dom_users_info
587 POLICY_HND pol; /* policy handle */
589 uint32 start_idx; /* number of values (0 indicates unlimited?) */
590 uint16 acb_mask; /* 0x0000 indicates all */
591 uint16 unknown_1; /* 0x0000 */
593 uint32 max_size; /* 0x0000 ffff */
595 } SAMR_Q_ENUM_DOM_USERS;
598 /* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
599 typedef struct r_samr_enum_dom_users_info
601 uint32 next_idx; /* next starting index required for enum */
610 UNISTR2 *uni_acct_name;
616 } SAMR_R_ENUM_DOM_USERS;
619 /* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
620 typedef struct q_samr_enum_dom_groups_info
622 POLICY_HND pol; /* policy handle */
624 /* this is possibly an enumeration context handle... */
625 uint32 unknown_0; /* 0x0000 0000 */
627 uint32 max_size; /* 0x0000 ffff */
629 } SAMR_Q_ENUM_DOM_GROUPS;
632 /* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
633 typedef struct r_samr_enum_dom_groups_info
643 SAM_ENTRY sam[MAX_SAM_ENTRIES];
644 UNISTR2 uni_grp_name[MAX_SAM_ENTRIES];
650 } SAMR_R_ENUM_DOM_GROUPS;
653 /* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
654 typedef struct q_samr_enum_dom_aliases_info
656 POLICY_HND pol; /* policy handle */
658 /* this is possibly an enumeration context handle... */
659 uint32 unknown_0; /* 0x0000 0000 */
661 uint32 max_size; /* 0x0000 ffff */
663 } SAMR_Q_ENUM_DOM_ALIASES;
666 /* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
667 typedef struct r_samr_enum_dom_aliases_info
677 SAM_ENTRY sam[MAX_SAM_ENTRIES];
678 UNISTR2 uni_grp_name[MAX_SAM_ENTRIES];
684 } SAMR_R_ENUM_DOM_ALIASES;
687 /* -- Level 1 Display Info - User Information -- */
689 typedef struct samr_entry_info1
697 UNIHDR hdr_acct_name;
698 UNIHDR hdr_user_name;
699 UNIHDR hdr_user_desc;
703 typedef struct samr_str_entry_info1
705 UNISTR2 uni_acct_name;
706 UNISTR2 uni_full_name;
707 UNISTR2 uni_acct_desc;
711 typedef struct sam_entry_info_1
713 SAM_ENTRY1 sam[MAX_SAM_ENTRIES];
714 SAM_STR1 str[MAX_SAM_ENTRIES];
719 /* -- Level 2 Display Info - Trust Account Information -- */
721 typedef struct samr_entry_info2
734 typedef struct samr_str_entry_info2
736 UNISTR2 uni_srv_name;
737 UNISTR2 uni_srv_desc;
741 typedef struct sam_entry_info_2
743 SAM_ENTRY2 sam[MAX_SAM_ENTRIES];
744 SAM_STR2 str[MAX_SAM_ENTRIES];
749 /* -- Level 3 Display Info - Domain Group Information -- */
751 typedef struct samr_entry_info3
756 uint32 attr; /* SE_GROUP_xxx, usually 7 */
763 typedef struct samr_str_entry_info3
765 UNISTR2 uni_grp_name;
766 UNISTR2 uni_grp_desc;
770 typedef struct sam_entry_info_3
772 SAM_ENTRY3 sam[MAX_SAM_ENTRIES];
773 SAM_STR3 str[MAX_SAM_ENTRIES];
778 /* -- Level 4 Display Info - User List (ASCII) -- */
780 typedef struct samr_entry_info4
783 STRHDR hdr_acct_name;
787 typedef struct samr_str_entry_info4
793 typedef struct sam_entry_info_4
795 SAM_ENTRY4 sam[MAX_SAM_ENTRIES];
796 SAM_STR4 str[MAX_SAM_ENTRIES];
801 /* -- Level 5 Display Info - Group List (ASCII) -- */
803 typedef struct samr_entry_info5
810 typedef struct samr_str_entry_info5
816 typedef struct sam_entry_info_5
818 SAM_ENTRY5 sam[MAX_SAM_ENTRIES];
819 SAM_STR5 str[MAX_SAM_ENTRIES];
824 typedef struct sam_dispinfo_ctr_info
828 SAM_DISPINFO_1 *info1; /* users/names/descriptions */
829 SAM_DISPINFO_2 *info2; /* trust accounts */
830 SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
831 SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
832 SAM_DISPINFO_5 *info5; /* group list (ASCII) */
833 void *info; /* allows assignment without typecasting, */
840 /* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
841 typedef struct q_samr_query_disp_info
843 POLICY_HND domain_pol;
845 uint16 switch_level; /* see SAM_DISPINFO_CTR above */
848 uint32 start_idx; /* start enumeration index */
849 uint32 max_entries; /* maximum number of entries to return */
850 uint32 max_size; /* recommended data size; if exceeded server
851 should return STATUS_MORE_ENTRIES */
853 } SAMR_Q_QUERY_DISPINFO;
856 /* SAMR_R_QUERY_DISPINFO */
857 typedef struct r_samr_query_dispinfo_info
859 uint32 total_size; /* total data size for all matching entries
860 (0 = uncalculated) */
861 uint32 data_size; /* actual data size returned = size of SAM_ENTRY
862 structures + total length of strings */
864 uint16 switch_level; /* see SAM_DISPINFO_CTR above */
867 uint32 num_entries; /* number of entries returned */
871 SAM_DISPINFO_CTR *ctr;
875 } SAMR_R_QUERY_DISPINFO;
878 /* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
879 typedef struct q_samr_delete_dom_group_info
881 POLICY_HND group_pol; /* policy handle */
883 } SAMR_Q_DELETE_DOM_GROUP;
886 /* SAMR_R_DELETE_DOM_GROUP - delete domain group */
887 typedef struct r_samr_delete_dom_group_info
889 POLICY_HND pol; /* policy handle */
890 uint32 status; /* return status */
892 } SAMR_R_DELETE_DOM_GROUP;
895 /* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
896 typedef struct q_samr_create_dom_group_info
898 POLICY_HND pol; /* policy handle */
900 UNIHDR hdr_acct_desc;
901 UNISTR2 uni_acct_desc;
903 uint16 unknown_1; /* 0x0002 */
904 uint16 unknown_2; /* 0x0001 */
906 } SAMR_Q_CREATE_DOM_GROUP;
908 /* SAMR_R_CREATE_DOM_GROUP - SAM create group */
909 typedef struct r_samr_create_dom_group_info
911 POLICY_HND pol; /* policy handle */
916 } SAMR_R_CREATE_DOM_GROUP;
918 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
919 typedef struct q_samr_query_group_info
921 POLICY_HND pol; /* policy handle */
923 uint16 switch_level; /* 0x0001 seen */
925 } SAMR_Q_QUERY_GROUPINFO;
927 typedef struct samr_group_info1
929 UNIHDR hdr_acct_name;
931 uint32 unknown_1; /* 0x0000 0003 - number of group members? */
932 uint32 unknown_2; /* 0x0000 0001 - number of group members? */
934 UNIHDR hdr_acct_desc;
936 UNISTR2 uni_acct_name;
937 UNISTR2 uni_acct_desc;
941 typedef struct samr_group_info4
943 UNIHDR hdr_acct_desc;
944 UNISTR2 uni_acct_desc;
949 typedef struct group_info_ctr
951 uint16 switch_value1;
952 uint16 switch_value2;
963 /* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
964 typedef struct r_samr_query_groupinfo_info
971 } SAMR_R_QUERY_GROUPINFO;
974 /* SAMR_Q_SET_GROUPINFO - SAM Group Info */
975 typedef struct q_samr_set_group_info
977 POLICY_HND pol; /* policy handle */
980 } SAMR_Q_SET_GROUPINFO;
982 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
983 typedef struct r_samr_set_group_info
987 } SAMR_R_SET_GROUPINFO;
990 /* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */
991 typedef struct q_samr_delete_dom_alias_info
993 POLICY_HND alias_pol; /* policy handle */
995 } SAMR_Q_DELETE_DOM_ALIAS;
998 /* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */
999 typedef struct r_samr_delete_dom_alias_info
1001 POLICY_HND pol; /* policy handle */
1002 uint32 status; /* return status */
1004 } SAMR_R_DELETE_DOM_ALIAS;
1007 /* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */
1008 typedef struct q_samr_create_dom_alias_info
1010 POLICY_HND dom_pol; /* policy handle */
1012 UNIHDR hdr_acct_desc;
1013 UNISTR2 uni_acct_desc;
1015 uint16 unknown_1; /* 0x001f */
1016 uint16 unknown_2; /* 0x000f */
1018 } SAMR_Q_CREATE_DOM_ALIAS;
1020 /* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */
1021 typedef struct r_samr_create_dom_alias_info
1023 POLICY_HND alias_pol; /* policy handle */
1028 } SAMR_R_CREATE_DOM_ALIAS;
1030 /* SAMR_Q_QUERY_ALIASINFO - SAM Alias Info */
1031 typedef struct q_samr_query_alias_info
1033 POLICY_HND pol; /* policy handle */
1035 uint16 switch_level; /* 0x0003 seen */
1037 } SAMR_Q_QUERY_ALIASINFO;
1039 typedef struct samr_alias_info3
1041 UNIHDR hdr_acct_desc;
1042 UNISTR2 uni_acct_desc;
1046 /* ALIAS_INFO_CTR */
1047 typedef struct alias_info_ctr
1049 uint16 switch_value1;
1050 uint16 switch_value2;
1060 /* SAMR_R_QUERY_ALIASINFO - SAM alias info */
1061 typedef struct r_samr_query_aliasinfo_info
1064 ALIAS_INFO_CTR *ctr;
1068 } SAMR_R_QUERY_ALIASINFO;
1071 /* SAMR_Q_SET_ALIASINFO - SAM Alias Info */
1072 typedef struct q_samr_set_alias_info
1074 POLICY_HND alias_pol; /* policy handle */
1075 ALIAS_INFO_CTR *ctr;
1077 } SAMR_Q_SET_ALIASINFO;
1079 /* SAMR_R_SET_ALIASINFO - SAM alias info */
1080 typedef struct r_samr_set_aliasinfo_info
1084 } SAMR_R_SET_ALIASINFO;
1087 /* SAMR_Q_QUERY_USERGROUPS - */
1088 typedef struct q_samr_query_usergroup_info
1090 POLICY_HND pol; /* policy handle associated with unknown id */
1092 } SAMR_Q_QUERY_USERGROUPS;
1094 /* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
1095 typedef struct r_samr_query_usergroup_info
1097 uint32 ptr_0; /* pointer */
1098 uint32 num_entries; /* number of RID groups */
1099 uint32 ptr_1; /* pointer */
1100 uint32 num_entries2; /* number of RID groups */
1102 DOM_GID *gid; /* group info */
1104 uint32 status; /* return status */
1106 } SAMR_R_QUERY_USERGROUPS;
1109 /* SAMR_Q_SET_USERINFO - set sam info */
1110 typedef struct q_samr_set_user_info
1112 POLICY_HND pol; /* policy handle associated with user */
1113 uint16 switch_value; /* 0x0017 */
1114 uint16 switch_value2; /* 0x0017 */
1118 SAM_USER_INFO_23 *id23; /* auth-level 0x17 */
1119 void* id; /* to make typecasting easy */
1123 } SAMR_Q_SET_USERINFO;
1125 /* SAMR_R_SET_USERINFO - set sam info */
1126 typedef struct r_samr_set_user_info
1128 uint32 status; /* return status */
1130 } SAMR_R_SET_USERINFO;
1133 /* SAMR_Q_QUERY_USERINFO - probably a get sam info */
1134 typedef struct q_samr_query_user_info
1136 POLICY_HND pol; /* policy handle associated with unknown id */
1137 uint16 switch_value; /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */
1139 } SAMR_Q_QUERY_USERINFO;
1141 /* SAMR_R_QUERY_USERINFO - probably a get sam info */
1142 typedef struct r_samr_query_user_info
1144 uint32 ptr; /* pointer */
1145 uint16 switch_value; /* 0x0015, 0x0011 or 0x0010 - same as in query */
1146 /* uint8[2] padding. */
1150 SAM_USER_INFO_10 *id10; /* auth-level 0x10 */
1151 SAM_USER_INFO_11 *id11; /* auth-level 0x11 */
1152 SAM_USER_INFO_21 *id21; /* auth-level 21 */
1153 void* id; /* to make typecasting easy */
1157 uint32 status; /* return status */
1159 } SAMR_R_QUERY_USERINFO;
1162 /****************************************************************************
1163 SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.
1165 the policy handle allocated by an "samr open secret" call is associated
1166 with a SID. this policy handle is what is queried here, *not* the SID
1167 itself. the response to the lookup rids is relative to this SID.
1168 *****************************************************************************/
1169 /* SAMR_Q_QUERY_USERALIASES */
1170 typedef struct q_samr_query_useraliases_info
1172 POLICY_HND pol; /* policy handle */
1174 uint32 num_sids1; /* number of rids being looked up */
1175 uint32 ptr; /* buffer pointer */
1176 uint32 num_sids2; /* number of rids being looked up */
1178 uint32 ptr_sid[MAX_LOOKUP_SIDS]; /* pointers to sids to be looked up */
1179 DOM_SID2 sid [MAX_LOOKUP_SIDS]; /* sids to be looked up. */
1181 } SAMR_Q_QUERY_USERALIASES;
1184 /* SAMR_R_QUERY_USERALIASES */
1185 typedef struct r_samr_query_useraliases_info
1188 uint32 ptr; /* undocumented buffer pointer */
1190 uint32 num_entries2;
1191 uint32 *rid; /* domain RIDs being looked up */
1193 uint32 status; /* return code */
1195 } SAMR_R_QUERY_USERALIASES;
1198 /****************************************************************************
1199 SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
1200 *****************************************************************************/
1201 /* SAMR_Q_LOOKUP_NAMES */
1202 typedef struct q_samr_lookup_names_info
1204 POLICY_HND pol; /* policy handle */
1206 uint32 num_names1; /* number of names being looked up */
1207 uint32 flags; /* 0x0000 03e8 - unknown */
1208 uint32 ptr; /* 0x0000 0000 - 32 bit unknown */
1209 uint32 num_names2; /* number of names being looked up */
1211 UNIHDR hdr_name[MAX_LOOKUP_SIDS]; /* unicode account name header */
1212 UNISTR2 uni_name[MAX_LOOKUP_SIDS]; /* unicode account name string */
1214 } SAMR_Q_LOOKUP_NAMES;
1217 /* SAMR_R_LOOKUP_NAMES */
1218 typedef struct r_samr_lookup_names_info
1220 uint32 num_rids1; /* number of aliases being looked up */
1221 uint32 ptr_rids; /* pointer to aliases */
1222 uint32 num_rids2; /* number of aliases being looked up */
1224 uint32 rid[MAX_LOOKUP_SIDS]; /* rids */
1226 uint32 num_types1; /* number of users in aliases being looked up */
1227 uint32 ptr_types; /* pointer to users in aliases */
1228 uint32 num_types2; /* number of users in aliases being looked up */
1230 uint32 type[MAX_LOOKUP_SIDS]; /* SID_ENUM type */
1232 uint32 status; /* return code */
1234 } SAMR_R_LOOKUP_NAMES;
1237 /****************************************************************************
1238 SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
1240 called to resolve domain RID groups.
1241 *****************************************************************************/
1242 /* SAMR_Q_LOOKUP_RIDS */
1243 typedef struct q_samr_lookup_rids_info
1245 POLICY_HND pol; /* policy handle */
1247 uint32 num_rids1; /* number of rids being looked up */
1248 uint32 flags; /* 0x0000 03e8 - unknown */
1249 uint32 ptr; /* 0x0000 0000 - 32 bit unknown */
1250 uint32 num_rids2; /* number of rids being looked up */
1252 uint32 rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
1254 } SAMR_Q_LOOKUP_RIDS;
1257 /****************************************************************************
1258 SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names
1260 *****************************************************************************/
1261 /* SAMR_R_LOOKUP_RIDS */
1262 typedef struct r_samr_lookup_rids_info
1264 uint32 num_names1; /* number of aliases being looked up */
1265 uint32 ptr_names; /* pointer to aliases */
1266 uint32 num_names2; /* number of aliases being looked up */
1268 UNIHDR hdr_name[MAX_LOOKUP_SIDS]; /* unicode account name header */
1269 UNISTR2 uni_name[MAX_LOOKUP_SIDS]; /* unicode account name string */
1271 uint32 num_types1; /* number of users in aliases being looked up */
1272 uint32 ptr_types; /* pointer to users in aliases */
1273 uint32 num_types2; /* number of users in aliases being looked up */
1275 uint32 type[MAX_LOOKUP_SIDS]; /* SID_ENUM type */
1279 } SAMR_R_LOOKUP_RIDS;
1282 /* SAMR_Q_OPEN_USER - probably an open */
1283 typedef struct q_samr_open_user_info
1285 POLICY_HND domain_pol; /* policy handle */
1286 uint32 unknown_0; /* 32 bit unknown - 0x02011b */
1287 uint32 user_rid; /* user RID */
1292 /* SAMR_R_OPEN_USER - probably an open */
1293 typedef struct r_samr_open_user_info
1295 POLICY_HND user_pol; /* policy handle associated with unknown id */
1296 uint32 status; /* return status */
1301 /* SAMR_Q_CREATE_USER - probably a create */
1302 typedef struct q_samr_create_user_info
1304 POLICY_HND domain_pol; /* policy handle */
1306 UNIHDR hdr_name; /* unicode account name header */
1307 UNISTR2 uni_name; /* unicode account name */
1309 uint16 acb_info; /* account control info */
1310 uint32 unknown_1; /* 0xe005 00b0 */
1312 } SAMR_Q_CREATE_USER;
1315 /* SAMR_R_CREATE_USER - probably a create */
1316 typedef struct r_samr_create_user_info
1318 POLICY_HND user_pol; /* policy handle associated with user */
1320 uint32 unknown_0; /* 0x0007 03ff */
1321 uint32 user_rid; /* user RID */
1322 uint32 status; /* return status */
1324 } SAMR_R_CREATE_USER;
1328 /* SAMR_Q_QUERY_GROUPMEM - query group members */
1329 typedef struct q_samr_query_groupmem_info
1331 POLICY_HND group_pol; /* policy handle */
1333 } SAMR_Q_QUERY_GROUPMEM;
1336 /* SAMR_R_QUERY_GROUPMEM - query group members */
1337 typedef struct r_samr_query_groupmem_info
1353 } SAMR_R_QUERY_GROUPMEM;
1356 /* SAMR_Q_DEL_GROUPMEM - probably an del group member */
1357 typedef struct q_samr_del_group_mem_info
1359 POLICY_HND pol; /* policy handle */
1361 uint32 rid; /* rid */
1363 } SAMR_Q_DEL_GROUPMEM;
1366 /* SAMR_R_DEL_GROUPMEM - probably an del group member */
1367 typedef struct r_samr_del_group_mem_info
1369 uint32 status; /* return status */
1371 } SAMR_R_DEL_GROUPMEM;
1374 /* SAMR_Q_ADD_GROUPMEM - probably an add group member */
1375 typedef struct q_samr_add_group_mem_info
1377 POLICY_HND pol; /* policy handle */
1379 uint32 rid; /* rid */
1380 uint32 unknown; /* 0x0000 0005 */
1382 } SAMR_Q_ADD_GROUPMEM;
1385 /* SAMR_R_ADD_GROUPMEM - probably an add group member */
1386 typedef struct r_samr_add_group_mem_info
1388 uint32 status; /* return status */
1390 } SAMR_R_ADD_GROUPMEM;
1393 /* SAMR_Q_OPEN_GROUP - probably an open */
1394 typedef struct q_samr_open_group_info
1396 POLICY_HND domain_pol; /* policy handle */
1397 uint32 unknown; /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
1398 uint32 rid_group; /* rid */
1400 } SAMR_Q_OPEN_GROUP;
1403 /* SAMR_R_OPEN_GROUP - probably an open */
1404 typedef struct r_samr_open_group_info
1406 POLICY_HND pol; /* policy handle */
1407 uint32 status; /* return status */
1409 } SAMR_R_OPEN_GROUP;
1412 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
1413 typedef struct q_samr_query_aliasmem_info
1415 POLICY_HND alias_pol; /* policy handle */
1417 } SAMR_Q_QUERY_ALIASMEM;
1420 /* SAMR_R_QUERY_ALIASMEM - query alias members */
1421 typedef struct r_samr_query_aliasmem_info
1431 } SAMR_R_QUERY_ALIASMEM;
1434 /* SAMR_Q_ADD_ALIASMEM - add alias member */
1435 typedef struct q_samr_add_alias_mem_info
1437 POLICY_HND alias_pol; /* policy handle */
1439 DOM_SID2 sid; /* member sid to be added to the alias */
1441 } SAMR_Q_ADD_ALIASMEM;
1444 /* SAMR_R_ADD_ALIASMEM - add alias member */
1445 typedef struct r_samr_add_alias_mem_info
1447 uint32 status; /* return status */
1449 } SAMR_R_ADD_ALIASMEM;
1452 /* SAMR_Q_DEL_ALIASMEM - add an add alias member */
1453 typedef struct q_samr_del_alias_mem_info
1455 POLICY_HND alias_pol; /* policy handle */
1457 DOM_SID2 sid; /* member sid to be added to alias */
1459 } SAMR_Q_DEL_ALIASMEM;
1462 /* SAMR_R_DEL_ALIASMEM - delete alias member */
1463 typedef struct r_samr_del_alias_mem_info
1465 uint32 status; /* return status */
1467 } SAMR_R_DEL_ALIASMEM;
1471 /* SAMR_Q_OPEN_ALIAS - probably an open */
1472 typedef struct q_samr_open_alias_info
1476 uint32 unknown_0; /* 0x0000 0008 */
1477 uint32 rid_alias; /* rid */
1479 } SAMR_Q_OPEN_ALIAS;
1482 /* SAMR_R_OPEN_ALIAS - probably an open */
1483 typedef struct r_samr_open_alias_info
1485 POLICY_HND pol; /* policy handle */
1486 uint32 status; /* return status */
1488 } SAMR_R_OPEN_ALIAS;
1491 /* SAMR_Q_CONNECT_ANON - probably an open */
1492 typedef struct q_samr_connect_anon_info
1494 uint32 ptr; /* ptr? */
1495 uint16 unknown_0; /* 0x005c */
1496 uint16 unknown_1; /* 0x0001 */
1497 uint32 unknown_2; /* 0x0000 0020 */
1499 } SAMR_Q_CONNECT_ANON;
1501 /* SAMR_R_CONNECT_ANON - probably an open */
1502 typedef struct r_samr_connect_anon_info
1504 POLICY_HND connect_pol; /* policy handle */
1505 uint32 status; /* return status */
1507 } SAMR_R_CONNECT_ANON;
1509 /* SAMR_Q_CONNECT - probably an open */
1510 typedef struct q_samr_connect_info
1512 uint32 ptr_srv_name; /* pointer (to server name?) */
1513 UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */
1515 uint32 unknown_0; /* 32 bit unknown */
1520 /* SAMR_R_CONNECT - probably an open */
1521 typedef struct r_samr_connect_info
1523 POLICY_HND connect_pol; /* policy handle */
1524 uint32 status; /* return status */
1528 /* SAMR_Q_UNKNOWN_38 */
1529 typedef struct q_samr_unknown_38
1532 UNIHDR hdr_srv_name;
1533 UNISTR2 uni_srv_name;
1535 } SAMR_Q_UNKNOWN_38;
1537 /* SAMR_R_UNKNOWN_38 */
1538 typedef struct r_samr_unknown_38
1545 } SAMR_R_UNKNOWN_38;
1547 /* SAMR_ENC_PASSWD */
1548 typedef struct enc_passwd_info
1556 typedef struct enc_hash_info
1563 /* SAMR_Q_CHGPASSWD_USER */
1564 typedef struct q_samr_chgpasswd_user_info
1568 UNIHDR hdr_dest_host; /* server name unicode header */
1569 UNISTR2 uni_dest_host; /* server name unicode string */
1571 UNIHDR hdr_user_name; /* username unicode string header */
1572 UNISTR2 uni_user_name; /* username unicode string */
1574 SAMR_ENC_PASSWD nt_newpass;
1575 SAMR_ENC_HASH nt_oldhash;
1577 uint32 unknown; /* 0x0000 0001 */
1579 SAMR_ENC_PASSWD lm_newpass;
1580 SAMR_ENC_HASH lm_oldhash;
1582 } SAMR_Q_CHGPASSWD_USER;
1584 /* SAMR_R_CHGPASSWD_USER */
1585 typedef struct r_samr_chgpasswd_user_info
1587 uint32 status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1589 } SAMR_R_CHGPASSWD_USER;
1591 #endif /* _RPC_SAMR_H */