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