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