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