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