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