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