r15441: cleanup older unused padding.
[sfrench/samba-autobuild/.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) 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_CHGPASSWD_USER3   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 /* SAM_USER_INFO_26 */
281 typedef struct sam_user_info_26
282 {
283         uint8 pass[532];
284         uint8 pw_len;
285 } SAM_USER_INFO_26;
286
287
288 /* SAM_USER_INFO_21 */
289 typedef struct sam_user_info_21
290 {
291         NTTIME logon_time;            /* logon time */
292         NTTIME logoff_time;           /* logoff time */
293         NTTIME kickoff_time;          /* kickoff time */
294         NTTIME pass_last_set_time;    /* password last set time */
295         NTTIME pass_can_change_time;  /* password can change time */
296         NTTIME pass_must_change_time; /* password must change time */
297
298         UNIHDR hdr_user_name;    /* username unicode string header */
299         UNIHDR hdr_full_name;    /* user's full name unicode string header */
300         UNIHDR hdr_home_dir;     /* home directory unicode string header */
301         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
302         UNIHDR hdr_logon_script; /* logon script unicode string header */
303         UNIHDR hdr_profile_path; /* profile path unicode string header */
304         UNIHDR hdr_acct_desc  ;  /* user description */
305         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
306         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
307         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
308
309         uint8 lm_pwd[16];    /* lm user passwords */
310         uint8 nt_pwd[16];    /* nt user passwords */
311
312         uint32 user_rid;      /* Primary User ID */
313         uint32 group_rid;     /* Primary Group ID */
314
315         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
316
317         /* Was unknown_3 */
318         uint32 fields_present; /* 0x00ff ffff */
319
320         uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
321         /* uint8 pad[2] */
322         uint32 ptr_logon_hrs; /* unknown pointer */
323
324         /* Was unknown_5. */
325         uint16 bad_password_count;
326         uint16 logon_count;
327
328         uint8 padding1[6];
329                 
330         uint8 passmustchange; /* 0x00 must change = 0x01 */
331
332         uint8 padding2;
333
334         UNISTR2 uni_user_name;    /* username unicode string */
335         UNISTR2 uni_full_name;    /* user's full name unicode string */
336         UNISTR2 uni_home_dir;     /* home directory unicode string */
337         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
338         UNISTR2 uni_logon_script; /* logon script unicode string */
339         UNISTR2 uni_profile_path; /* profile path unicode string */
340         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
341         UNISTR2 uni_workstations; /* login from workstations unicode string */
342         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
343         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
344
345         LOGON_HRS logon_hrs;
346
347 } SAM_USER_INFO_21;
348
349 #define PASS_MUST_CHANGE_AT_NEXT_LOGON  0x01
350 #define PASS_DONT_CHANGE_AT_NEXT_LOGON  0x00
351
352 /* SAM_USER_INFO_20 */
353 typedef struct sam_user_info_20
354 {
355         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
356
357         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
358
359 } SAM_USER_INFO_20;
360
361 /* SAM_USER_INFO_18 */
362 typedef struct sam_user_info_18
363 {
364         uint8 lm_pwd[16];    /* lm user passwords */
365         uint8 nt_pwd[16];    /* nt user passwords */
366
367         uint8 lm_pwd_active; 
368         uint8 nt_pwd_active; 
369
370 } SAM_USER_INFO_18;
371
372 /* SAM_USER_INFO_17 */
373 typedef struct sam_user_info_17
374 {
375         uint8  padding_0[16];  /* 0 - padding 16 bytes */
376         NTTIME expiry;         /* expiry time or something? */
377         uint8  padding_1[24];  /* 0 - padding 24 bytes */
378
379         UNIHDR hdr_mach_acct;  /* unicode header for machine account */
380         uint32 padding_2;      /* 0 - padding 4 bytes */
381
382         uint32 ptr_1;          /* pointer */
383         uint8  padding_3[32];  /* 0 - padding 32 bytes */
384         uint32 padding_4;      /* 0 - padding 4 bytes */
385
386         uint32 ptr_2;          /* pointer */
387         uint32 padding_5;      /* 0 - padding 4 bytes */
388
389         uint32 ptr_3;          /* pointer */
390         uint8  padding_6[32];  /* 0 - padding 32 bytes */
391
392         uint32 rid_user;       /* user RID */
393         uint32 rid_group;      /* group RID */
394
395         uint16 acct_ctrl;      /* 0080 - ACB_XXXX */
396         uint16 unknown_3;      /* 16 bit padding */
397
398         uint16 unknown_4;      /* 0x003f      - 16 bit unknown */
399         uint16 unknown_5;      /* 0x003c      - 16 bit unknown */
400
401         uint8  padding_7[16];  /* 0 - padding 16 bytes */
402         uint32 padding_8;      /* 0 - padding 4 bytes */
403         
404         UNISTR2 uni_mach_acct; /* unicode string for machine account */
405
406         uint8  padding_9[48];  /* 0 - padding 48 bytes */
407
408 } SAM_USER_INFO_17;
409
410
411 /* SAM_USER_INFO_16 */
412 typedef struct sam_user_info_16
413 {
414         uint32 acb_info;
415
416 } SAM_USER_INFO_16;
417
418
419 /* SAM_USER_INFO_7 */
420 typedef struct sam_user_info_7
421 {
422         UNIHDR hdr_name;  /* unicode header for name */
423         UNISTR2 uni_name; /* unicode string for name */
424
425 } SAM_USER_INFO_7;
426
427
428 /* SAM_USER_INFO_9 */
429 typedef struct sam_user_info_9
430 {
431         uint32 rid_group;     /* Primary Group RID */
432 } SAM_USER_INFO_9;
433
434
435 /* SAMR_Q_CLOSE_HND - probably a policy handle close */
436 typedef struct q_samr_close_hnd_info
437 {
438     POLICY_HND pol;          /* policy handle */
439
440 } SAMR_Q_CLOSE_HND;
441
442
443 /* SAMR_R_CLOSE_HND - probably a policy handle close */
444 typedef struct r_samr_close_hnd_info
445 {
446         POLICY_HND pol;       /* policy handle */
447         NTSTATUS status;         /* return status */
448
449 } SAMR_R_CLOSE_HND;
450
451
452 /****************************************************************************
453 SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this
454 *****************************************************************************/
455
456 /* SAMR_Q_GET_USRDOM_PWINFO */
457 typedef struct q_samr_usrdom_pwinfo_info
458 {
459         POLICY_HND user_pol;          /* policy handle */
460
461 } SAMR_Q_GET_USRDOM_PWINFO;
462
463
464 /****************************************************************************
465 SAMR_R_GET_USRDOM_PWINFO - a "set user info" occurs just after this
466 *****************************************************************************/
467
468 /* SAMR_R_GET_USRDOM_PWINFO */
469 typedef struct r_samr_usrdom_pwinfo_info
470 {
471         uint16 min_pwd_length;
472         uint16 unknown_1; /* 0x0016 or 0x0015 */
473         uint32 password_properties;
474         NTSTATUS status; 
475
476 } SAMR_R_GET_USRDOM_PWINFO;
477
478 /****************************************************************************
479 SAMR_Q_SET_SEC_OBJ - info level 4.
480 *****************************************************************************/
481
482 /* SAMR_Q_SET_SEC_OBJ - */
483 typedef struct q_samr_set_sec_obj_info
484 {
485         POLICY_HND pol;          /* policy handle */
486         uint32 sec_info;         /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
487         SEC_DESC_BUF *buf;
488
489 } SAMR_Q_SET_SEC_OBJ;
490
491 /* SAMR_R_SET_SEC_OBJ - */
492 typedef struct r_samr_set_sec_obj_info
493 {
494         NTSTATUS status;         /* return status */
495
496 } SAMR_R_SET_SEC_OBJ;
497
498
499 /****************************************************************************
500 SAMR_Q_QUERY_SEC_OBJ - info level 4.  returns SIDs.
501 *****************************************************************************/
502
503 /* SAMR_Q_QUERY_SEC_OBJ - probably get domain info... */
504 typedef struct q_samr_query_sec_obj_info
505 {
506         POLICY_HND user_pol;          /* policy handle */
507         uint32 sec_info;     /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
508
509 } SAMR_Q_QUERY_SEC_OBJ;
510
511 /* SAMR_R_QUERY_SEC_OBJ - probably an open */
512 typedef struct r_samr_query_sec_obj_info
513 {
514         uint32 ptr;
515         SEC_DESC_BUF *buf;
516
517         NTSTATUS status;         /* return status */
518
519 } SAMR_R_QUERY_SEC_OBJ;
520
521
522 /****************************************************************************
523 SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
524 *****************************************************************************/
525
526 /* SAMR_Q_QUERY_DOMAIN_INFO - */
527 typedef struct q_samr_query_domain_info
528 {
529         POLICY_HND domain_pol;   /* policy handle */
530         uint16 switch_value;     /* 0x0002, 0x0001 */
531
532 } SAMR_Q_QUERY_DOMAIN_INFO;
533
534 typedef struct sam_unknown_info_3_info
535 {
536         NTTIME logout;  
537         /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
538
539         /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
540
541 } SAM_UNK_INFO_3;
542
543 typedef struct sam_unknown_info_6_info
544 {
545         uint32 unknown_0; /* 0x0000 0000 */
546
547         uint32 ptr_0;     /* pointer to unknown structure */
548         uint8  padding[12]; /* 12 bytes zeros */
549
550 } SAM_UNK_INFO_6;
551
552 typedef struct sam_unknown_info_7_info
553 {
554         uint16 server_role;
555
556 } SAM_UNK_INFO_7;
557
558 typedef struct sam_unknown_info_8_info
559 {
560         UINT64_S seq_num;
561         NTTIME domain_create_time;
562
563 } SAM_UNK_INFO_8;
564
565 typedef struct sam_unknown_info_12_inf
566 {
567         NTTIME duration;
568         NTTIME reset_count;
569         uint16 bad_attempt_lockout;
570
571 } SAM_UNK_INFO_12;
572
573 typedef struct sam_unknown_info_5_inf
574 {
575         UNIHDR hdr_domain; /* domain name unicode header */
576         UNISTR2 uni_domain; /* domain name unicode string */
577
578 } SAM_UNK_INFO_5;
579
580 typedef struct sam_unknown_info_2_inf
581 {
582         NTTIME logout; /* whether users are forcibly disconnected when logon hours expire */
583         UNIHDR hdr_comment; /* comment according to samba4 idl */
584         UNIHDR hdr_domain; /* domain name unicode header */
585         UNIHDR hdr_server; /* server name unicode header */
586
587         /* put all the data in here, at the moment, including what the above
588            pointer is referring to
589          */
590
591         UINT64_S seq_num;
592         
593         uint32 unknown_4; /* 0x0000 0001 */
594         uint32 server_role;
595         uint32 unknown_6; /* 0x0000 0001 */
596         uint32 num_domain_usrs; /* number of users in domain */
597         uint32 num_domain_grps; /* number of domain groups in domain */
598         uint32 num_local_grps; /* number of local groups in domain */
599
600         UNISTR2 uni_comment; /* comment unicode string */
601         UNISTR2 uni_domain; /* domain name unicode string */
602         UNISTR2 uni_server; /* server name unicode string */
603
604 } SAM_UNK_INFO_2;
605
606 typedef struct sam_unknown_info_1_inf
607 {
608         uint16 min_length_password;
609         uint16 password_history;
610         uint32 password_properties;
611         NTTIME expire;
612         NTTIME min_passwordage;
613
614 } SAM_UNK_INFO_1;
615
616
617 typedef struct sam_unknown_ctr_info
618 {
619         union
620         {
621                 SAM_UNK_INFO_1 inf1;
622                 SAM_UNK_INFO_2 inf2;
623                 SAM_UNK_INFO_3 inf3;
624                 SAM_UNK_INFO_5 inf5;
625                 SAM_UNK_INFO_6 inf6;
626                 SAM_UNK_INFO_7 inf7;
627                 SAM_UNK_INFO_8 inf8;
628                 SAM_UNK_INFO_12 inf12;
629
630         } info;
631
632 } SAM_UNK_CTR;
633
634
635 /* SAMR_R_QUERY_DOMAIN_INFO - */
636 typedef struct r_samr_query_domain_info
637 {
638         uint32 ptr_0;
639         uint16 switch_value; /* same as in query */
640
641         SAM_UNK_CTR *ctr;
642
643         NTSTATUS status;         /* return status */
644
645 } SAMR_R_QUERY_DOMAIN_INFO;
646
647
648 /* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
649 typedef struct q_samr_lookup_domain_info
650 {
651         POLICY_HND connect_pol;
652
653         UNIHDR  hdr_domain;
654         UNISTR2 uni_domain;
655
656 } SAMR_Q_LOOKUP_DOMAIN;
657
658
659 /* SAMR_R_LOOKUP_DOMAIN */
660 typedef struct r_samr_lookup_domain_info
661 {
662         uint32   ptr_sid;
663         DOM_SID2 dom_sid;
664
665         NTSTATUS status;
666
667 } SAMR_R_LOOKUP_DOMAIN;
668
669
670 /****************************************************************************
671 SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
672
673 0x0000 03f1 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
674 0x0000 0200 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
675 *****************************************************************************/
676
677 /* SAMR_Q_OPEN_DOMAIN */
678 typedef struct q_samr_open_domain_info
679 {
680         POLICY_HND pol;   /* policy handle */
681         uint32 flags;               /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
682         DOM_SID2 dom_sid;         /* domain SID */
683
684 } SAMR_Q_OPEN_DOMAIN;
685
686
687 /* SAMR_R_OPEN_DOMAIN - probably an open */
688 typedef struct r_samr_open_domain_info
689 {
690         POLICY_HND domain_pol; /* policy handle associated with the SID */
691         NTSTATUS status;         /* return status */
692
693 } SAMR_R_OPEN_DOMAIN;
694
695 #define MAX_SAM_ENTRIES_W2K 0x400
696 #define MAX_SAM_ENTRIES_W95 50
697 /* The following should be the greater of the preceeding two. */
698 #define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K
699
700 typedef struct samr_entry_info
701 {
702         uint32 rid;
703         UNIHDR hdr_name;
704
705 } SAM_ENTRY;
706
707
708 /* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
709 typedef struct q_samr_enum_domains_info
710 {
711         POLICY_HND pol;     /* policy handle */
712
713         uint32 start_idx;   /* enumeration handle */
714         uint32 max_size;    /* 0x0000 ffff */
715
716 } SAMR_Q_ENUM_DOMAINS;
717
718 /* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
719 typedef struct r_samr_enum_domains_info
720 {
721         uint32 next_idx;     /* next starting index required for enum */
722         uint32 ptr_entries1;  
723
724         uint32 num_entries2;
725         uint32 ptr_entries2;
726
727         uint32 num_entries3;
728
729         SAM_ENTRY *sam;
730         UNISTR2 *uni_dom_name;
731
732         uint32 num_entries4;
733
734         NTSTATUS status;
735
736 } SAMR_R_ENUM_DOMAINS;
737
738 /* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
739 typedef struct q_samr_enum_dom_users_info
740 {
741         POLICY_HND pol;          /* policy handle */
742
743         uint32 start_idx;   /* number of values (0 indicates unlimited?) */
744         uint32 acb_mask;          /* 0x0000 indicates all */
745
746         uint32 max_size;              /* 0x0000 ffff */
747
748 } SAMR_Q_ENUM_DOM_USERS;
749
750
751 /* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
752 typedef struct r_samr_enum_dom_users_info
753 {
754         uint32 next_idx;     /* next starting index required for enum */
755         uint32 ptr_entries1;  
756
757         uint32 num_entries2;
758         uint32 ptr_entries2;
759
760         uint32 num_entries3;
761
762         SAM_ENTRY *sam;
763         UNISTR2 *uni_acct_name;
764
765         uint32 num_entries4;
766
767         NTSTATUS status;
768
769 } SAMR_R_ENUM_DOM_USERS;
770
771
772 /* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
773 typedef struct q_samr_enum_dom_groups_info
774 {
775         POLICY_HND pol;          /* policy handle */
776
777         /* this is possibly an enumeration context handle... */
778         uint32 start_idx;         /* 0x0000 0000 */
779
780         uint32 max_size;              /* 0x0000 ffff */
781
782 } SAMR_Q_ENUM_DOM_GROUPS;
783
784
785 /* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
786 typedef struct r_samr_enum_dom_groups_info
787 {
788         uint32 next_idx;
789         uint32 ptr_entries1;
790
791         uint32 num_entries2;
792         uint32 ptr_entries2;
793
794         uint32 num_entries3;
795
796         SAM_ENTRY *sam;
797         UNISTR2 *uni_grp_name;
798
799         uint32 num_entries4;
800
801         NTSTATUS status;
802
803 } SAMR_R_ENUM_DOM_GROUPS;
804
805
806 /* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
807 typedef struct q_samr_enum_dom_aliases_info
808 {
809         POLICY_HND pol;          /* policy handle */
810
811         /* this is possibly an enumeration context handle... */
812         uint32 start_idx;         /* 0x0000 0000 */
813
814         uint32 max_size;              /* 0x0000 ffff */
815
816 } SAMR_Q_ENUM_DOM_ALIASES;
817
818
819 /* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
820 typedef struct r_samr_enum_dom_aliases_info
821 {
822         uint32 next_idx;
823         uint32 ptr_entries1;
824
825         uint32 num_entries2;
826         uint32 ptr_entries2;
827
828         uint32 num_entries3;
829
830         SAM_ENTRY *sam;
831         UNISTR2 *uni_grp_name;
832
833         uint32 num_entries4;
834
835         NTSTATUS status;
836
837 } SAMR_R_ENUM_DOM_ALIASES;
838
839
840 /* -- Level 1 Display Info - User Information -- */
841
842 typedef struct samr_entry_info1
843 {
844         uint32 user_idx;
845
846         uint32 rid_user;
847         uint32 acb_info;
848
849         UNIHDR hdr_acct_name;
850         UNIHDR hdr_user_name;
851         UNIHDR hdr_user_desc;
852
853 } SAM_ENTRY1;
854
855 typedef struct samr_str_entry_info1
856 {
857         UNISTR2 uni_acct_name;
858         UNISTR2 uni_full_name;
859         UNISTR2 uni_acct_desc;
860
861 } SAM_STR1;
862
863 typedef struct sam_entry_info_1
864 {
865         SAM_ENTRY1 *sam;
866         SAM_STR1   *str;
867
868 } SAM_DISPINFO_1;
869
870
871 /* -- Level 2 Display Info - Trust Account Information -- */
872
873 typedef struct samr_entry_info2
874 {
875         uint32 user_idx;
876
877         uint32 rid_user;
878         uint32 acb_info;
879
880         UNIHDR hdr_srv_name;
881         UNIHDR hdr_srv_desc;
882
883 } SAM_ENTRY2;
884
885 typedef struct samr_str_entry_info2
886 {
887         UNISTR2 uni_srv_name;
888         UNISTR2 uni_srv_desc;
889
890 } SAM_STR2;
891
892 typedef struct sam_entry_info_2
893 {
894         SAM_ENTRY2 *sam;
895         SAM_STR2   *str;
896
897 } SAM_DISPINFO_2;
898
899
900 /* -- Level 3 Display Info - Domain Group Information -- */
901
902 typedef struct samr_entry_info3
903 {
904         uint32 grp_idx;
905
906         uint32 rid_grp;
907         uint32 attr;     /* SE_GROUP_xxx, usually 7 */
908
909         UNIHDR hdr_grp_name;
910         UNIHDR hdr_grp_desc;
911
912 } SAM_ENTRY3;
913
914 typedef struct samr_str_entry_info3
915 {
916         UNISTR2 uni_grp_name;
917         UNISTR2 uni_grp_desc;
918
919 } SAM_STR3;
920
921 typedef struct sam_entry_info_3
922 {
923         SAM_ENTRY3 *sam;
924         SAM_STR3   *str;
925
926 } SAM_DISPINFO_3;
927
928
929 /* -- Level 4 Display Info - User List (ASCII) -- */
930
931 typedef struct samr_entry_info4
932 {
933         uint32 user_idx;
934         STRHDR hdr_acct_name;
935
936 } SAM_ENTRY4;
937
938 typedef struct samr_str_entry_info4
939 {
940         STRING2 acct_name;
941
942 } SAM_STR4;
943
944 typedef struct sam_entry_info_4
945 {
946         SAM_ENTRY4 *sam;
947         SAM_STR4   *str;
948
949 } SAM_DISPINFO_4;
950
951
952 /* -- Level 5 Display Info - Group List (ASCII) -- */
953
954 typedef struct samr_entry_info5
955 {
956         uint32 grp_idx;
957         STRHDR hdr_grp_name;
958
959 } SAM_ENTRY5;
960
961 typedef struct samr_str_entry_info5
962 {
963         STRING2 grp_name;
964
965 } SAM_STR5;
966
967 typedef struct sam_entry_info_5
968 {
969         SAM_ENTRY5 *sam;
970         SAM_STR5   *str;
971
972 } SAM_DISPINFO_5;
973
974
975 typedef struct sam_dispinfo_ctr_info
976 {
977         union
978         {
979                 SAM_DISPINFO_1 *info1; /* users/names/descriptions */
980                 SAM_DISPINFO_2 *info2; /* trust accounts */
981                 SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
982                 SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
983                 SAM_DISPINFO_5 *info5; /* group list (ASCII) */
984                 void       *info; /* allows assignment without typecasting, */
985
986         } sam;
987
988 } SAM_DISPINFO_CTR;
989
990
991 /* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
992 typedef struct q_samr_query_disp_info
993 {
994         POLICY_HND domain_pol;
995
996         uint16 switch_level;    /* see SAM_DISPINFO_CTR above */
997         /* align */
998
999         uint32 start_idx;       /* start enumeration index */
1000         uint32 max_entries;     /* maximum number of entries to return */
1001         uint32 max_size;        /* recommended data size; if exceeded server
1002                                    should return STATUS_MORE_ENTRIES */
1003
1004 } SAMR_Q_QUERY_DISPINFO;
1005
1006
1007 /* SAMR_R_QUERY_DISPINFO  */
1008 typedef struct r_samr_query_dispinfo_info
1009 {
1010         uint32 total_size;     /* total data size for all matching entries
1011                                   (0 = uncalculated) */
1012         uint32 data_size;      /* actual data size returned = size of SAM_ENTRY
1013                                   structures + total length of strings */
1014
1015         uint16 switch_level;   /* see SAM_DISPINFO_CTR above */
1016         /* align */
1017
1018         uint32 num_entries;    /* number of entries returned */
1019         uint32 ptr_entries;
1020         uint32 num_entries2;
1021
1022         SAM_DISPINFO_CTR *ctr;
1023
1024         NTSTATUS status;
1025
1026 } SAMR_R_QUERY_DISPINFO;
1027
1028
1029 /* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
1030 typedef struct q_samr_delete_dom_group_info
1031 {
1032     POLICY_HND group_pol;          /* policy handle */
1033
1034 } SAMR_Q_DELETE_DOM_GROUP;
1035
1036
1037 /* SAMR_R_DELETE_DOM_GROUP - delete domain group */
1038 typedef struct r_samr_delete_dom_group_info
1039 {
1040         POLICY_HND pol;       /* policy handle */
1041         NTSTATUS status;        /* return status */
1042
1043 } SAMR_R_DELETE_DOM_GROUP;
1044
1045
1046 /* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
1047 typedef struct q_samr_create_dom_group_info
1048 {
1049         POLICY_HND pol;        /* policy handle */
1050
1051         UNIHDR hdr_acct_desc;
1052         UNISTR2 uni_acct_desc;
1053
1054         uint32 access_mask;    
1055
1056 } SAMR_Q_CREATE_DOM_GROUP;
1057
1058 /* SAMR_R_CREATE_DOM_GROUP - SAM create group */
1059 typedef struct r_samr_create_dom_group_info
1060 {
1061         POLICY_HND pol;        /* policy handle */
1062
1063         uint32 rid;    
1064         NTSTATUS status;    
1065
1066 } SAMR_R_CREATE_DOM_GROUP;
1067
1068 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
1069 typedef struct q_samr_query_group_info
1070 {
1071         POLICY_HND pol;        /* policy handle */
1072
1073         uint16 switch_level;    /* 0x0001 seen */
1074
1075 } SAMR_Q_QUERY_GROUPINFO;
1076
1077 typedef struct samr_group_info1
1078 {
1079         UNIHDR hdr_acct_name;
1080
1081         uint32 group_attr; /* 0x0000 0003 - group attribute */
1082         uint32 num_members; /* 0x0000 0001 - number of group members? */
1083
1084         UNIHDR hdr_acct_desc;
1085
1086         UNISTR2 uni_acct_name;
1087         UNISTR2 uni_acct_desc;
1088
1089 } GROUP_INFO1;
1090
1091 typedef struct samr_group_info2
1092 {
1093         uint16 level;
1094         UNIHDR hdr_acct_name;
1095         UNISTR2 uni_acct_name;
1096
1097 } GROUP_INFO2;
1098
1099 typedef struct samr_group_info3
1100 {
1101         uint32 group_attr; /* 0x0000 0003 - group attribute */
1102
1103 } GROUP_INFO3;
1104
1105 typedef struct samr_group_info4
1106 {
1107         uint16 level;
1108         UNIHDR hdr_acct_desc;
1109         UNISTR2 uni_acct_desc;
1110
1111 } GROUP_INFO4;
1112
1113 typedef struct samr_group_info5
1114 {
1115         UNIHDR hdr_acct_name;
1116
1117         uint32 group_attr; /* 0x0000 0003 - group attribute */
1118         uint32 num_members; /* 0x0000 0001 - number of group members? */
1119
1120         UNIHDR hdr_acct_desc;
1121
1122         UNISTR2 uni_acct_name;
1123         UNISTR2 uni_acct_desc;
1124
1125 } GROUP_INFO5;
1126
1127
1128 /* GROUP_INFO_CTR */
1129 typedef struct group_info_ctr
1130 {
1131         uint16 switch_value1;
1132
1133         union
1134         {
1135                 GROUP_INFO1 info1;
1136                 GROUP_INFO2 info2;
1137                 GROUP_INFO3 info3;
1138                 GROUP_INFO4 info4;
1139                 GROUP_INFO5 info5;
1140         } group;
1141
1142 } GROUP_INFO_CTR;
1143
1144 /* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
1145 typedef struct r_samr_query_groupinfo_info
1146 {
1147         uint32 ptr;        
1148         GROUP_INFO_CTR *ctr;
1149
1150         NTSTATUS status;
1151
1152 } SAMR_R_QUERY_GROUPINFO;
1153
1154
1155 /* SAMR_Q_SET_GROUPINFO - SAM Group Info */
1156 typedef struct q_samr_set_group_info
1157 {
1158         POLICY_HND pol;        /* policy handle */
1159         GROUP_INFO_CTR *ctr;
1160
1161 } SAMR_Q_SET_GROUPINFO;
1162
1163 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
1164 typedef struct r_samr_set_group_info
1165 {
1166         NTSTATUS status;
1167
1168 } SAMR_R_SET_GROUPINFO;
1169
1170
1171 /* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */
1172 typedef struct q_samr_delete_dom_alias_info
1173 {
1174     POLICY_HND alias_pol;          /* policy handle */
1175
1176 } SAMR_Q_DELETE_DOM_ALIAS;
1177
1178
1179 /* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */
1180 typedef struct r_samr_delete_dom_alias_info
1181 {
1182         POLICY_HND pol;       /* policy handle */
1183         NTSTATUS status;        /* return status */
1184
1185 } SAMR_R_DELETE_DOM_ALIAS;
1186
1187
1188 /* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */
1189 typedef struct q_samr_create_dom_alias_info
1190 {
1191         POLICY_HND dom_pol;        /* policy handle */
1192
1193         UNIHDR hdr_acct_desc;
1194         UNISTR2 uni_acct_desc;
1195
1196         uint32 access_mask;    /* 0x001f000f */
1197
1198 } SAMR_Q_CREATE_DOM_ALIAS;
1199
1200 /* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */
1201 typedef struct r_samr_create_dom_alias_info
1202 {
1203         POLICY_HND alias_pol;        /* policy handle */
1204
1205         uint32 rid;    
1206         NTSTATUS status;    
1207
1208 } SAMR_R_CREATE_DOM_ALIAS;
1209
1210
1211 /********************************************************/
1212
1213 typedef struct {
1214         UNISTR4 name;
1215         UNISTR4 description;
1216         uint32 num_member;
1217 } ALIAS_INFO1;
1218
1219 typedef struct {
1220         UNISTR4 name;
1221 } ALIAS_INFO2;
1222
1223 typedef struct {
1224         UNISTR4 description;
1225 } ALIAS_INFO3;
1226
1227 typedef struct {
1228         POLICY_HND pol;        /* policy handle */
1229         uint16 level;    /* 0x0003 seen */
1230 } SAMR_Q_QUERY_ALIASINFO;
1231
1232 typedef struct {
1233         uint16 level;
1234         union {
1235                 ALIAS_INFO1 info1;
1236                 ALIAS_INFO2 info2;
1237                 ALIAS_INFO3 info3;
1238         } alias;
1239 } ALIAS_INFO_CTR;
1240
1241 typedef struct {
1242         ALIAS_INFO_CTR *ctr;
1243         NTSTATUS status;
1244 } SAMR_R_QUERY_ALIASINFO;
1245
1246
1247 /********************************************************/
1248
1249 typedef struct {
1250         POLICY_HND alias_pol;        /* policy handle */
1251         ALIAS_INFO_CTR ctr;
1252 } SAMR_Q_SET_ALIASINFO;
1253
1254 typedef struct {
1255         NTSTATUS status;
1256 } SAMR_R_SET_ALIASINFO;
1257
1258
1259 /********************************************************/
1260
1261 /* SAMR_Q_QUERY_USERGROUPS - */
1262 typedef struct q_samr_query_usergroup_info
1263 {
1264         POLICY_HND pol;          /* policy handle associated with unknown id */
1265
1266 } SAMR_Q_QUERY_USERGROUPS;
1267
1268 /* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
1269 typedef struct r_samr_query_usergroup_info
1270 {
1271         uint32 ptr_0;            /* pointer */
1272         uint32 num_entries;      /* number of RID groups */
1273         uint32 ptr_1;            /* pointer */
1274         uint32 num_entries2;     /* number of RID groups */
1275
1276         DOM_GID *gid; /* group info */
1277
1278         NTSTATUS status;         /* return status */
1279
1280 } SAMR_R_QUERY_USERGROUPS;
1281
1282 /* SAM_USERINFO_CTR - sam user info */
1283 typedef struct sam_userinfo_ctr_info
1284 {
1285         uint16 switch_value;      
1286
1287         union
1288         {
1289                 SAM_USER_INFO_7  *id7;
1290                 SAM_USER_INFO_9  *id9;
1291                 SAM_USER_INFO_16 *id16;
1292                 SAM_USER_INFO_17 *id17;
1293                 SAM_USER_INFO_18 *id18;
1294                 SAM_USER_INFO_20 *id20;
1295                 SAM_USER_INFO_21 *id21;
1296                 SAM_USER_INFO_23 *id23;
1297                 SAM_USER_INFO_24 *id24;
1298                 SAM_USER_INFO_25 *id25;
1299                 SAM_USER_INFO_26 *id26;
1300                 void* id; /* to make typecasting easy */
1301
1302         } info;
1303
1304 } SAM_USERINFO_CTR;
1305
1306
1307 /* SAMR_Q_SET_USERINFO2 - set sam info */
1308 typedef struct q_samr_set_user_info2
1309 {
1310         POLICY_HND pol;          /* policy handle associated with user */
1311         uint16 switch_value;      /* 0x0010 */
1312
1313         SAM_USERINFO_CTR *ctr;
1314
1315 } SAMR_Q_SET_USERINFO2;
1316
1317 /* SAMR_R_SET_USERINFO2 - set sam info */
1318 typedef struct r_samr_set_user_info2
1319 {
1320         NTSTATUS status;         /* return status */
1321
1322 } SAMR_R_SET_USERINFO2;
1323
1324 /* SAMR_Q_SET_USERINFO - set sam info */
1325 typedef struct q_samr_set_user_info
1326 {
1327         POLICY_HND pol;          /* policy handle associated with user */
1328         uint16 switch_value;
1329         SAM_USERINFO_CTR *ctr;
1330
1331 } SAMR_Q_SET_USERINFO;
1332
1333 /* SAMR_R_SET_USERINFO - set sam info */
1334 typedef struct r_samr_set_user_info
1335 {
1336         NTSTATUS status;         /* return status */
1337
1338 } SAMR_R_SET_USERINFO;
1339
1340
1341 /* SAMR_Q_QUERY_USERINFO - probably a get sam info */
1342 typedef struct q_samr_query_user_info
1343 {
1344         POLICY_HND pol;          /* policy handle associated with unknown id */
1345         uint16 switch_value;         /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */
1346
1347 } SAMR_Q_QUERY_USERINFO;
1348
1349 /* SAMR_R_QUERY_USERINFO - probably a get sam info */
1350 typedef struct r_samr_query_user_info
1351 {
1352         uint32 ptr;            /* pointer */
1353         SAM_USERINFO_CTR *ctr;
1354
1355         NTSTATUS status;         /* return status */
1356
1357 } SAMR_R_QUERY_USERINFO;
1358
1359
1360 /****************************************************************************
1361 SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.
1362
1363 the policy handle allocated by an "samr open secret" call is associated
1364 with a SID.  this policy handle is what is queried here, *not* the SID
1365 itself.  the response to the lookup rids is relative to this SID.
1366 *****************************************************************************/
1367 /* SAMR_Q_QUERY_USERALIASES */
1368 typedef struct q_samr_query_useraliases_info
1369 {
1370         POLICY_HND pol;       /* policy handle */
1371
1372         uint32 num_sids1;      /* number of rids being looked up */
1373         uint32 ptr;            /* buffer pointer */
1374         uint32 num_sids2;      /* number of rids being looked up */
1375
1376         uint32   *ptr_sid; /* pointers to sids to be looked up */
1377         DOM_SID2 *sid    ; /* sids to be looked up. */
1378
1379 } SAMR_Q_QUERY_USERALIASES;
1380
1381
1382 /* SAMR_R_QUERY_USERALIASES */
1383 typedef struct r_samr_query_useraliases_info
1384 {
1385         uint32 num_entries;
1386         uint32 ptr; /* undocumented buffer pointer */
1387
1388         uint32 num_entries2; 
1389         uint32 *rid; /* domain RIDs being looked up */
1390
1391         NTSTATUS status; /* return code */
1392
1393 } SAMR_R_QUERY_USERALIASES;
1394
1395
1396 /****************************************************************************
1397 SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
1398 *****************************************************************************/
1399 /* SAMR_Q_LOOKUP_NAMES */
1400 typedef struct q_samr_lookup_names_info
1401 {
1402         POLICY_HND pol;       /* policy handle */
1403
1404         uint32 num_names1;      /* number of names being looked up */
1405         uint32 flags;           /* 0x0000 03e8 - unknown */
1406         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1407         uint32 num_names2;      /* number of names being looked up */
1408
1409         UNIHDR  *hdr_name; /* unicode account name header */
1410         UNISTR2 *uni_name; /* unicode account name string */
1411
1412 } SAMR_Q_LOOKUP_NAMES;
1413
1414
1415 /* SAMR_R_LOOKUP_NAMES */
1416 typedef struct r_samr_lookup_names_info
1417 {
1418         uint32 num_rids1;      /* number of aliases being looked up */
1419         uint32 ptr_rids;       /* pointer to aliases */
1420         uint32 num_rids2;      /* number of aliases being looked up */
1421
1422         uint32 *rids; /* rids */
1423
1424         uint32 num_types1;      /* number of users in aliases being looked up */
1425         uint32 ptr_types;       /* pointer to users in aliases */
1426         uint32 num_types2;      /* number of users in aliases being looked up */
1427
1428         uint32 *types; /* SID_ENUM type */
1429
1430         NTSTATUS status; /* return code */
1431
1432 } SAMR_R_LOOKUP_NAMES;
1433
1434
1435 /****************************************************************************
1436 SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
1437
1438 called to resolve domain RID groups.
1439 *****************************************************************************/
1440 /* SAMR_Q_LOOKUP_RIDS */
1441 typedef struct q_samr_lookup_rids_info
1442 {
1443         POLICY_HND pol;       /* policy handle */
1444
1445         uint32 num_rids1;      /* number of rids being looked up */
1446         uint32 flags;          /* 0x0000 03e8 - unknown */
1447         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1448         uint32 num_rids2;      /* number of rids being looked up */
1449
1450         uint32 *rid; /* domain RIDs being looked up */
1451
1452 } SAMR_Q_LOOKUP_RIDS;
1453
1454
1455 /****************************************************************************
1456 SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names
1457
1458 *****************************************************************************/
1459 /* SAMR_R_LOOKUP_RIDS */
1460 typedef struct r_samr_lookup_rids_info
1461 {
1462         uint32 num_names1;      /* number of aliases being looked up */
1463         uint32 ptr_names;       /* pointer to aliases */
1464         uint32 num_names2;      /* number of aliases being looked up */
1465
1466         UNIHDR  *hdr_name; /* unicode account name header */
1467         UNISTR2 *uni_name; /* unicode account name string */
1468
1469         uint32 num_types1;      /* number of users in aliases being looked up */
1470         uint32 ptr_types;       /* pointer to users in aliases */
1471         uint32 num_types2;      /* number of users in aliases being looked up */
1472
1473         uint32 *type; /* SID_ENUM type */
1474
1475         NTSTATUS status;
1476
1477 } SAMR_R_LOOKUP_RIDS;
1478
1479
1480 /* SAMR_Q_OPEN_USER - probably an open */
1481 typedef struct q_samr_open_user_info
1482 {
1483         POLICY_HND domain_pol;       /* policy handle */
1484         uint32 access_mask;     /* 32 bit unknown - 0x02011b */
1485         uint32 user_rid;      /* user RID */
1486
1487 } SAMR_Q_OPEN_USER;
1488
1489
1490 /* SAMR_R_OPEN_USER - probably an open */
1491 typedef struct r_samr_open_user_info
1492 {
1493         POLICY_HND user_pol;       /* policy handle associated with unknown id */
1494         NTSTATUS status;         /* return status */
1495
1496 } SAMR_R_OPEN_USER;
1497
1498
1499 /* SAMR_Q_CREATE_USER - probably a create */
1500 typedef struct q_samr_create_user_info
1501 {
1502         POLICY_HND domain_pol;       /* policy handle */
1503
1504         UNIHDR  hdr_name;       /* unicode account name header */
1505         UNISTR2 uni_name;       /* unicode account name */
1506
1507         uint32 acb_info;      /* account control info */
1508         uint32 access_mask;     /* 0xe005 00b0 */
1509
1510 } SAMR_Q_CREATE_USER;
1511
1512
1513 /* SAMR_R_CREATE_USER - probably a create */
1514 typedef struct r_samr_create_user_info
1515 {
1516         POLICY_HND user_pol;       /* policy handle associated with user */
1517
1518         uint32 access_granted;
1519         uint32 user_rid;      /* user RID */
1520         NTSTATUS status;         /* return status */
1521
1522 } SAMR_R_CREATE_USER;
1523
1524
1525 /* SAMR_Q_DELETE_DOM_USER - delete domain user */
1526 typedef struct q_samr_delete_dom_user_info
1527 {
1528     POLICY_HND user_pol;          /* policy handle */
1529
1530 } SAMR_Q_DELETE_DOM_USER;
1531
1532
1533 /* SAMR_R_DELETE_DOM_USER - delete domain user */
1534 typedef struct r_samr_delete_dom_user_info
1535 {
1536         POLICY_HND pol;       /* policy handle */
1537         NTSTATUS status;        /* return status */
1538
1539 } SAMR_R_DELETE_DOM_USER;
1540
1541
1542 /* SAMR_Q_QUERY_GROUPMEM - query group members */
1543 typedef struct q_samr_query_groupmem_info
1544 {
1545         POLICY_HND group_pol;        /* policy handle */
1546
1547 } SAMR_Q_QUERY_GROUPMEM;
1548
1549
1550 /* SAMR_R_QUERY_GROUPMEM - query group members */
1551 typedef struct r_samr_query_groupmem_info
1552 {
1553         uint32 ptr;
1554         uint32 num_entries;
1555
1556         uint32 ptr_rids;
1557         uint32 ptr_attrs;
1558
1559         uint32 num_rids;
1560         uint32 *rid;
1561
1562         uint32 num_attrs;
1563         uint32 *attr;
1564
1565         NTSTATUS status;
1566
1567 } SAMR_R_QUERY_GROUPMEM;
1568
1569
1570 /* SAMR_Q_DEL_GROUPMEM - probably an del group member */
1571 typedef struct q_samr_del_group_mem_info
1572 {
1573         POLICY_HND pol;       /* policy handle */
1574         uint32 rid;         /* rid */
1575
1576 } SAMR_Q_DEL_GROUPMEM;
1577
1578
1579 /* SAMR_R_DEL_GROUPMEM - probably an del group member */
1580 typedef struct r_samr_del_group_mem_info
1581 {
1582         NTSTATUS status;         /* return status */
1583
1584 } SAMR_R_DEL_GROUPMEM;
1585
1586
1587 /* SAMR_Q_ADD_GROUPMEM - probably an add group member */
1588 typedef struct q_samr_add_group_mem_info
1589 {
1590         POLICY_HND pol;       /* policy handle */
1591
1592         uint32 rid;         /* rid */
1593         uint32 unknown;     /* 0x0000 0005 */
1594
1595 } SAMR_Q_ADD_GROUPMEM;
1596
1597
1598 /* SAMR_R_ADD_GROUPMEM - probably an add group member */
1599 typedef struct r_samr_add_group_mem_info
1600 {
1601         NTSTATUS status;         /* return status */
1602
1603 } SAMR_R_ADD_GROUPMEM;
1604
1605
1606 /* SAMR_Q_OPEN_GROUP - probably an open */
1607 typedef struct q_samr_open_group_info
1608 {
1609         POLICY_HND domain_pol;       /* policy handle */
1610         uint32 access_mask;         /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
1611         uint32 rid_group;        /* rid */
1612
1613 } SAMR_Q_OPEN_GROUP;
1614
1615
1616 /* SAMR_R_OPEN_GROUP - probably an open */
1617 typedef struct r_samr_open_group_info
1618 {
1619         POLICY_HND pol;       /* policy handle */
1620         NTSTATUS status;         /* return status */
1621
1622 } SAMR_R_OPEN_GROUP;
1623
1624
1625 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
1626 typedef struct q_samr_query_aliasmem_info
1627 {
1628         POLICY_HND alias_pol;        /* policy handle */
1629
1630 } SAMR_Q_QUERY_ALIASMEM;
1631
1632
1633 /* SAMR_R_QUERY_ALIASMEM - query alias members */
1634 typedef struct r_samr_query_aliasmem_info
1635 {
1636         uint32 num_sids;
1637         uint32 ptr;
1638         uint32 num_sids1;
1639
1640         DOM_SID2 *sid;
1641
1642         NTSTATUS status;
1643
1644 } SAMR_R_QUERY_ALIASMEM;
1645
1646
1647 /* SAMR_Q_ADD_ALIASMEM - add alias member */
1648 typedef struct q_samr_add_alias_mem_info
1649 {
1650         POLICY_HND alias_pol;       /* policy handle */
1651
1652         DOM_SID2 sid; /* member sid to be added to the alias */
1653
1654 } SAMR_Q_ADD_ALIASMEM;
1655
1656
1657 /* SAMR_R_ADD_ALIASMEM - add alias member */
1658 typedef struct r_samr_add_alias_mem_info
1659 {
1660         NTSTATUS status;         /* return status */
1661
1662 } SAMR_R_ADD_ALIASMEM;
1663
1664
1665 /* SAMR_Q_DEL_ALIASMEM - add an add alias member */
1666 typedef struct q_samr_del_alias_mem_info
1667 {
1668         POLICY_HND alias_pol;       /* policy handle */
1669
1670         DOM_SID2 sid; /* member sid to be added to alias */
1671
1672 } SAMR_Q_DEL_ALIASMEM;
1673
1674
1675 /* SAMR_R_DEL_ALIASMEM - delete alias member */
1676 typedef struct r_samr_del_alias_mem_info
1677 {
1678         NTSTATUS status;         /* return status */
1679
1680 } SAMR_R_DEL_ALIASMEM;
1681
1682
1683
1684 /* SAMR_Q_OPEN_ALIAS - probably an open */
1685 typedef struct q_samr_open_alias_info
1686 {
1687         POLICY_HND dom_pol;
1688
1689         uint32 access_mask;         
1690         uint32 rid_alias;
1691
1692 } SAMR_Q_OPEN_ALIAS;
1693
1694
1695 /* SAMR_R_OPEN_ALIAS - probably an open */
1696 typedef struct r_samr_open_alias_info
1697 {
1698         POLICY_HND pol;       /* policy handle */
1699         NTSTATUS status;         /* return status */
1700
1701 } SAMR_R_OPEN_ALIAS;
1702
1703
1704 /* SAMR_Q_CONNECT_ANON - probably an open */
1705 typedef struct q_samr_connect_anon_info {
1706         uint32 ptr;                  /* ptr? */
1707         uint16 unknown_0;            /* Only pushed if ptr is non-zero. */
1708         uint32 access_mask;
1709 } SAMR_Q_CONNECT_ANON;
1710
1711 /* SAMR_R_CONNECT_ANON - probably an open */
1712 typedef struct r_samr_connect_anon_info
1713 {
1714         POLICY_HND connect_pol;       /* policy handle */
1715         NTSTATUS status;         /* return status */
1716
1717 } SAMR_R_CONNECT_ANON;
1718
1719 /* SAMR_Q_CONNECT - probably an open */
1720 typedef struct q_samr_connect_info
1721 {
1722         uint32 ptr_srv_name;         /* pointer (to server name?) */
1723         UNISTR2 uni_srv_name;        /* unicode server name starting with '\\' */
1724
1725         uint32 access_mask;            
1726
1727 } SAMR_Q_CONNECT;
1728
1729
1730 /* SAMR_R_CONNECT - probably an open */
1731 typedef struct r_samr_connect_info
1732 {
1733         POLICY_HND connect_pol;       /* policy handle */
1734         NTSTATUS status;         /* return status */
1735
1736 } SAMR_R_CONNECT;
1737
1738 /* SAMR_Q_CONNECT4 */
1739 typedef struct q_samr_connect4_info
1740 {
1741         uint32 ptr_srv_name; /* pointer to server name */
1742         UNISTR2 uni_srv_name;
1743
1744         uint32 unk_0; /* possible server name type, 1 for IP num, 2 for name */
1745         uint32 access_mask;
1746 } SAMR_Q_CONNECT4;
1747
1748 /* SAMR_R_CONNECT4 - same format as connect */
1749 typedef struct r_samr_connect_info SAMR_R_CONNECT4;       
1750
1751 /* SAMR_Q_CONNECT5 */
1752 typedef struct q_samr_connect5_info
1753 {
1754         uint32 ptr_srv_name; /* pointer to server name */
1755         UNISTR2 uni_srv_name;
1756         uint32 access_mask;
1757         uint32 level;
1758         /* These following are acutally a level dependent
1759            value. Fudge it for now. JRA */
1760         uint32 info1_unk1;
1761         uint32 info1_unk2;
1762 } SAMR_Q_CONNECT5;
1763
1764 /* SAMR_R_CONNECT5 */
1765 typedef struct r_samr_connect_info5
1766 {
1767         uint32 level;
1768         uint32 info1_unk1;
1769         uint32 info1_unk2;
1770         POLICY_HND connect_pol;       /* policy handle */
1771         NTSTATUS status;         /* return status */
1772
1773 } SAMR_R_CONNECT5;
1774
1775
1776 /* SAMR_Q_GET_DOM_PWINFO */
1777 typedef struct q_samr_get_dom_pwinfo
1778 {
1779         uint32 ptr; 
1780         UNIHDR  hdr_srv_name;
1781         UNISTR2 uni_srv_name;
1782
1783 } SAMR_Q_GET_DOM_PWINFO;
1784
1785 #define DOMAIN_PASSWORD_COMPLEX         0x00000001
1786 #define DOMAIN_PASSWORD_NO_ANON_CHANGE  0x00000002
1787 #define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
1788 #define DOMAIN_LOCKOUT_ADMINS           0x00000008
1789 #define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
1790 #define DOMAIN_REFUSE_PASSWORD_CHANGE   0x00000020
1791
1792 /* SAMR_R_GET_DOM_PWINFO */
1793 typedef struct r_samr_get_dom_pwinfo
1794 {
1795         uint16 min_pwd_length;
1796         uint32 password_properties;
1797         NTSTATUS status;
1798
1799 } SAMR_R_GET_DOM_PWINFO;
1800
1801 /* SAMR_ENC_PASSWD */
1802 typedef struct enc_passwd_info
1803 {
1804         uint32 ptr;
1805         uint8 pass[516];
1806
1807 } SAMR_ENC_PASSWD;
1808
1809 /* SAMR_ENC_HASH */
1810 typedef struct enc_hash_info
1811 {
1812         uint32 ptr;
1813         uint8 hash[16];
1814
1815 } SAMR_ENC_HASH;
1816
1817 /* SAMR_Q_CHGPASSWD_USER */
1818 typedef struct q_samr_chgpasswd_user_info
1819 {
1820         uint32 ptr_0;
1821
1822         UNIHDR hdr_dest_host; /* server name unicode header */
1823         UNISTR2 uni_dest_host; /* server name unicode string */
1824
1825         UNIHDR hdr_user_name;    /* username unicode string header */
1826         UNISTR2 uni_user_name;    /* username unicode string */
1827
1828         SAMR_ENC_PASSWD nt_newpass;
1829         SAMR_ENC_HASH nt_oldhash;
1830
1831         uint32 unknown; /* 0x0000 0001 */
1832
1833         SAMR_ENC_PASSWD lm_newpass;
1834         SAMR_ENC_HASH lm_oldhash;
1835
1836 } SAMR_Q_CHGPASSWD_USER;
1837
1838 /* SAMR_R_CHGPASSWD_USER */
1839 typedef struct r_samr_chgpasswd_user_info
1840 {
1841         NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1842
1843 } SAMR_R_CHGPASSWD_USER;
1844
1845 /* SAMR_Q_CHGPASSWD3 */
1846 typedef struct q_samr_chgpasswd_user3
1847 {
1848         uint32 ptr_0;
1849
1850         UNIHDR hdr_dest_host; /* server name unicode header */
1851         UNISTR2 uni_dest_host; /* server name unicode string */
1852
1853         UNIHDR hdr_user_name;    /* username unicode string header */
1854         UNISTR2 uni_user_name;    /* username unicode string */
1855
1856         SAMR_ENC_PASSWD nt_newpass;
1857         SAMR_ENC_HASH nt_oldhash;
1858
1859         uint32 lm_change; /* 0x0000 0001 */
1860
1861         SAMR_ENC_PASSWD lm_newpass;
1862         SAMR_ENC_HASH lm_oldhash;
1863
1864         SAMR_ENC_PASSWD password3;
1865
1866 } SAMR_Q_CHGPASSWD_USER3;
1867
1868 #define REJECT_REASON_OTHER             0x00000000
1869 #define REJECT_REASON_TOO_SHORT         0x00000001
1870 #define REJECT_REASON_IN_HISTORY        0x00000002
1871 #define REJECT_REASON_NOT_COMPLEX       0x00000005
1872
1873 /* SAMR_CHANGE_REJECT */
1874 typedef struct samr_change_reject
1875 {
1876         uint32 reject_reason;
1877         uint32 unknown1;
1878         uint32 unknown2;
1879
1880 } SAMR_CHANGE_REJECT;
1881
1882 /* SAMR_R_CHGPASSWD3 */
1883 typedef struct r_samr_chgpasswd_user3
1884 {
1885         uint32 ptr_info;
1886         uint32 ptr_reject;
1887         SAM_UNK_INFO_1 *info;
1888         SAMR_CHANGE_REJECT *reject;
1889         NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1890
1891 } SAMR_R_CHGPASSWD_USER3;
1892
1893
1894
1895 /* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */
1896 typedef struct q_samr_remove_sid_foreign_domain_info
1897 {
1898         POLICY_HND dom_pol;   /* policy handle */
1899         DOM_SID2 sid;         /* SID */
1900
1901 } SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN;
1902
1903
1904 /* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */
1905 typedef struct r_samr_remove_sid_foreign_domain_info
1906 {
1907         NTSTATUS status;         /* return status */
1908
1909 } SAMR_R_REMOVE_SID_FOREIGN_DOMAIN;
1910
1911
1912
1913 /* these are from the old rpc_samr.h - they are needed while the merge
1914    is still going on */
1915 #define MAX_SAM_SIDS 15
1916
1917 /* DOM_SID3 - security id */
1918 typedef struct sid_info_3
1919 {
1920         uint16 len; /* length, bytes, including length of len :-) */
1921         /* uint8  pad[2]; */
1922         
1923         DOM_SID sid;
1924
1925 } DOM_SID3;
1926
1927 /* SAMR_Q_QUERY_DOMAIN_INFO2 */
1928 typedef struct q_samr_query_domain_info2
1929 {
1930         POLICY_HND domain_pol;   /* policy handle */
1931         uint16 switch_value;
1932
1933 } SAMR_Q_QUERY_DOMAIN_INFO2;
1934
1935 /* SAMR_R_QUERY_DOMAIN_INFO2 */
1936 typedef struct r_samr_query_domain_info2
1937 {
1938         uint32 ptr_0;
1939         uint16 switch_value;
1940         SAM_UNK_CTR *ctr;
1941         NTSTATUS status;         /* return status */
1942
1943 } SAMR_R_QUERY_DOMAIN_INFO2;
1944
1945 /* SAMR_Q_SET_DOMAIN_INFO */
1946 typedef struct q_samr_set_domain_info
1947 {
1948         POLICY_HND domain_pol;   /* policy handle */
1949         uint16 switch_value0;
1950         uint16 switch_value;
1951         SAM_UNK_CTR *ctr;
1952
1953 } SAMR_Q_SET_DOMAIN_INFO;
1954
1955 /* SAMR_R_SET_DOMAIN_INFO */
1956 typedef struct r_samr_set_domain_info
1957 {
1958         NTSTATUS status;         /* return status */
1959
1960 } SAMR_R_SET_DOMAIN_INFO;
1961
1962 #endif /* _RPC_SAMR_H */