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