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