summaryrefslogtreecommitdiff
path: root/source3/include/rpc_samr.h
blob: e9c9efd899e5b933b93861930434997124cc9bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
/* 
   Unix SMB/CIFS implementation.
   SMB parameters and setup
   Copyright (C) Andrew Tridgell              1992-2000
   Copyright (C) Luke Kenneth Casson Leighton 1996-2000
   Copyright (C) Paul Ashton                  1997-2000
   Copyright (C) Jean François Micouleau      1998-2001
   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
   
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
#define _RPC_SAMR_H 

/*******************************************************************
 the following information comes from a QuickView on samsrv.dll,
 and gives an idea of exactly what is needed:
 
x SamrAddMemberToAlias
x SamrAddMemberToGroup
SamrAddMultipleMembersToAlias
x SamrChangePasswordUser
x SamrCloseHandle
x SamrConnect
x SamrCreateAliasInDomain
x SamrCreateGroupInDomain
x SamrCreateUserInDomain
? SamrDeleteAlias
SamrDeleteGroup
x SamrDeleteUser
x SamrEnumerateAliasesInDomain
SamrEnumerateDomainsInSamServer
x SamrEnumerateGroupsInDomain
x SamrEnumerateUsersInDomain
SamrGetUserDomainPasswordInformation
SamrLookupDomainInSamServer
? SamrLookupIdsInDomain
x SamrLookupNamesInDomain
x SamrOpenAlias
x SamrOpenDomain
x SamrOpenGroup
x SamrOpenUser
x SamrQueryDisplayInformation
x SamrQueryInformationAlias
SamrQueryInformationDomain
? SamrQueryInformationUser
x SamrQuerySecurityObject
SamrRemoveMemberFromAlias
SamrRemoveMemberFromForiegnDomain
SamrRemoveMemberFromGroup
SamrRemoveMultipleMembersFromAlias
x SamrSetInformationAlias
SamrSetInformationDomain
x SamrSetInformationGroup
x SamrSetInformationUser
SamrSetMemberAttributesOfGroup
SamrSetSecurityObject
SamrShutdownSamServer
SamrTestPrivateFunctionsDomain
SamrTestPrivateFunctionsUser

********************************************************************/

#define SAMR_CONNECT_ANON      0x00
#define SAMR_CLOSE_HND         0x01
#define SAMR_SET_SEC_OBJECT    0x02
#define SAMR_QUERY_SEC_OBJECT  0x03

#define SAMR_UNKNOWN_4         0x04 /* profile info? */
#define SAMR_LOOKUP_DOMAIN     0x05
#define SAMR_ENUM_DOMAINS      0x06
#define SAMR_OPEN_DOMAIN       0x07
#define SAMR_QUERY_DOMAIN_INFO 0x08
#define SAMR_SET_DOMAIN_INFO   0x09

#define SAMR_CREATE_DOM_GROUP  0x0a
#define SAMR_ENUM_DOM_GROUPS   0x0b
#define SAMR_ENUM_DOM_USERS    0x0d
#define SAMR_CREATE_DOM_ALIAS  0x0e
#define SAMR_ENUM_DOM_ALIASES  0x0f
#define SAMR_QUERY_USERALIASES 0x10

#define SAMR_LOOKUP_NAMES      0x11
#define SAMR_LOOKUP_RIDS       0x12

#define SAMR_OPEN_GROUP        0x13
#define SAMR_QUERY_GROUPINFO   0x14
#define SAMR_SET_GROUPINFO     0x15
#define SAMR_ADD_GROUPMEM      0x16
#define SAMR_DELETE_DOM_GROUP  0x17
#define SAMR_DEL_GROUPMEM      0x18
#define SAMR_QUERY_GROUPMEM    0x19
#define SAMR_UNKNOWN_1A        0x1a

#define SAMR_OPEN_ALIAS        0x1b
#define SAMR_QUERY_ALIASINFO   0x1c
#define SAMR_SET_ALIASINFO     0x1d
#define SAMR_DELETE_DOM_ALIAS  0x1e
#define SAMR_ADD_ALIASMEM      0x1f
#define SAMR_DEL_ALIASMEM      0x20
#define SAMR_QUERY_ALIASMEM    0x21

#define SAMR_OPEN_USER         0x22
#define SAMR_DELETE_DOM_USER   0x23
#define SAMR_QUERY_USERINFO    0x24
#define SAMR_SET_USERINFO2     0x25
#define SAMR_QUERY_USERGROUPS  0x27

#define SAMR_QUERY_DISPINFO    0x28
#define SAMR_GET_DISPENUM_INDEX 0x29
#define SAMR_UNKNOWN_2a        0x2a
#define SAMR_UNKNOWN_2b        0x2b
#define SAMR_GET_USRDOM_PWINFO 0x2c
#define SAMR_REMOVE_SID_FOREIGN_DOMAIN        0x2d
#define SAMR_QUERY_DOMAIN_INFO2  0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */
#define SAMR_UNKNOWN_2f        0x2f
#define SAMR_QUERY_DISPINFO3   0x30 /* Alias for SAMR_QUERY_DISPINFO
				       with info level 3 */
#define SAMR_UNKNOWN_31        0x31
#define SAMR_CREATE_USER       0x32
#define SAMR_QUERY_DISPINFO4   0x33 /* Alias for SAMR_QUERY_DISPINFO
				       with info level 4 */
#define SAMR_ADDMULTI_ALIASMEM 0x34

#define SAMR_UNKNOWN_35        0x35
#define SAMR_UNKNOWN_36        0x36
#define SAMR_CHGPASSWD_USER    0x37
#define SAMR_GET_DOM_PWINFO    0x38
#define SAMR_CONNECT           0x39
#define SAMR_SET_USERINFO      0x3A
#define SAMR_CONNECT4          0x3E
#define SAMR_CHGPASSWD_USER3   0x3F
#define SAMR_CONNECT5          0x40

