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