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