typedef struct logon_hours_info
{
	uint32 max_len; /* normally 1260 bytes */
	uint32 offset;
	uint32 len; /* normally 21 bytes */
	uint8 hours[32];

} LOGON_HRS;

/* SAM_USER_INFO_23 */
typedef struct sam_user_info_23
{
	/* TIMES MAY NOT IN RIGHT ORDER!!!! */
	NTTIME logon_time;            /* logon time */
	NTTIME logoff_time;           /* logoff time */
	NTTIME kickoff_time;          /* kickoff time */
	NTTIME pass_last_set_time;    /* password last set time */
	NTTIME pass_can_change_time;  /* password can change time */
	NTTIME pass_must_change_time; /* password must change time */

	UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
	UNIHDR hdr_full_name;    /* user's full name unicode string header */
	UNIHDR hdr_home_dir;     /* home directory unicode string header */
	UNIHDR hdr_dir_drive;    /* home drive unicode string header */
	UNIHDR hdr_logon_script; /* logon script unicode string header */
	UNIHDR hdr_profile_path; /* profile path unicode string header */
	UNIHDR hdr_acct_desc  ;  /* user description */
	UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
	UNIHDR hdr_comment;
	UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */

	uint8 lm_pwd[16];    /* lm user passwords */
	uint8 nt_pwd[16];    /* nt user passwords */

	uint32 user_rid;      /* Primary User ID */
	uint32 group_rid;     /* Primary Group ID */

	uint32 acb_info; /* account info (ACB_xxxx bit-mask) */

	uint32 fields_present; /* 0x09f8 27fa */

	uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
	/* uint8 pad[2] */
	uint32 ptr_logon_hrs; /* pointer to logon hours */

	/* Was unknown_5. */
	uint16 bad_password_count;
	uint16 logon_count;

	uint8 padding1[6];
		
	uint8 passmustchange; /* 0x00 must change = 0x01 */

	uint8 padding2;

	uint8 pass[516];

	UNISTR2 uni_user_name;    /* NULL - username unicode string */
	UNISTR2 uni_full_name;    /* user's full name unicode string */
	UNISTR2 uni_home_dir;     /* home directory unicode string */
	UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
	UNISTR2 uni_logon_script; /* logon script unicode string */
	UNISTR2 uni_profile_path; /* profile path unicode string */
	UNISTR2 uni_acct_desc  ;  /* user description unicode string */
	UNISTR2 uni_workstations; /* login from workstations unicode string */
	UNISTR2 uni_comment;
	UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */

	LOGON_HRS logon_hrs;

} SAM_USER_INFO_23;

/* SAM_USER_INFO_24 */
typedef struct sam_user_info_24
{
	uint8 pass[516];
	uint8 pw_len;
} SAM_USER_INFO_24;

/*
 * NB. This structure is *definately* incorrect. It's my best guess
 * currently for W2K SP2. The password field is encrypted in a different
 * way than normal... And there are definately other problems. JRA.
 */

/* SAM_USER_INFO_25 */
typedef struct sam_user_info_25
{
	/* TIMES MAY NOT IN RIGHT ORDER!!!! */
	NTTIME logon_time;            /* logon time */
	NTTIME logoff_time;           /* logoff time */
	NTTIME kickoff_time;          /* kickoff time */
	NTTIME pass_last_set_time;    /* password last set time */
	NTTIME pass_can_change_time;  /* password can change time */
	NTTIME pass_must_change_time; /* password must change time */

	UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
	UNIHDR hdr_full_name;    /* user's full name unicode string header */
	UNIHDR hdr_home_dir;     /* home directory unicode string header */
	UNIHDR hdr_dir_drive;    /* home drive unicode string header */
	UNIHDR hdr_logon_script; /* logon script unicode string header */
	UNIHDR hdr_profile_path; /* profile path unicode string header */
	UNIHDR hdr_acct_desc  ;  /* user description */
	UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
	UNIHDR hdr_comment;
	UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */

	uint8 lm_pwd[16];    /* lm user passwords */
	uint8 nt_pwd[16];    /* nt user passwords */

	uint32 user_rid;      /* Primary User ID */
	uint32 group_rid;     /* Primary Group ID */

	uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
	uint32 fields_present;

	uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
	/* uint8 pad[2] */
	uint32 ptr_logon_hrs; /* pointer to logon hours */

	/* Was unknown_5. */
	uint16 bad_password_count;
	uint16 logon_count;

	uint8 padding1[6];
		
	uint8 passmustchange; /* 0x00 must change = 0x01 */

	uint8 padding2;

	uint8 pass[532];

	UNISTR2 uni_user_name;    /* NULL - username unicode string */
	UNISTR2 uni_full_name;    /* user's full name unicode string */
	UNISTR2 uni_home_dir;     /* home directory unicode string */
	UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
	UNISTR2 uni_logon_script; /* logon script unicode string */
	UNISTR2 uni_profile_path; /* profile path unicode string */
	UNISTR2 uni_acct_desc  ;  /* user description unicode string */
	UNISTR2 uni_workstations; /* login from workstations unicode string */
	UNISTR2 uni_comment;
	UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
	LOGON_HRS logon_hrs;
} SAM_USER_INFO_25;

/* SAM_USER_INFO_26 */
typedef struct sam_user_info_26
{
	uint8 pass[532];
	uint8 pw_len;
} SAM_USER_INFO_26;


