#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:"), helpstring("Active Directory Replication"), pointer_default(unique) ] interface drsuapi { /*****************/ /* Function 0x00 */ typedef [flag(NDR_PAHEX)] struct { [range(1,10000)] uint32 length; [size_is(length)] uint8 data[]; } drsuapi_DsBindInfo; /* 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"; /* this are the bind info blobs returned (seemed to be const): w2k3 7ffbff1f81a6ff5d80139441a372e9b779d70268f801000000000000 w2k 7ffb1f00cb7fb9102391c143bda81fc90e0ff452f4000000 */ const uint8 DRSUAPI_DS_BIND_INFO_RESPONSE_W2K3[] = { 0x7f,0xfb,0xff,0x1f,0x81,0xa6,0xff,0x5d, 0x80,0x13,0x94,0x41,0xa3,0x72,0xe9,0xb7, 0x79,0xd7,0x02,0x68,0xf8,0x01,0x00,0x00, 0x00,0x00,0x00,0x00}; const uint8 DRSUAPI_DS_BIND_INFO_RESPONSE_W2K[] = { 0x7f,0xfb,0x1f,0x00,0xcb,0x7f,0xb9,0x10, 0x23,0x91,0xc1,0x43,0xbd,0xa8,0x1f,0xc9, 0x0e,0x0f,0xf4,0x52,0xf4,0x00,0x00,0x00}; WERROR drsuapi_DsBind( [in] GUID *bind_guid, [in,out] drsuapi_DsBindInfo *bind_info, [out,ref] policy_handle *bind_handle ); /*****************/ /* Function 0x01 */ WERROR drsuapi_DsUnbind( [in,out,ref] policy_handle *bind_handle ); /*****************/ /* Function 0x02 */ typedef struct { uint32 unknown1; uint32 unknown2; GUID guid1; uint8 unknown3[28]; [range(0,0xA00000)] uint32 length; [size_is(length+1)] uint16 nc_dn[*]; } drsuapi_DsReplicaSyncRequest1Info; typedef struct { drsuapi_DsReplicaSyncRequest1Info *info; GUID guid1; astring *string1; uint32 unknown1; } drsuapi_DsReplicaSyncRequest1; typedef union { [case(1)] drsuapi_DsReplicaSyncRequest1 req1; } drsuapi_DsReplicaSyncRequest; WERROR drsuapi_DsReplicaSync( [in,ref] policy_handle *bind_handle, [in] uint32 level, [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req ); /*****************/ /* Function 0x03 */ WERROR DRSUAPI_GET_NC_CHANGES(); /*****************/ /* Function 0x04 */ WERROR DRSUAPI_UPDATE_REFS(); /*****************/ /* Function 0x05 */ WERROR DRSUAPI_REPLICA_ADD(); /*****************/ /* Function 0x06 */ WERROR DRSUAPI_REPLICA_DEL(); /*****************/ /* Function 0x07 */ 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 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 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 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 */ uint32 format_flags; uint32 format_offered; uint32 format_desired; [range(1,10000)] uint32 count; [size_is(count)] drsuapi_DsNameString *names; } drsuapi_DsNameRequest1; typedef union { [case(1)] drsuapi_DsNameRequest1 req1; } drsuapi_DsNameRequest; typedef struct { uint32 status; unistr *dns_domain_name; unistr *result_name; } drsuapi_DsNameInfo1; typedef struct { uint32 count; [size_is(count)] drsuapi_DsNameInfo1 *array; } drsuapi_DsNameCtr1; typedef union { [case(1)] drsuapi_DsNameCtr1 *ctr1; } drsuapi_DsNameCtr; WERROR drsuapi_DsCrackNames( [in,ref] policy_handle *bind_handle, [in, out] uint32 level, [in,switch_is(level)] drsuapi_DsNameRequest req, [out,switch_is(level)] drsuapi_DsNameCtr ctr ); /*****************/ /* Function 0x0d */ typedef enum { DRSUAPI_DS_SPN_OPERATION_ADD = 0, DRSUAPI_DS_SPN_OPERATION_REPLACE= 1, DRSUAPI_DS_SPN_OPERATION_DELETE = 2 } drsuapi_DsSpnOperation; typedef struct { int32 operation; int32 unknown1; unistr *object_dn; [range(0,10000)] uint32 count; [size_is(count)] drsuapi_DsNameString *spn_names; } drsuapi_DsWriteAccountSpnRequest1; typedef union { [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1; } drsuapi_DsWriteAccountSpnRequest; typedef struct { WERROR status; } drsuapi_DsWriteAccountSpnResult1; typedef union { [case(1)] drsuapi_DsWriteAccountSpnResult1 res1; } drsuapi_DsWriteAccountSpnResult; WERROR drsuapi_DsWriteAccountSpn( [in,ref] policy_handle *bind_handle, [in, out] uint32 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 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 union { [case(1)] drsuapi_DsGetDCInfoCtr1 ctr1; [case(2)] drsuapi_DsGetDCInfoCtr2 ctr2; [case(-1)] 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 */ WERROR DRSUAPI_ADD_ENTRY(); /*****************/ /* Function 0x12 */ WERROR DRSUAPI_EXECUTE_KCC(); /*****************/ /* Function 0x13 */ typedef enum { DRSUAPI_DS_REPLICA_GET_INFO = 1, DRSUAPI_DS_REPLICA_GET_INFO2 = 2 } drsuapi_DsReplicaGetInfoLevel; typedef 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 { int32 info_type; unistr *object_dn; GUID guid1; } drsuapi_DsReplicaGetInfoRequest1; typedef struct { int32 info_type; unistr *object_dn; GUID guid1; uint32 unknown1; unistr *string1; unistr *string2; uint32 unknown2; } drsuapi_DsReplicaGetInfoRequest2; typedef union { [case(1)] drsuapi_DsReplicaGetInfoRequest1 req1; [case(2)] 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_T tmp_highest_usn; HYPER_T 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 { GUID source_dsa_invocation_id; HYPER_T highest_usn; } drsuapi_DsReplicaCoursor; 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_T originating_usn; HYPER_T 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 struct { NTTIME operation_start; uint32 serial_num; /* unique till reboot */ uint32 priority; uint16 operation_type; uint32 options_flags; 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_T originating_usn; HYPER_T 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_T 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_T 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_T originating_usn; HYPER_T 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_T originating_usn; HYPER_T 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_T 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 { uint32 u1; uint32 u2; [range(0,0x100000)] uint32 count; uint32 u3; [size_is(count)] drsuapi_DsReplicaCoursor array[]; } drsuapi_DsReplicaCoursor05Ctr; typedef struct { unistr *str1; uint32 u1; uint32 u2; uint32 u3; uint32 u4; uint32 u5; HYPER_T u6; uint32 u7; } drsuapi_DsReplica06; typedef struct { [range(0,256)] uint32 count; uint32 reserved; [size_is(count)] drsuapi_DsReplica06 array[]; } drsuapi_DsReplica06Ctr; typedef union { [case(0)] drsuapi_DsReplicaNeighbourCtr *neighbours; [case(1)] drsuapi_DsReplicaCoursorCtr *coursors; [case(2)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata; [case(3)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures; [case(4)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures; [case(5)] drsuapi_DsReplicaOpCtr *pendingops; [case(6)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata; [case(7)] drsuapi_DsReplicaCoursor2Ctr *coursors2; [case(8)] drsuapi_DsReplicaCoursor3Ctr *coursors3; [case(9)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2; [case(10)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2; [case(-2)] drsuapi_DsReplicaNeighbourCtr *neighbours02; [case(-4)] drsuapi_DsReplicaConnection04Ctr *connections04; [case(-5)] drsuapi_DsReplicaCoursor05Ctr *coursors05; [case(-6)] drsuapi_DsReplica06Ctr *i06; } drsuapi_DsReplicaInfo; WERROR drsuapi_DsReplicaGetInfo( [in,ref] policy_handle *bind_handle, [in] int32 level, [in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req, [out] int32 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(); }