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