/* SAM_USER_INFO_21 */
typedef struct sam_user_info_21
{
	NTTIME logon_time;            /* logon time */
	NTTIME logoff_time;           /* logoff time */
	NTTIME kickoff_time;          /* kickoff time */
	NTTIME pass_last_set_time;    /* password last set time */
	NTTIME pass_can_change_time;  /* password can change time */
	NTTIME pass_must_change_time; /* password must change time */

	UNIHDR hdr_user_name;    /* username unicode string header */
	UNIHDR hdr_full_name;    /* user's full name unicode string header */
	UNIHDR hdr_home_dir;     /* home directory unicode string header */
	UNIHDR hdr_dir_drive;    /* home drive unicode string header */
	UNIHDR hdr_logon_script; /* logon script unicode string header */
	UNIHDR hdr_profile_path; /* profile path unicode string header */
	UNIHDR hdr_acct_desc  ;  /* user description */
	UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
	UNIHDR hdr_comment;
	UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */

	uint8 lm_pwd[16];    /* lm user passwords */
	uint8 nt_pwd[16];    /* nt user passwords */

	uint32 user_rid;      /* Primary User ID */
	uint32 group_rid;     /* Primary Group ID */

	uint32 acb_info; /* account info (ACB_xxxx bit-mask) */

	/* Was unknown_3 */
	uint32 fields_present; /* 0x00ff ffff */

	uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
	/* uint8 pad[2] */
	uint32 ptr_logon_hrs; /* unknown pointer */

	/* Was unknown_5. */
	uint16 bad_password_count;
	uint16 logon_count;

	uint8 padding1[6];
		
	uint8 passmustchange; /* 0x00 must change = 0x01 */

	uint8 padding2;

	UNISTR2 uni_user_name;    /* username unicode string */
	UNISTR2 uni_full_name;    /* user's full name unicode string */
	UNISTR2 uni_home_dir;     /* home directory unicode string */
	UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
	UNISTR2 uni_logon_script; /* logon script unicode string */
	UNISTR2 uni_profile_path; /* profile path unicode string */
	UNISTR2 uni_acct_desc  ;  /* user description unicode string */
	UNISTR2 uni_workstations; /* login from workstations unicode string */
	UNISTR2 uni_comment;
	UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */

	LOGON_HRS logon_hrs;

} SAM_USER_INFO_21;

#define PASS_MUST_CHANGE_AT_NEXT_LOGON	0x01
#define PASS_DONT_CHANGE_AT_NEXT_LOGON	0x00

/* SAM_USER_INFO_20 */
typedef struct sam_user_info_20
{
	UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */

	UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */

} SAM_USER_INFO_20;

/* SAM_USER_INFO_18 */
typedef struct sam_user_info_18
{
	uint8 lm_pwd[16];    /* lm user passwords */
	uint8 nt_pwd[16];    /* nt user passwords */

	uint8 lm_pwd_active; 
	uint8 nt_pwd_active; 

} SAM_USER_INFO_18;

/* SAM_USER_INFO_17 */
typedef struct sam_user_info_17
{
	uint8  padding_0[16];  /* 0 - padding 16 bytes */
	NTTIME expiry;         /* expiry time or something? */
	uint8  padding_1[24];  /* 0 - padding 24 bytes */

	UNIHDR hdr_mach_acct;  /* unicode header for machine account */
	uint32 padding_2;      /* 0 - padding 4 bytes */

	uint32 ptr_1;          /* pointer */
	uint8  padding_3[32];  /* 0 - padding 32 bytes */
	uint32 padding_4;      /* 0 - padding 4 bytes */

	uint32 ptr_2;          /* pointer */
	uint32 padding_5;      /* 0 - padding 4 bytes */

	uint32 ptr_3;          /* pointer */
	uint8  padding_6[32];  /* 0 - padding 32 bytes */

	uint32 rid_user;       /* user RID */
	uint32 rid_group;      /* group RID */

	uint16 acct_ctrl;      /* 0080 - ACB_XXXX */
	uint16 unknown_3;      /* 16 bit padding */

	uint16 unknown_4;      /* 0x003f      - 16 bit unknown */
	uint16 unknown_5;      /* 0x003c      - 16 bit unknown */

	uint8  padding_7[16];  /* 0 - padding 16 bytes */
	uint32 padding_8;      /* 0 - padding 4 bytes */
	
	UNISTR2 uni_mach_acct; /* unicode string for machine account */

	uint8  padding_9[48];  /* 0 - padding 48 bytes */

} SAM_USER_INFO_17;


/* SAM_USER_INFO_16 */
typedef struct sam_user_info_16
{
	uint32 acb_info;

} SAM_USER_INFO_16;


/* SAM_USER_INFO_7 */
typedef struct sam_user_info_7
{
	UNIHDR hdr_name;  /* unicode header for name */
	UNISTR2 uni_name; /* unicode string for name */

} SAM_USER_INFO_7;


/* SAM_USER_INFO_9 */
typedef struct sam_user_info_9
{
	uint32 rid_group;     /* Primary Group RID */
} SAM_USER_INFO_9;


/****************************************************************************
SAMR_Q_SET_SEC_OBJ - info level 4.
*****************************************************************************/

/* SAMR_Q_SET_SEC_OBJ - */
typedef struct q_samr_set_sec_obj_info
{
	POLICY_HND pol;          /* policy handle */
	uint32 sec_info;         /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
	SEC_DESC_BUF *buf;

} SAMR_Q_SET_SEC_OBJ;

/* SAMR_R_SET_SEC_OBJ - */
typedef struct r_samr_set_sec_obj_info
{
	NTSTATUS status;         /* return status */

} SAMR_R_SET_SEC_OBJ;


/****************************************************************************
SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
*****************************************************************************/

