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
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2017 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _MLSVC_SAM_NDL_
#define _MLSVC_SAM_NDL_
/*
* Security Accounts Manager RPC (SAMR) interface definition.
*/
#include <libmlrpc/ndrtypes.ndl>
/* Windows NT */
#define SAMR_OPNUM_Connect 0x00 /* SamrConnect */
#define SAMR_OPNUM_CloseHandle 0x01
#define SAMR_OPNUM_SetSecObject 0x02
#define SAMR_OPNUM_QuerySecObject 0x03
#define SAMR_OPNUM_ShutdownSamServer 0x04 /* NotUsedOnWire */
#define SAMR_OPNUM_LookupDomain 0x05
#define SAMR_OPNUM_EnumLocalDomains 0x06
#define SAMR_OPNUM_OpenDomain 0x07
#define SAMR_OPNUM_QueryDomainInfo 0x08
#define SAMR_OPNUM_SetDomainInfo 0x09
#define SAMR_OPNUM_CreateDomainGroup 0x0a
#define SAMR_OPNUM_QueryDomainGroups 0x0b
#define SAMR_OPNUM_CreateDomainUser 0x0c
#define SAMR_OPNUM_EnumDomainUsers 0x0d
#define SAMR_OPNUM_CreateDomainAlias 0x0e
#define SAMR_OPNUM_EnumDomainAliases 0x0f
#define SAMR_OPNUM_LookupIds 0x10 /* GetAliasMembership */
#define SAMR_OPNUM_LookupNames 0x11
#define SAMR_OPNUM_LookupDomainIds 0x12
#define SAMR_OPNUM_OpenGroup 0x13
#define SAMR_OPNUM_QueryGroupInfo 0x14
#define SAMR_OPNUM_StoreGroupInfo 0x15
#define SAMR_OPNUM_AddGroupMember 0x16
#define SAMR_OPNUM_DeleteDomainGroup 0x17
#define SAMR_OPNUM_DeleteGroupMember 0x18
#define SAMR_OPNUM_ListGroupMembers 0x19
#define SAMR_OPNUM_SetGroupMemberAttributes 0x1a
#define SAMR_OPNUM_OpenAlias 0x1b
#define SAMR_OPNUM_QueryAliasInfo 0x1c
#define SAMR_OPNUM_SetAliasInfo 0x1d
#define SAMR_OPNUM_DeleteDomainAlias 0x1e
#define SAMR_OPNUM_AddAliasMember 0x1f
#define SAMR_OPNUM_DeleteAliasMember 0x20
#define SAMR_OPNUM_ListAliasMembers 0x21
#define SAMR_OPNUM_OpenUser 0x22
#define SAMR_OPNUM_DeleteUser 0x23
#define SAMR_OPNUM_QueryUserInfo 0x24
#define SAMR_OPNUM_SetUserInfo0 0x25 /* SetUserInfo */
#define SAMR_OPNUM_ChangeUserPassword0 0x26 /* ChangeUserPassword */
#define SAMR_OPNUM_QueryUserGroups 0x27
#define SAMR_OPNUM_QueryDispInfo 0x28 /* QueryDispInfo1 */
#define SAMR_OPNUM_GetDisplayEnumIndex 0x29
#define SAMR_OPNUM_TestPrivateDomainFunctions 0x2a /* NotUsedOnWire */
#define SAMR_OPNUM_TestPrivateUserFunctions 0x2b /* NotUsedOnWire */
#define SAMR_OPNUM_GetUserPwInfo 0x2c
/* Windows 2000 */
#define SAMR_OPNUM_RemoveMemberFromForeignDomain 0x2d
#define SAMR_OPNUM_QueryInfoDomain2 0x2e
#define SAMR_OPNUM_QueryInfoUser2 0x2f
#define SAMR_OPNUM_EnumDomainGroups 0x30 /* QueryDispInfo2 */
#define SAMR_OPNUM_GetDisplayEnumIndex2 0x31
#define SAMR_OPNUM_CreateUser 0x32
#define SAMR_OPNUM_QueryDispInfo4 0x33
#define SAMR_OPNUM_AddMultipleAliasMembers 0x34
#define SAMR_OPNUM_RemoveMultipleAliasMembers 0x35
#define SAMR_OPNUM_ChangeUserOemPassword 0x36
#define SAMR_OPNUM_ChangePasswordUser2 0x37 /* UnicodePasswd */
#define SAMR_OPNUM_GetDomainPwInfo 0x38
#define SAMR_OPNUM_Connect2 0x39 /* SamrConnect2 */
#define SAMR_OPNUM_SetUserInfo 0x3a /* SetInfoUser2 */
#define SAMR_OPNUM_SetBootKeyInformation 0x3b
#define SAMR_OPNUM_GetBootKeyInformation 0x3c
#define SAMR_OPNUM_Connect3 0x3d /* NotUsedOnWire */
#define SAMR_OPNUM_Connect4 0x3e /* SamrConnect4 */
#define SAMR_OPNUM_ChangeUserUnicodePassword3 0x3f
/* Windows XP and Windows Server 2003 */
#define SAMR_OPNUM_Connect5 0x40 /* SamrConnect5 */
#define SAMR_OPNUM_RidToSid 0x41
#define SAMR_OPNUM_SetDSRMPassword 0x42
#define SAMR_OPNUM_ValidatePassword 0x43
/* Windows Vista */
#define SAMR_OPNUM_QueryLocalizableAccountsInDomain 0x44
#define SAMR_OPNUM_PerformGenericOperation 0x45
/*
* Sam account flags used when creating an account. These flags seem
* to be very similar to the USER_INFO_X flags (UF_XXX) in lmaccess.h
* but the values are different.
*/
#define SAMR_AF_ACCOUNTDISABLE 0x0001
#define SAMR_AF_HOMEDIR_REQUIRED 0x0002
#define SAMR_AF_PASSWD_NOTREQD 0x0004
#define SAMR_AF_TEMP_DUPLICATE_ACCOUNT 0x0008
#define SAMR_AF_NORMAL_ACCOUNT 0x0010
#define SAMR_AF_MNS_LOGON_ACCOUNT 0x0020
#define SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT 0x0040
#define SAMR_AF_WORKSTATION_TRUST_ACCOUNT 0x0080
#define SAMR_AF_SERVER_TRUST_ACCOUNT 0x0100
#define SAMR_AF_DONT_EXPIRE_PASSWD 0x0200
#define SAMR_AF_ACCOUNT_AUTOLOCK 0x0400
#define SAMR_AF_MACHINE_ACCOUNT_MASK ( \
SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT \
| SAMR_AF_WORKSTATION_TRUST_ACCOUNT \
| SAMR_AF_SERVER_TRUST_ACCOUNT)
#define SAMR_AF_ACCOUNT_TYPE_MASK ( \
SAMR_AF_TEMP_DUPLICATE_ACCOUNT \
| SAMR_AF_NORMAL_ACCOUNT \
| SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT \
| SAMR_AF_WORKSTATION_TRUST_ACCOUNT \
| SAMR_AF_SERVER_TRUST_ACCOUNT)
/*
* QueryUserInfo UserAllInformation WhichFields
*/
#define SAMR_USER_ALL_USERNAME 0x00000001
#define SAMR_USER_ALL_FULLNAME 0x00000002
#define SAMR_USER_ALL_USERID 0x00000004
#define SAMR_USER_ALL_PRIMARYGROUPID 0x00000008
#define SAMR_USER_ALL_ADMINCOMMENT 0x00000010
#define SAMR_USER_ALL_USERCOMMENT 0x00000020
#define SAMR_USER_ALL_HOMEDIRECTORY 0x00000040
#define SAMR_USER_ALL_HOMEDIRECTORYDRIVE 0x00000080
#define SAMR_USER_ALL_SCRIPTPATH 0x00000100
#define SAMR_USER_ALL_PROFILEPATH 0x00000200
#define SAMR_USER_ALL_WORKSTATIONS 0x00000400
#define SAMR_USER_ALL_LASTLOGON 0x00000800
#define SAMR_USER_ALL_LASTLOGOFF 0x00001000
#define SAMR_USER_ALL_LOGONHOURS 0x00002000
#define SAMR_USER_ALL_BADPASSWORDCOUNT 0x00004000
#define SAMR_USER_ALL_LOGONCOUNT 0x00008000
#define SAMR_USER_ALL_PASSWORDCANCHANGE 0x00010000
#define SAMR_USER_ALL_PASSWORDMUSTCHANGE 0x00020000
#define SAMR_USER_ALL_PASSWORDLASTSET 0x00040000
#define SAMR_USER_ALL_ACCOUNTEXPIRES 0x00080000
#define SAMR_USER_ALL_USERACCOUNTCONTROL 0x00100000
#define SAMR_USER_ALL_PARAMETERS 0x00200000
#define SAMR_USER_ALL_COUNTRYCODE 0x00400000
#define SAMR_USER_ALL_CODEPAGE 0x00800000
#define SAMR_USER_ALL_NTPASSWORDPRESENT 0x01000000
#define SAMR_USER_ALL_LMPASSWORDPRESENT 0x02000000
#define SAMR_USER_ALL_PRIVATEDATA 0x04000000
#define SAMR_USER_ALL_PASSWORDEXPIRED 0x08000000
#define SAMR_USER_ALL_SECURITYDESCRIPTOR 0x10000000
#define SAMR_USER_ALL_OWF_PASSWORD 0x20000000
#define SAMR_USER_ALL_UNDEFINED_MASK 0xC0000000
/*
* Alias Access Mask values for SAMR
* Section 2.2.1.6 of MS-SAMR
*/
#define SAMR_ALIAS_ACCESS_EXECUTE 0x00020008
#define SAMR_ALIAS_ACCESS_WRITE 0x00020013
#define SAMR_ALIAS_ACCESS_READ 0x00020004
#define SAMR_ALIAS_ACCESS_ALL_ACCESS 0x000F001F
#define SAMR_ALIAS_ACCESS_WRITE_ACCOUNT 0x00000010
#define SAMR_ALIAS_ACCESS_READ_INFO 0x00000008
#define SAMR_ALIAS_ACCESS_LIST_MEMBERS 0x00000004
#define SAMR_ALIAS_ACCESS_REMOVE_MEMBER 0x00000002
#define SAMR_ALIAS_ACCESS_ADD_MEMBER 0x00000001
#define SAMR_REVISION_1 1 /* Pre Windows 2000 */
#define SAMR_REVISION_2 2 /* Windows 2000 */
#define SAMR_REVISION_3 3 /* Post Windows 2000 */
/*
* Definition for a SID. The ndl compiler does not allow a typedef of
* a structure containing variable size members.
* Note: cast compatible with smb_sid_t, and code depends on that.
*/
struct samr_sid {
BYTE Revision;
BYTE SubAuthCount;
BYTE Authority[6];
SIZE_IS(SubAuthCount)
DWORD SubAuthority[ANY_SIZE_ARRAY];
};
/*
* SAMR definition of a security_descriptor.
*/
struct samr_sec_desc {
BYTE Revision;
BYTE Sbz1;
WORD Control;
struct samr_sid *owner;
struct samr_sid *group;
struct samr_sid *sacl;
struct samr_sid *dacl;
};
struct samr_sd {
DWORD length;
SIZE_IS(length)
BYTE *data;
};
typedef struct samr_sd samr_sd_t;
/*
* See RPC_STRING in the MS IDL.
* Definition for a string. The length and allosize should be set to
* twice the string length (i.e. strlen(str) * 2). The runtime code
* will perform the appropriate string to a wide-char conversions,
* so str should point to a regular char * string.
*/
struct samr_string {
WORD length;
WORD allosize;
LPTSTR str;
};
typedef struct samr_string samr_string_t;
/*
* Alternative varying/conformant string definition - for
* non-null terminated strings. This definition must match
* ndr_vcbuf_t.
*/
struct samr_vcb {
/*
* size_is (actually a copy of length_is) will
* be inserted here by the marshalling library.
*/
DWORD vc_first_is;
DWORD vc_length_is;
SIZE_IS(vc_length_is)
WORD buffer[ANY_SIZE_ARRAY];
};
struct samr_vcbuf {
WORD wclen;
WORD wcsize;
struct samr_vcb *vcb;
};
typedef struct samr_vcbuf samr_vcbuf_t;
CONTEXT_HANDLE(samr_handle) samr_handle_t;
/*
* OLD_LARGE_INTEGER: a 64-bit value.
*/
struct samr_quad {
DWORD low;
DWORD high;
};
typedef struct samr_quad samr_quad_t;
/*
* Blob used for the NT and LM OWF passwords.
* The length and maxlen should be 16.
*/
struct samr_short_blob {
WORD length;
WORD maxlen;
SIZE_IS(length / 2)
WORD *buf;
};
#define DOMAIN_PASSWORD_COMPLEX 0x00000001
#define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002
#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
#define DOMAIN_LOCKOUT_ADMINS 0x00000008
#define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
#define DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020
struct samr_password_info {
WORD min_length;
DWORD properties;
};
typedef struct samr_password_info samr_password_info_t;
/*
* There is some sort of logon bitmap structure in here, which I
* think is a varying and conformant array, i.e.
*
* struct samr_logon_hours {
* DWORD size_is; (1260)
* DWORD first_is; (zero)
* DWORD length_is; (168)
* BYTE bitmap[21];
* };
*
* struct samr_logon_info {
* DWORD length;
* SIZE_IS(length / 8)
* struct samr_logon_hours *hours;
* };
*
* There are 10080 minutes/week => 10080/8 = 1260 (0x04EC).
* So size_is is set as some sort of maximum.
*
* There are 168 hours/week => 168/8 = 21 (0xA8). Since there are 21
* bytes (all set to 0xFF), this is is probably the default setting.
*/
#define SAMR_MINS_PER_WEEK 10080
#define SAMR_HOURS_PER_WEEK 168
#define SAMR_HOURS_MAX_SIZE (SAMR_MINS_PER_WEEK / 8)
#define SAMR_HOURS_SET_LEN(LEN) ((LEN) / 8)
#define SAMR_SET_USER_HOURS_SZ 21
struct samr_logon_hours {
DWORD size;
DWORD first;
DWORD length;
BYTE bitmap[SAMR_SET_USER_HOURS_SZ];
};
struct samr_logon_info {
DWORD units;
DWORD hours;
};
struct samr_logon_hours_all {
WORD units_per_week;
SIZE_IS(units_per_week / 8)
BYTE *hours;
};
/*
* SAMPR_USER_PASSWORD (in the MS Net API) or
* struct samr_user_password (internal use) is
* the "clear" form of struct samr_encr_passwd
* (SAMPR_ENCRYPTED_USER_PASSWORD in MS Net).
* It's not used by ndrgen, but is declared here
* to help clarify the relationship between these,
* and for the benefit of our client-side code.
*/
#ifndef NDRGEN
#define SAMR_USER_PWLEN 256
struct samr_user_password {
ndr_wchar_t Buffer[SAMR_USER_PWLEN];
DWORD Length;
};
#endif /* NDRGEN */
/* SAMPR_ENCRYPTED_USER_PASSWORD */
#define SAMR_ENCR_PWLEN 516 /* sizeof samr_user_password */
struct samr_encr_passwd {
BYTE data[SAMR_ENCR_PWLEN];
};
/* ENCRYPTED_NT_OWF_PASSWORD */
#define SAMR_PWHASH_LEN 16
struct samr_encr_hash {
BYTE data[SAMR_PWHASH_LEN];
};
/*
***********************************************************************
* SamrConnect.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_Connect)
struct samr_Connect {
IN DWORD *servername;
IN DWORD access_mask;
OUT samr_handle_t handle;
OUT DWORD status;
};
/*
***********************************************************************
* SamrConnect2.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_Connect2)
struct samr_Connect2 {
IN LPTSTR servername;
IN DWORD access_mask;
OUT samr_handle_t handle;
OUT DWORD status;
};
/*
***********************************************************************
* SamrConnect4. A new form of connect first seen with Windows 2000.
* A new field has been added to the input request. Value: 0x00000002.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_Connect4)
struct samr_Connect4 {
IN LPTSTR servername;
IN DWORD revision;
IN DWORD access_mask;
OUT samr_handle_t handle;
OUT DWORD status;
};
/*
***********************************************************************
* SamrConnect5. A new form of connect first seen with Windows XP.
* The server name is the fully qualified domain name, i.e.
* \\server.sun.com.
*
* [in] DWORD InVersion,
* [in] [switch_is(InVersion)] samr_revision_info *InRevisionInfo
* [out] DWORD *OutVersion
* [out] [switch_is(*OutVersion)] *samr_revision_info *OutRevisionInfo
*
* SupportedFeatures (see notes in [MS-SAMR]
* 0x00000001 RID values returned from the server must not be
* concatenated with the domain SID.
* 0x00000002 Reserved
* 0x00000004 Reserved
***********************************************************************
*/
struct samr_revision_info1 {
DWORD revision;
DWORD supported_features;
};
typedef struct samr_revision_info1 samr_revision_info1_t;
union samr_revision_info {
UNION_INFO_ENT(1,samr_revision_info);
DEFAULT char *nullptr;
};
OPERATION(SAMR_OPNUM_Connect5)
struct samr_Connect5 {
IN LPTSTR servername;
IN DWORD access_mask;
/*
* This should be a union, but instead this is
* done this way because unions are hard to
* express in this RPC implementation.
*/
INOUT DWORD unknown2_00000001; /* V1 */
INOUT DWORD unknown3_00000001; /* V1 */
/* SAMPR_REVISION_INFO_V1 */
INOUT DWORD unknown4_00000003; /* Revision */
INOUT DWORD unknown5_00000000; /* SupportedFeatures */
OUT samr_handle_t handle;
OUT DWORD status;
};
/*
***********************************************************************
* CloseHandle closes an association with the SAM. Using the same
* structure as the LSA seems to work.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_CloseHandle)
struct samr_CloseHandle {
IN samr_handle_t handle;
OUT samr_handle_t result_handle;
OUT DWORD status;
};
/*
***********************************************************************
* QuerySecObject
*
* Returns the SecurityDescriptor of the object. Support not complete.
*
* QuerySecObject (
* IN samr_handle_t obj_handle,
* IN SECURITY_INFO secinfo,
* OUT samr_sd_t *sd,
* OUT DWORD status
* )
*
***********************************************************************
*/
typedef DWORD SECURITY_INFO;
OPERATION(SAMR_OPNUM_QuerySecObject)
struct samr_QuerySecObject {
IN samr_handle_t obj_handle;
IN SECURITY_INFO secinfo;
OUT samr_sd_t *sd;
OUT DWORD status;
};
/*
***********************************************************************
* LookupDomain: lookup up the domain SID.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_LookupDomain)
struct samr_LookupDomain {
IN samr_handle_t handle;
IN samr_string_t domain_name;
OUT struct samr_sid *sid;
OUT DWORD status;
};
/*
***********************************************************************
* EnumLocalDomain
*
* This looks like a request to get the local domains supported by a
* remote server. NT always seems to return 2 domains: the local
* domain (hostname) and the Builtin domain.
*
* The max_length field is set to 0x2000.
* Enum_context is set to 0 in the request and set to entries_read in
* the reply. Like most of these enums, total_entries is the same as
* entries_read.
***********************************************************************
*/
struct samr_LocalDomainEntry {
DWORD unknown;
samr_string_t name;
};
struct samr_LocalDomainInfo {
DWORD entries_read;
SIZE_IS(entries_read)
struct samr_LocalDomainEntry *entry;
};
OPERATION(SAMR_OPNUM_EnumLocalDomains)
struct samr_EnumLocalDomain {
IN samr_handle_t handle;
INOUT DWORD enum_context;
IN DWORD max_length;
OUT struct samr_LocalDomainInfo *info;
OUT DWORD total_entries;
OUT DWORD status;
};
/*
***********************************************************************
* OpenDomain
*
* Open a specific domain within the SAM. From this I assume that each
* SAM can handle multiple domains so you need to identify the one with
* which you want to work. Working with a domain handle does appear to
* offer the benefit that you can then use RIDs instead of full SIDs,
* which simplifies things a bit. The domain handle can be used to get
* user and group handles.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_OpenDomain)
struct samr_OpenDomain {
IN samr_handle_t handle;
IN DWORD access_mask;
IN REFERENCE struct samr_sid *sid;
OUT samr_handle_t domain_handle;
OUT DWORD status;
};
/*
***********************************************************************
* QueryDomainInfo
*
* Windows 95 Server Manager sends requests for levels 6 and 7 when
* the services menu item is selected.
***********************************************************************
*/
#define SAMR_QUERY_DOMAIN_INFO_2 2
#define SAMR_QUERY_DOMAIN_INFO_6 6
#define SAMR_QUERY_DOMAIN_INFO_7 7
struct samr_QueryDomainInfo2 {
DWORD unknown1; /* 00 00 00 00 */
DWORD unknown2; /* 00 00 00 80 */
samr_string_t s1;
samr_string_t domain;
samr_string_t s2;
DWORD sequence_num; /* 2B 00 00 00 */
DWORD unknown3; /* 00 00 00 00 */
DWORD unknown4; /* 01 00 00 00 */
DWORD unknown5; /* 03 00 00 00 */
DWORD unknown6; /* 01 */
DWORD num_users;
DWORD num_groups;
DWORD num_aliases;
};
struct samr_QueryDomainInfo6 {
DWORD unknown1; /* 00 00 00 00 */
DWORD unknown2; /* B0 7F 14 00 */
DWORD unknown3; /* 00 00 00 00 */
DWORD unknown4; /* 00 00 00 00 */
DWORD unknown5; /* 00 00 00 00 */
};
struct samr_QueryDomainInfo7 {
DWORD unknown1; /* 03 00 00 00 */
};
union samr_QueryDomainInfo_ru {
UNION_INFO_ENT(2,samr_QueryDomainInfo);
UNION_INFO_ENT(6,samr_QueryDomainInfo);
UNION_INFO_ENT(7,samr_QueryDomainInfo);
DEFAULT char *nullptr;
};
struct samr_QueryDomainInfoRes {
WORD switch_value;
SWITCH(switch_value)
union samr_QueryDomainInfo_ru ru;
};
OPERATION(SAMR_OPNUM_QueryDomainInfo)
struct samr_QueryDomainInfo {
IN samr_handle_t domain_handle;
IN WORD info_level;
OUT struct samr_QueryDomainInfoRes *info;
OUT DWORD status;
};
/*
* Identical to SAMR_OPNUM_QueryDomainInfo.
*/
OPERATION(SAMR_OPNUM_QueryInfoDomain2)
struct samr_QueryInfoDomain2 {
IN samr_handle_t domain_handle;
IN WORD info_level;
OUT struct samr_QueryDomainInfoRes *info;
OUT DWORD status;
};
#define SAMR_QUERY_ALIAS_INFO_GENERAL 1
#define SAMR_QUERY_ALIAS_INFO_NAME 2
#define SAMR_QUERY_ALIAS_INFO_COMMENT 3
struct samr_QueryAliasInfoGeneral {
WORD level;
samr_string_t name;
DWORD member_count;
samr_string_t desc;
};
struct samr_QueryAliasInfoName {
WORD level;
samr_string_t name;
};
struct samr_QueryAliasInfoComment {
WORD level;
samr_string_t desc;
};
union samr_QueryAliasInfo_ru {
CASE(1) struct samr_QueryAliasInfoGeneral info1;
CASE(2) struct samr_QueryAliasInfoName info2;
CASE(3) struct samr_QueryAliasInfoComment info3;
DEFAULT char *nullptr;
};
struct samr_QueryAliasInfoRes {
DWORD address;
WORD switch_value;
SWITCH(switch_value)
union samr_QueryAliasInfo_ru ru;
};
OPERATION(SAMR_OPNUM_QueryAliasInfo)
struct samr_QueryAliasInfo {
IN samr_handle_t alias_handle;
IN WORD level;
OUT DWORD address;
SWITCH (level)
OUT union samr_QueryAliasInfo_ru ru;
OUT DWORD status;
};
OPERATION(SAMR_OPNUM_CreateDomainAlias)
struct samr_CreateDomainAlias {
IN samr_handle_t domain_handle;
IN samr_string_t alias_name;
IN DWORD access_mask;
OUT samr_handle_t alias_handle;
OUT DWORD rid;
OUT DWORD status;
};
OPERATION(SAMR_OPNUM_SetAliasInfo)
struct samr_SetAliasInfo {
IN samr_handle_t alias_handle;
IN WORD level;
/* TBD */
OUT DWORD status;
};
OPERATION(SAMR_OPNUM_DeleteDomainAlias)
struct samr_DeleteDomainAlias {
INOUT samr_handle_t alias_handle;
OUT DWORD status;
};
OPERATION(SAMR_OPNUM_OpenAlias)
struct samr_OpenAlias {
IN samr_handle_t domain_handle;
IN DWORD access_mask;
IN DWORD rid;
OUT samr_handle_t alias_handle;
OUT DWORD status;
};
struct name_rid {
DWORD rid;
samr_string_t name;
};
struct aliases_info {
DWORD count;
DWORD address;
SIZE_IS(count)
struct name_rid info[ANY_SIZE_ARRAY];
};
OPERATION(SAMR_OPNUM_EnumDomainAliases)
struct samr_EnumDomainAliases {
IN samr_handle_t domain_handle;
IN DWORD resume_handle;
IN DWORD mask;
OUT DWORD out_resume;
OUT struct aliases_info *aliases;
OUT DWORD entries;
OUT DWORD status;
};
struct user_acct_info {
DWORD index;
DWORD rid;
DWORD ctrl;
samr_string_t name;
samr_string_t fullname;
samr_string_t desc;
};
struct user_disp_info {
OUT DWORD total_size;
OUT DWORD returned_size;
OUT WORD switch_value;
DWORD count;
SIZE_IS(count)
struct user_acct_info *acct;
};
OPERATION(SAMR_OPNUM_QueryDispInfo)
struct samr_QueryDispInfo {
IN samr_handle_t domain_handle;
IN WORD level;
IN DWORD start_idx;
IN DWORD max_entries;
IN DWORD pref_maxsize;
OUT struct user_disp_info users;
OUT DWORD status;
};
struct group_acct_info {
DWORD index;
DWORD rid;
DWORD ctrl;
samr_string_t name;
samr_string_t desc;
};
struct group_disp_info {
DWORD count;
/* right now we just need one entry */
struct group_acct_info acct[1];
};
OPERATION(SAMR_OPNUM_EnumDomainGroups)
struct samr_EnumDomainGroups {
IN samr_handle_t domain_handle;
IN WORD level;
IN DWORD start_idx;
IN DWORD max_entries;
IN DWORD pref_maxsize;
OUT DWORD total_size;
OUT DWORD returned_size;
OUT WORD switch_value;
OUT DWORD count;
OUT struct group_disp_info *groups;
OUT DWORD status;
};
/*
***********************************************************************
* OpenUser
*
* Input must be a domain handle obtained via SAMR_OPNUM_OpenDomain,
* an access mask and the appropriate user rid. The output will be a
* handle for use with the specified user.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_OpenUser)
struct samr_OpenUser {
IN samr_handle_t handle;
IN DWORD access_mask;
IN DWORD rid;
OUT samr_handle_t user_handle;
OUT DWORD status;
};
/*
***********************************************************************
* DeleteUser
***********************************************************************
*/
OPERATION(SAMR_OPNUM_DeleteUser)
struct samr_DeleteUser {
INOUT samr_handle_t user_handle;
OUT DWORD status;
};
/*
***********************************************************************
* QueryUserInfo
*
* Provides various pieces of information on a specific user (see
* SAM_Q_QUERY_USERINFO and SAM_R_QUERY_USERINFO). The handle must
* be a valid SAM user handle.
*
* QueryUserInfo (
* IN samr_handle_t user_handle,
* IN WORD switch_value,
* OUT union switch(switch_value) {
* case 1: struct QueryUserInfo1 *info1;
* } bufptr,
* OUT DWORD status
* )
*
* typedef enum _USER_INFORMATION_CLASS {
* UserGeneralInformation = 1,
* UserPreferencesInformation = 2,
* UserLogonInformation = 3,
* UserLogonHoursInformation = 4,
* UserAccountInformation = 5,
* UserNameInformation = 6,
* UserAccountNameInformation = 7,
* UserFullNameInformation = 8,
* UserPrimaryGroupInformation = 9,
* UserHomeInformation = 10,
* UserScriptInformation = 11,
* UserProfileInformation = 12,
* UserAdminCommentInformation = 13,
* UserWorkStationsInformation = 14,
* UserControlInformation = 16,
* UserExpiresInformation = 17,
* UserInternal1Information = 18,
* UserParametersInformation = 20,
* UserAllInformation = 21,
* UserInternal4Information = 23,
* UserInternal5Information = 24,
* UserInternal4InformationNew = 25,
* UserInternal5InformationNew = 26,
* } USER_INFORMATION_CLASS;
*
* 1 = username, fullname, description and some other stuff.
* 3 = large structure containing user rid, group rid, username
* and fullname.
* 5 = large structure (like 3) containing user rid, group rid,
* username, fullname and description.
* 6 = username and fullname
* 7 = username
* 8 = fullname
* 9 = group rid
* 16 = used after creating a new account
*
* Due to an ndrgen bug, a function must be provided to to patch the
* offsets used by the unmarshalling code at runtime. In order to
* simplify things it is useful to use a naming convention that
* indicates the switch value for each structure.
*
***********************************************************************
*/
#define SAMR_QUERY_USER_INFO_1 1
#define SAMR_QUERY_USER_UNAME_AND_FNAME 6
#define SAMR_QUERY_USER_USERNAME 7
#define SAMR_QUERY_USER_FULLNAME 8
#define SAMR_QUERY_USER_GROUPRID 9
#define SAMR_QUERY_USER_CONTROL_INFO 16
#define SAMR_QUERY_USER_ALL_INFO 21
struct samr_QueryUserInfo1 {
samr_string_t username;
samr_string_t fullname;
DWORD group_rid;
samr_string_t description;
samr_string_t unknown;
};
struct samr_QueryUserInfo6 {
samr_string_t username;
samr_string_t fullname;
};
struct samr_QueryUserInfo7 {
samr_string_t username;
};
struct samr_QueryUserInfo8 {
samr_string_t fullname;
};
struct samr_QueryUserInfo9 {
DWORD group_rid;
};
struct samr_QueryUserInfo16 {
DWORD UserAccountControl;
};
/*
* SAMR_USER_ALL_INFORMATION
*/
struct samr_QueryUserInfo21 {
samr_quad_t LastLogon;
samr_quad_t LastLogoff;
samr_quad_t PasswordLastSet;
samr_quad_t AccountExpires;
samr_quad_t PasswordCanChange;
samr_quad_t PasswordMustChange;
samr_string_t UserName;
samr_string_t FullName;
samr_string_t HomeDirectory;
samr_string_t HomeDirectoryDrive;
samr_string_t ScriptPath;
samr_string_t ProfilePath;
samr_string_t AdminComment;
samr_string_t WorkStations;
samr_string_t UserComment;
samr_string_t Parameters;
struct samr_short_blob LmOwfPassword;
struct samr_short_blob NtOwfPassword;
samr_string_t PrivateData;
samr_sd_t SecurityDescriptor;
DWORD UserId;
DWORD PrimaryGroupId;
DWORD UserAccountControl;
DWORD WhichFields;
struct samr_logon_hours_all LogonHours;
WORD BadPasswordCount;
WORD LogonCount;
WORD CountryCode;
WORD CodePage;
BYTE LmPasswordPresent;
BYTE NtPasswordPresent;
BYTE PasswordExpired;
BYTE PrivateDataSensitive;
};
/* See also: fixup_samr_QueryUserInfo() */
union QueryUserInfo_result_u {
UNION_INFO_ENT(1,samr_QueryUserInfo);
UNION_INFO_ENT(6,samr_QueryUserInfo);
UNION_INFO_ENT(7,samr_QueryUserInfo);
UNION_INFO_ENT(8,samr_QueryUserInfo);
UNION_INFO_ENT(9,samr_QueryUserInfo);
UNION_INFO_ENT(16,samr_QueryUserInfo);
UNION_INFO_ENT(21,samr_QueryUserInfo);
DEFAULT char *nullptr;
};
/*
* This structure needs to be declared, even though it can't be used in
* samr_QueryUserInfo, in order to get the appropriate size to calculate
* the correct fixup offsets. If ndrgen did the right thing,
* QueryUserInfo_result would be one of the out parameters. However, if
* we do it that way, the switch_value isn't known early enough to do
* the fixup calculation. So it all has to go in samr_QueryUserInfo.
*/
struct QueryUserInfo_result {
DWORD address;
WORD switch_value;
SWITCH(switch_value)
union QueryUserInfo_result_u ru;
};
OPERATION(SAMR_OPNUM_QueryUserInfo)
struct samr_QueryUserInfo {
IN samr_handle_t user_handle;
IN WORD switch_value;
/*
* Can't use this form because we need to include members explicitly.
* OUT struct QueryUserInfo_result result;
*/
OUT DWORD address;
OUT WORD switch_index;
SWITCH(switch_value)
OUT union QueryUserInfo_result_u ru;
OUT DWORD status;
};
/*
***********************************************************************
* QueryUserGroups
***********************************************************************
*/
struct samr_UserGroups {
DWORD rid;
DWORD attr;
};
struct samr_UserGroupInfo {
DWORD n_entry;
SIZE_IS(n_entry)
struct samr_UserGroups *groups;
};
OPERATION(SAMR_OPNUM_QueryUserGroups)
struct samr_QueryUserGroups {
IN samr_handle_t user_handle;
OUT struct samr_UserGroupInfo *info;
OUT DWORD status;
};
/*
***********************************************************************
* LookupName
***********************************************************************
*/
struct samr_LookupNameTable {
DWORD n_entry;
SIZE_IS(n_entry)
samr_string_t names[ANY_SIZE_ARRAY];
};
struct samr_LookupRidTable {
DWORD n_entry;
SIZE_IS(n_entry)
DWORD *rid;
};
struct samr_RidType {
DWORD n_entry;
SIZE_IS(n_entry)
DWORD *rid_type;
};
OPERATION(SAMR_OPNUM_LookupNames)
struct samr_LookupNames {
IN samr_handle_t handle;
IN DWORD n_entry;
IN DWORD max_n_entry;
IN DWORD index;
IN DWORD total;
IN samr_string_t name;
OUT struct samr_LookupRidTable rids;
OUT struct samr_RidType rid_types;
OUT DWORD status;
};
/*
***********************************************************************
* OpenGroup
*
* Input must be a domain handle obtained via SAMR_OPNUM_OpenDomain,
* an access mask and the appropriate group rid. The output will be a
* handle for use with the specified group.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_OpenGroup)
struct samr_OpenGroup {
IN samr_handle_t handle;
IN DWORD access_mask;
IN DWORD rid;
OUT samr_handle_t group_handle;
OUT DWORD status;
};
/*
***********************************************************************
* QueryGroupInfo
*
* Input must be a group handle obtained via SAMR_OPNUM_OpenGroup,
* an access mask and the appropriate group rid. The output will
* be a handle for use with the specified group.
***********************************************************************
*/
struct samr_QueryGroupInfo1 {
samr_string_t groupname;
};
union samr_QueryGroupInfo_result_u {
UNION_INFO_ENT(1,samr_QueryGroupInfo);
DEFAULT char *nullptr;
};
struct samr_QueryGroupInfo_result {
DWORD address;
WORD switch_index;
SWITCH(switch_index)
union samr_QueryGroupInfo_result_u ru;
};
OPERATION(SAMR_OPNUM_QueryGroupInfo)
struct samr_QueryGroupInfo {
IN samr_handle_t group_handle;
IN DWORD switch_value;
OUT DWORD address;
OUT WORD switch_index;
SWITCH(switch_index)
OUT union samr_QueryGroupInfo_result_u ru;
OUT DWORD status;
};
/*
***********************************************************************
* StoreGroupInfo
*
* This definition is mostly just a place holder in case this is useful
* in the future. Note that it may not be correct. The information is
* from a netmon trace captured when I added a group description. I
* haven't implemented it because we don't have to update anything on
* the PDC. The description should almost certainly be in a separate
* structure.
***********************************************************************
*/
OPERATION(SAMR_OPNUM_StoreGroupInfo)
struct samr_StoreGroupInfo {
IN samr_handle_t group_handle;
IN DWORD switch_value;
IN samr_string_t group_description;
OUT DWORD status;
};
/*
* AddAliasMember
*/
OPERATION(SAMR_OPNUM_AddAliasMember)
struct samr_AddAliasMember {
IN samr_handle_t alias_handle;
IN REFERENCE struct samr_sid *sid;
OUT DWORD status;
};
/*
* DeleteAliasMember
*/
OPERATION(SAMR_OPNUM_DeleteAliasMember)
struct samr_DeleteAliasMember {
IN samr_handle_t alias_handle;
IN REFERENCE struct samr_sid *sid;
OUT DWORD status;
};
struct samr_SidList {
struct samr_sid *sid;
};
struct samr_SidInfo {
DWORD n_entry;
SIZE_IS(n_entry)
struct samr_SidList *sidlist;
};
/*
* ListAliasMembers
*/
OPERATION(SAMR_OPNUM_ListAliasMembers)
struct samr_ListAliasMembers {
IN samr_handle_t alias_handle;
OUT struct samr_SidInfo info;
OUT DWORD status;
};
/*
***********************************************************************
* GetUserDomainPasswordInformation
***********************************************************************
*/
OPERATION(SAMR_OPNUM_GetUserPwInfo)
struct samr_GetUserPwInfo {
IN samr_handle_t user_handle;
OUT REFERENCE samr_password_info_t *pwinfo;
OUT DWORD status;
};
/*
***********************************************************************
* CreateUser
*
* Create a user in the domain specified by the domain handle. The
* domain handle is obtained obtained via SAMR_OPNUM_OpenDomain.
* DesiredAccess: 0xe00500b0.
* The output will be a handle for use with the specified user and the
* user's RID. I think the RID may be a unique pointer (it can be null).
***********************************************************************
*/
OPERATION(SAMR_OPNUM_CreateUser)
struct samr_CreateUser {
IN samr_handle_t handle;
IN samr_vcbuf_t username;
IN DWORD account_flags;
IN DWORD desired_access;
OUT samr_handle_t user_handle;
OUT DWORD maybe_ptr;
OUT DWORD rid;
OUT DWORD status;
};
/*
***********************************************************************
* ChangePasswordUser2 - See:
* SamrUnicodeChangePasswordUser2 [MS-SAMR 3.1.5.10.3]
***********************************************************************
*/
OPERATION(SAMR_OPNUM_ChangePasswordUser2)
struct samr_ChangePasswordUser2 {
IN samr_string_t *servername;
IN REF samr_string_t *username;
IN struct samr_encr_passwd *nt_newpw;
IN struct samr_encr_hash *nt_oldpw;
IN BYTE lm_present;
IN struct samr_encr_passwd *lm_newpw;
IN struct samr_encr_hash *lm_oldpw;
OUT DWORD status;
};
/*
***********************************************************************
* GetDomainPwInfo
***********************************************************************
*/
OPERATION(SAMR_OPNUM_GetDomainPwInfo)
struct samr_GetDomainPwInfo {
IN DWORD unused;
OUT REFERENCE samr_password_info_t *pwinfo;
OUT DWORD status;
};
/*
***********************************************************************
* SetUserInfo
* [MS-SAMR] SamrSetInformationUser2
***********************************************************************
*/
/* USER_CONTROL_INFORMATION */
struct samr_SetUserInfo16 {
DWORD UserAccountControl;
};
/*
* samr_SetUserInfo21, a.k.a
* SAMR_USER_ALL_INFORMATION
*
* We now know this is the same as samr_QueryUserInfo21
* Could merge, except for the samr_vcbuf_t mess.
*/
#define SAMR_SET_USER_INFO_21 21
struct samr_SetUserInfo21 {
samr_quad_t LastLogon;
samr_quad_t LastLogoff;
samr_quad_t PasswordLastSet;
samr_quad_t AccountExpires;
samr_quad_t PasswordCanChange;
samr_quad_t PasswordMustChange;
samr_vcbuf_t UserName;
samr_vcbuf_t FullName;
samr_vcbuf_t HomeDirectory;
samr_vcbuf_t HomeDirectoryDrive;
samr_vcbuf_t ScriptPath;
samr_vcbuf_t ProfilePath;
samr_vcbuf_t AdminComment;
samr_vcbuf_t WorkStations;
samr_vcbuf_t UserComment;
samr_vcbuf_t Parameters;
struct samr_short_blob LmOwfPassword;
struct samr_short_blob NtOwfPassword;
samr_vcbuf_t PrivateData;
samr_sd_t SecurityDescriptor;
DWORD UserId; /* RID */
DWORD PrimaryGroupId;
DWORD UserAccountControl;
DWORD WhichFields;
/*
* This should be samr_logon_hours_all, but apparently
* ndrgen doesn't get that quite right, so instead, the
* client-side code patches this up.
*/
struct samr_logon_info LogonHours;
WORD BadPasswordCount;
WORD LogonCount;
WORD CountryCode;
WORD CodePage;
BYTE LmPasswordPresent;
BYTE NtPasswordPresent;
BYTE PasswordExpired;
BYTE PrivateDataSensitive;
};
/*
* SAMPR_USER_INTERNAL4_INFORMATION
* UserInternal4Information (23)
*/
#define SAMR_SET_USER_INFO_23 23
struct samr_SetUserInfo23 {
struct samr_SetUserInfo21 info21;
struct samr_encr_passwd encr_pw;
};
/*
* SAMPR_USER_INTERNAL5_INFORMATION
* UserInternal5Information (24)
*/
#define SAMR_SET_USER_INFO_24 24
struct samr_SetUserInfo24 {
struct samr_encr_passwd encr_pw;
BYTE password_expired;
};
union samr_SetUserInfo_u {
UNION_INFO_ENT(16,samr_SetUserInfo);
UNION_INFO_ENT(21,samr_SetUserInfo);
UNION_INFO_ENT(23,samr_SetUserInfo);
UNION_INFO_ENT(24,samr_SetUserInfo);
DEFAULT DWORD nothing;
};
struct samr_SetUserInfo_s {
WORD info_level;
WORD switch_value;
SWITCH(switch_value)
union samr_SetUserInfo_u ru;
};
OPERATION(SAMR_OPNUM_SetUserInfo)
struct samr_SetUserInfo {
IN samr_handle_t user_handle;
IN struct samr_SetUserInfo_s info;
OUT DWORD status;
};
/*
***********************************************************************
* The SAMR interface definition.
***********************************************************************
*/
INTERFACE(0)
union samr_interface {
CASE(SAMR_OPNUM_Connect)
struct samr_Connect Connect;
CASE(SAMR_OPNUM_CloseHandle)
struct samr_CloseHandle CloseHandle;
CASE(SAMR_OPNUM_QuerySecObject)
struct samr_QuerySecObject QuerySecObject;
CASE(SAMR_OPNUM_LookupDomain)
struct samr_LookupDomain LookupDomain;
CASE(SAMR_OPNUM_EnumLocalDomains)
struct samr_EnumLocalDomain EnumLocalDomain;
CASE(SAMR_OPNUM_OpenDomain)
struct samr_OpenDomain OpenDomain;
CASE(SAMR_OPNUM_QueryDomainInfo)
struct samr_QueryDomainInfo QueryDomainInfo;
CASE(SAMR_OPNUM_QueryInfoDomain2)
struct samr_QueryInfoDomain2 QueryInfoDomain2;
CASE(SAMR_OPNUM_LookupNames)
struct samr_LookupNames LookupNames;
CASE(SAMR_OPNUM_OpenUser)
struct samr_OpenUser OpenUser;
CASE(SAMR_OPNUM_DeleteUser)
struct samr_DeleteUser DeleteUser;
CASE(SAMR_OPNUM_QueryUserInfo)
struct samr_QueryUserInfo QueryUserInfo;
CASE(SAMR_OPNUM_QueryUserGroups)
struct samr_QueryUserGroups QueryUserGroups;
CASE(SAMR_OPNUM_OpenGroup)
struct samr_OpenGroup OpenGroup;
CASE(SAMR_OPNUM_AddAliasMember)
struct samr_AddAliasMember AddAliasMember;
CASE(SAMR_OPNUM_DeleteAliasMember)
struct samr_DeleteAliasMember DeleteAliasMember;
CASE(SAMR_OPNUM_ListAliasMembers)
struct samr_ListAliasMembers ListAliasMembers;
CASE(SAMR_OPNUM_GetUserPwInfo)
struct samr_GetUserPwInfo GetUserPwInfo;
CASE(SAMR_OPNUM_CreateUser)
struct samr_CreateUser CreateUser;
CASE(SAMR_OPNUM_ChangePasswordUser2)
struct samr_ChangePasswordUser2 ChangePasswordUser2;
CASE(SAMR_OPNUM_GetDomainPwInfo)
struct samr_GetDomainPwInfo GetDomainPwInfo;
CASE(SAMR_OPNUM_Connect2)
struct samr_Connect2 Connect2;
CASE(SAMR_OPNUM_SetUserInfo)
struct samr_SetUserInfo SetUserInfo;
CASE(SAMR_OPNUM_Connect4)
struct samr_Connect4 Connect4;
CASE(SAMR_OPNUM_Connect5)
struct samr_Connect5 Connect5;
CASE(SAMR_OPNUM_QueryDispInfo)
struct samr_QueryDispInfo QueryDispInfo;
CASE(SAMR_OPNUM_OpenAlias)
struct samr_OpenAlias OpenAlias;
CASE(SAMR_OPNUM_CreateDomainAlias)
struct samr_CreateDomainAlias CreateDomainAlias;
CASE(SAMR_OPNUM_SetAliasInfo)
struct samr_SetAliasInfo SetAliasInfo;
CASE(SAMR_OPNUM_QueryAliasInfo)
struct samr_QueryAliasInfo QueryAliasInfo;
CASE(SAMR_OPNUM_DeleteDomainAlias)
struct samr_DeleteDomainAlias DeleteDomainAlias;
CASE(SAMR_OPNUM_EnumDomainAliases)
struct samr_EnumDomainAliases EnumDomainAliases;
CASE(SAMR_OPNUM_EnumDomainGroups)
struct samr_EnumDomainGroups EnumDomainGroups;
};
typedef union samr_interface samr_interface_t;
EXTERNTYPEINFO(samr_interface)
#endif /* _MLSVC_SAM_NDL_ */
|