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