/* SAMR_Q_QUERY_DOMAIN_INFO - */
typedef struct q_samr_query_domain_info
{
	POLICY_HND domain_pol;   /* policy handle */
	uint16 switch_value;     /* 0x0002, 0x0001 */

} SAMR_Q_QUERY_DOMAIN_INFO;

typedef struct sam_unknown_info_1_inf
{
	uint16 min_length_password;
	uint16 password_history;
	uint32 password_properties;
	NTTIME expire;
	NTTIME min_passwordage;

} SAM_UNK_INFO_1;

typedef struct sam_unknown_info_2_inf
{
	NTTIME logout; /* whether users are forcibly disconnected when logon hours expire */
	UNIHDR hdr_comment; /* comment according to samba4 idl */
	UNIHDR hdr_domain; /* domain name unicode header */
	UNIHDR hdr_server; /* server name unicode header */

	/* put all the data in here, at the moment, including what the above
	   pointer is referring to
	 */

	uint64 seq_num;
	
	uint32 unknown_4; /* 0x0000 0001 */
	uint32 server_role;
	uint32 unknown_6; /* 0x0000 0001 */
	uint32 num_domain_usrs; /* number of users in domain */
	uint32 num_domain_grps; /* number of domain groups in domain */
	uint32 num_local_grps; /* number of local groups in domain */

	UNISTR2 uni_comment; /* comment unicode string */
	UNISTR2 uni_domain; /* domain name unicode string */
	UNISTR2 uni_server; /* server name unicode string */

} SAM_UNK_INFO_2;

typedef struct sam_unknown_info_3_info
{
	NTTIME logout;	
	/* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
	/* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/

} SAM_UNK_INFO_3;

typedef struct sam_unknown_info_4_inf
{
	UNIHDR hdr_comment; /* comment according to samba4 idl */
	UNISTR2 uni_comment; /* comment unicode string */

} SAM_UNK_INFO_4;

typedef struct sam_unknown_info_5_inf
{
	UNIHDR hdr_domain; /* domain name unicode header */
	UNISTR2 uni_domain; /* domain name unicode string */

} SAM_UNK_INFO_5;

typedef struct sam_unknown_info_6_info
{
	UNIHDR hdr_server; /* server name unicode header */
	UNISTR2 uni_server; /* server name unicode string */

} SAM_UNK_INFO_6;

typedef struct sam_unknown_info_7_info
{
	uint16 server_role;

} SAM_UNK_INFO_7;

typedef struct sam_unknown_info_8_info
{
	uint64 seq_num;
	NTTIME domain_create_time;

} SAM_UNK_INFO_8;

typedef struct sam_unknown_info_9_info
{
	uint32 unknown;

} SAM_UNK_INFO_9;

typedef struct sam_unknown_info_12_inf
{
	NTTIME duration;
	NTTIME reset_count;
	uint16 bad_attempt_lockout;

} SAM_UNK_INFO_12;

typedef struct sam_unknown_info_13_info
{
	uint64 seq_num;
	NTTIME domain_create_time;
	uint32 unknown1;
	uint32 unknown2;

} SAM_UNK_INFO_13;

typedef struct sam_unknown_ctr_info
{
	union
	{
		SAM_UNK_INFO_1 inf1;
		SAM_UNK_INFO_2 inf2;
		SAM_UNK_INFO_3 inf3;
		SAM_UNK_INFO_4 inf4;
		SAM_UNK_INFO_5 inf5;
		SAM_UNK_INFO_6 inf6;
		SAM_UNK_INFO_7 inf7;
		SAM_UNK_INFO_8 inf8;
		SAM_UNK_INFO_9 inf9;
		SAM_UNK_INFO_12 inf12;
		SAM_UNK_INFO_13 inf13;

	} info;

} SAM_UNK_CTR;


/* SAMR_R_QUERY_DOMAIN_INFO - */
typedef struct r_samr_query_domain_info
{
	uint32 ptr_0;
	uint16 switch_value; /* same as in query */

	SAM_UNK_CTR *ctr;

	NTSTATUS status;         /* return status */

} SAMR_R_QUERY_DOMAIN_INFO;


/* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
typedef struct q_samr_lookup_domain_info
{
	POLICY_HND connect_pol;

	UNIHDR  hdr_domain;
	UNISTR2 uni_domain;

} SAMR_Q_LOOKUP_DOMAIN;


/* SAMR_R_LOOKUP_DOMAIN */
typedef struct r_samr_lookup_domain_info
{
	uint32   ptr_sid;
	DOM_SID2 dom_sid;

	NTSTATUS status;

} SAMR_R_LOOKUP_DOMAIN;


#define MAX_SAM_ENTRIES_W2K 0x400
#define MAX_SAM_ENTRIES_W95 50
/* The following should be the greater of the preceeding two. */
#define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K

typedef struct samr_entry_info
{
	uint32 rid;
	UNIHDR hdr_name;

} SAM_ENTRY;


/* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
typedef struct q_samr_enum_domains_info
{
	POLICY_HND pol;     /* policy handle */

	uint32 start_idx;   /* enumeration handle */
	uint32 max_size;    /* 0x0000 ffff */

} SAMR_Q_ENUM_DOMAINS;

/* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
typedef struct r_samr_enum_domains_info
{
	uint32 next_idx;     /* next starting index required for enum */
	uint32 ptr_entries1;  

	uint32 num_entries2;
	uint32 ptr_entries2;

	uint32 num_entries3;

	SAM_ENTRY *sam;
	UNISTR2 *uni_dom_name;

	uint32 num_entries4;

	NTSTATUS status;

} SAMR_R_ENUM_DOMAINS;

/* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
typedef struct q_samr_enum_dom_users_info
{
	POLICY_HND pol;          /* policy handle */

	uint32 start_idx;   /* number of values (0 indicates unlimited?) */
	uint32 acb_mask;          /* 0x0000 indicates all */

	uint32 max_size;              /* 0x0000 ffff */

} SAMR_Q_ENUM_DOM_USERS;


/* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
typedef struct r_samr_enum_dom_users_info
{
	uint32 next_idx;     /* next starting index required for enum */
	uint32 ptr_entries1;  

	uint32 num_entries2;
	uint32 ptr_entries2;

	uint32 num_entries3;

	SAM_ENTRY *sam;
	UNISTR2 *uni_acct_name;

	uint32 num_entries4;

	NTSTATUS status;

} SAMR_R_ENUM_DOM_USERS;


/* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
typedef struct q_samr_enum_dom_groups_info
{
	POLICY_HND pol;          /* policy handle */

	/* this is possibly an enumeration context handle... */
	uint32 start_idx;         /* 0x0000 0000 */

	uint32 max_size;              /* 0x0000 ffff */

} SAMR_Q_ENUM_DOM_GROUPS;


/* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
typedef struct r_samr_enum_dom_groups_info
{
	uint32 next_idx;
	uint32 ptr_entries1;

	uint32 num_entries2;
	uint32 ptr_entries2;

	uint32 num_entries3;

	SAM_ENTRY *sam;
	UNISTR2 *uni_grp_name;

	uint32 num_entries4;

	NTSTATUS status;

} SAMR_R_ENUM_DOM_GROUPS;


/* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
typedef struct q_samr_enum_dom_aliases_info
{
	POLICY_HND pol;          /* policy handle */

	/* this is possibly an enumeration context handle... */
	uint32 start_idx;         /* 0x0000 0000 */

	uint32 max_size;              /* 0x0000 ffff */

} SAMR_Q_ENUM_DOM_ALIASES;


/* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
typedef struct r_samr_enum_dom_aliases_info
{
	uint32 next_idx;
	uint32 ptr_entries1;

	uint32 num_entries2;
	uint32 ptr_entries2;

	uint32 num_entries3;

	SAM_ENTRY *sam;
	UNISTR2 *uni_grp_name;

	uint32 num_entries4;

	NTSTATUS status;

} SAMR_R_ENUM_DOM_ALIASES;


/* -- Level 1 Display Info - User Information -- */

typedef struct samr_entry_info1
{
	uint32 user_idx;

	uint32 rid_user;
	uint32 acb_info;

	UNIHDR hdr_acct_name;
	UNIHDR hdr_user_name;
	UNIHDR hdr_user_desc;

} SAM_ENTRY1;

typedef struct samr_str_entry_info1
{
	UNISTR2 uni_acct_name;
	UNISTR2 uni_full_name;
	UNISTR2 uni_acct_desc;

} SAM_STR1;

typedef struct sam_entry_info_1
{
	SAM_ENTRY1 *sam;
	SAM_STR1   *str;

} SAM_DISPINFO_1;


/* -- Level 2 Display Info - Trust Account Information -- */

typedef struct samr_entry_info2
{
	uint32 user_idx;

	uint32 rid_user;
	uint32 acb_info;

	UNIHDR hdr_srv_name;
	UNIHDR hdr_srv_desc;

} SAM_ENTRY2;

typedef struct samr_str_entry_info2
{
	UNISTR2 uni_srv_name;
	UNISTR2 uni_srv_desc;

} SAM_STR2;

typedef struct sam_entry_info_2
{
	SAM_ENTRY2 *sam;
	SAM_STR2   *str;

} SAM_DISPINFO_2;


/* -- Level 3 Display Info - Domain Group Information -- */

typedef struct samr_entry_info3
{
	uint32 grp_idx;

	uint32 rid_grp;
	uint32 attr;     /* SE_GROUP_xxx, usually 7 */

	UNIHDR hdr_grp_name;
	UNIHDR hdr_grp_desc;

} SAM_ENTRY3;

typedef struct samr_str_entry_info3
{
	UNISTR2 uni_grp_name;
	UNISTR2 uni_grp_desc;

} SAM_STR3;

typedef struct sam_entry_info_3
{
	SAM_ENTRY3 *sam;
	SAM_STR3   *str;

} SAM_DISPINFO_3;


/* -- Level 4 Display Info - User List (ASCII) -- */

typedef struct samr_entry_info4
{
	uint32 user_idx;
	STRHDR hdr_acct_name;

} SAM_ENTRY4;

typedef struct samr_str_entry_info4
{
	STRING2 acct_name;

} SAM_STR4;

typedef struct sam_entry_info_4
{
	SAM_ENTRY4 *sam;
	SAM_STR4   *str;

} SAM_DISPINFO_4;


/* -- Level 5 Display Info - Group List (ASCII) -- */

typedef struct samr_entry_info5
{
	uint32 grp_idx;
	STRHDR hdr_grp_name;

} SAM_ENTRY5;

typedef struct samr_str_entry_info5
{
	STRING2 grp_name;

} SAM_STR5;

typedef struct sam_entry_info_5
{
	SAM_ENTRY5 *sam;
	SAM_STR5   *str;

} SAM_DISPINFO_5;


typedef struct sam_dispinfo_ctr_info
{
	union
	{
		SAM_DISPINFO_1 *info1; /* users/names/descriptions */
		SAM_DISPINFO_2 *info2; /* trust accounts */
		SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
		SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
		SAM_DISPINFO_5 *info5; /* group list (ASCII) */
		void       *info; /* allows assignment without typecasting, */

	} sam;

} SAM_DISPINFO_CTR;


/* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
typedef struct q_samr_query_disp_info
{
	POLICY_HND domain_pol;

	uint16 switch_level;    /* see SAM_DISPINFO_CTR above */
	/* align */

	uint32 start_idx;       /* start enumeration index */
	uint32 max_entries;     /* maximum number of entries to return */
	uint32 max_size;        /* recommended data size; if exceeded server
				   should return STATUS_MORE_ENTRIES */

} SAMR_Q_QUERY_DISPINFO;


/* SAMR_R_QUERY_DISPINFO  */
typedef struct r_samr_query_dispinfo_info
{
	uint32 total_size;     /* total data size for all matching entries
				  (0 = uncalculated) */
	uint32 data_size;      /* actual data size returned = size of SAM_ENTRY
				  structures + total length of strings */

	uint16 switch_level;   /* see SAM_DISPINFO_CTR above */
	/* align */

	uint32 num_entries;    /* number of entries returned */
	uint32 ptr_entries;
	uint32 num_entries2;

	SAM_DISPINFO_CTR *ctr;

	NTSTATUS status;

} SAMR_R_QUERY_DISPINFO;

/* SAMR_Q_GET_DISPENUM_INDEX */
typedef struct q_samr_get_dispenum_index
{
	POLICY_HND domain_pol;
	uint16 switch_level;
	LSA_STRING name;

} SAMR_Q_GET_DISPENUM_INDEX;

/* SAMR_R_GET_DISPENUM_INDEX */
typedef struct r_samr_get_dispenum_index
{
	uint32 idx;
	NTSTATUS status;
	
} SAMR_R_GET_DISPENUM_INDEX;

/* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
typedef struct q_samr_query_group_info
{
	POLICY_HND pol;        /* policy handle */

	uint16 switch_level;    /* 0x0001 seen */

} SAMR_Q_QUERY_GROUPINFO;

typedef struct samr_group_info1
{
	UNIHDR hdr_acct_name;

	uint32 group_attr; /* 0x0000 0003 - group attribute */
	uint32 num_members; /* 0x0000 0001 - number of group members? */

	UNIHDR hdr_acct_desc;

	UNISTR2 uni_acct_name;
	UNISTR2 uni_acct_desc;

} GROUP_INFO1;

typedef struct samr_group_info2
{
	uint16 level;
	UNIHDR hdr_acct_name;
	UNISTR2 uni_acct_name;

} GROUP_INFO2;

typedef struct samr_group_info3
{
	uint32 group_attr; /* 0x0000 0003 - group attribute */

} GROUP_INFO3;

typedef struct samr_group_info4
{
	uint16 level;
	UNIHDR hdr_acct_desc;
	UNISTR2 uni_acct_desc;

} GROUP_INFO4;

typedef struct samr_group_info5
{
	UNIHDR hdr_acct_name;

	uint32 group_attr; /* 0x0000 0003 - group attribute */
	uint32 num_members; /* 0x0000 0001 - number of group members? */

	UNIHDR hdr_acct_desc;

	UNISTR2 uni_acct_name;
	UNISTR2 uni_acct_desc;

} GROUP_INFO5;


/* GROUP_INFO_CTR */
typedef struct group_info_ctr
{
	uint16 switch_value1;

	union
 	{
		GROUP_INFO1 info1;
		GROUP_INFO2 info2;
		GROUP_INFO3 info3;
		GROUP_INFO4 info4;
		GROUP_INFO5 info5;
	} group;

} GROUP_INFO_CTR;

/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
typedef struct r_samr_query_groupinfo_info
{
	uint32 ptr;        
	GROUP_INFO_CTR *ctr;

	NTSTATUS status;

} SAMR_R_QUERY_GROUPINFO;


/* SAMR_Q_SET_GROUPINFO - SAM Group Info */
typedef struct q_samr_set_group_info
{
	POLICY_HND pol;        /* policy handle */
	GROUP_INFO_CTR *ctr;

} SAMR_Q_SET_GROUPINFO;

/* SAMR_R_SET_GROUPINFO - SAM Group Info */
typedef struct r_samr_set_group_info
{
	NTSTATUS status;

} SAMR_R_SET_GROUPINFO;


/********************************************************/

typedef struct {
	UNISTR4 name;
	UNISTR4 description;
	uint32 num_member;
} ALIAS_INFO1;

typedef struct {
	UNISTR4 name;
} ALIAS_INFO2;

typedef struct {
	UNISTR4 description;
} ALIAS_INFO3;

typedef struct {
	POLICY_HND pol;        /* policy handle */
	uint16 level;    /* 0x0003 seen */
} SAMR_Q_QUERY_ALIASINFO;

typedef struct {
	uint16 level;
	union {
		ALIAS_INFO1 info1;
		ALIAS_INFO2 info2;
		ALIAS_INFO3 info3;
	} alias;
} ALIAS_INFO_CTR;

typedef struct {
	ALIAS_INFO_CTR *ctr;
	NTSTATUS status;
} SAMR_R_QUERY_ALIASINFO;


/********************************************************/

typedef struct {
	POLICY_HND alias_pol;        /* policy handle */
	ALIAS_INFO_CTR ctr;
} SAMR_Q_SET_ALIASINFO;

typedef struct {
	NTSTATUS status;
} SAMR_R_SET_ALIASINFO;


/********************************************************/

/* SAMR_Q_QUERY_USERGROUPS - */
typedef struct q_samr_query_usergroup_info
{
	POLICY_HND pol;          /* policy handle associated with unknown id */

} SAMR_Q_QUERY_USERGROUPS;

/* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
typedef struct r_samr_query_usergroup_info
{
	uint32 ptr_0;            /* pointer */
	uint32 num_entries;      /* number of RID groups */
	uint32 ptr_1;            /* pointer */
	uint32 num_entries2;     /* number of RID groups */

	DOM_GID *gid; /* group info */

	NTSTATUS status;         /* return status */

} SAMR_R_QUERY_USERGROUPS;

