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