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