/* SAM_USERINFO_CTR - sam user info */
typedef struct sam_userinfo_ctr_info
{
	uint16 switch_value;      

	union
	{
		SAM_USER_INFO_7  *id7;
		SAM_USER_INFO_9  *id9;
		SAM_USER_INFO_16 *id16;
		SAM_USER_INFO_17 *id17;
		SAM_USER_INFO_18 *id18;
		SAM_USER_INFO_20 *id20;
		SAM_USER_INFO_21 *id21;
		SAM_USER_INFO_23 *id23;
		SAM_USER_INFO_24 *id24;
		SAM_USER_INFO_25 *id25;
		SAM_USER_INFO_26 *id26;
		void* id; /* to make typecasting easy */

	} info;

} SAM_USERINFO_CTR;


/* SAMR_Q_SET_USERINFO2 - set sam info */
typedef struct q_samr_set_user_info2
{
	POLICY_HND pol;          /* policy handle associated with user */
	uint16 switch_value;      /* 0x0010 */

	SAM_USERINFO_CTR *ctr;

} SAMR_Q_SET_USERINFO2;

/* SAMR_R_SET_USERINFO2 - set sam info */
typedef struct r_samr_set_user_info2
{
	NTSTATUS status;         /* return status */

} SAMR_R_SET_USERINFO2;

/* SAMR_Q_SET_USERINFO - set sam info */
typedef struct q_samr_set_user_info
{
	POLICY_HND pol;          /* policy handle associated with user */
	uint16 switch_value;
	SAM_USERINFO_CTR *ctr;

} SAMR_Q_SET_USERINFO;

/* SAMR_R_SET_USERINFO - set sam info */
typedef struct r_samr_set_user_info
{
	NTSTATUS status;         /* return status */

} SAMR_R_SET_USERINFO;


/* SAMR_Q_QUERY_USERINFO - probably a get sam info */
typedef struct q_samr_query_user_info
{
	POLICY_HND pol;          /* policy handle associated with unknown id */
	uint16 switch_value;         /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */

} SAMR_Q_QUERY_USERINFO;

/* SAMR_R_QUERY_USERINFO - probably a get sam info */
typedef struct r_samr_query_user_info
{
	uint32 ptr;            /* pointer */
	SAM_USERINFO_CTR *ctr;

	NTSTATUS status;         /* return status */

} SAMR_R_QUERY_USERINFO;


/****************************************************************************
SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.

the policy handle allocated by an "samr open secret" call is associated
with a SID.  this policy handle is what is queried here, *not* the SID
itself.  the response to the lookup rids is relative to this SID.
*****************************************************************************/
/* SAMR_Q_QUERY_USERALIASES */
typedef struct q_samr_query_useraliases_info
{
	POLICY_HND pol;       /* policy handle */

	uint32 num_sids1;      /* number of rids being looked up */
	uint32 ptr;            /* buffer pointer */
	uint32 num_sids2;      /* number of rids being looked up */

	uint32   *ptr_sid; /* pointers to sids to be looked up */
	DOM_SID2 *sid    ; /* sids to be looked up. */

} SAMR_Q_QUERY_USERALIASES;


/* SAMR_R_QUERY_USERALIASES */
typedef struct r_samr_query_useraliases_info
{
	uint32 num_entries;
	uint32 ptr; /* undocumented buffer pointer */

	uint32 num_entries2; 
	uint32 *rid; /* domain RIDs being looked up */

	NTSTATUS status; /* return code */

} SAMR_R_QUERY_USERALIASES;


/****************************************************************************
SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
*****************************************************************************/
/* SAMR_Q_LOOKUP_NAMES */
typedef struct q_samr_lookup_names_info
{
	POLICY_HND pol;       /* policy handle */

	uint32 num_names1;      /* number of names being looked up */
	uint32 flags;           /* 0x0000 03e8 - unknown */
	uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
	uint32 num_names2;      /* number of names being looked up */

	UNIHDR  *hdr_name; /* unicode account name header */
	UNISTR2 *uni_name; /* unicode account name string */

} SAMR_Q_LOOKUP_NAMES;


/* SAMR_R_LOOKUP_NAMES */
typedef struct r_samr_lookup_names_info
{
	uint32 num_rids1;      /* number of aliases being looked up */
	uint32 ptr_rids;       /* pointer to aliases */
	uint32 num_rids2;      /* number of aliases being looked up */

	uint32 *rids; /* rids */

	uint32 num_types1;      /* number of users in aliases being looked up */
	uint32 ptr_types;       /* pointer to users in aliases */
	uint32 num_types2;      /* number of users in aliases being looked up */

	uint32 *types; /* SID_ENUM type */

	NTSTATUS status; /* return code */

} SAMR_R_LOOKUP_NAMES;


/****************************************************************************
SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.

called to resolve domain RID groups.
*****************************************************************************/
/* SAMR_Q_LOOKUP_RIDS */
typedef struct q_samr_lookup_rids_info
{
	POLICY_HND pol;       /* policy handle */

	uint32 num_rids1;      /* number of rids being looked up */
	uint32 flags;          /* 0x0000 03e8 - unknown */
	uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
	uint32 num_rids2;      /* number of rids being looked up */

	uint32 *rid; /* domain RIDs being looked up */

} SAMR_Q_LOOKUP_RIDS;


