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