Fixed enumeration of a large (<1500) users from a Samba PDC to a W2k
[samba.git] / source / include / rpc_samr.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell              1992-2000
6    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
7    Copyright (C) Paul Ashton                  1997-2000
8    Copyright (C) Jean François Micouleau      1998-2001.
9    
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14    
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19    
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25 #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
26 #define _RPC_SAMR_H 
27
28
29 #include "rpc_misc.h"
30
31
32 /*******************************************************************
33  the following information comes from a QuickView on samsrv.dll,
34  and gives an idea of exactly what is needed:
35  
36 x SamrAddMemberToAlias
37 x SamrAddMemberToGroup
38 SamrAddMultipleMembersToAlias
39 x SamrChangePasswordUser
40 x SamrCloseHandle
41 x SamrConnect
42 x SamrCreateAliasInDomain
43 x SamrCreateGroupInDomain
44 x SamrCreateUserInDomain
45 ? SamrDeleteAlias
46 SamrDeleteGroup
47 x SamrDeleteUser
48 x SamrEnumerateAliasesInDomain
49 SamrEnumerateDomainsInSamServer
50 x SamrEnumerateGroupsInDomain
51 x SamrEnumerateUsersInDomain
52 SamrGetUserDomainPasswordInformation
53 SamrLookupDomainInSamServer
54 ? SamrLookupIdsInDomain
55 x SamrLookupNamesInDomain
56 x SamrOpenAlias
57 x SamrOpenDomain
58 x SamrOpenGroup
59 x SamrOpenUser
60 x SamrQueryDisplayInformation
61 x SamrQueryInformationAlias
62 SamrQueryInformationDomain
63 ? SamrQueryInformationUser
64 x SamrQuerySecurityObject
65 SamrRemoveMemberFromAlias
66 SamrRemoveMemberFromForiegnDomain
67 SamrRemoveMemberFromGroup
68 SamrRemoveMultipleMembersFromAlias
69 x SamrSetInformationAlias
70 SamrSetInformationDomain
71 x SamrSetInformationGroup
72 x SamrSetInformationUser
73 SamrSetMemberAttributesOfGroup
74 SamrSetSecurityObject
75 SamrShutdownSamServer
76 SamrTestPrivateFunctionsDomain
77 SamrTestPrivateFunctionsUser
78
79 ********************************************************************/
80
81 #define SAMR_CONNECT_ANON      0x00
82 #define SAMR_CLOSE_HND         0x01
83 #define SAMR_UNKNOWN_2         0x02 /* set sec object? */
84 #define SAMR_QUERY_SEC_OBJECT  0x03
85
86 #define SAMR_UNKNOWN_4         0x04 /* profile info? */
87 #define SAMR_LOOKUP_DOMAIN     0x05
88 #define SAMR_ENUM_DOMAINS      0x06
89 #define SAMR_OPEN_DOMAIN       0x07
90 #define SAMR_QUERY_DOMAIN_INFO 0x08
91 #define SAMR_SET_DOMAIN_INFO   0x09
92
93 #define SAMR_CREATE_DOM_GROUP  0x0a
94 #define SAMR_ENUM_DOM_GROUPS   0x0b
95 #define SAMR_ENUM_DOM_USERS    0x0d
96 #define SAMR_CREATE_DOM_ALIAS  0x0e
97 #define SAMR_ENUM_DOM_ALIASES  0x0f
98 #define SAMR_QUERY_USERALIASES 0x10
99
100 #define SAMR_LOOKUP_NAMES      0x11
101 #define SAMR_LOOKUP_RIDS       0x12
102
103 #define SAMR_OPEN_GROUP        0x13
104 #define SAMR_QUERY_GROUPINFO   0x14
105 #define SAMR_SET_GROUPINFO     0x15
106 #define SAMR_ADD_GROUPMEM      0x16
107 #define SAMR_DELETE_DOM_GROUP  0x17
108 #define SAMR_DEL_GROUPMEM      0x18
109 #define SAMR_QUERY_GROUPMEM    0x19
110 #define SAMR_UNKNOWN_1A        0x1a
111
112 #define SAMR_OPEN_ALIAS        0x1b
113 #define SAMR_QUERY_ALIASINFO   0x1c
114 #define SAMR_SET_ALIASINFO     0x1d
115 #define SAMR_DELETE_DOM_ALIAS  0x1e
116 #define SAMR_ADD_ALIASMEM      0x1f
117 #define SAMR_DEL_ALIASMEM      0x20
118 #define SAMR_QUERY_ALIASMEM    0x21
119
120 #define SAMR_OPEN_USER         0x22
121 #define SAMR_DELETE_DOM_USER   0x23
122 #define SAMR_QUERY_USERINFO    0x24
123 #define SAMR_SET_USERINFO2     0x25
124 #define SAMR_QUERY_USERGROUPS  0x27
125
126 #define SAMR_QUERY_DISPINFO    0x28
127 #define SAMR_UNKNOWN_29        0x29
128 #define SAMR_UNKNOWN_2a        0x2a
129 #define SAMR_UNKNOWN_2b        0x2b
130 #define SAMR_GET_USRDOM_PWINFO 0x2c
131 #define SAMR_UNKNOWN_2D        0x2d
132 #define SAMR_UNKNOWN_2E        0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */
133 #define SAMR_UNKNOWN_2f        0x2f
134 #define SAMR_QUERY_DISPINFO3   0x30 /* Alias for SAMR_QUERY_DISPINFO
135                                        with info level 3 */
136 #define SAMR_UNKNOWN_31        0x31
137 #define SAMR_CREATE_USER       0x32
138 #define SAMR_QUERY_DISPINFO4   0x33 /* Alias for SAMR_QUERY_DISPINFO
139                                        with info level 4 */
140 #define SAMR_ADDMULTI_ALIASMEM 0x34
141
142 #define SAMR_UNKNOWN_35        0x35
143 #define SAMR_UNKNOWN_36        0x36
144 #define SAMR_CHGPASSWD_USER    0x37
145 #define SAMR_GET_DOM_PWINFO    0x38
146 #define SAMR_CONNECT           0x39
147 #define SAMR_SET_USERINFO      0x3A
148
149
150 typedef struct _DISP_USER_INFO {
151         SAM_ACCOUNT *sam;
152 } DISP_USER_INFO;
153
154 typedef struct _DISP_GROUP_INFO {
155         DOMAIN_GRP *grp;
156 } DISP_GROUP_INFO;
157
158
159 typedef struct logon_hours_info
160 {
161         uint32 len; /* normally 21 bytes */
162         uint8 hours[32];
163
164 } LOGON_HRS;
165
166 /* SAM_USER_INFO_23 */
167 typedef struct sam_user_info_23
168 {
169         /* TIMES MAY NOT IN RIGHT ORDER!!!! */
170         NTTIME logon_time;            /* logon time */
171         NTTIME logoff_time;           /* logoff time */
172         NTTIME kickoff_time;          /* kickoff time */
173         NTTIME pass_last_set_time;    /* password last set time */
174         NTTIME pass_can_change_time;  /* password can change time */
175         NTTIME pass_must_change_time; /* password must change time */
176
177         UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
178         UNIHDR hdr_full_name;    /* user's full name unicode string header */
179         UNIHDR hdr_home_dir;     /* home directory unicode string header */
180         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
181         UNIHDR hdr_logon_script; /* logon script unicode string header */
182         UNIHDR hdr_profile_path; /* profile path unicode string header */
183         UNIHDR hdr_acct_desc  ;  /* user description */
184         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
185         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
186         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
187
188         uint8 lm_pwd[16];    /* lm user passwords */
189         uint8 nt_pwd[16];    /* nt user passwords */
190
191         uint32 user_rid;      /* Primary User ID */
192         uint32 group_rid;     /* Primary Group ID */
193
194         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
195
196         uint32 unknown_3; /* 0x09f8 27fa */
197
198         uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
199         /* uint8 pad[2] */
200         uint32 ptr_logon_hrs; /* pointer to logon hours */
201
202         uint8 padding1[8];
203
204         uint32 unknown_5;     /* 0x0001 0000 */
205
206         uint8 pass[516];
207
208         UNISTR2 uni_user_name;    /* NULL - username unicode string */
209         UNISTR2 uni_full_name;    /* user's full name unicode string */
210         UNISTR2 uni_home_dir;     /* home directory unicode string */
211         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
212         UNISTR2 uni_logon_script; /* logon script unicode string */
213         UNISTR2 uni_profile_path; /* profile path unicode string */
214         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
215         UNISTR2 uni_workstations; /* login from workstations unicode string */
216         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
217         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
218
219         uint32 unknown_6; /* 0x0000 04ec */
220         uint32 padding4;
221
222         LOGON_HRS logon_hrs;
223
224 } SAM_USER_INFO_23;
225
226 /* SAM_USER_INFO_24 */
227 typedef struct sam_user_info_24
228 {
229         uint8 pass[516];
230         uint16 pw_len;
231 } SAM_USER_INFO_24;
232
233 /*
234  * NB. This structure is *definately* incorrect. It's my best guess
235  * currently for W2K SP2. The password field is encrypted in a different
236  * way than normal... And there are definately other problems. JRA.
237  */
238
239 /* SAM_USER_INFO_25 */
240 typedef struct sam_user_info_25
241 {
242         /* TIMES MAY NOT IN RIGHT ORDER!!!! */
243         NTTIME logon_time;            /* logon time */
244         NTTIME logoff_time;           /* logoff time */
245         NTTIME kickoff_time;          /* kickoff time */
246         NTTIME pass_last_set_time;    /* password last set time */
247         NTTIME pass_can_change_time;  /* password can change time */
248         NTTIME pass_must_change_time; /* password must change time */
249
250         UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
251         UNIHDR hdr_full_name;    /* user's full name unicode string header */
252         UNIHDR hdr_home_dir;     /* home directory unicode string header */
253         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
254         UNIHDR hdr_logon_script; /* logon script unicode string header */
255         UNIHDR hdr_profile_path; /* profile path unicode string header */
256         UNIHDR hdr_acct_desc  ;  /* user description */
257         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
258         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
259         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
260
261         uint8 lm_pwd[16];    /* lm user passwords */
262         uint8 nt_pwd[16];    /* nt user passwords */
263
264         uint32 user_rid;      /* Primary User ID */
265         uint32 group_rid;     /* Primary Group ID */
266
267         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
268
269         uint32 unknown_6[6];
270
271         uint8 pass[532];
272
273         UNISTR2 uni_user_name;    /* NULL - username unicode string */
274         UNISTR2 uni_full_name;    /* user's full name unicode string */
275         UNISTR2 uni_home_dir;     /* home directory unicode string */
276         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
277         UNISTR2 uni_logon_script; /* logon script unicode string */
278         UNISTR2 uni_profile_path; /* profile path unicode string */
279         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
280         UNISTR2 uni_workstations; /* login from workstations unicode string */
281         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
282         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
283 } SAM_USER_INFO_25;
284
285
286 /* SAM_USER_INFO_21 */
287 typedef struct sam_user_info_21
288 {
289         NTTIME logon_time;            /* logon time */
290         NTTIME logoff_time;           /* logoff time */
291         NTTIME kickoff_time;          /* kickoff time */
292         NTTIME pass_last_set_time;    /* password last set time */
293         NTTIME pass_can_change_time;  /* password can change time */
294         NTTIME pass_must_change_time; /* password must change time */
295
296         UNIHDR hdr_user_name;    /* username unicode string header */
297         UNIHDR hdr_full_name;    /* user's full name unicode string header */
298         UNIHDR hdr_home_dir;     /* home directory unicode string header */
299         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
300         UNIHDR hdr_logon_script; /* logon script unicode string header */
301         UNIHDR hdr_profile_path; /* profile path unicode string header */
302         UNIHDR hdr_acct_desc  ;  /* user description */
303         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
304         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
305         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
306
307         uint8 lm_pwd[16];    /* lm user passwords */
308         uint8 nt_pwd[16];    /* nt user passwords */
309
310         uint32 user_rid;      /* Primary User ID */
311         uint32 group_rid;     /* Primary Group ID */
312
313         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
314
315         uint32 unknown_3; /* 0x00ff ffff */
316
317         uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
318         /* uint8 pad[2] */
319         uint32 ptr_logon_hrs; /* unknown pointer */
320
321         uint32 unknown_5;     /* 0x0002 0000 */
322
323         uint8 padding1[8];
324
325         UNISTR2 uni_user_name;    /* username unicode string */
326         UNISTR2 uni_full_name;    /* user's full name unicode string */
327         UNISTR2 uni_home_dir;     /* home directory unicode string */
328         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
329         UNISTR2 uni_logon_script; /* logon script unicode string */
330         UNISTR2 uni_profile_path; /* profile path unicode string */
331         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
332         UNISTR2 uni_workstations; /* login from workstations unicode string */
333         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
334         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
335
336         uint32 unknown_6; /* 0x0000 04ec */
337         uint32 padding4;
338
339         LOGON_HRS logon_hrs;
340
341 } SAM_USER_INFO_21;
342
343
344 /* SAM_USER_INFO_20 */
345 typedef struct sam_user_info_20
346 {
347         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
348
349         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
350
351 } SAM_USER_INFO_20;
352
353 /* SAM_USER_INFO_12 */
354 typedef struct sam_user_info_12
355 {
356         uint8 lm_pwd[16];    /* lm user passwords */
357         uint8 nt_pwd[16];    /* nt user passwords */
358
359         uint8 lm_pwd_active; 
360         uint8 nt_pwd_active; 
361
362 } SAM_USER_INFO_12;
363
364 /* SAM_USER_INFO_11 */
365 typedef struct sam_user_info_11
366 {
367         uint8  padding_0[16];  /* 0 - padding 16 bytes */
368         NTTIME expiry;         /* expiry time or something? */
369         uint8  padding_1[24];  /* 0 - padding 24 bytes */
370
371         UNIHDR hdr_mach_acct;  /* unicode header for machine account */
372         uint32 padding_2;      /* 0 - padding 4 bytes */
373
374         uint32 ptr_1;          /* pointer */
375         uint8  padding_3[32];  /* 0 - padding 32 bytes */
376         uint32 padding_4;      /* 0 - padding 4 bytes */
377
378         uint32 ptr_2;          /* pointer */
379         uint32 padding_5;      /* 0 - padding 4 bytes */
380
381         uint32 ptr_3;          /* pointer */
382         uint8  padding_6[32];  /* 0 - padding 32 bytes */
383
384         uint32 rid_user;       /* user RID */
385         uint32 rid_group;      /* group RID */
386
387         uint16 acct_ctrl;      /* 0080 - ACB_XXXX */
388         uint16 unknown_3;      /* 16 bit padding */
389
390         uint16 unknown_4;      /* 0x003f      - 16 bit unknown */
391         uint16 unknown_5;      /* 0x003c      - 16 bit unknown */
392
393         uint8  padding_7[16];  /* 0 - padding 16 bytes */
394         uint32 padding_8;      /* 0 - padding 4 bytes */
395         
396         UNISTR2 uni_mach_acct; /* unicode string for machine account */
397
398         uint8  padding_9[48];  /* 0 - padding 48 bytes */
399
400 } SAM_USER_INFO_11;
401
402
403 /* SAM_USER_INFO_10 */
404 typedef struct sam_user_info_10
405 {
406         uint32 acb_info;
407
408 } SAM_USER_INFO_10;
409
410
411
412 /* SAMR_Q_CLOSE_HND - probably a policy handle close */
413 typedef struct q_samr_close_hnd_info
414 {
415     POLICY_HND pol;          /* policy handle */
416
417 } SAMR_Q_CLOSE_HND;
418
419
420 /* SAMR_R_CLOSE_HND - probably a policy handle close */
421 typedef struct r_samr_close_hnd_info
422 {
423         POLICY_HND pol;       /* policy handle */
424         NTSTATUS status;         /* return status */
425
426 } SAMR_R_CLOSE_HND;
427
428
429 /****************************************************************************
430 SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this
431 *****************************************************************************/
432
433 /* SAMR_Q_GET_USRDOM_PWINFO */
434 typedef struct q_samr_usrdom_pwinfo_info
435 {
436         POLICY_HND user_pol;          /* policy handle */
437
438 } SAMR_Q_GET_USRDOM_PWINFO;
439
440
441 /****************************************************************************
442 SAMR_R_GET_USRDOM_PWINFO - a "set user info" occurs just after this
443 *****************************************************************************/
444
445 /* SAMR_R_GET_USRDOM_PWINFO */
446 typedef struct r_samr_usrdom_pwinfo_info
447 {
448         uint16 unknown_0; /* 0000 */
449         uint16 unknown_1; /* 0x0016 or 0x0015 */
450         uint32 unknown_2; /* 0x0000 0000 */
451         NTSTATUS status; 
452
453 } SAMR_R_GET_USRDOM_PWINFO;
454
455
456 /****************************************************************************
457 SAMR_Q_QUERY_SEC_OBJ - info level 4.  returns SIDs.
458 *****************************************************************************/
459
460 /* SAMR_Q_QUERY_SEC_OBJ - probably get domain info... */
461 typedef struct q_samr_query_sec_obj_info
462 {
463         POLICY_HND user_pol;          /* policy handle */
464         uint32 sec_info;     /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
465
466 } SAMR_Q_QUERY_SEC_OBJ;
467
468 /* SAMR_R_QUERY_SEC_OBJ - probably an open */
469 typedef struct r_samr_query_sec_obj_info
470 {
471         uint32 ptr;
472         SEC_DESC_BUF *buf;
473
474         NTSTATUS status;         /* return status */
475
476 } SAMR_R_QUERY_SEC_OBJ;
477
478
479 /****************************************************************************
480 SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
481 *****************************************************************************/
482
483 /* SAMR_Q_QUERY_DOMAIN_INFO - */
484 typedef struct q_samr_query_domain_info
485 {
486         POLICY_HND domain_pol;   /* policy handle */
487         uint16 switch_value;     /* 0x0002, 0x0001 */
488
489 } SAMR_Q_QUERY_DOMAIN_INFO;
490
491 typedef struct sam_unknown_info_3_info
492 {
493         NTTIME logout;  
494         /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
495
496         /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
497
498 } SAM_UNK_INFO_3;
499
500 typedef struct sam_unknown_info_6_info
501 {
502         uint32 unknown_0; /* 0x0000 0000 */
503
504         uint32 ptr_0;     /* pointer to unknown structure */
505         uint8  padding[12]; /* 12 bytes zeros */
506
507 } SAM_UNK_INFO_6;
508
509 typedef struct sam_unknown_info_7_info
510 {
511         uint16 unknown_0; /* 0x0003 */
512
513 } SAM_UNK_INFO_7;
514
515 typedef struct sam_unknown_info_12_inf
516 {
517         NTTIME duration;
518         NTTIME reset_count;
519         uint16 bad_attempt_lockout;
520
521 } SAM_UNK_INFO_12;
522
523 typedef struct sam_unknown_info_5_inf
524 {
525         UNIHDR hdr_server; /* server name unicode header */
526         UNISTR2 uni_server; /* server name unicode string */
527
528 } SAM_UNK_INFO_5;
529
530 typedef struct sam_unknown_info_2_inf
531 {
532         uint32 unknown_0; /* 0x0000 0000 */
533         uint32 unknown_1; /* 0x8000 0000 */
534         uint32 unknown_2; /* 0x0000 0000 */
535
536         uint32 ptr_0;     /* pointer to unknown structure */
537         UNIHDR hdr_domain; /* domain name unicode header */
538         UNIHDR hdr_server; /* server name unicode header */
539
540         /* put all the data in here, at the moment, including what the above
541            pointer is referring to
542          */
543
544         uint32 seq_num; /* some sort of incrementing sequence number? */
545         uint32 unknown_3; /* 0x0000 0000 */
546         
547         uint32 unknown_4; /* 0x0000 0001 */
548         uint32 unknown_5; /* 0x0000 0003 */
549         uint32 unknown_6; /* 0x0000 0001 */
550         uint32 num_domain_usrs; /* number of users in domain */
551         uint32 num_domain_grps; /* number of domain groups in domain */
552         uint32 num_local_grps; /* number of local groups in domain */
553
554         uint8 padding[12]; /* 12 bytes zeros */
555
556         UNISTR2 uni_domain; /* domain name unicode string */
557         UNISTR2 uni_server; /* server name unicode string */
558
559 } SAM_UNK_INFO_2;
560
561 typedef struct sam_unknown_info_1_inf
562 {
563         uint16 min_length_password;
564         uint16 password_history;
565         uint32 flag;
566         NTTIME expire;
567         NTTIME min_passwordage;
568
569 } SAM_UNK_INFO_1;
570
571
572 typedef struct sam_unknown_ctr_info
573 {
574         union
575         {
576                 SAM_UNK_INFO_1 inf1;
577                 SAM_UNK_INFO_2 inf2;
578                 SAM_UNK_INFO_3 inf3;
579                 SAM_UNK_INFO_5 inf5;
580                 SAM_UNK_INFO_6 inf6;
581                 SAM_UNK_INFO_7 inf7;
582                 SAM_UNK_INFO_12 inf12;
583
584         } info;
585
586 } SAM_UNK_CTR;
587
588
589 /* SAMR_R_QUERY_DOMAIN_INFO - */
590 typedef struct r_samr_query_domain_info
591 {
592         uint32 ptr_0;
593         uint16 switch_value; /* same as in query */
594
595         SAM_UNK_CTR *ctr;
596
597         NTSTATUS status;         /* return status */
598
599 } SAMR_R_QUERY_DOMAIN_INFO;
600
601
602 /* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
603 typedef struct q_samr_lookup_domain_info
604 {
605         POLICY_HND connect_pol;
606
607         UNIHDR  hdr_domain;
608         UNISTR2 uni_domain;
609
610 } SAMR_Q_LOOKUP_DOMAIN;
611
612
613 /* SAMR_R_LOOKUP_DOMAIN */
614 typedef struct r_samr_lookup_domain_info
615 {
616         uint32   ptr_sid;
617         DOM_SID2 dom_sid;
618
619         NTSTATUS status;
620
621 } SAMR_R_LOOKUP_DOMAIN;
622
623
624 /****************************************************************************
625 SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
626
627 0x0000 03f1 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
628 0x0000 0200 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
629 *****************************************************************************/
630
631 /* SAMR_Q_OPEN_DOMAIN */
632 typedef struct q_samr_open_domain_info
633 {
634         POLICY_HND pol;   /* policy handle */
635         uint32 flags;               /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
636         DOM_SID2 dom_sid;         /* domain SID */
637
638 } SAMR_Q_OPEN_DOMAIN;
639
640
641 /* SAMR_R_OPEN_DOMAIN - probably an open */
642 typedef struct r_samr_open_domain_info
643 {
644         POLICY_HND domain_pol; /* policy handle associated with the SID */
645         NTSTATUS status;         /* return status */
646
647 } SAMR_R_OPEN_DOMAIN;
648
649 #define MAX_SAM_ENTRIES 0x400
650
651 typedef struct samr_entry_info
652 {
653         uint32 rid;
654         UNIHDR hdr_name;
655
656 } SAM_ENTRY;
657
658
659 /* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
660 typedef struct q_samr_enum_domains_info
661 {
662         POLICY_HND pol;     /* policy handle */
663
664         uint32 start_idx;   /* enumeration handle */
665         uint32 max_size;    /* 0x0000 ffff */
666
667 } SAMR_Q_ENUM_DOMAINS;
668
669 /* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
670 typedef struct r_samr_enum_domains_info
671 {
672         uint32 next_idx;     /* next starting index required for enum */
673         uint32 ptr_entries1;  
674
675         uint32 num_entries2;
676         uint32 ptr_entries2;
677
678         uint32 num_entries3;
679
680         SAM_ENTRY *sam;
681         UNISTR2 *uni_dom_name;
682
683         uint32 num_entries4;
684
685         NTSTATUS status;
686
687 } SAMR_R_ENUM_DOMAINS;
688
689 /* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
690 typedef struct q_samr_enum_dom_users_info
691 {
692         POLICY_HND pol;          /* policy handle */
693
694         uint32 start_idx;   /* number of values (0 indicates unlimited?) */
695         uint16 acb_mask;          /* 0x0000 indicates all */
696         uint16 unknown_1;         /* 0x0000 */
697
698         uint32 max_size;              /* 0x0000 ffff */
699
700 } SAMR_Q_ENUM_DOM_USERS;
701
702
703 /* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
704 typedef struct r_samr_enum_dom_users_info
705 {
706         uint32 next_idx;     /* next starting index required for enum */
707         uint32 ptr_entries1;  
708
709         uint32 num_entries2;
710         uint32 ptr_entries2;
711
712         uint32 num_entries3;
713
714         SAM_ENTRY *sam;
715         UNISTR2 *uni_acct_name;
716
717         uint32 num_entries4;
718
719         NTSTATUS status;
720
721 } SAMR_R_ENUM_DOM_USERS;
722
723
724 /* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
725 typedef struct q_samr_enum_dom_groups_info
726 {
727         POLICY_HND pol;          /* policy handle */
728
729         /* this is possibly an enumeration context handle... */
730         uint32 start_idx;         /* 0x0000 0000 */
731
732         uint32 max_size;              /* 0x0000 ffff */
733
734 } SAMR_Q_ENUM_DOM_GROUPS;
735
736
737 /* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
738 typedef struct r_samr_enum_dom_groups_info
739 {
740         uint32 next_idx;
741         uint32 ptr_entries1;
742
743         uint32 num_entries2;
744         uint32 ptr_entries2;
745
746         uint32 num_entries3;
747
748         SAM_ENTRY *sam;
749         UNISTR2 *uni_grp_name;
750
751         uint32 num_entries4;
752
753         NTSTATUS status;
754
755 } SAMR_R_ENUM_DOM_GROUPS;
756
757
758 /* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
759 typedef struct q_samr_enum_dom_aliases_info
760 {
761         POLICY_HND pol;          /* policy handle */
762
763         /* this is possibly an enumeration context handle... */
764         uint32 start_idx;         /* 0x0000 0000 */
765
766         uint32 max_size;              /* 0x0000 ffff */
767
768 } SAMR_Q_ENUM_DOM_ALIASES;
769
770
771 /* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
772 typedef struct r_samr_enum_dom_aliases_info
773 {
774         uint32 next_idx;
775         uint32 ptr_entries1;
776
777         uint32 num_entries2;
778         uint32 ptr_entries2;
779
780         uint32 num_entries3;
781
782         SAM_ENTRY *sam;
783         UNISTR2 *uni_grp_name;
784
785         uint32 num_entries4;
786
787         NTSTATUS status;
788
789 } SAMR_R_ENUM_DOM_ALIASES;
790
791
792 /* -- Level 1 Display Info - User Information -- */
793
794 typedef struct samr_entry_info1
795 {
796         uint32 user_idx;
797
798         uint32 rid_user;
799         uint16 acb_info;
800
801         UNIHDR hdr_acct_name;
802         UNIHDR hdr_user_name;
803         UNIHDR hdr_user_desc;
804
805 } SAM_ENTRY1;
806
807 typedef struct samr_str_entry_info1
808 {
809         UNISTR2 uni_acct_name;
810         UNISTR2 uni_full_name;
811         UNISTR2 uni_acct_desc;
812
813 } SAM_STR1;
814
815 typedef struct sam_entry_info_1
816 {
817         SAM_ENTRY1 *sam;
818         SAM_STR1   *str;
819
820 } SAM_DISPINFO_1;
821
822
823 /* -- Level 2 Display Info - Trust Account Information -- */
824
825 typedef struct samr_entry_info2
826 {
827         uint32 user_idx;
828
829         uint32 rid_user;
830         uint16 acb_info;
831
832         UNIHDR hdr_srv_name;
833         UNIHDR hdr_srv_desc;
834
835 } SAM_ENTRY2;
836
837 typedef struct samr_str_entry_info2
838 {
839         UNISTR2 uni_srv_name;
840         UNISTR2 uni_srv_desc;
841
842 } SAM_STR2;
843
844 typedef struct sam_entry_info_2
845 {
846         SAM_ENTRY2 *sam;
847         SAM_STR2   *str;
848
849 } SAM_DISPINFO_2;
850
851
852 /* -- Level 3 Display Info - Domain Group Information -- */
853
854 typedef struct samr_entry_info3
855 {
856         uint32 grp_idx;
857
858         uint32 rid_grp;
859         uint32 attr;     /* SE_GROUP_xxx, usually 7 */
860
861         UNIHDR hdr_grp_name;
862         UNIHDR hdr_grp_desc;
863
864 } SAM_ENTRY3;
865
866 typedef struct samr_str_entry_info3
867 {
868         UNISTR2 uni_grp_name;
869         UNISTR2 uni_grp_desc;
870
871 } SAM_STR3;
872
873 typedef struct sam_entry_info_3
874 {
875         SAM_ENTRY3 *sam;
876         SAM_STR3   *str;
877
878 } SAM_DISPINFO_3;
879
880
881 /* -- Level 4 Display Info - User List (ASCII) -- */
882
883 typedef struct samr_entry_info4
884 {
885         uint32 user_idx;
886         STRHDR hdr_acct_name;
887
888 } SAM_ENTRY4;
889
890 typedef struct samr_str_entry_info4
891 {
892         STRING2 acct_name;
893
894 } SAM_STR4;
895
896 typedef struct sam_entry_info_4
897 {
898         SAM_ENTRY4 *sam;
899         SAM_STR4   *str;
900
901 } SAM_DISPINFO_4;
902
903
904 /* -- Level 5 Display Info - Group List (ASCII) -- */
905
906 typedef struct samr_entry_info5
907 {
908         uint32 grp_idx;
909         STRHDR hdr_grp_name;
910
911 } SAM_ENTRY5;
912
913 typedef struct samr_str_entry_info5
914 {
915         STRING2 grp_name;
916
917 } SAM_STR5;
918
919 typedef struct sam_entry_info_5
920 {
921         SAM_ENTRY5 *sam;
922         SAM_STR5   *str;
923
924 } SAM_DISPINFO_5;
925
926
927 typedef struct sam_dispinfo_ctr_info
928 {
929         union
930         {
931                 SAM_DISPINFO_1 *info1; /* users/names/descriptions */
932                 SAM_DISPINFO_2 *info2; /* trust accounts */
933                 SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
934                 SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
935                 SAM_DISPINFO_5 *info5; /* group list (ASCII) */
936                 void       *info; /* allows assignment without typecasting, */
937
938         } sam;
939
940 } SAM_DISPINFO_CTR;
941
942
943 /* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
944 typedef struct q_samr_query_disp_info
945 {
946         POLICY_HND domain_pol;
947
948         uint16 switch_level;    /* see SAM_DISPINFO_CTR above */
949         /* align */
950
951         uint32 start_idx;       /* start enumeration index */
952         uint32 max_entries;     /* maximum number of entries to return */
953         uint32 max_size;        /* recommended data size; if exceeded server
954                                    should return STATUS_MORE_ENTRIES */
955
956 } SAMR_Q_QUERY_DISPINFO;
957
958
959 /* SAMR_R_QUERY_DISPINFO  */
960 typedef struct r_samr_query_dispinfo_info
961 {
962         uint32 total_size;     /* total data size for all matching entries
963                                   (0 = uncalculated) */
964         uint32 data_size;      /* actual data size returned = size of SAM_ENTRY
965                                   structures + total length of strings */
966
967         uint16 switch_level;   /* see SAM_DISPINFO_CTR above */
968         /* align */
969
970         uint32 num_entries;    /* number of entries returned */
971         uint32 ptr_entries;
972         uint32 num_entries2;
973
974         SAM_DISPINFO_CTR *ctr;
975
976         NTSTATUS status;
977
978 } SAMR_R_QUERY_DISPINFO;
979
980
981 /* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
982 typedef struct q_samr_delete_dom_group_info
983 {
984     POLICY_HND group_pol;          /* policy handle */
985
986 } SAMR_Q_DELETE_DOM_GROUP;
987
988
989 /* SAMR_R_DELETE_DOM_GROUP - delete domain group */
990 typedef struct r_samr_delete_dom_group_info
991 {
992         POLICY_HND pol;       /* policy handle */
993         NTSTATUS status;        /* return status */
994
995 } SAMR_R_DELETE_DOM_GROUP;
996
997
998 /* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
999 typedef struct q_samr_create_dom_group_info
1000 {
1001         POLICY_HND pol;        /* policy handle */
1002
1003         UNIHDR hdr_acct_desc;
1004         UNISTR2 uni_acct_desc;
1005
1006         uint32 access_mask;    
1007
1008 } SAMR_Q_CREATE_DOM_GROUP;
1009
1010 /* SAMR_R_CREATE_DOM_GROUP - SAM create group */
1011 typedef struct r_samr_create_dom_group_info
1012 {
1013         POLICY_HND pol;        /* policy handle */
1014
1015         uint32 rid;    
1016         NTSTATUS status;    
1017
1018 } SAMR_R_CREATE_DOM_GROUP;
1019
1020 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
1021 typedef struct q_samr_query_group_info
1022 {
1023         POLICY_HND pol;        /* policy handle */
1024
1025         uint16 switch_level;    /* 0x0001 seen */
1026
1027 } SAMR_Q_QUERY_GROUPINFO;
1028
1029 typedef struct samr_group_info1
1030 {
1031         UNIHDR hdr_acct_name;
1032
1033         uint32 unknown_1; /* 0x0000 0003 - number of group members? */
1034         uint32 num_members; /* 0x0000 0001 - number of group members? */
1035
1036         UNIHDR hdr_acct_desc;
1037
1038         UNISTR2 uni_acct_name;
1039         UNISTR2 uni_acct_desc;
1040
1041 } GROUP_INFO1;
1042
1043 typedef struct samr_group_info3
1044 {
1045         uint32 unknown_1; /* 0x0000 0003 - number of group members? */
1046
1047 } GROUP_INFO3;
1048
1049 typedef struct samr_group_info4
1050 {
1051         UNIHDR hdr_acct_desc;
1052         UNISTR2 uni_acct_desc;
1053
1054 } GROUP_INFO4;
1055
1056 /* GROUP_INFO_CTR */
1057 typedef struct group_info_ctr
1058 {
1059         uint16 switch_value1;
1060
1061         union
1062         {
1063                 GROUP_INFO1 info1;
1064                 GROUP_INFO3 info3;
1065                 GROUP_INFO4 info4;
1066
1067         } group;
1068
1069 } GROUP_INFO_CTR;
1070
1071 /* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
1072 typedef struct r_samr_query_groupinfo_info
1073 {
1074         uint32 ptr;        
1075         GROUP_INFO_CTR *ctr;
1076
1077         NTSTATUS status;
1078
1079 } SAMR_R_QUERY_GROUPINFO;
1080
1081
1082 /* SAMR_Q_SET_GROUPINFO - SAM Group Info */
1083 typedef struct q_samr_set_group_info
1084 {
1085         POLICY_HND pol;        /* policy handle */
1086         GROUP_INFO_CTR *ctr;
1087
1088 } SAMR_Q_SET_GROUPINFO;
1089
1090 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
1091 typedef struct r_samr_set_group_info
1092 {
1093         NTSTATUS status;
1094
1095 } SAMR_R_SET_GROUPINFO;
1096
1097
1098 /* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */
1099 typedef struct q_samr_delete_dom_alias_info
1100 {
1101     POLICY_HND alias_pol;          /* policy handle */
1102
1103 } SAMR_Q_DELETE_DOM_ALIAS;
1104
1105
1106 /* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */
1107 typedef struct r_samr_delete_dom_alias_info
1108 {
1109         POLICY_HND pol;       /* policy handle */
1110         NTSTATUS status;        /* return status */
1111
1112 } SAMR_R_DELETE_DOM_ALIAS;
1113
1114
1115 /* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */
1116 typedef struct q_samr_create_dom_alias_info
1117 {
1118         POLICY_HND dom_pol;        /* policy handle */
1119
1120         UNIHDR hdr_acct_desc;
1121         UNISTR2 uni_acct_desc;
1122
1123         uint32 access_mask;    /* 0x001f000f */
1124
1125 } SAMR_Q_CREATE_DOM_ALIAS;
1126
1127 /* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */
1128 typedef struct r_samr_create_dom_alias_info
1129 {
1130         POLICY_HND alias_pol;        /* policy handle */
1131
1132         uint32 rid;    
1133         NTSTATUS status;    
1134
1135 } SAMR_R_CREATE_DOM_ALIAS;
1136
1137 /* SAMR_Q_QUERY_ALIASINFO - SAM Alias Info */
1138 typedef struct q_samr_query_alias_info
1139 {
1140         POLICY_HND pol;        /* policy handle */
1141
1142         uint16 switch_level;    /* 0x0003 seen */
1143
1144 } SAMR_Q_QUERY_ALIASINFO;
1145
1146 typedef struct samr_alias_info1
1147 {
1148         UNIHDR hdr_acct_name;
1149         UNIHDR hdr_acct_desc;
1150         uint32 num_member;
1151         UNISTR2 uni_acct_name;
1152         UNISTR2 uni_acct_desc;
1153
1154 } ALIAS_INFO1;
1155
1156 typedef struct samr_alias_info3
1157 {
1158         UNIHDR hdr_acct_desc;
1159         UNISTR2 uni_acct_desc;
1160
1161 } ALIAS_INFO3;
1162
1163 /* ALIAS_INFO_CTR */
1164 typedef struct alias_info_ctr
1165 {
1166         uint16 switch_value1;
1167         uint16 switch_value2;
1168
1169         union
1170         {
1171                 ALIAS_INFO1 info1;
1172                 ALIAS_INFO3 info3;
1173
1174         } alias;
1175
1176 } ALIAS_INFO_CTR;
1177
1178 /* SAMR_R_QUERY_ALIASINFO - SAM alias info */
1179 typedef struct r_samr_query_aliasinfo_info
1180 {
1181         uint32 ptr;        
1182         ALIAS_INFO_CTR ctr;
1183
1184         NTSTATUS status;
1185
1186 } SAMR_R_QUERY_ALIASINFO;
1187
1188
1189 /* SAMR_Q_SET_ALIASINFO - SAM Alias Info */
1190 typedef struct q_samr_set_alias_info
1191 {
1192         POLICY_HND alias_pol;        /* policy handle */
1193         ALIAS_INFO_CTR ctr;
1194
1195 } SAMR_Q_SET_ALIASINFO;
1196
1197 /* SAMR_R_SET_ALIASINFO - SAM alias info */
1198 typedef struct r_samr_set_aliasinfo_info
1199 {
1200         NTSTATUS status;
1201
1202 } SAMR_R_SET_ALIASINFO;
1203
1204
1205 /* SAMR_Q_QUERY_USERGROUPS - */
1206 typedef struct q_samr_query_usergroup_info
1207 {
1208         POLICY_HND pol;          /* policy handle associated with unknown id */
1209
1210 } SAMR_Q_QUERY_USERGROUPS;
1211
1212 /* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
1213 typedef struct r_samr_query_usergroup_info
1214 {
1215         uint32 ptr_0;            /* pointer */
1216         uint32 num_entries;      /* number of RID groups */
1217         uint32 ptr_1;            /* pointer */
1218         uint32 num_entries2;     /* number of RID groups */
1219
1220         DOM_GID *gid; /* group info */
1221
1222         NTSTATUS status;         /* return status */
1223
1224 } SAMR_R_QUERY_USERGROUPS;
1225
1226 /* SAM_USERINFO_CTR - sam user info */
1227 typedef struct sam_userinfo_ctr_info
1228 {
1229         uint16 switch_value;      
1230
1231         union
1232         {
1233                 SAM_USER_INFO_10 *id10; /* auth-level 0x10 */
1234                 SAM_USER_INFO_11 *id11; /* auth-level 0x11 */
1235                 SAM_USER_INFO_12 *id12; /* auth-level 0x12 */
1236                 SAM_USER_INFO_20 *id20; /* auth-level 20 */
1237                 SAM_USER_INFO_21 *id21; /* auth-level 21 */
1238                 SAM_USER_INFO_23 *id23; /* auth-level 0x17 */
1239                 SAM_USER_INFO_24 *id24; /* auth-level 0x18 */
1240                 SAM_USER_INFO_25 *id25; /* auth-level 0x19 */
1241                 void* id; /* to make typecasting easy */
1242
1243         } info;
1244
1245 } SAM_USERINFO_CTR;
1246
1247
1248 /* SAMR_Q_SET_USERINFO2 - set sam info */
1249 typedef struct q_samr_set_user_info2
1250 {
1251         POLICY_HND pol;          /* policy handle associated with user */
1252         uint16 switch_value;      /* 0x0010 */
1253
1254         SAM_USERINFO_CTR *ctr;
1255
1256 } SAMR_Q_SET_USERINFO2;
1257
1258 /* SAMR_R_SET_USERINFO2 - set sam info */
1259 typedef struct r_samr_set_user_info2
1260 {
1261         NTSTATUS status;         /* return status */
1262
1263 } SAMR_R_SET_USERINFO2;
1264
1265 /* SAMR_Q_SET_USERINFO - set sam info */
1266 typedef struct q_samr_set_user_info
1267 {
1268         POLICY_HND pol;          /* policy handle associated with user */
1269         uint16 switch_value;
1270         SAM_USERINFO_CTR *ctr;
1271
1272 } SAMR_Q_SET_USERINFO;
1273
1274 /* SAMR_R_SET_USERINFO - set sam info */
1275 typedef struct r_samr_set_user_info
1276 {
1277         NTSTATUS status;         /* return status */
1278
1279 } SAMR_R_SET_USERINFO;
1280
1281
1282 /* SAMR_Q_QUERY_USERINFO - probably a get sam info */
1283 typedef struct q_samr_query_user_info
1284 {
1285         POLICY_HND pol;          /* policy handle associated with unknown id */
1286         uint16 switch_value;         /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */
1287
1288 } SAMR_Q_QUERY_USERINFO;
1289
1290 /* SAMR_R_QUERY_USERINFO - probably a get sam info */
1291 typedef struct r_samr_query_user_info
1292 {
1293         uint32 ptr;            /* pointer */
1294         SAM_USERINFO_CTR *ctr;
1295
1296         NTSTATUS status;         /* return status */
1297
1298 } SAMR_R_QUERY_USERINFO;
1299
1300
1301 /****************************************************************************
1302 SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.
1303
1304 the policy handle allocated by an "samr open secret" call is associated
1305 with a SID.  this policy handle is what is queried here, *not* the SID
1306 itself.  the response to the lookup rids is relative to this SID.
1307 *****************************************************************************/
1308 /* SAMR_Q_QUERY_USERALIASES */
1309 typedef struct q_samr_query_useraliases_info
1310 {
1311         POLICY_HND pol;       /* policy handle */
1312
1313         uint32 num_sids1;      /* number of rids being looked up */
1314         uint32 ptr;            /* buffer pointer */
1315         uint32 num_sids2;      /* number of rids being looked up */
1316
1317         uint32   *ptr_sid; /* pointers to sids to be looked up */
1318         DOM_SID2 *sid    ; /* sids to be looked up. */
1319
1320 } SAMR_Q_QUERY_USERALIASES;
1321
1322
1323 /* SAMR_R_QUERY_USERALIASES */
1324 typedef struct r_samr_query_useraliases_info
1325 {
1326         uint32 num_entries;
1327         uint32 ptr; /* undocumented buffer pointer */
1328
1329         uint32 num_entries2; 
1330         uint32 *rid; /* domain RIDs being looked up */
1331
1332         NTSTATUS status; /* return code */
1333
1334 } SAMR_R_QUERY_USERALIASES;
1335
1336
1337 /****************************************************************************
1338 SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
1339 *****************************************************************************/
1340 /* SAMR_Q_LOOKUP_NAMES */
1341 typedef struct q_samr_lookup_names_info
1342 {
1343         POLICY_HND pol;       /* policy handle */
1344
1345         uint32 num_names1;      /* number of names being looked up */
1346         uint32 flags;           /* 0x0000 03e8 - unknown */
1347         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1348         uint32 num_names2;      /* number of names being looked up */
1349
1350         UNIHDR  *hdr_name; /* unicode account name header */
1351         UNISTR2 *uni_name; /* unicode account name string */
1352
1353 } SAMR_Q_LOOKUP_NAMES;
1354
1355
1356 /* SAMR_R_LOOKUP_NAMES */
1357 typedef struct r_samr_lookup_names_info
1358 {
1359         uint32 num_rids1;      /* number of aliases being looked up */
1360         uint32 ptr_rids;       /* pointer to aliases */
1361         uint32 num_rids2;      /* number of aliases being looked up */
1362
1363         uint32 *rids; /* rids */
1364
1365         uint32 num_types1;      /* number of users in aliases being looked up */
1366         uint32 ptr_types;       /* pointer to users in aliases */
1367         uint32 num_types2;      /* number of users in aliases being looked up */
1368
1369         uint32 *types; /* SID_ENUM type */
1370
1371         NTSTATUS status; /* return code */
1372
1373 } SAMR_R_LOOKUP_NAMES;
1374
1375
1376 /****************************************************************************
1377 SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
1378
1379 called to resolve domain RID groups.
1380 *****************************************************************************/
1381 /* SAMR_Q_LOOKUP_RIDS */
1382 typedef struct q_samr_lookup_rids_info
1383 {
1384         POLICY_HND pol;       /* policy handle */
1385
1386         uint32 num_rids1;      /* number of rids being looked up */
1387         uint32 flags;          /* 0x0000 03e8 - unknown */
1388         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1389         uint32 num_rids2;      /* number of rids being looked up */
1390
1391         uint32 *rid; /* domain RIDs being looked up */
1392
1393 } SAMR_Q_LOOKUP_RIDS;
1394
1395
1396 /****************************************************************************
1397 SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names
1398
1399 *****************************************************************************/
1400 /* SAMR_R_LOOKUP_RIDS */
1401 typedef struct r_samr_lookup_rids_info
1402 {
1403         uint32 num_names1;      /* number of aliases being looked up */
1404         uint32 ptr_names;       /* pointer to aliases */
1405         uint32 num_names2;      /* number of aliases being looked up */
1406
1407         UNIHDR  *hdr_name; /* unicode account name header */
1408         UNISTR2 *uni_name; /* unicode account name string */
1409
1410         uint32 num_types1;      /* number of users in aliases being looked up */
1411         uint32 ptr_types;       /* pointer to users in aliases */
1412         uint32 num_types2;      /* number of users in aliases being looked up */
1413
1414         uint32 *type; /* SID_ENUM type */
1415
1416         NTSTATUS status;
1417
1418 } SAMR_R_LOOKUP_RIDS;
1419
1420
1421 /* SAMR_Q_OPEN_USER - probably an open */
1422 typedef struct q_samr_open_user_info
1423 {
1424         POLICY_HND domain_pol;       /* policy handle */
1425         uint32 access_mask;     /* 32 bit unknown - 0x02011b */
1426         uint32 user_rid;      /* user RID */
1427
1428 } SAMR_Q_OPEN_USER;
1429
1430
1431 /* SAMR_R_OPEN_USER - probably an open */
1432 typedef struct r_samr_open_user_info
1433 {
1434         POLICY_HND user_pol;       /* policy handle associated with unknown id */
1435         NTSTATUS status;         /* return status */
1436
1437 } SAMR_R_OPEN_USER;
1438
1439
1440 /* SAMR_Q_CREATE_USER - probably a create */
1441 typedef struct q_samr_create_user_info
1442 {
1443         POLICY_HND domain_pol;       /* policy handle */
1444
1445         UNIHDR  hdr_name;       /* unicode account name header */
1446         UNISTR2 uni_name;       /* unicode account name */
1447
1448         uint32 acb_info;      /* account control info */
1449         uint32 access_mask;     /* 0xe005 00b0 */
1450
1451 } SAMR_Q_CREATE_USER;
1452
1453
1454 /* SAMR_R_CREATE_USER - probably a create */
1455 typedef struct r_samr_create_user_info
1456 {
1457         POLICY_HND user_pol;       /* policy handle associated with user */
1458
1459         uint32 unknown_0;     /* 0x0007 03ff */
1460         uint32 user_rid;      /* user RID */
1461         NTSTATUS status;         /* return status */
1462
1463 } SAMR_R_CREATE_USER;
1464
1465
1466 /* SAMR_Q_DELETE_DOM_USER - delete domain user */
1467 typedef struct q_samr_delete_dom_user_info
1468 {
1469     POLICY_HND user_pol;          /* policy handle */
1470
1471 } SAMR_Q_DELETE_DOM_USER;
1472
1473
1474 /* SAMR_R_DELETE_DOM_USER - delete domain user */
1475 typedef struct r_samr_delete_dom_user_info
1476 {
1477         POLICY_HND pol;       /* policy handle */
1478         NTSTATUS status;        /* return status */
1479
1480 } SAMR_R_DELETE_DOM_USER;
1481
1482
1483 /* SAMR_Q_QUERY_GROUPMEM - query group members */
1484 typedef struct q_samr_query_groupmem_info
1485 {
1486         POLICY_HND group_pol;        /* policy handle */
1487
1488 } SAMR_Q_QUERY_GROUPMEM;
1489
1490
1491 /* SAMR_R_QUERY_GROUPMEM - query group members */
1492 typedef struct r_samr_query_groupmem_info
1493 {
1494         uint32 ptr;
1495         uint32 num_entries;
1496
1497         uint32 ptr_rids;
1498         uint32 ptr_attrs;
1499
1500         uint32 num_rids;
1501         uint32 *rid;
1502
1503         uint32 num_attrs;
1504         uint32 *attr;
1505
1506         NTSTATUS status;
1507
1508 } SAMR_R_QUERY_GROUPMEM;
1509
1510
1511 /* SAMR_Q_DEL_GROUPMEM - probably an del group member */
1512 typedef struct q_samr_del_group_mem_info
1513 {
1514         POLICY_HND pol;       /* policy handle */
1515         uint32 rid;         /* rid */
1516
1517 } SAMR_Q_DEL_GROUPMEM;
1518
1519
1520 /* SAMR_R_DEL_GROUPMEM - probably an del group member */
1521 typedef struct r_samr_del_group_mem_info
1522 {
1523         NTSTATUS status;         /* return status */
1524
1525 } SAMR_R_DEL_GROUPMEM;
1526
1527
1528 /* SAMR_Q_ADD_GROUPMEM - probably an add group member */
1529 typedef struct q_samr_add_group_mem_info
1530 {
1531         POLICY_HND pol;       /* policy handle */
1532
1533         uint32 rid;         /* rid */
1534         uint32 unknown;     /* 0x0000 0005 */
1535
1536 } SAMR_Q_ADD_GROUPMEM;
1537
1538
1539 /* SAMR_R_ADD_GROUPMEM - probably an add group member */
1540 typedef struct r_samr_add_group_mem_info
1541 {
1542         NTSTATUS status;         /* return status */
1543
1544 } SAMR_R_ADD_GROUPMEM;
1545
1546
1547 /* SAMR_Q_OPEN_GROUP - probably an open */
1548 typedef struct q_samr_open_group_info
1549 {
1550         POLICY_HND domain_pol;       /* policy handle */
1551         uint32 access_mask;         /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
1552         uint32 rid_group;        /* rid */
1553
1554 } SAMR_Q_OPEN_GROUP;
1555
1556
1557 /* SAMR_R_OPEN_GROUP - probably an open */
1558 typedef struct r_samr_open_group_info
1559 {
1560         POLICY_HND pol;       /* policy handle */
1561         NTSTATUS status;         /* return status */
1562
1563 } SAMR_R_OPEN_GROUP;
1564
1565
1566 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
1567 typedef struct q_samr_query_aliasmem_info
1568 {
1569         POLICY_HND alias_pol;        /* policy handle */
1570
1571 } SAMR_Q_QUERY_ALIASMEM;
1572
1573
1574 /* SAMR_R_QUERY_ALIASMEM - query alias members */
1575 typedef struct r_samr_query_aliasmem_info
1576 {
1577         uint32 num_sids;
1578         uint32 ptr;
1579         uint32 num_sids1;
1580
1581         DOM_SID2 *sid;
1582
1583         NTSTATUS status;
1584
1585 } SAMR_R_QUERY_ALIASMEM;
1586
1587
1588 /* SAMR_Q_ADD_ALIASMEM - add alias member */
1589 typedef struct q_samr_add_alias_mem_info
1590 {
1591         POLICY_HND alias_pol;       /* policy handle */
1592
1593         DOM_SID2 sid; /* member sid to be added to the alias */
1594
1595 } SAMR_Q_ADD_ALIASMEM;
1596
1597
1598 /* SAMR_R_ADD_ALIASMEM - add alias member */
1599 typedef struct r_samr_add_alias_mem_info
1600 {
1601         NTSTATUS status;         /* return status */
1602
1603 } SAMR_R_ADD_ALIASMEM;
1604
1605
1606 /* SAMR_Q_DEL_ALIASMEM - add an add alias member */
1607 typedef struct q_samr_del_alias_mem_info
1608 {
1609         POLICY_HND alias_pol;       /* policy handle */
1610
1611         DOM_SID2 sid; /* member sid to be added to alias */
1612
1613 } SAMR_Q_DEL_ALIASMEM;
1614
1615
1616 /* SAMR_R_DEL_ALIASMEM - delete alias member */
1617 typedef struct r_samr_del_alias_mem_info
1618 {
1619         NTSTATUS status;         /* return status */
1620
1621 } SAMR_R_DEL_ALIASMEM;
1622
1623
1624
1625 /* SAMR_Q_OPEN_ALIAS - probably an open */
1626 typedef struct q_samr_open_alias_info
1627 {
1628         POLICY_HND dom_pol;
1629
1630         uint32 access_mask;         
1631         uint32 rid_alias;
1632
1633 } SAMR_Q_OPEN_ALIAS;
1634
1635
1636 /* SAMR_R_OPEN_ALIAS - probably an open */
1637 typedef struct r_samr_open_alias_info
1638 {
1639         POLICY_HND pol;       /* policy handle */
1640         NTSTATUS status;         /* return status */
1641
1642 } SAMR_R_OPEN_ALIAS;
1643
1644
1645 /* SAMR_Q_CONNECT_ANON - probably an open */
1646 typedef struct q_samr_connect_anon_info
1647 {
1648         uint32 ptr;                  /* ptr? */
1649         uint16 unknown_0;            /* 0x005c */
1650         uint16 unknown_1;            /* 0x0001 */
1651         uint32 access_mask;
1652
1653 } SAMR_Q_CONNECT_ANON;
1654
1655 /* SAMR_R_CONNECT_ANON - probably an open */
1656 typedef struct r_samr_connect_anon_info
1657 {
1658         POLICY_HND connect_pol;       /* policy handle */
1659         NTSTATUS status;         /* return status */
1660
1661 } SAMR_R_CONNECT_ANON;
1662
1663 /* SAMR_Q_CONNECT - probably an open */
1664 typedef struct q_samr_connect_info
1665 {
1666         uint32 ptr_srv_name;         /* pointer (to server name?) */
1667         UNISTR2 uni_srv_name;        /* unicode server name starting with '\\' */
1668
1669         uint32 access_mask;            
1670
1671 } SAMR_Q_CONNECT;
1672
1673
1674 /* SAMR_R_CONNECT - probably an open */
1675 typedef struct r_samr_connect_info
1676 {
1677     POLICY_HND connect_pol;       /* policy handle */
1678         NTSTATUS status;         /* return status */
1679
1680 } SAMR_R_CONNECT;
1681
1682 /* SAMR_Q_GET_DOM_PWINFO */
1683 typedef struct q_samr_get_dom_pwinfo
1684 {
1685         uint32 ptr; 
1686         UNIHDR  hdr_srv_name;
1687         UNISTR2 uni_srv_name;
1688
1689 } SAMR_Q_GET_DOM_PWINFO;
1690
1691 /* SAMR_R_GET_DOM_PWINFO */
1692 typedef struct r_samr_get_dom_pwinfo
1693 {
1694         uint16 unk_0;
1695         uint16 unk_1;
1696         uint16 unk_2;
1697         NTSTATUS status;
1698
1699 } SAMR_R_GET_DOM_PWINFO;
1700
1701 /* SAMR_ENC_PASSWD */
1702 typedef struct enc_passwd_info
1703 {
1704         uint32 ptr;
1705         uint8 pass[516];
1706
1707 } SAMR_ENC_PASSWD;
1708
1709 /* SAMR_ENC_HASH */
1710 typedef struct enc_hash_info
1711 {
1712         uint32 ptr;
1713         uint8 hash[16];
1714
1715 } SAMR_ENC_HASH;
1716
1717 /* SAMR_Q_CHGPASSWD_USER */
1718 typedef struct q_samr_chgpasswd_user_info
1719 {
1720         uint32 ptr_0;
1721
1722         UNIHDR hdr_dest_host; /* server name unicode header */
1723         UNISTR2 uni_dest_host; /* server name unicode string */
1724
1725         UNIHDR hdr_user_name;    /* username unicode string header */
1726         UNISTR2 uni_user_name;    /* username unicode string */
1727
1728         SAMR_ENC_PASSWD nt_newpass;
1729         SAMR_ENC_HASH nt_oldhash;
1730
1731         uint32 unknown; /* 0x0000 0001 */
1732
1733         SAMR_ENC_PASSWD lm_newpass;
1734         SAMR_ENC_HASH lm_oldhash;
1735
1736 } SAMR_Q_CHGPASSWD_USER;
1737
1738 /* SAMR_R_CHGPASSWD_USER */
1739 typedef struct r_samr_chgpasswd_user_info
1740 {
1741         NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1742
1743 } SAMR_R_CHGPASSWD_USER;
1744
1745
1746 /* SAMR_Q_UNKNOWN_2D */
1747 typedef struct q_samr_unknown_2d_info
1748 {
1749         POLICY_HND dom_pol;   /* policy handle */
1750         DOM_SID2 sid;         /* SID */
1751
1752 } SAMR_Q_UNKNOWN_2D;
1753
1754
1755 /* SAMR_R_UNKNOWN_2D - probably an open */
1756 typedef struct r_samr_unknown_2d_info
1757 {
1758         NTSTATUS status;         /* return status */
1759
1760 } SAMR_R_UNKNOWN_2D;
1761
1762
1763
1764 /* these are from the old rpc_samr.h - they are needed while the merge
1765    is still going on */
1766 #define MAX_SAM_SIDS 15
1767
1768 /* DOM_SID3 - security id */
1769 typedef struct sid_info_3
1770 {
1771         uint16 len; /* length, bytes, including length of len :-) */
1772         /* uint8  pad[2]; */
1773         
1774         DOM_SID sid;
1775
1776 } DOM_SID3;
1777
1778 /* SAMR_Q_UNKNOWN_2E */
1779 typedef struct q_samr_unknown_2e_info
1780 {
1781         POLICY_HND domain_pol;   /* policy handle */
1782         uint16 switch_value;
1783
1784 } SAMR_Q_UNKNOWN_2E;
1785
1786 /* SAMR_R_UNKNOWN_2E */
1787 typedef struct r_samr_unknown_2e_info
1788 {
1789         uint32 ptr_0;
1790         uint16 switch_value;
1791         SAM_UNK_CTR *ctr;
1792         NTSTATUS status;         /* return status */
1793
1794 } SAMR_R_UNKNOWN_2E;
1795
1796 /* SAMR_Q_SET_DOMAIN_INFO */
1797 typedef struct q_samr_set_domain_info
1798 {
1799         POLICY_HND domain_pol;   /* policy handle */
1800         uint16 switch_value0;
1801         uint16 switch_value;
1802         SAM_UNK_CTR *ctr;
1803
1804 } SAMR_Q_SET_DOMAIN_INFO;
1805
1806 /* SAMR_R_SET_DOMAIN_INFO */
1807 typedef struct r_samr_set_domain_info
1808 {
1809         NTSTATUS status;         /* return status */
1810
1811 } SAMR_R_SET_DOMAIN_INFO;
1812
1813
1814 #endif /* _RPC_SAMR_H */
1815