/****************************************************************************
SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names

*****************************************************************************/
/* SAMR_R_LOOKUP_RIDS */
typedef struct r_samr_lookup_rids_info
{
	uint32 num_names1;      /* number of aliases being looked up */
	uint32 ptr_names;       /* pointer to aliases */
	uint32 num_names2;      /* number of aliases being looked up */

	UNIHDR  *hdr_name; /* unicode account name header */
	UNISTR2 *uni_name; /* unicode account name string */

	uint32 num_types1;      /* number of users in aliases being looked up */
	uint32 ptr_types;       /* pointer to users in aliases */
	uint32 num_types2;      /* number of users in aliases being looked up */

	uint32 *type; /* SID_ENUM type */

	NTSTATUS status;

} SAMR_R_LOOKUP_RIDS;


/* SAMR_Q_QUERY_GROUPMEM - query group members */
typedef struct q_samr_query_groupmem_info
{
	POLICY_HND group_pol;        /* policy handle */

} SAMR_Q_QUERY_GROUPMEM;


/* SAMR_R_QUERY_GROUPMEM - query group members */
typedef struct r_samr_query_groupmem_info
{
	uint32 ptr;
	uint32 num_entries;

	uint32 ptr_rids;
	uint32 ptr_attrs;

	uint32 num_rids;
	uint32 *rid;

	uint32 num_attrs;
	uint32 *attr;

	NTSTATUS status;

} SAMR_R_QUERY_GROUPMEM;


/* SAMR_ENC_PASSWD */
typedef struct enc_passwd_info
{
	uint32 ptr;
	uint8 pass[516];

} SAMR_ENC_PASSWD;

/* SAMR_ENC_HASH */
typedef struct enc_hash_info
{
	uint32 ptr;
	uint8 hash[16];

} SAMR_ENC_HASH;

/* SAMR_Q_CHGPASSWD_USER */
typedef struct q_samr_chgpasswd_user_info
{
	uint32 ptr_0;

	UNIHDR hdr_dest_host; /* server name unicode header */
	UNISTR2 uni_dest_host; /* server name unicode string */

	UNIHDR hdr_user_name;    /* username unicode string header */
	UNISTR2 uni_user_name;    /* username unicode string */

	SAMR_ENC_PASSWD nt_newpass;
	SAMR_ENC_HASH nt_oldhash;

	uint32 unknown; /* 0x0000 0001 */

	SAMR_ENC_PASSWD lm_newpass;
	SAMR_ENC_HASH lm_oldhash;

} SAMR_Q_CHGPASSWD_USER;

/* SAMR_R_CHGPASSWD_USER */
typedef struct r_samr_chgpasswd_user_info
{
	NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */

} SAMR_R_CHGPASSWD_USER;

/* SAMR_Q_CHGPASSWD3 */
typedef struct q_samr_chgpasswd_user3
{
	uint32 ptr_0;

	UNIHDR hdr_dest_host; /* server name unicode header */
	UNISTR2 uni_dest_host; /* server name unicode string */

	UNIHDR hdr_user_name;    /* username unicode string header */
	UNISTR2 uni_user_name;    /* username unicode string */

	SAMR_ENC_PASSWD nt_newpass;
	SAMR_ENC_HASH nt_oldhash;

	uint32 lm_change; /* 0x0000 0001 */

	SAMR_ENC_PASSWD lm_newpass;
	SAMR_ENC_HASH lm_oldhash;

	SAMR_ENC_PASSWD password3;

} SAMR_Q_CHGPASSWD_USER3;

/* SAMR_CHANGE_REJECT */
typedef struct samr_change_reject
{
	uint32 reject_reason;
	uint32 unknown1;
	uint32 unknown2;

} SAMR_CHANGE_REJECT;

/* SAMR_R_CHGPASSWD3 */
typedef struct r_samr_chgpasswd_user3
{
	uint32 ptr_info;
	uint32 ptr_reject;
	SAM_UNK_INFO_1 *info;
	SAMR_CHANGE_REJECT *reject;
	NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */

} SAMR_R_CHGPASSWD_USER3;



/* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */
typedef struct q_samr_remove_sid_foreign_domain_info
{
	POLICY_HND dom_pol;   /* policy handle */
	DOM_SID2 sid;         /* SID */

} SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN;


/* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */
typedef struct r_samr_remove_sid_foreign_domain_info
{
	NTSTATUS status;         /* return status */

} SAMR_R_REMOVE_SID_FOREIGN_DOMAIN;



/* these are from the old rpc_samr.h - they are needed while the merge
   is still going on */
#define MAX_SAM_SIDS 15

/* DOM_SID3 - security id */
typedef struct sid_info_3
{
        uint16 len; /* length, bytes, including length of len :-) */
        /* uint8  pad[2]; */
        
        DOM_SID sid;

} DOM_SID3;

/* SAMR_Q_QUERY_DOMAIN_INFO2 */
typedef struct q_samr_query_domain_info2
{
	POLICY_HND domain_pol;   /* policy handle */
	uint16 switch_value;

} SAMR_Q_QUERY_DOMAIN_INFO2;

/* SAMR_R_QUERY_DOMAIN_INFO2 */
typedef struct r_samr_query_domain_info2
{
	uint32 ptr_0;
	uint16 switch_value;
	SAM_UNK_CTR *ctr;
	NTSTATUS status;         /* return status */

} SAMR_R_QUERY_DOMAIN_INFO2;

/* SAMR_Q_SET_DOMAIN_INFO */
typedef struct q_samr_set_domain_info
{
	POLICY_HND domain_pol;   /* policy handle */
	uint16 switch_value0;
	uint16 switch_value;
	SAM_UNK_CTR *ctr;

} SAMR_Q_SET_DOMAIN_INFO;

/* SAMR_R_SET_DOMAIN_INFO */
typedef struct r_samr_set_domain_info
{
	NTSTATUS status;         /* return status */

} SAMR_R_SET_DOMAIN_INFO;

#endif /* _RPC_SAMR_H */