summaryrefslogtreecommitdiff
path: root/source4/librpc/idl/drsuapi.idl
blob: 50706a17391c9d1defd5a7ec6843132a096880a9 (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
#include "idl_types.h"

[ 
  uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
  version(4.0),
  endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
  authservice("ldap"),
  helpstring("Active Directory Replication"),
  pointer_default(unique),
  depends(security)
] 
interface drsuapi
{
	/*****************/
        /* Function 0x00 */
        typedef [bitmap32bit] bitmap {
		DRSUAPI_SUPPORTED_EXTENSION_BASE			= 0x00000001,
		DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION		= 0x00000002,
		DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI			= 0x00000004,
		DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2			= 0x00000008,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS		= 0x00000010,
		DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1			= 0x00000020,
		DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION	= 0x00000040,
		DRSUAPI_SUPPORTED_EXTENSION_00000080			= 0x00000080,
		DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE			= 0x00000100,
		DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2			= 0x00000200,
		DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION	= 0x00000400,
		DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2			= 0x00000800,
		DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
		DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND			= 0x00002000,
		DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO		= 0x00004000,
		DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION		= 0x00008000,
		DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01			= 0x00010000,
		DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP	= 0x00020000,
		DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY		= 0x00040000,
		DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3			= 0x00080000,
		DRSUAPI_SUPPORTED_EXTENSION_00100000			= 0x00100000,
		DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2		= 0x00200000,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6		= 0x00400000,
		DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS		= 0x00800000,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8		= 0x01000000,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5		= 0x02000000,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6		= 0x04000000,
		/*
		 * the following 3 have the same value
		 * repadmin.exe /bind says that
		 */
		DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3		= 0x08000000,
		DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7		= 0x08000000,
		DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT		= 0x08000000,
		DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS		= 0x10000000,
		DRSUAPI_SUPPORTED_EXTENSION_20000000			= 0x20000000,
		DRSUAPI_SUPPORTED_EXTENSION_40000000			= 0x40000000,
		DRSUAPI_SUPPORTED_EXTENSION_80000000			= 0x80000000
	} drsuapi_SupportedExtensions;

	/* this is used by w2k */
	typedef struct {
		drsuapi_SupportedExtensions supported_extensions;
		GUID site_guid;
		uint32 u1;
	} drsuapi_DsBindInfo24;

	/* this is used by w2k3 */
	typedef struct {
		drsuapi_SupportedExtensions supported_extensions;
		GUID site_guid;
		uint32 u1;
		uint32 repl_epoch;
	} drsuapi_DsBindInfo28;

	typedef struct {
		[flag(NDR_REMAINING)] DATA_BLOB info;
	} drsuapi_DsBindInfoFallBack;

	typedef [nodiscriminant] union {
		[case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
		[case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
		[default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
	} drsuapi_DsBindInfo;

	/* the drsuapi_DsBindInfoCtr was this before
	 * typedef [flag(NDR_PAHEX)] struct {
	 *	[range(1,10000)] uint32 length;
	 *	[size_is(length)] uint8 data[];
	 * } drsuapi_DsBindInfo;
	 *
	 * but we don't want the caller to manually decode this blob,
	 * so we're doing it here
	 */

	typedef struct {
		[range(1,10000)] uint32 length;
		[switch_is(length)] drsuapi_DsBindInfo info;
	} drsuapi_DsBindInfoCtr;

	/* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
	 * 
	 * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
	 */
	const string DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";

	WERROR drsuapi_DsBind(
		[in]	    GUID *bind_guid,
		[in,out]    drsuapi_DsBindInfoCtr *bind_info,
		[out,ref]   policy_handle *bind_handle
		);

	/*****************/
        /* Function 0x01 */
	WERROR drsuapi_DsUnbind(
		[in,out,ref] policy_handle *bind_handle
		);

	/*****************/
	/* Function 0x02 */
	typedef [gensize] struct {
		[value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
		[value(ndr_length_dom_sid(&r->sid))]  uint32 __ndr_size_sid;
		GUID guid;
		[subcontext_size(28),subcontext(0)] dom_sid sid;
		[flag(STR_SIZE4|STR_CHARLEN|STR_CONFORMANT)] string dn;
	} drsuapi_DsReplicaObjectIdentifier;

	typedef bitmap {
		DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION	= 0x00000001,
		DRSUAPI_DS_REPLICA_SYNC_WRITEABLE		= 0x00000002,
		DRSUAPI_DS_REPLICA_SYNC_PERIODIC		= 0x00000004,
		DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING	= 0x00000008,
		DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES		= 0x00000010,
		DRSUAPI_DS_REPLICA_SYNC_FULL			= 0x00000020,
		DRSUAPI_DS_REPLICA_SYNC_URGENT			= 0x00000040,
		DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD		= 0x00000080,
		DRSUAPI_DS_REPLICA_SYNC_FORCE			= 0x00000100,
		DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE		= 0x00000200,
		DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED		= 0x00000400,
		DRSUAPI_DS_REPLICA_SYNC_TWO_WAY			= 0x00000800,
		DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY		= 0x00001000,
		DRSUAPI_DS_REPLICA_SYNC_INITIAL			= 0x00002000,
		DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION		= 0x00004000,
		DRSUAPI_DS_REPLICA_SYNC_ABANDONED		= 0x00008000,
		DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS	= 0x00010000,
		DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET	= 0x00020000,
		DRSUAPI_DS_REPLICA_SYNC_REQUEUE			= 0x00040000,
		DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION		= 0x00080000,
		DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA	= 0x00100000,
		DRSUAPI_DS_REPLICA_SYNC_CRITICAL		= 0x00200000,
		DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS	= 0x00400000,
		DRSUAPI_DS_REPLICA_SYNC_PREEMPTED		= 0x00800000
	} drsuapi_DsReplicaSyncOptions;

	typedef struct {
		drsuapi_DsReplicaObjectIdentifier *naming_context;
		GUID guid1;
		astring *string1;
		drsuapi_DsReplicaSyncOptions options;
	} drsuapi_DsReplicaSyncRequest1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsReplicaSyncRequest1 req1;
	} drsuapi_DsReplicaSyncRequest;

	WERROR drsuapi_DsReplicaSync(
		[in,ref] policy_handle *bind_handle,
		[in] int32 level,
		[in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
		);

	/*****************/
	/* Function 0x03 */
	typedef struct {
		hyper usn1;
		hyper usn2;
		hyper usn3;
	} drsuapi_DsGetNCChangesUsnTriple;

	typedef struct {
		GUID source_dsa_invocation_id;
		hyper highest_usn;
	} drsuapi_DsReplicaCoursor;

	typedef struct {
		uint32 u1;
		uint32 u2;
		[range(0,0x100000)] uint32 count;
		uint32 u3;
		[size_is(count)] drsuapi_DsReplicaCoursor array[];
	} drsuapi_DsReplicaCoursor05Ctr;

	typedef struct {
		GUID guid1;
		GUID guid2;
		[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
		drsuapi_DsGetNCChangesUsnTriple usn1;
		drsuapi_DsReplicaCoursor05Ctr *coursor;
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
		hyper h1;
	} drsuapi_DsGetNCChangesRequest5;

	typedef [flag(NDR_PAHEX)] struct {
		[range(0,10000)] uint32 length;
		[size_is(length)] uint8 *byte_array[];
	} drsuapi_DsGetNCChangesRequest_Ctr14;

	typedef struct {
		uint32 unknown1;
		drsuapi_DsGetNCChangesRequest_Ctr14 data;
	} drsuapi_DsGetNCChangesRequest_Ctr13;

	typedef struct {
		[range(0,0x100000)] uint32 count;
		[size_is(count)] drsuapi_DsGetNCChangesRequest_Ctr13 *array[];
	} drsuapi_DsGetNCChangesRequest_Ctr12;

	typedef struct {
		GUID guid1;
		GUID guid2;
		[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
		drsuapi_DsGetNCChangesUsnTriple usn1;
		drsuapi_DsReplicaCoursor05Ctr *coursor;
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
		hyper h1;
		uint32 unique_ptr1;
		uint32 unique_ptr2;
		drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
	} drsuapi_DsGetNCChangesRequest8;

	typedef [switch_type(int32)] union {
		[case(5)] drsuapi_DsGetNCChangesRequest5 req5;
		[case(8)] drsuapi_DsGetNCChangesRequest8 req8;
	} drsuapi_DsGetNCChangesRequest;

	typedef struct {
		drsuapi_DsReplicaCoursor coursor;
		NTTIME_1sec time1;
	} drsuapi_DsReplicaCoursorEx;

	typedef struct {
		uint32 u1;
		uint32 u2;
		[range(0,0x100000)] uint32 count;
		uint32 u3;
		[size_is(count)] drsuapi_DsReplicaCoursorEx array[];
	} drsuapi_DsReplicaCoursorEx05Ctr;

	typedef [v1_enum] enum {
		DRSUAPI_OBJECTCLASS_top		= 0x0
	} drsuapi_DsObjectClassId;

	typedef [v1_enum] enum {
		DRSUAPI_ATTRIBUTE_objectClass		= 0x00000000,
		DRSUAPI_ATTRIBUTE_description		= 0x0000000d,
		DRSUAPI_ATTRIBUTE_invocationId		= 0x00020073,
		DRSUAPI_ATTRIBUTE_ntSecurityDescriptor	= 0x00020119,
		DRSUAPI_ATTRIBUTE_objectSid		= 0x00090092,
		DRSUAPI_ATTRIBUTE_objectCategory	= 0x0009030e
	} drsuapi_DsAttributeId;

	/* Generic DATA_BLOB values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		DATA_BLOB *data;
	} drsuapi_DsAttributeValueDataBlob;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueDataBlob *values[];
	} drsuapi_DsAttributeValueCtrDataBlob;

	/* objectClass values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] drsuapi_DsObjectClassId *objectClassId;
	} drsuapi_DsAttributeValueObjectClassId;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueObjectClassId *values[];
	} drsuapi_DsAttributeValueCtrObjectClassId;

	/* uint32 values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] uint32 *value;
	} drsuapi_DsAttributeValueUINT32;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueUINT32 *values[];
	} drsuapi_DsAttributeValueCtrUINT32;

	/* UnicodeString values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] nstring *string;
	} drsuapi_DsAttributeValueUnicodeString;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueUnicodeString *values[];
	} drsuapi_DsAttributeValueCtrUnicodeString;

	/* DN String values */
	typedef [gensize] struct {
		[value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags)-4)] uint32 __ndr_size;
		[value(ndr_length_dom_sid(&r->sid))]  uint32 __ndr_size_sid;
		GUID guid;
		[subcontext_size(28),subcontext(0)] dom_sid sid;
		[flag(STR_SIZE4|STR_CHARLEN)] string dn;
	} drsuapi_DsReplicaObjectIdentifier3;

	typedef  struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] drsuapi_DsReplicaObjectIdentifier3 *object;
	} drsuapi_DsAttributeValueDNString;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueDNString *values[];
	} drsuapi_DsAttributeValueCtrDNString;

	/* GUID values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] GUID *guid;
	} drsuapi_DsAttributeValueGUID;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueGUID *values[];
	} drsuapi_DsAttributeValueCtrGUID;

	/* SID values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] dom_sid *sid;
	} drsuapi_DsAttributeValueSID;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueSID *values[];
	} drsuapi_DsAttributeValueCtrSID;

	/* SecurityDescriptor values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] security_descriptor *sd;
	} drsuapi_DsAttributeValueSecurityDescriptor;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueSecurityDescriptor *values[];
	} drsuapi_DsAttributeValueCtrSecurityDescriptor;

	/* NTTIME_1sec values */
	typedef struct {
		[range(0,10485760)] uint32 length;
		[subcontext(4)] NTTIME_1sec *time;
	} drsuapi_DsAttributeValueNTTIME_1sec;

	typedef struct {
		[range(0,10485760)] uint32 num_values;
		[size_is(num_values)] drsuapi_DsAttributeValueNTTIME_1sec *values[];
	} drsuapi_DsAttributeValueCtrNTTIME_1sec;

	typedef [nodiscriminant] union {
		[case(DRSUAPI_ATTRIBUTE_objectClass)] drsuapi_DsAttributeValueCtrObjectClassId object_class_id;

		/* UINT32 */
		[case(0x00020001)] drsuapi_DsAttributeValueCtrUINT32 uint32;
		[case(0x00090177)] drsuapi_DsAttributeValueCtrUINT32 uint32;
		[case(0x000905b3)] drsuapi_DsAttributeValueCtrUINT32 uint32;

		/* GUID */
		[case(DRSUAPI_ATTRIBUTE_invocationId)] drsuapi_DsAttributeValueCtrGUID guid;

		/* SID */
		[case(DRSUAPI_ATTRIBUTE_objectSid)] drsuapi_DsAttributeValueCtrSID sid;

		/* SecurityDescriptor */
		/* we can't parse some ads specific security_descriptors yet
		[case(DRSUAPI_ATTRIBUTE_ntSecurityDescriptor)] drsuapi_DsAttributeValueCtrSecurityDescriptor security_descriptor;
		*/

		/* UnicodeString */
		[case(DRSUAPI_ATTRIBUTE_description)]		drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
		[case(0x00090001)]				drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
		[case(0x0009037b)]				drsuapi_DsAttributeValueCtrUnicodeString unicode_string;

		/* DN String */
		[case(DRSUAPI_ATTRIBUTE_objectCategory)]	drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x0002000e)]				drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x00020024)]				drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x0009071c)]				drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x0009072c)]				drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x0009026a)]				drsuapi_DsAttributeValueCtrDNString dn_string;
		[case(0x00090203)]				drsuapi_DsAttributeValueCtrDNString dn_string;

		/* NTTIME_1sec */
		[case(0x00020002)] drsuapi_DsAttributeValueCtrNTTIME_1sec nttime_1sec;

		/* the default is the DATA_BLOB */
		[default] drsuapi_DsAttributeValueCtrDataBlob data_blob;
	} drsuapi_DsReplicaAttributeValueCtr;

	typedef [flag(NDR_PAHEX)] struct {
		drsuapi_DsAttributeId attid;
		[switch_is(attid)] drsuapi_DsReplicaAttributeValueCtr value_ctr;
	} drsuapi_DsReplicaAttribute;

	typedef struct {
		[range(0,1048576)] uint32 num_attributes;
		[size_is(num_attributes)]  drsuapi_DsReplicaAttribute *attributes[];
	} drsuapi_DsReplicaAttributeCtr;

	typedef [public] struct {
		drsuapi_DsReplicaObjectIdentifier *identifier;
		uint32 unknown1;
		drsuapi_DsReplicaAttributeCtr attribute_ctr;
	} drsuapi_DsReplicaObject;

	typedef struct {
		uint32 version;
		NTTIME_1sec time;
		GUID guid;
		hyper usn;
	} drsuapi_DsReplicaMetaData;

	typedef [public] struct {
		[range(0,1048576)] uint32 count;
		[size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
	} drsuapi_DsReplicaMetaDataCtr;

	typedef [noprint] struct {
		drsuapi_DsReplicaObjectListItemEx *next_object;
		drsuapi_DsReplicaObject object;
		uint32 unknown1;
		GUID *guid;
		drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
	} drsuapi_DsReplicaObjectListItemEx;

	typedef struct {
		GUID guid1;
		GUID guid2;
		drsuapi_DsReplicaObjectIdentifier *naming_context;
		drsuapi_DsGetNCChangesUsnTriple usn1;
		drsuapi_DsGetNCChangesUsnTriple usn2;
		drsuapi_DsReplicaCoursorEx05Ctr *coursor_ex;
		drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
		uint32 u1[3];
		drsuapi_DsReplicaObjectListItemEx *first_object;
		uint32 u2;
	} drsuapi_DsGetNCChangesCtr1;

	typedef struct {
		GUID guid1;
		GUID guid2;
		drsuapi_DsReplicaObjectIdentifier *naming_context;
		drsuapi_DsGetNCChangesUsnTriple usn1;
		drsuapi_DsGetNCChangesUsnTriple usn2;
		drsuapi_DsReplicaCoursorEx05Ctr *coursor_ex;
		drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
		uint32 u1[3];
		uint32 ptr1;
		uint32 u2[3];
		uint32 len1;
		uint32 array_ptr1;
		uint32 u3;
	} drsuapi_DsGetNCChangesCtr6;

	typedef struct {
		uint32 u1;/* decompressed_length ? */
		uint32 compressed_length;
		DATA_BLOB *compressed;
	} drsuapi_DsGetNCChangesCtr7CompressedInfo;

	typedef struct {
		uint32 u1;
		uint16 u2; /* enum */
		drsuapi_DsGetNCChangesCtr7CompressedInfo info;
	} drsuapi_DsGetNCChangesCtr7;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
		[case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
		[case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
	} drsuapi_DsGetNCChangesCtr;

	WERROR drsuapi_DsGetNCChanges(
		[in,ref] policy_handle *bind_handle,
		[in,out] int32 level,
		[in,switch_is(level)] drsuapi_DsGetNCChangesRequest req,
		[out,switch_is(level)] drsuapi_DsGetNCChangesCtr ctr
		);

	/*****************/
        /* Function 0x04 */
	typedef bitmap {
		DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION	= 0x00000001,
		DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE			= 0x00000002,
		DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE			= 0x00000004,
		DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE		= 0x00000008,
		DRSUAPI_DS_REPLICA_UPDATE_0x00000010			= 0x00000010
	} drsuapi_DsReplicaUpdateRefsOptions;

	typedef struct {
		[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
		[ref] ascstr *dest_dsa_dns_name;
		GUID dest_dsa_guid;
		drsuapi_DsReplicaUpdateRefsOptions options;
	} drsuapi_DsReplicaUpdateRefsRequest1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
	} drsuapi_DsReplicaUpdateRefsRequest;

	WERROR drsuapi_DsReplicaUpdateRefs(
		[in,ref] policy_handle *bind_handle,
		[in] int32 level,
		[in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
		);

	/*****************/
        /* Function 0x05 */
	typedef bitmap {
		DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION	= 0x00000001,
		DRSUAPI_DS_REPLICA_ADD_WRITEABLE		= 0x00000002
		/* TODO ... */
	} drsuapi_DsReplicaAddOptions;

	WERROR DRSUAPI_REPLICA_ADD();

	/*****************/
        /* Function 0x06 */
	typedef bitmap {
		DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION	= 0x00000001,
		DRSUAPI_DS_REPLICA_DELETE_WRITEABLE			= 0x00000002
		/* TODO ... */
	} drsuapi_DsReplicaDeleteOptions;

	WERROR DRSUAPI_REPLICA_DEL();

	/*****************/
        /* Function 0x07 */
	typedef bitmap {
		DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION	= 0x00000001,
		DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE			= 0x00000002
	} drsuapi_DsReplicaModifyOptions;

	WERROR DRSUAPI_REPLICA_MODIFY();

	/*****************/
        /* Function 0x08 */
	WERROR DRSUAPI_VERIFY_NAMES();

	/*****************/
        /* Function 0x09 */
	WERROR DRSUAPI_GET_MEMBERSHIPS();

	/*****************/
        /* Function 0x0a */
	WERROR DRSUAPI_INTER_DOMAIN_MOVE();

	/*****************/
        /* Function 0x0b */
	WERROR DRSUAPI_GET_NT4_CHANGELOG();

	/*****************/
	/* Function 0x0c */
	typedef [v1_enum] enum {
		DRSUAPI_DS_NAME_STATUS_OK			= 0,
		DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR		= 1,
		DRSUAPI_DS_NAME_STATUS_NOT_FOUND		= 2,
		DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE		= 3,
		DRSUAPI_DS_NAME_STATUS_NO_MAPPING		= 4,
		DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY		= 5,
		DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING	= 6,
		DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL		= 7
	} drsuapi_DsNameStatus;

	typedef [v1_enum] enum {
		DRSUAPI_DS_NAME_FLAG_NO_FLAGS			= 0x0,
		DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY		= 0x1,
		DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC			= 0x2,
		DRSUAPI_DS_NAME_FLAG_GCVERIFY			= 0x4,
		DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL		= 0x8
	} drsuapi_DsNameFlags;

	typedef [v1_enum] enum {
		DRSUAPI_DS_NAME_FORMAT_UKNOWN			= 0,
		DRSUAPI_DS_NAME_FORMAT_FQDN_1779		= 1,
		DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT		= 2,
		DRSUAPI_DS_NAME_FORMAT_DISPLAY			= 3,
		DRSUAPI_DS_NAME_FORMAT_GUID 			= 6,
		DRSUAPI_DS_NAME_FORMAT_CANONICAL		= 7,
		DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL		= 8,
		DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX		= 9,
		DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL	= 10,
		DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY	= 11,
		DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN		= 12
	} drsuapi_DsNameFormat;

	typedef struct {
		unistr *str;
	} drsuapi_DsNameString;

	typedef struct {
		uint32 unknown1; /* 0x000004e4 */
		uint32 unknown2; /* 0x00000407 */
		drsuapi_DsNameFlags format_flags;
		drsuapi_DsNameFormat format_offered;
		drsuapi_DsNameFormat format_desired;
		[range(1,10000)] uint32 count;
		[size_is(count)] drsuapi_DsNameString *names[];
	} drsuapi_DsNameRequest1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsNameRequest1 req1;
	} drsuapi_DsNameRequest;

	typedef struct {
		drsuapi_DsNameStatus status;
		unistr *dns_domain_name;
		unistr *result_name;
	} drsuapi_DsNameInfo1;

	typedef struct {
		uint32 count;
		[size_is(count)] drsuapi_DsNameInfo1 *array[];
	} drsuapi_DsNameCtr1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsNameCtr1 *ctr1;
	} drsuapi_DsNameCtr;

	WERROR drsuapi_DsCrackNames(
		[in,ref] policy_handle *bind_handle,
		[in, out] int32 level,
		[in,switch_is(level)] drsuapi_DsNameRequest req,
		[out,switch_is(level)] drsuapi_DsNameCtr ctr
		);

	/*****************/
	/* Function 0x0d */
	typedef [v1_enum] enum {
		DRSUAPI_DS_SPN_OPERATION_ADD	= 0,
		DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
		DRSUAPI_DS_SPN_OPERATION_DELETE	= 2
	} drsuapi_DsSpnOperation;

	typedef struct {
		drsuapi_DsSpnOperation operation;
		uint32 unknown1;
		unistr *object_dn;
		[range(0,10000)] uint32 count;
		[size_is(count)] drsuapi_DsNameString *spn_names[];
	} drsuapi_DsWriteAccountSpnRequest1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
	} drsuapi_DsWriteAccountSpnRequest;

	typedef struct {
		WERROR status;
	} drsuapi_DsWriteAccountSpnResult1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
	} drsuapi_DsWriteAccountSpnResult;

	WERROR drsuapi_DsWriteAccountSpn(
		[in,ref] policy_handle *bind_handle,
		[in, out] int32 level,
		[in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
		[out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
		);

	/*****************/
        /* Function 0x0e */
	WERROR DRSUAPI_REMOVE_DS_SERVER();

	/*****************/
        /* Function 0x0f */
	WERROR DRSUAPI_REMOVE_DS_DOMAIN();

	/*****************/
        /* Function 0x10 */
	typedef struct {
		unistr *domain_name; /* netbios or dns */
		int32 level; /* specifies the switch level for the request */
	} drsuapi_DsGetDCInfoRequest1;

	typedef [switch_type(int32)] union {
		[case(1)] drsuapi_DsGetDCInfoRequest1 req1;
	} drsuapi_DsGetDCInfoRequest;

	typedef struct {
		unistr *netbios_name;
		unistr *dns_name;
		unistr *site_name;
		unistr *computer_dn;
		unistr *server_dn;
		uint32 is_pdc;
		uint32 is_enabled;
	} drsuapi_DsGetDCInfo1;

	typedef struct {
		[range(0,10000)] uint32 count;
		[size_is(count)] drsuapi_DsGetDCInfo1 *array[];
	} drsuapi_DsGetDCInfoCtr1;

	typedef struct {
		unistr *netbios_name;
		unistr *dns_name;
		unistr *site_name;
		unistr *site_dn;
		unistr *computer_dn;
		unistr *server_dn;
		unistr *ntds_dn;
		uint32 is_pdc;
		uint32 is_enabled;
		uint32 is_gc;
		GUID site_guid;
		GUID computer_guid;
		GUID server_guid;
		GUID ntds_guid;
	} drsuapi_DsGetDCInfo2;

	typedef struct {
		[range(0,10000)] uint32 count;
		[size_is(count)] drsuapi_DsGetDCInfo2 *array[];
	} drsuapi_DsGetDCInfoCtr2;

	typedef struct {
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
		uint32 unknown5;
		uint32 unknown6;
		unistr *server_nt4_account;
	} drsuapi_DsGetDCInfo01;

	typedef struct {
		[range(0,10000)] uint32 count;
		[size_is(count)] drsuapi_DsGetDCInfo01 *array[];
	} drsuapi_DsGetDCInfoCtr01;

	typedef [v1_enum] enum {
		DRSUAPI_DC_INFO_CTR_1  = 1,
		DRSUAPI_DC_INFO_CTR_2  = 2,
		DRSUAPI_DC_INFO_CTR_01 = -1
	} drsuapi_DsGetDCInfoCtrLevels;

        typedef [switch_type(int32)] union {
		[case(DRSUAPI_DC_INFO_CTR_1)]  drsuapi_DsGetDCInfoCtr1  ctr1;
		[case(DRSUAPI_DC_INFO_CTR_2)]  drsuapi_DsGetDCInfoCtr2  ctr2;
		[case(DRSUAPI_DC_INFO_CTR_01)] drsuapi_DsGetDCInfoCtr01 ctr01;
	} drsuapi_DsGetDCInfoCtr;

	WERROR drsuapi_DsGetDomainControllerInfo(
		[in,ref] policy_handle *bind_handle,
		[in, out] int32 level,
		[in,switch_is(level)] drsuapi_DsGetDCInfoRequest req,
		[out,switch_is(level)] drsuapi_DsGetDCInfoCtr ctr
		);

	/*****************/
        /* Function 0x11 */
	typedef [noprint] struct {
		drsuapi_DsReplicaObjectListItem *next_object;
		drsuapi_DsReplicaObject object;
	} drsuapi_DsReplicaObjectListItem;

	typedef struct {
		drsuapi_DsReplicaObjectListItem first_object;
	} drsuapi_DsAddEntryRequest2;

	typedef [switch_type(int32)] union {
		[case(2)] drsuapi_DsAddEntryRequest2 req2;
	} drsuapi_DsAddEntryRequest;

	typedef struct {
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
	} drsuapi_DsAddEntryCtr3Info1;

	typedef [switch_type(uint32)] union {
		[case(1)] drsuapi_DsAddEntryCtr3Info1 info1;
	} drsuapi_DsAddEntryCtr3Info;

	typedef struct {
		GUID guid;
		[subcontext_size(28),subcontext(0)] dom_sid sid;
	} drsuapi_DsReplicaObjectIdentifier2;

	typedef struct {
		drsuapi_DsReplicaObjectIdentifier *id;
		uint32 level;
		[switch_is(level)] drsuapi_DsAddEntryCtr3Info *info;
		[range(0,10000)] uint32 count;
		[size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects[];
	} drsuapi_DsAddEntryCtr3;

	typedef [switch_type(int32)] union {
		[case(3)] drsuapi_DsAddEntryCtr3 ctr3;
	} drsuapi_DsAddEntryCtr;

	WERROR drsuapi_DsAddEntry(
		[in,ref] policy_handle *bind_handle,
		[in,out] int32 level,
		[in,switch_is(level)] drsuapi_DsAddEntryRequest req,
		[out,switch_is(level)] drsuapi_DsAddEntryCtr ctr
		);

	/*****************/
        /* Function 0x12 */
	WERROR DRSUAPI_EXECUTE_KCC();

	/*****************/
	/* Function 0x13 */
	typedef [v1_enum] enum {
		DRSUAPI_DS_REPLICA_GET_INFO				= 1,
		DRSUAPI_DS_REPLICA_GET_INFO2				= 2
	} drsuapi_DsReplicaGetInfoLevel;

	typedef [v1_enum] enum {
		DRSUAPI_DS_REPLICA_INFO_NEIGHBORS			= 0,
		DRSUAPI_DS_REPLICA_INFO_CURSORS				= 1,
		DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA			= 2,
		DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES	= 3,
		DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES 		= 4,
		DRSUAPI_DS_REPLICA_INFO_PENDING_OPS 			= 5,
		DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA	= 6,
		DRSUAPI_DS_REPLICA_INFO_CURSORS2			= 7,
		DRSUAPI_DS_REPLICA_INFO_CURSORS3			= 8,
		DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2			= 9,
		DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2	= 10,
		DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02			= -2,
		DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04			= -4,
		DRSUAPI_DS_REPLICA_INFO_CURSURS05			= -5,
		DRSUAPI_DS_REPLICA_INFO_06				= -6
	} drsuapi_DsReplicaInfoType;

	typedef struct {
		drsuapi_DsReplicaInfoType info_type;
		unistr *object_dn;
		GUID guid1;
	} drsuapi_DsReplicaGetInfoRequest1;

	typedef struct {
		drsuapi_DsReplicaInfoType info_type;
		unistr *object_dn;
		GUID guid1;
		uint32 unknown1;
		unistr *string1;
		unistr *string2;
		uint32 unknown2;
	} drsuapi_DsReplicaGetInfoRequest2;

	typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
		[case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
		[case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
	} drsuapi_DsReplicaGetInfoRequest;

	typedef struct {
		unistr *naming_context_dn;
		unistr *source_dsa_obj_dn;
		unistr *source_dsa_address;
		unistr *transport_obj_dn;
		uint32 replica_flags;
		uint32 reserved;
		GUID naming_context_obj_guid;
		GUID source_dsa_obj_guid;
		GUID source_dsa_invocation_id;
		GUID transport_obj_guid;
		hyper tmp_highest_usn;
		hyper highest_usn;
		NTTIME last_success;
		NTTIME last_attempt;
		WERROR result_last_attempt;
		uint32 consecutive_sync_failures;
	} drsuapi_DsReplicaNeighbour;

	typedef struct {
		uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplicaNeighbour array[];
	} drsuapi_DsReplicaNeighbourCtr;

	typedef struct {
		uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplicaCoursor array[];
	} drsuapi_DsReplicaCoursorCtr;

	typedef struct {
		unistr *attribute_name;
		uint32 version;
		NTTIME originating_last_changed;
		GUID originating_dsa_invocation_id;
		hyper originating_usn;
		hyper local_usn;
	} drsuapi_DsReplicaObjMetaData;

	typedef struct {
		uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplicaObjMetaData array[];
	} drsuapi_DsReplicaObjMetaDataCtr;

	typedef struct {
		unistr *dsa_obj_dn;
		GUID dsa_obj_guid;
		NTTIME first_failure;
		uint32 num_failures;
		WERROR last_result;
	} drsuapi_DsReplicaKccDsaFailure;

	typedef struct {
		uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
	} drsuapi_DsReplicaKccDsaFailuresCtr;

	typedef enum {
		DRSUAPI_DS_REPLICA_OP_TYPE_SYNC		= 0,
		DRSUAPI_DS_REPLICA_OP_TYPE_ADD		= 1,
		DRSUAPI_DS_REPLICA_OP_TYPE_DELETE	= 2,
		DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY	= 3,
		DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS	= 4
	} drsuapi_DsReplicaOpType;

	typedef [switch_type(drsuapi_DsReplicaOpType)] union {
		[case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)]		drsuapi_DsReplicaSyncOptions sync;
		[case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)]		drsuapi_DsReplicaAddOptions add;
		[case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)]	drsuapi_DsReplicaDeleteOptions delete;
		[case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)]	drsuapi_DsReplicaModifyOptions modify;
		[case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)]	drsuapi_DsReplicaUpdateRefsOptions update_refs;
		[default] uint32 unknown;
	} drsuapi_DsRplicaOpOptions;

	typedef struct {
		NTTIME operation_start;
		uint32 serial_num; /* unique till reboot */
		uint32 priority;
		drsuapi_DsReplicaOpType operation_type;
		[switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
		unistr *nc_dn;
		unistr *remote_dsa_obj_dn;
		unistr *remote_dsa_address;
		GUID nc_obj_guid;
		GUID remote_dsa_obj_guid;
	} drsuapi_DsReplicaOp;

	typedef struct {
		NTTIME time;
		uint32 count;
		[size_is(count)] drsuapi_DsReplicaOp array[];
	} drsuapi_DsReplicaOpCtr;

	typedef struct {
		unistr *attribute_name;
		unistr *object_dn;
		uint32 value_length;
		[size_is(value_length)] uint8 *value[];
		NTTIME deleted;
		NTTIME created;
		uint32 version;
		NTTIME originating_last_changed;
		GUID originating_dsa_invocation_id;
		hyper originating_usn;
		hyper local_usn;
	} drsuapi_DsReplicaAttrValMetaData;

	typedef struct {
		uint32 count;
		int32 enumeration_context;
		[size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
	} drsuapi_DsReplicaAttrValMetaDataCtr;

	typedef struct {
		GUID source_dsa_invocation_id;
		hyper highest_usn;
		NTTIME last_sync_success;
	} drsuapi_DsReplicaCoursor2;

	typedef struct {
		uint32 count;
		int32 enumeration_context;
		[size_is(count)] drsuapi_DsReplicaCoursor2 array[];
	} drsuapi_DsReplicaCoursor2Ctr;

	typedef struct {
		GUID source_dsa_invocation_id;
		hyper highest_usn;
		NTTIME last_sync_success;
		unistr *source_dsa_obj_dn;
	} drsuapi_DsReplicaCoursor3;

	typedef struct {
		uint32 count;
		int32 enumeration_context;
		[size_is(count)] drsuapi_DsReplicaCoursor3 array[];
	} drsuapi_DsReplicaCoursor3Ctr;

	typedef struct {
		unistr *attribute_name;
		uint32 version;
		NTTIME originating_last_changed;
		GUID originating_dsa_invocation_id;
		hyper originating_usn;
		hyper local_usn;
		unistr *originating_dsa_obj_dn;
	} drsuapi_DsReplicaObjMetaData2;

	typedef struct {
		uint32 count;
		int32 enumeration_context;
		[size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
	} drsuapi_DsReplicaObjMetaData2Ctr;

	typedef struct {
		unistr *attribute_name;
		unistr *object_dn;
		uint32 value_length;
		[size_is(value_length)] uint8 *value[];
		NTTIME deleted;
		NTTIME created;
		uint32 version;
		NTTIME originating_last_changed;
		GUID originating_dsa_invocation_id;
		hyper originating_usn;
		hyper local_usn;
		unistr *originating_dsa_obj_dn;
	} drsuapi_DsReplicaAttrValMetaData2;

	typedef struct {
		uint32 count;
		int32 enumeration_context;
		[size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
	} drsuapi_DsReplicaAttrValMetaData2Ctr;

	typedef struct {
		hyper u1; /* session number? */
		uint32 u2;
		uint32 u3;
		GUID bind_guid;
		NTTIME_1sec bind_time;
		uint32 u4; /* flags? */
		uint32 u5;
	} drsuapi_DsReplicaConnection04;

	typedef struct {
		[range(0,10000)] uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplicaConnection04 array[];
	} drsuapi_DsReplicaConnection04Ctr;

	typedef struct {
		unistr *str1;
		uint32 u1;
		uint32 u2;
		uint32 u3;
		uint32 u4;
		uint32 u5;
		hyper u6;
		uint32 u7;
	} drsuapi_DsReplica06;

	typedef struct {
		[range(0,256)] uint32 count;
		uint32 reserved;
		[size_is(count)] drsuapi_DsReplica06 array[];
	} drsuapi_DsReplica06Ctr;

	typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
		[case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
		[case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCoursorCtr *coursors;
		[case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
		[case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
		[case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
		[case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
		[case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
		[case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCoursor2Ctr *coursors2;
		[case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCoursor3Ctr *coursors3;
		[case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
		[case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
		[case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
		[case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
		[case(DRSUAPI_DS_REPLICA_INFO_CURSURS05)] drsuapi_DsReplicaCoursor05Ctr *coursors05;
		[case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
	} drsuapi_DsReplicaInfo;

	WERROR drsuapi_DsReplicaGetInfo(
		[in,ref] policy_handle *bind_handle,
		[in] drsuapi_DsReplicaGetInfoLevel level,
		[in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req,
		[out] drsuapi_DsReplicaInfoType info_type,
		[out,switch_is(info_type)] drsuapi_DsReplicaInfo info
		);

	/*****************/
        /* Function 0x14 */
	WERROR DRSUAPI_ADD_SID_HISTORY();

	/*****************/
        /* Function 0x15 */
	WERROR DRSUAPI_GET_MEMBERSHIPS2();

	/*****************/
        /* Function 0x16 */
	WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();

	/*****************/
        /* Function 0x17 */
	WERROR DRSUAPI_GET_OBJECT_EXISTENCE();

	/*****************/
        /* Function 0x18 */
	WERROR DRSUAPI_QUERY_SITES_BY_COST();
}