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