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