MS DRSR
MS DRSR
Tools. The Open Specifications documentation does not require the use of Microsoft programming
tools or programming environments in order for you to develop an implementation. If you have access
to Microsoft programming tools and environments, you are free to take advantage of them. Certain
Open Specifications documents are intended for use in conjunction with publicly available standards
specifications and network programming art and, as such, assume that the reader either is familiar
with the aforementioned material or has immediate access to it.
1 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Revision Summary
Revision Revision
Date History Class Comments
6/1/2007 1.2.1 Editorial Changed language and formatting in the technical content.
8/10/2007 1.3.1 Editorial Changed language and formatting in the technical content.
1/25/2008 2.0.1 Editorial Changed language and formatting in the technical content.
2 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Revision Revision
Date History Class Comments
3 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Table of Contents
1 Introduction .......................................................................................................... 22
1.1 Glossary ......................................................................................................... 23
1.2 References ...................................................................................................... 35
1.2.1 Normative References ................................................................................. 35
1.2.2 Informative References ............................................................................... 37
1.3 Overview ........................................................................................................ 37
1.3.1 Methods Categorized by Function.................................................................. 37
1.3.2 Sequencing Issues ...................................................................................... 38
1.3.3 Most Frequently Used Types......................................................................... 40
1.4 Relationship to Other Protocols .......................................................................... 40
1.5 Prerequisites/Preconditions ............................................................................... 41
1.6 Applicability Statement ..................................................................................... 41
1.7 Versioning and Capability Negotiation ................................................................. 41
1.8 Vendor-Extensible Fields ................................................................................... 42
1.9 Standards Assignments..................................................................................... 42
2 Message Transport ................................................................................................ 43
2.1 RPC Transport ................................................................................................. 43
2.2 Protocol Security .............................................................................................. 43
2.2.1 General Background .................................................................................... 43
2.2.2 Service Principal Names for Domain Controllers .............................................. 43
2.2.3 DC-to-DC Operations .................................................................................. 44
2.2.3.1 Security Provider .................................................................................. 44
2.2.3.2 SPN for a Target DC in AD DS................................................................. 44
2.2.3.3 SPN for a Target DC in AD LDS ............................................................... 45
2.2.4 Client-to-DC Operations .............................................................................. 45
2.2.4.1 Security Provider .................................................................................. 46
2.2.4.2 SPN for a Target DC in AD DS................................................................. 46
2.2.4.3 SPN for a Target DC in AD LDS ............................................................... 47
2.3 Directory Service Schema Elements ................................................................... 48
3 Background to Behavior Specifications .................................................................. 49
3.1 Document Organization .................................................................................... 49
3.2 Typographical Conventions ................................................................................ 49
3.3 State Model ..................................................................................................... 49
3.3.1 Preliminaries .............................................................................................. 49
3.3.2 Transactions .............................................................................................. 50
3.3.3 Concrete and Abstract Types ........................................................................ 50
3.4 Pseudocode Language ...................................................................................... 51
3.4.1 Naming Conventions ................................................................................... 51
3.4.2 Language Constructs for Concrete Types ....................................................... 51
3.4.3 Language Constructs for Abstract Types ........................................................ 52
3.4.4 Common Language Constructs ..................................................................... 54
3.4.5 Access to Objects and Their Attributes .......................................................... 55
3.4.6 Asynchronous Processing ............................................................................. 58
3.5 Conventions for Protocol Examples ..................................................................... 58
3.5.1 Common Configuration ................................................................................ 58
3.5.2 Data Display Conventions ............................................................................ 59
3.6 Server and Client Initialization ........................................................................... 60
3.6.1 AD LDS Specifics ........................................................................................ 60
4 RPC Methods and Their Behavior ........................................................................... 61
4.1 drsuapi RPC Interface ....................................................................................... 61
4.1.1 IDL_DRSAddEntry (Opnum 17) .................................................................... 63
4.1.1.1 Method-Specific Concrete Types.............................................................. 63
4 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.1.1.1 DRS_MSG_ADDENTRYREQ ................................................................ 63
4.1.1.1.2 DRS_MSG_ADDENTRYREQ_V1 .......................................................... 64
4.1.1.1.3 DRS_MSG_ADDENTRYREQ_V2 .......................................................... 64
4.1.1.1.4 DRS_MSG_ADDENTRYREQ_V3 .......................................................... 64
4.1.1.1.5 DRS_MSG_ADDENTRYREPLY ............................................................. 64
4.1.1.1.6 DRS_MSG_ADDENTRYREPLY_V1 ....................................................... 65
4.1.1.1.7 DRS_MSG_ADDENTRYREPLY_V2 ....................................................... 65
4.1.1.1.8 DRS_MSG_ADDENTRYREPLY_V3 ....................................................... 66
4.1.1.1.9 ADDENTRY_REPLY_INFO .................................................................. 66
4.1.1.1.10 DIRERR_DRS_WIRE_V1 ................................................................... 67
4.1.1.1.11 ATRERR_DRS_WIRE_V1 ................................................................... 67
4.1.1.1.12 PROBLEMLIST_DRS_WIRE_V1........................................................... 67
4.1.1.1.13 INTFORMPROB_DRS_WIRE_V1 ......................................................... 68
4.1.1.1.14 NAMERR_DRS_WIRE_V1 .................................................................. 68
4.1.1.1.15 REFERR_DRS_WIRE_V1 ................................................................... 68
4.1.1.1.16 NAMERESOP_DRS_WIRE_V1 ............................................................. 69
4.1.1.1.17 DSA_ADDRESS_LIST_DRS_WIRE_V1 ................................................. 69
4.1.1.1.18 CONTREF_DRS_WIRE_V1 ................................................................. 69
4.1.1.1.19 SECERR_DRS_WIRE_V1 ................................................................... 70
4.1.1.1.20 SVCERR_DRS_WIRE_V1 ................................................................... 71
4.1.1.1.21 UPDERR_DRS_WIRE_V1 ................................................................... 71
4.1.1.1.22 SYSERR_DRS_WIRE_V1 ................................................................... 71
4.1.1.1.23 DRS_ERROR_DATA .......................................................................... 72
4.1.1.1.24 DRS_ERROR_DATA_V1 .................................................................... 72
4.1.1.1.25 DIRERR Codes ................................................................................ 72
4.1.1.1.26 PROBLEM Error Codes ...................................................................... 73
4.1.1.2 Method-Specific Abstract Types and Procedures ........................................ 75
4.1.1.2.1 ConstructReplSpn ............................................................................ 75
4.1.1.2.2 CreateCrossRef ............................................................................... 75
4.1.1.2.3 CreateNtdsDsa ................................................................................ 77
4.1.1.2.4 UseCredsForAccessCheck ................................................................. 79
4.1.1.2.5 IsDomainToBeCreated...................................................................... 79
4.1.1.2.6 GetDomainNameFromEntinf .............................................................. 79
4.1.1.2.7 ENTINF_GetAttribute ....................................................................... 79
4.1.1.2.8 SetErrorData................................................................................... 80
4.1.1.2.9 ClientIpMatch.................................................................................. 80
4.1.1.2.10 PerformModifyEntInf ........................................................................ 80
4.1.1.2.11 DoAttributesSatisfyPreCheckForCreateNtdsDsa ................................... 80
4.1.1.3 Server Behavior of the IDL_DRSAddEntry Method ..................................... 81
4.1.2 IDL_DRSAddSidHistory (Opnum 20) .............................................................. 84
4.1.2.1 Method-Specific Concrete Types.............................................................. 84
4.1.2.1.1 DRS_MSG_ADDSIDREQ .................................................................... 84
4.1.2.1.2 DRS_MSG_ADDSIDREQ_V1 .............................................................. 85
4.1.2.1.3 DRS_MSG_ADDSIDREPLY ................................................................. 86
4.1.2.1.4 DRS_MSG_ADDSIDREPLY_V1 ........................................................... 86
4.1.2.1.5 DRS_ADDSID_FLAGS ....................................................................... 86
4.1.2.2 Method-Specific Abstract Types and Procedures ........................................ 87
4.1.2.2.1 ConnectionCtx................................................................................. 87
4.1.2.2.2 ConnectToDC .................................................................................. 87
4.1.2.2.3 ConnectToDCWithCreds .................................................................... 87
4.1.2.2.4 GenerateFailureAudit ....................................................................... 87
4.1.2.2.5 GenerateSuccessAudit...................................................................... 87
4.1.2.2.6 GenerateSuccessAuditRemotely ........................................................ 87
4.1.2.2.7 GetKeyLength ................................................................................. 88
4.1.2.2.8 FindGC ........................................................................................... 88
4.1.2.2.9 GetPDC .......................................................................................... 88
4.1.2.2.10 HasAdminRights .............................................................................. 88
4.1.2.2.11 IsAuditingEnabled............................................................................ 88
5 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.2.2.12 IsLocalRpcCall ................................................................................. 88
4.1.2.2.13 IsNT4SP4OrBetter ........................................................................... 88
4.1.2.2.14 IsAuditingGroupPresent .................................................................... 89
4.1.2.2.15 IsWellKnownDomainRelativeSid......................................................... 89
4.1.2.2.16 LastRID .......................................................................................... 89
4.1.2.2.17 RemoteQuery.................................................................................. 89
4.1.2.3 Server Behavior of the IDL_DRSAddSidHistory Method .............................. 89
4.1.2.4 Examples of the IDL_DRSAddSidHistory Method ....................................... 97
4.1.2.4.1 Calling IDL_DRSAddSidHistory with
DS_ADDSID_FLAG_PRIVATE_CHK_SECURE Flags ................................ 97
4.1.2.4.1.1 Client Request ........................................................................... 97
4.1.2.4.1.2 Server Response ........................................................................ 97
4.1.2.4.1.3 Final State ................................................................................ 97
4.1.2.4.2 Calling IDL_DRSAddSidHistory with
DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ Flags ............................... 97
4.1.2.4.2.1 Initial State ............................................................................... 97
4.1.2.4.2.2 Client Request ........................................................................... 98
4.1.2.4.2.3 Server Response ........................................................................ 98
4.1.2.4.2.4 Final State ................................................................................ 98
4.1.2.4.3 Calling IDL_DRSAddSidHistory with 0 in Flags ..................................... 99
4.1.2.4.3.1 Initial State ............................................................................... 99
4.1.2.4.3.2 Client Request ..........................................................................100
4.1.2.4.3.3 Server Response .......................................................................100
4.1.2.4.3.4 Final State ...............................................................................101
4.1.3 IDL_DRSBind (Opnum 0) ............................................................................101
4.1.3.1 Client Behavior When Sending the IDL_DRSBind Request .........................102
4.1.3.2 Server Behavior of the IDL_DRSBind Method ...........................................107
4.1.3.3 Client Behavior When Receiving the IDL_DRSBind Response .....................111
4.1.3.4 Examples of the IDL_DRSBind Method ....................................................111
4.1.3.4.1 Initial State ...................................................................................111
4.1.3.4.2 Client Request................................................................................112
4.1.3.4.3 Server Response ............................................................................113
4.1.3.4.4 Final State .....................................................................................115
4.1.4 IDL_DRSCrackNames (Opnum 12) ...............................................................115
4.1.4.1 Method-Specific Concrete Types.............................................................115
4.1.4.1.1 DRS_MSG_CRACKREQ ....................................................................115
4.1.4.1.2 DRS_MSG_CRACKREQ_V1 ...............................................................116
4.1.4.1.3 DS_NAME_FORMAT ........................................................................118
4.1.4.1.4 DS_NAME_RESULT_ITEMW ..............................................................118
4.1.4.1.5 DS_NAME_RESULTW ......................................................................119
4.1.4.1.6 DRS_MSG_CRACKREPLY ..................................................................119
4.1.4.1.7 DRS_MSG_CRACKREPLY_V1 ............................................................119
4.1.4.1.8 DS_NAME_ERROR ..........................................................................119
4.1.4.2 Method-Specific Abstract Types and Procedures .......................................121
4.1.4.2.1 CanonicalNameFromCanonicalNameEx ..............................................121
4.1.4.2.2 DomainDNSNameFromDomain .........................................................121
4.1.4.2.3 DomainFromDomainDNSName .........................................................121
4.1.4.2.4 DomainNameFromCanonicalName ....................................................121
4.1.4.2.5 DomainNameFromSid .....................................................................122
4.1.4.2.6 DomainNameFromUPN ....................................................................122
4.1.4.2.7 DomainNetBIOSNameFromDomain ...................................................122
4.1.4.2.8 DomainSidFromSid .........................................................................122
4.1.4.2.9 CrackNames ..................................................................................122
4.1.4.2.10 LookupName..................................................................................126
4.1.4.2.11 LookupAttr ....................................................................................129
4.1.4.2.12 LookupCanonicalName ....................................................................129
4.1.4.2.13 GetCanonicalName .........................................................................129
4.1.4.2.14 LookupSPN ....................................................................................130
6 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.4.2.15 LookupSID ....................................................................................131
4.1.4.2.16 LookupUnknownName .....................................................................131
4.1.4.2.17 LookupUPNAndAltSecID ..................................................................132
4.1.4.2.18 LookupFPO ....................................................................................132
4.1.4.2.19 MapSPN ........................................................................................133
4.1.4.2.20 ParseCanonicalName.......................................................................133
4.1.4.2.21 RetrieveDCSuffixFromDn .................................................................134
4.1.4.2.22 UserNameFromUPN ........................................................................134
4.1.4.2.23 TranslateFPOToName ......................................................................134
4.1.4.2.24 ConstructOutput .............................................................................135
4.1.4.2.25 IsDomainOnly ................................................................................135
4.1.4.3 Server Behavior of the IDL_DRSCrackNames Method ...............................136
4.1.4.4 Examples of the IDL_DRSCrackNames Method .........................................137
4.1.4.4.1 Initial State ...................................................................................137
4.1.4.4.2 Client Request................................................................................137
4.1.4.4.3 Server Response ............................................................................138
4.1.4.4.4 Final State .....................................................................................138
4.1.5 IDL_DRSDomainControllerInfo (Opnum 16) ..................................................138
4.1.5.1 Method-Specific Concrete Types.............................................................139
4.1.5.1.1 DRS_MSG_DCINFOREQ ...................................................................139
4.1.5.1.2 DRS_MSG_DCINFOREQ_V1 .............................................................139
4.1.5.1.3 DRS_MSG_DCINFOREPLY ................................................................139
4.1.5.1.4 DRS_MSG_DCINFOREPLY_V1 ...........................................................140
4.1.5.1.5 DRS_MSG_DCINFOREPLY_V2 ...........................................................140
4.1.5.1.6 DRS_MSG_DCINFOREPLY_V3 ...........................................................140
4.1.5.1.7 DRS_MSG_DCINFOREPLY_VFFFFFFFF ................................................140
4.1.5.1.8 DS_DOMAIN_CONTROLLER_INFO_1W ..............................................141
4.1.5.1.9 DS_DOMAIN_CONTROLLER_INFO_2W ..............................................141
4.1.5.1.10 DS_DOMAIN_CONTROLLER_INFO_3W ..............................................142
4.1.5.1.11 DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW ...................................143
4.1.5.2 Server Behavior of the IDL_DRSDomainControllerInfo Method ...................143
4.1.5.3 Examples of the IDL_DRSDomainControllerInfo Method ............................148
4.1.5.3.1 Initial State ...................................................................................148
4.1.5.3.2 Client Request................................................................................151
4.1.5.3.3 Server Response ............................................................................151
4.1.5.3.4 Final State .....................................................................................152
4.1.6 IDL_DRSExecuteKCC (Opnum 18) ...............................................................152
4.1.6.1 Method-Specific Concrete Types.............................................................153
4.1.6.1.1 DRS_MSG_KCC_EXECUTE ...............................................................153
4.1.6.1.2 DRS_MSG_KCC_EXECUTE_V1 ..........................................................153
4.1.6.2 Method-Specific Abstract Types and Procedures .......................................153
4.1.6.2.1 ExecuteKCCTasks ...........................................................................153
4.1.6.3 Server Behavior of the IDL_DRSExecuteKCC Method ................................154
4.1.7 IDL_DRSFinishDemotion (Opnum 27) ...........................................................154
4.1.7.1 Method-Specific Concrete Types.............................................................155
4.1.7.1.1 DRS_MSG_FINISH_DEMOTIONREQ ...................................................155
4.1.7.1.2 DRS_MSG_FINISH_DEMOTIONREQ_V1 .............................................155
4.1.7.1.3 DRS_MSG_FINISH_DEMOTIONREPLY ................................................156
4.1.7.1.4 DRS_MSG_FINISH_DEMOTIONREPLY_V1 ..........................................156
4.1.7.2 Method-Specific Abstract Types and Procedures .......................................157
4.1.7.2.1 RemoveADLDSServer ......................................................................157
4.1.7.2.2 RemoveADLDSSCP .........................................................................157
4.1.7.2.3 RemoveADLDSSPNs ........................................................................157
4.1.7.3 Server Behavior of the IDL_DRSFinishDemotion Method ...........................158
4.1.8 IDL_DRSGetMemberships (Opnum 9) ...........................................................160
4.1.8.1 Method-Specific Concrete Types.............................................................160
4.1.8.1.1 DRS_MSG_REVMEMB_REQ ..............................................................160
4.1.8.1.2 DRS_MSG_REVMEMB_REQ_V1 .........................................................160
7 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.8.1.3 REVERSE_MEMBERSHIP_OPERATION_TYPE .......................................161
4.1.8.1.4 DRS_MSG_REVMEMB_REPLY............................................................162
4.1.8.1.5 DRS_MSG_REVMEMB_REPLY_V1 ......................................................162
4.1.8.1.6 SE_GROUP Values ..........................................................................162
4.1.8.2 Method-Specific Abstract Types and Procedures .......................................163
4.1.8.2.1 Arc and ArcSet ...............................................................................163
4.1.8.2.2 Closure .........................................................................................163
4.1.8.2.3 DomainOf ......................................................................................163
4.1.8.2.4 GetDSNameOfEnterpriseRODCsGroup ...............................................163
4.1.8.2.5 GetDSNameFromPrimaryGroupId .....................................................163
4.1.8.2.6 IsMatchedGroup .............................................................................163
4.1.8.2.7 Neighbors ......................................................................................164
4.1.8.3 Server Behavior of the IDL_DRSGetMemberships Method ..........................164
4.1.9 IDL_DRSGetMemberships2 (Opnum 21) .......................................................167
4.1.9.1 Method-Specific Concrete Types.............................................................167
4.1.9.1.1 DRS_MSG_GETMEMBERSHIPS2_REQ ................................................167
4.1.9.1.2 DRS_MSG_GETMEMBERSHIPS2_REQ_V1 ...........................................168
4.1.9.1.3 DRS_MSG_GETMEMBERSHIPS2_REPLY .............................................168
4.1.9.1.4 DRS_MSG_GETMEMBERSHIPS2_REPLY_V1 ........................................168
4.1.9.2 Server Behavior of the IDL_DRSGetMemberships2 Method ........................168
4.1.10 IDL_DRSGetNCChanges (Opnum 3) .............................................................169
4.1.10.1 Overview ............................................................................................170
4.1.10.1.1 Cycle Start and Finish .....................................................................170
4.1.10.1.2 Cycle Goal .....................................................................................170
4.1.10.1.3 Extended Operations.......................................................................171
4.1.10.2 Method-Specific Concrete Types.............................................................171
4.1.10.2.1 DRS_MSG_GETCHGREQ ..................................................................171
4.1.10.2.2 DRS_MSG_GETCHGREQ_V3 .............................................................172
4.1.10.2.3 DRS_MSG_GETCHGREQ_V4 .............................................................173
4.1.10.2.4 DRS_MSG_GETCHGREQ_V5 .............................................................173
4.1.10.2.5 DRS_MSG_GETCHGREQ_V7 .............................................................174
4.1.10.2.6 DRS_MSG_GETCHGREQ_V8 .............................................................174
4.1.10.2.7 DRS_MSG_GETCHGREQ_V10 ...........................................................175
4.1.10.2.8 DRS_MSG_GETCHGREQ_V11 ...........................................................176
4.1.10.2.9 DRS_MSG_GETCHGREPLY ...............................................................177
4.1.10.2.10 DRS_MSG_GETCHGREPLY_V1 ..........................................................177
4.1.10.2.11 DRS_MSG_GETCHGREPLY_V2 ..........................................................178
4.1.10.2.12 DRS_MSG_GETCHGREPLY_V6 ..........................................................178
4.1.10.2.13 DRS_MSG_GETCHGREPLY_V7 ..........................................................179
4.1.10.2.14 DRS_MSG_GETCHGREPLY_V9 ..........................................................179
4.1.10.2.15 DRS_MSG_GETCHGREPLY_NATIVE ...................................................180
4.1.10.2.16 DRS_MSG_GETCHGREPLY_NATIVE_VERSION_NUMBER .......................181
4.1.10.2.17 COMPRESSED_DATA .......................................................................181
4.1.10.2.18 DRS_COMP_ALG_TYPE ....................................................................181
4.1.10.2.19 DRS_COMPRESSED_BLOB ...............................................................181
4.1.10.2.20 ENCRYPTED_PAYLOAD ....................................................................182
4.1.10.2.21 EXOP_ERR Codes ...........................................................................182
4.1.10.2.22 EXOP_REQ Codes ...........................................................................183
4.1.10.2.23 PROPERTY_META_DATA ..................................................................183
4.1.10.3 Method-Specific Abstract Types and Procedures .......................................183
4.1.10.3.1 AbstractLinkValStampFromConcreteLinkValStamp ..............................183
4.1.10.3.2 AbstractPASFromConcretePAS ..........................................................184
4.1.10.3.3 AbstractUTDFromConcreteUTD .........................................................184
4.1.10.3.4 AttributeAndStamp .........................................................................184
4.1.10.3.5 AttributeStampCompare ..................................................................185
4.1.10.3.6 ConcretePASFromAbstractPAS ..........................................................185
4.1.10.3.7 ConcreteUTDFromAbstractUTD .........................................................185
4.1.10.3.8 GetNCChangesNativeReply ..............................................................186
8 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.10.3.9 GetStampsForUpdate ......................................................................186
4.1.10.3.10 GetWellKnownObject ......................................................................187
4.1.10.3.11 IsSecretAttribute ............................................................................187
4.1.10.3.12 IsUserIncluded ...............................................................................187
4.1.10.3.13 ObjAtts .........................................................................................187
4.1.10.3.14 ObjAttVal ......................................................................................188
4.1.10.3.15 PerformModifyDNOperation ..............................................................188
4.1.10.3.16 RemoveAttrVal ...............................................................................188
4.1.10.3.17 SetAttrStamp .................................................................................188
4.1.10.3.18 SetAttrVal .....................................................................................188
4.1.10.3.19 SetLinkStamp ................................................................................188
4.1.10.4 Client Behavior When Sending the IDL_DRSGetNCChanges Request ...........189
4.1.10.4.1 ReplicateNCRequestMsg ..................................................................189
4.1.10.4.2 ReplSingleObjRequestMsg ...............................................................192
4.1.10.4.3 PerformExtendedOpRequestMsg .......................................................194
4.1.10.5 Server Behavior of the IDL_DRSGetNCChanges Method ............................196
4.1.10.5.1 TransformInput ..............................................................................198
4.1.10.5.2 GetReplChanges .............................................................................200
4.1.10.5.3 GetReplScope ................................................................................203
4.1.10.5.4 ObjectMatchesSearchFilter...............................................................204
4.1.10.5.5 GetChangesInScope........................................................................204
4.1.10.5.6 FilterAttribute ................................................................................205
4.1.10.5.7 GetResponseSubset ........................................................................207
4.1.10.5.8 AddObjToResponse .........................................................................207
4.1.10.5.9 UpdateRevealedList ........................................................................209
4.1.10.5.10 AddLinkToResponse ........................................................................210
4.1.10.5.11 EncryptValuesIfNecessary................................................................211
4.1.10.5.12 ProcessFsmoRoleRequest ................................................................212
4.1.10.5.13 RevealSecretsPolicy ........................................................................215
4.1.10.5.14 GetRevealSecretsPolicyForUser ........................................................215
4.1.10.5.15 RevealSecretsForUserAllowed ..........................................................216
4.1.10.5.16 GetRoleScope ................................................................................217
4.1.10.5.17 SortResponseLinks .........................................................................218
4.1.10.5.18 ReplValInfV1ListFromReplValInfNativeList ..........................................219
4.1.10.5.19 ReplValInfNativeListFromReplValInfV1List ..........................................219
4.1.10.5.20 TransformOutput ............................................................................219
4.1.10.5.21 CompressOrDecompressWin2k3 .......................................................221
4.1.10.5.21.1 LZ77 Compression Algorithm ......................................................221
4.1.10.5.21.2 DIRECT2 Encoding Algorithm ......................................................223
4.1.10.5.22 GetOptionalFeatureBit .....................................................................226
4.1.10.6 Client Behavior When Receiving the IDL_DRSGetNCChanges Response .......227
4.1.10.6.1 ProcessGetNCChangesReply .............................................................227
4.1.10.6.2 EnableRecycleBin ...........................................................................229
4.1.10.6.3 EnablePrivilegedAccessManagement .................................................230
4.1.10.6.4 PrepareCrossNCMove ......................................................................230
4.1.10.6.5 AdjustInstanceTypeAttrVal...............................................................232
4.1.10.6.6 SetResetInstanceTypeBits ...............................................................233
4.1.10.6.7 PerformModifyOperation ..................................................................233
4.1.10.6.8 NameObject...................................................................................234
4.1.10.6.9 AddObject .....................................................................................235
4.1.10.6.10 UpdateObject .................................................................................236
4.1.10.6.11 FindBestParentObject ......................................................................238
4.1.10.6.12 ResolveNameConflict ......................................................................239
4.1.10.6.13 MakeConflictDN ..............................................................................240
4.1.10.6.14 ProcessLinkValue ............................................................................241
4.1.10.6.15 UpdateRepsFrom ............................................................................243
4.1.10.6.16 UpdateUTDandPAS .........................................................................243
4.1.10.6.17 DecryptValuesIfNecessary ...............................................................244
9 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.10.6.18 DecompressReplyMessage ...............................................................246
4.1.10.6.19 DecompressMessage .......................................................................247
4.1.10.7 Examples of the IDL_DRSGetNCChanges Method - Add User .....................248
4.1.10.7.1 Initial State ...................................................................................248
4.1.10.7.2 Client Request................................................................................250
4.1.10.7.3 Server Response ............................................................................251
4.1.10.7.4 Final State .....................................................................................252
4.1.10.8 Examples of the IDL_DRSGetNCChanges Method - Add User to a Group .....254
4.1.10.8.1 Initial State ...................................................................................254
4.1.10.8.2 Client Request................................................................................256
4.1.10.8.3 Server Response ............................................................................256
4.1.10.8.4 Final State .....................................................................................257
4.1.10.9 Examples of the IDL_DRSGetNCChanges Method - Change User Password ..258
4.1.10.9.1 Initial State ...................................................................................258
4.1.10.9.2 Client Request................................................................................261
4.1.10.9.3 Server Response ............................................................................262
4.1.10.9.4 Final State .....................................................................................263
4.1.11 IDL_DRSGetNT4ChangeLog (Opnum 11) ......................................................264
4.1.11.1 Method-Specific Concrete Types.............................................................265
4.1.11.1.1 DRS_MSG_NT4_CHGLOG_REQ .........................................................265
4.1.11.1.2 DRS_MSG_NT4_CHGLOG_REQ_V1 ...................................................265
4.1.11.1.3 DRS_MSG_NT4_CHGLOG_REPLY ......................................................266
4.1.11.1.4 DRS_MSG_NT4_CHGLOG_REPLY_V1 .................................................266
4.1.11.1.5 NT4_REPLICATION_STATE ...............................................................266
4.1.11.2 Method-Specific Abstract Types and Procedures .......................................267
4.1.11.2.1 IsPDC ...........................................................................................267
4.1.11.2.2 GetWindowsErrorCode ....................................................................267
4.1.11.3 Server Behavior of the IDL_DRSGetNT4ChangeLog Method .......................267
4.1.11.4 Examples of the IDL_DRSGetNT4ChangeLog Method ................................270
4.1.11.4.1 Initial State ...................................................................................270
4.1.11.4.2 Client Request................................................................................270
4.1.11.4.3 Server Response ............................................................................271
4.1.11.4.4 Final State .....................................................................................271
4.1.12 IDL_DRSGetObjectExistence (Opnum 23) .....................................................271
4.1.12.1 Method-Specific Concrete Types.............................................................272
4.1.12.1.1 DRS_MSG_EXISTREQ......................................................................272
4.1.12.1.2 DRS_MSG_EXISTREQ_V1 ................................................................272
4.1.12.1.3 DRS_MSG_EXISTREPLY ...................................................................272
4.1.12.1.4 DRS_MSG_EXISTREPLY_V1 .............................................................273
4.1.12.2 Method-Specific Abstract Types and Procedures .......................................273
4.1.12.2.1 GuidSequence ................................................................................273
4.1.12.3 Client Behavior When Sending the IDL_DRSGetObjectExistence Request ....274
4.1.12.4 Server Behavior of the IDL_DRSGetObjectExistence Method ......................275
4.1.12.5 Client Behavior When Receiving the IDL_DRSGetObjectExistence Response 276
4.1.13 IDL_DRSGetReplInfo (Opnum 19) ................................................................276
4.1.13.1 Method-Specific Concrete Types.............................................................276
4.1.13.1.1 DRS_MSG_GETREPLINFO_REQ .........................................................276
4.1.13.1.2 DRS_MSG_GETREPLINFO_REQ_V1 ...................................................277
4.1.13.1.3 DRS_MSG_GETREPLINFO_REQ_V2 ...................................................277
4.1.13.1.4 DS_REPL_INFO Codes .....................................................................278
4.1.13.1.5 DRS_MSG_GETREPLINFO_REPLY ......................................................279
4.1.13.1.6 DS_REPL_NEIGHBORSW .................................................................280
4.1.13.1.7 DS_REPL_NEIGHBORW ...................................................................280
4.1.13.1.8 DS_REPL_CURSORS .......................................................................281
4.1.13.1.9 DS_REPL_CURSOR .........................................................................281
4.1.13.1.10 DS_REPL_CURSORS_2 ....................................................................282
4.1.13.1.11 DS_REPL_CURSOR_2 ......................................................................282
4.1.13.1.12 DS_REPL_CURSORS_3W .................................................................282
10 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.13.1.13 DS_REPL_CURSOR_3W ...................................................................283
4.1.13.1.14 DS_REPL_OBJ_META_DATA .............................................................283
4.1.13.1.15 DS_REPL_ATTR_META_DATA ...........................................................283
4.1.13.1.16 DS_REPL_OBJ_META_DATA_2 .........................................................284
4.1.13.1.17 DS_REPL_ATTR_META_DATA_2 ........................................................284
4.1.13.1.18 DS_REPL_KCC_DSA_FAILURESW .....................................................285
4.1.13.1.19 DS_REPL_KCC_DSA_FAILUREW .......................................................285
4.1.13.1.20 DS_REPL_PENDING_OPSW ..............................................................286
4.1.13.1.21 DS_REPL_OPW ...............................................................................286
4.1.13.1.22 DS_REPL_ATTR_VALUE_META_DATA ................................................286
4.1.13.1.23 DS_REPL_VALUE_META_DATA .........................................................287
4.1.13.1.24 DS_REPL_ATTR_VALUE_META_DATA_2 .............................................288
4.1.13.1.25 DS_REPL_VALUE_META_DATA_2 ......................................................288
4.1.13.1.26 DS_REPL_CLIENT_CONTEXTS ..........................................................289
4.1.13.1.27 DS_REPL_CLIENT_CONTEXT ............................................................289
4.1.13.1.28 DS_REPL_SERVER_OUTGOING_CALLS ..............................................289
4.1.13.1.29 DS_REPL_SERVER_OUTGOING_CALL ................................................290
4.1.13.2 Method-Specific Abstract Types and Procedures .......................................291
4.1.13.2.1 GetDNFromInvocationID .................................................................291
4.1.13.2.2 GetDNFromObjectGuid ....................................................................291
4.1.13.2.3 GetNCs .........................................................................................291
4.1.13.2.4 GetUpToDatenessVector ..................................................................291
4.1.13.3 Server Behavior of the IDL_DRSGetReplInfo Method ................................292
4.1.13.4 Examples of the IDL_DRSGetReplInfo Method .........................................303
4.1.13.4.1 Calling IDL_DRSGetReplInfo with infoType DS_REPL_INFO_NEIGHBORS to
find replication neighbors for a specified NC .......................................303
4.1.13.4.1.1 Initial State ..............................................................................303
4.1.13.4.1.2 Client Request ..........................................................................303
4.1.13.4.1.3 Server Response .......................................................................304
4.1.13.4.1.4 Final State ...............................................................................305
4.1.13.4.2 Calling IDL_DRSGetReplInfo with infoType DS_REPL_INFO_NEIGHBORS to
find the naming contexts for which a DC receives updates from a replication
neighbor .......................................................................................305
4.1.13.4.2.1 Initial State ..............................................................................305
4.1.13.4.2.2 Client Request ..........................................................................306
4.1.13.4.2.3 Server Response .......................................................................307
4.1.13.4.2.4 Final State ...............................................................................309
4.1.13.4.3 Calling IDL_DRSGetReplInfo with infoType DS_REPL_INFO_REPSTO to find
replication neighbors for a specified NC .............................................309
4.1.13.4.3.1 Initial State ..............................................................................309
4.1.13.4.3.2 Client Request ..........................................................................309
4.1.13.4.3.3 Server Response .......................................................................310
4.1.13.4.3.4 Final State ...............................................................................310
4.1.13.4.4 Calling IDL_DRSGetReplInfo with infoType
DS_REPL_INFO_CURSORS_3_FOR_NC ..............................................310
4.1.13.4.4.1 Initial State ..............................................................................311
4.1.13.4.4.2 Client Request ..........................................................................311
4.1.13.4.4.3 Server Response .......................................................................311
4.1.13.4.4.4 Final State ...............................................................................312
4.1.13.4.5 Calling IDL_DRSGetReplInfo with infoType
DS_REPL_INFO_METADATA_2_FOR_OBJ ...........................................312
4.1.13.4.5.1 Initial State ..............................................................................312
4.1.13.4.5.2 Client Request ..........................................................................313
4.1.13.4.5.3 Server Response .......................................................................313
4.1.13.4.5.4 Final State ...............................................................................316
4.1.13.4.6 Calling IDL_DRSGetReplInfo with infoType
DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE to view the replication
metadata for all values of a link value attribute ..................................316
11 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.13.4.6.1 Initial State ..............................................................................316
4.1.13.4.6.2 Client Request ..........................................................................316
4.1.13.4.6.3 Server Response .......................................................................316
4.1.13.4.6.4 Final State ...............................................................................318
4.1.13.4.7 Calling IDL_DRSGetReplInfo with infoType
DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE to view the replication
metadata for a specific value of a link value attribute..........................318
4.1.13.4.7.1 Initial State ..............................................................................318
4.1.13.4.7.2 Client Request ..........................................................................319
4.1.13.4.7.3 Server Response .......................................................................319
4.1.13.4.7.4 Final State ...............................................................................320
4.1.13.4.8 Calling IDL_DRSGetReplInfo with infoType
DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES ................................320
4.1.13.4.8.1 Initial State ..............................................................................320
4.1.13.4.8.2 Client Request ..........................................................................320
4.1.13.4.8.3 Server Response .......................................................................320
4.1.13.4.8.4 Final State ...............................................................................321
4.1.13.4.9 Calling IDL_DRSGetReplInfo with infoType DS_REPL_INFO_PENDING_OPS
....................................................................................................321
4.1.13.4.9.1 Initial State ..............................................................................321
4.1.13.4.9.2 Client Request ..........................................................................321
4.1.13.4.9.3 Server Response .......................................................................322
4.1.13.4.9.4 Final State ...............................................................................322
4.1.14 IDL_DRSInitDemotion (Opnum 25) ..............................................................322
4.1.14.1 Method-Specific Concrete Types.............................................................323
4.1.14.1.1 DRS_MSG_INIT_DEMOTIONREQ ......................................................323
4.1.14.1.2 DRS_MSG_INIT_DEMOTIONREQ_V1 .................................................323
4.1.14.1.3 DRS_MSG_INIT_DEMOTIONREPLY ....................................................323
4.1.14.1.4 DRS_MSG_INIT_DEMOTIONREPLY_V1 ..............................................324
4.1.14.2 Server Behavior of the IDL_DRSInitDemotion Method ...............................324
4.1.15 IDL_DRSInterDomainMove (Opnum 10) .......................................................324
4.1.15.1 Method-Specific Concrete Types.............................................................325
4.1.15.1.1 DRS_MSG_MOVEREQ ......................................................................325
4.1.15.1.2 DRS_MSG_MOVEREQ_V1 ................................................................325
4.1.15.1.3 DRS_MSG_MOVEREQ_V2 ................................................................326
4.1.15.1.4 DRS_MSG_MOVEREPLY ...................................................................326
4.1.15.1.5 DRS_MSG_MOVEREPLY_V1 ..............................................................326
4.1.15.1.6 DRS_MSG_MOVEREPLY_V2 ..............................................................327
4.1.15.2 Method-Specific Abstract Types and Procedures .......................................327
4.1.15.2.1 AttrIsBacklink ................................................................................327
4.1.15.2.2 AttrIsConstructed ...........................................................................327
4.1.15.2.3 AttrIsNonReplicated ........................................................................327
4.1.15.2.4 AuthorizationInfoFromClientCredentials .............................................328
4.1.15.2.5 ImpersonateAuthorizationInfo ..........................................................328
4.1.15.2.6 IsApplicationNC ..............................................................................328
4.1.15.2.7 RevertToSelf ..................................................................................328
4.1.15.3 Server Behavior of the IDL_DRSInterDomainMove Method ........................328
4.1.15.4 Examples of the IDL_DRSInterDomainMove Method .................................331
4.1.15.4.1 Initial State ...................................................................................331
4.1.15.4.2 Client Request................................................................................333
4.1.15.4.3 Server Response ............................................................................334
4.1.15.4.4 Final State .....................................................................................334
4.1.16 IDL_DRSQuerySitesByCost (Opnum 24) .......................................................336
4.1.16.1 Method-Specific Concrete Types.............................................................336
4.1.16.1.1 DRS_MSG_QUERYSITESREQ ............................................................336
4.1.16.1.2 DRS_MSG_QUERYSITESREQ_V1 ......................................................336
4.1.16.1.3 DRS_MSG_QUERYSITESREPLY .........................................................337
4.1.16.1.4 DRS_MSG_QUERYSITESREPLY_V1 ....................................................337
12 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.16.1.5 DRS_MSG_QUERYSITESREPLYELEMENT_V1 .......................................337
4.1.16.2 Method-Specific Abstract Types and Procedures .......................................338
4.1.16.2.1 ValidateSiteRDN .............................................................................338
4.1.16.2.2 WeightedArc and WeightedArcSet .....................................................338
4.1.16.2.3 MinWeightPath ...............................................................................338
4.1.16.3 Server Behavior of the IDL_DRSQuerySitesByCost Method ........................339
4.1.16.4 Examples of IDL_DRSQuerySitesByCost Method ......................................341
4.1.16.4.1 Nontransitive Communication Using siteLinkBridge .............................341
4.1.16.4.1.1 Initial State ..............................................................................342
4.1.16.4.1.2 Client Request ..........................................................................348
4.1.16.4.1.3 Server Response .......................................................................348
4.1.16.4.1.4 Final State ...............................................................................349
4.1.16.4.2 Transitive Communication ...............................................................349
4.1.16.4.2.1 Initial State ..............................................................................350
4.1.16.4.2.2 Client Request ..........................................................................354
4.1.16.4.2.3 Server Response .......................................................................355
4.1.16.4.2.4 Final State ...............................................................................355
4.1.17 IDL_DRSRemoveDsDomain (Opnum 15) .......................................................355
4.1.17.1 Method-Specific Concrete Types.............................................................356
4.1.17.1.1 DRS_MSG_RMDMNREQ ...................................................................356
4.1.17.1.2 DRS_MSG_RMDMNREQ_V1 ..............................................................356
4.1.17.1.3 DRS_MSG_RMDMNREPLY ................................................................356
4.1.17.1.4 DRS_MSG_RMDMNREPLY_V1 ...........................................................357
4.1.17.2 Method-Specific Abstract Types and Procedures .......................................357
4.1.17.2.1 HasNCReplicated ............................................................................357
4.1.17.3 Server Behavior of the IDL_DRSRemoveDsDomain Method .......................357
4.1.18 IDL_DRSRemoveDsServer (Opnum 14) ........................................................358
4.1.18.1 Method-Specific Concrete Types.............................................................359
4.1.18.1.1 DRS_MSG_RMSVRREQ ....................................................................359
4.1.18.1.2 DRS_MSG_RMSVRREQ_V1...............................................................359
4.1.18.1.3 DRS_MSG_RMSVRREPLY .................................................................360
4.1.18.1.4 DRS_MSG_RMSVRREPLY_V1 ............................................................360
4.1.18.2 Server Behavior of the IDL_DRSRemoveDsServer Method .........................360
4.1.19 IDL_DRSReplicaAdd (Opnum 5) ...................................................................363
4.1.19.1 Method-Specific Concrete Types.............................................................363
4.1.19.1.1 DRS_MSG_REPADD ........................................................................363
4.1.19.1.2 DRS_MSG_REPADD_V1 ...................................................................364
4.1.19.1.3 DRS_MSG_REPADD_V2 ...................................................................364
4.1.19.1.4 DRS_MSG_REPADD_V3 ...................................................................364
4.1.19.2 Server Behavior of the IDL_DRSReplicaAdd Method ..................................365
4.1.20 IDL_DRSReplicaDel (Opnum 6) ...................................................................368
4.1.20.1 Method-Specific Concrete Types.............................................................369
4.1.20.1.1 DRS_MSG_REPDEL .........................................................................369
4.1.20.1.2 DRS_MSG_REPDEL_V1 ....................................................................369
4.1.20.2 Server Behavior of the IDL_DRSReplicaDel Method ..................................369
4.1.21 IDL_DRSReplicaDemotion (Opnum 26) .........................................................372
4.1.21.1 Method-Specific Concrete Types.............................................................373
4.1.21.1.1 DRS_MSG_REPLICA_DEMOTIONREQ .................................................373
4.1.21.1.2 DRS_MSG_REPLICA_DEMOTIONREQ_V1 ...........................................373
4.1.21.1.3 DRS_MSG_REPLICA_DEMOTIONREPLY ..............................................373
4.1.21.1.4 DRS_MSG_REPLICA_DEMOTIONREPLY_V1.........................................374
4.1.21.2 Method-Specific Abstract Types and Procedures .......................................374
4.1.21.2.1 ReplicationPartners() ......................................................................374
4.1.21.2.2 AbandonAllFSMORoles() ..................................................................374
4.1.21.2.3 ReplicateOffChanges() ....................................................................375
4.1.21.3 Server Behavior of the IDL_DRSReplicaDemotion Method .........................376
4.1.22 IDL_DRSReplicaModify (Opnum 7) ...............................................................377
4.1.22.1 Method-Specific Concrete Types.............................................................377
13 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.22.1.1 DRS_MSG_REPMOD ........................................................................377
4.1.22.1.2 DRS_MSG_REPMOD_V1 ..................................................................377
4.1.22.2 Server Behavior of the IDL_DRSReplicaModify Method ..............................378
4.1.23 IDL_DRSReplicaSync (Opnum 2) .................................................................380
4.1.23.1 Method-Specific Concrete Types.............................................................380
4.1.23.1.1 DRS_MSG_REPSYNC .......................................................................380
4.1.23.1.2 DRS_MSG_REPSYNC_V1 .................................................................380
4.1.23.1.3 DRS_MSG_REPSYNC_V2 .................................................................381
4.1.23.2 Server Behavior of the IDL_DRSReplicaSync Method ................................381
4.1.24 IDL_DRSReplicaVerifyObjects (Opnum 22) ....................................................383
4.1.24.1 Method-Specific Concrete Types.............................................................383
4.1.24.1.1 DRS_MSG_REPVERIFYOBJ ...............................................................383
4.1.24.1.2 DRS_MSG_REPVERIFYOBJ_V1 ..........................................................384
4.1.24.2 Method-Specific Abstract Types and Procedures .......................................384
4.1.24.2.1 GetRemoteUTD ..............................................................................384
4.1.24.2.2 ObjectExistsAtDC ...........................................................................384
4.1.24.3 Server Behavior of the IDL_DRSReplicaVerifyObjects Method ....................385
4.1.24.4 Examples of the IDL_DRSReplicaVerifyObjects Method .............................386
4.1.24.4.1 Initial State ...................................................................................386
4.1.24.4.2 Client Request................................................................................389
4.1.24.4.3 Server Response ............................................................................389
4.1.24.4.4 Final State .....................................................................................389
4.1.25 IDL_DRSUnbind (Opnum 1) ........................................................................390
4.1.25.1 Server Behavior of the IDL_DRSUnbind Method .......................................391
4.1.26 IDL_DRSUpdateRefs (Opnum 4) ..................................................................391
4.1.26.1 Method-Specific Concrete Types.............................................................391
4.1.26.1.1 DRS_MSG_UPDREFS .......................................................................391
4.1.26.1.2 DRS_MSG_UPDREFS_V1 .................................................................392
4.1.26.1.3 DRS_MSG_UPDREFS_V2 .................................................................392
4.1.26.2 Server Behavior of the IDL_DRSUpdateRefs Method .................................392
4.1.26.3 Examples of the IDL_DRSUpdateRefs Method ..........................................393
4.1.26.3.1 Adding a repsTo Entry .....................................................................393
4.1.26.3.1.1 Initial State ..............................................................................394
4.1.26.3.1.2 Client Request ..........................................................................394
4.1.26.3.1.3 Server Response .......................................................................394
4.1.26.3.1.4 Final State ...............................................................................394
4.1.26.3.2 Replacing a repsTo Entry .................................................................395
4.1.26.3.2.1 Initial State ..............................................................................395
4.1.26.3.2.2 Client Request ..........................................................................396
4.1.26.3.2.3 Server Response .......................................................................396
4.1.26.3.2.4 Final State ...............................................................................396
4.1.27 IDL_DRSVerifyNames (Opnum 8) ................................................................397
4.1.27.1 Method-Specific Concrete Types.............................................................397
4.1.27.1.1 DRS_MSG_VERIFYREQ ....................................................................397
4.1.27.1.2 DRS_MSG_VERIFYREQ_V1 ..............................................................397
4.1.27.1.3 DRS_MSG_VERIFYREPLY .................................................................398
4.1.27.1.4 DRS_MSG_VERIFYREPLY_V1 ............................................................398
4.1.27.2 Server Behavior of the IDL_DRSVerifyNames Method ...............................399
4.1.27.3 Examples of the IDL_DRSVerifyNames Method ........................................402
4.1.27.3.1 Initial State ...................................................................................402
4.1.27.3.2 Client Request................................................................................402
4.1.27.3.3 Server Response ............................................................................402
4.1.27.3.4 Final State .....................................................................................403
4.1.28 IDL_DRSWriteSPN (Opnum 13) ...................................................................403
4.1.28.1 Method-Specific Concrete Types.............................................................403
4.1.28.1.1 DRS_MSG_SPNREQ ........................................................................403
4.1.28.1.2 DRS_MSG_SPNREQ_V1 ...................................................................404
4.1.28.1.3 DRS_MSG_SPNREPLY ......................................................................404
14 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.28.1.4 DRS_MSG_SPNREPLY_V1 ................................................................404
4.1.28.1.5 DS_SPN_OPERATION ......................................................................405
4.1.28.2 Method-Specific Abstract Types and Procedures .......................................405
4.1.28.2.1 ExecuteWriteSPNRemotely...............................................................405
4.1.28.3 Server Behavior of the IDL_DRSWriteSPN Method ....................................405
4.1.29 IDL_DRSAddCloneDC (Opnum 28) ...............................................................407
4.1.29.1 Method-Specific Concrete Types.............................................................408
4.1.29.1.1 DRS_MSG_ADDCLONEDCREQ ..........................................................408
4.1.29.1.2 DRS_MSG_ADDCLONEDCREQ_V1 .....................................................408
4.1.29.1.3 DRS_MSG_ADDCLONEDCREPLY .......................................................408
4.1.29.1.4 DRS_MSG_ADDCLONEDCREPLY_V1 ..................................................409
4.1.29.2 Method-Specific Abstract Types and Procedures .......................................409
4.1.29.2.1 GetKeyLength ................................................................................409
4.1.29.2.2 DNMap ..........................................................................................409
4.1.29.2.3 DCInfo ..........................................................................................409
4.1.29.2.4 TranslationInfo ...............................................................................409
4.1.29.2.5 ReplaceName .................................................................................410
4.1.29.2.6 ReplaceSIDInSecurityDescriptor .......................................................410
4.1.29.2.7 GetPrincipalSid ...............................................................................410
4.1.29.2.8 GenerateNewKrbTgtAcct ..................................................................410
4.1.29.2.9 DuplicateObject ..............................................................................411
4.1.29.3 Server Behavior of the IDL_DRSAddCloneDC Method ................................412
4.1.29.4 Examples of the IDL_DRSAddCloneDC Method .........................................416
4.1.29.4.1 Initial State ...................................................................................416
4.1.29.4.2 Client Request................................................................................420
4.1.29.4.3 Server Response ............................................................................420
4.1.29.4.4 Final State .....................................................................................420
4.1.30 IDL_DRSWriteNgcKey (Opnum 29) ..............................................................423
4.1.30.1 Method-Specific Concrete Types.............................................................424
4.1.30.1.1 DRS_MSG_WRITENGCKEYREQ .........................................................424
4.1.30.1.2 DRS_MSG_WRITENGCKEYREQ_V1 ....................................................424
4.1.30.1.3 DRS_MSG_WRITENGCKEYREPLY ......................................................424
4.1.30.1.4 DRS_MSG_WRITENGCKEYREPLY_V1 .................................................424
4.1.30.2 Method-Specific Abstract Types and Procedures .......................................425
4.1.30.2.1 AccessCheckWriteToKeyCredentialLinkAttribute ..................................425
4.1.30.2.2 ComposeKeyCredentialLinkForComputer............................................425
4.1.30.3 Server Behavior of the IDL_DRSWriteNgcKey Method ...............................427
4.1.31 IDL_DRSReadNgcKey (Opnum 30) ...............................................................428
4.1.31.1 Method-Specific Concrete Types.............................................................429
4.1.31.1.1 DRS_MSG_READNGCKEYREQ ...........................................................429
4.1.31.1.2 DRS_MSG_READNGCKEYREQ_V1 .....................................................429
4.1.31.1.3 DRS_MSG_READNGCKEYREPLY ........................................................429
4.1.31.1.4 DRS_MSG_READNGCKEYREPLY_V1...................................................429
4.1.31.2 Server Behavior of the IDL_DRSReadNgcKey Method ...............................430
4.2 dsaop RPC Interface ........................................................................................431
4.2.1 IDL_DSAPrepareScript (Opnum 0) ...............................................................432
4.2.1.1 Method-Specific Concrete Types.............................................................432
4.2.1.1.1 DSA_MSG_PREPARE_SCRIPT_REQ....................................................432
4.2.1.1.2 DSA_MSG_PREPARE_SCRIPT_REQ_V1 ..............................................432
4.2.1.1.3 DSA_MSG_PREPARE_SCRIPT_REPLY .................................................433
4.2.1.1.4 DSA_MSG_PREPARE_SCRIPT_REPLY_V1 ...........................................433
4.2.1.2 Method-Specific Abstract Types and Procedures .......................................433
4.2.1.2.1 GetKeyLengthHandleT .....................................................................433
4.2.1.2.2 PrepareScriptInProgress ..................................................................433
4.2.1.2.3 PrepareScriptVerifyScript .................................................................434
4.2.1.2.4 PrepareScriptHashBody ...................................................................434
4.2.1.2.5 PrepareScriptHashSignature ............................................................434
4.2.1.2.6 PrepareScriptGeneratePassword .......................................................434
15 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.2.1.3 Server Behavior of the IDL_DSAPrepareScript Method ..............................434
4.2.2 IDL_DSAExecuteScript (Opnum 1) ...............................................................436
4.2.2.1 Method-Specific Concrete Types.............................................................436
4.2.2.1.1 DSA_MSG_EXECUTE_SCRIPT_REQ ...................................................436
4.2.2.1.2 DSA_MSG_EXECUTE_SCRIPT_REQ_V1 ..............................................437
4.2.2.1.3 DSA_MSG_EXECUTE_SCRIPT_REPLY.................................................437
4.2.2.1.4 DSA_MSG_EXECUTE_SCRIPT_REPLY_V1 ...........................................437
4.2.2.2 Method-Specific Abstract Types and Procedures .......................................437
4.2.2.2.1 ExecuteScriptInProgress ..................................................................437
4.2.2.2.2 ExecuteScript .................................................................................438
4.2.2.3 Server Behavior of the IDL_DSAExecuteScript Method ..............................438
5 Common Data Types, Variables, and Procedures ................................................. 440
5.1 AbstractPTFromConcretePT ..............................................................................440
5.2 AccessCheckAttr .............................................................................................440
5.3 AccessCheckCAR .............................................................................................441
5.4 AccessCheckObject..........................................................................................441
5.5 AccessCheckWriteToSpnAttribute ......................................................................441
5.6 AddSubRef .....................................................................................................442
5.7 AmIRODC ......................................................................................................443
5.8 AmILHServer ..................................................................................................443
5.9 ATTR .............................................................................................................443
5.10 ATTRBLOCK ....................................................................................................444
5.11 AttributeStamp ...............................................................................................444
5.12 AttributeSyntax ..............................................................................................445
5.13 AttrStamp ......................................................................................................445
5.14 ATTRTYP ........................................................................................................446
5.15 AttrtypFromSchemaObj ...................................................................................446
5.16 ATTRVAL ........................................................................................................446
5.16.1 Concrete Value Representations ..................................................................446
5.16.1.1 INT32 .................................................................................................447
5.16.1.2 INT64 .................................................................................................447
5.16.1.3 OctetString .........................................................................................447
5.16.1.4 String8 ...............................................................................................447
5.16.1.5 String16 .............................................................................................447
5.16.1.6 SECURITY_DESCRIPTOR .......................................................................447
5.16.1.7 SID ....................................................................................................447
5.16.2 Abstract Value Representations ...................................................................448
5.16.2.1 Object(DS-DN) ....................................................................................448
5.16.2.2 Object(DN-String) ................................................................................449
5.16.2.3 Object(DN-Binary) ...............................................................................449
5.16.2.4 Object(Access-Point) ............................................................................449
5.16.2.5 Object(OR-Name) ................................................................................450
5.16.2.6 String(NT-Sec-Desc) ............................................................................450
5.16.2.7 String(Sid) ..........................................................................................450
5.16.2.8 String(Teletex) ....................................................................................450
5.16.3 Converting Between Abstract and Concrete Value Representations ..................450
5.16.3.1 Boolean ..............................................................................................452
5.16.3.2 Enumeration and Integer ......................................................................452
5.16.3.3 LargeInteger .......................................................................................453
5.16.3.4 Object(Presentation-Address) ................................................................453
5.16.3.5 Object(Replica-Link) String (Octet) ........................................................453
5.16.3.6 String(IA5) String(Printable) String(Numeric) String(Teletex) ....................453
5.16.3.7 String(Unicode) ...................................................................................454
5.16.3.8 String(Object-Identifier) .......................................................................454
5.16.3.9 String(UTC-Time) and String(Generalized-Time) ......................................454
5.16.3.10 Object(DS-DN) ....................................................................................455
5.16.3.11 Object(DN-Binary) ...............................................................................456
16 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.3.12 Object(DN-String) ................................................................................457
5.16.3.13 Object(OR-Name) ................................................................................458
5.16.3.14 Object(Access-Point) ............................................................................458
5.16.3.15 String(Sid) ..........................................................................................458
5.16.3.16 String(NT-Sec-Desc) ............................................................................458
5.16.4 ATTRTYP-to-OID Conversion .......................................................................459
5.17 ATTRVALBLOCK ..............................................................................................465
5.18 ATTRVALFromValue .........................................................................................465
5.19 BindToDSA() ..................................................................................................465
5.20 BOOL.............................................................................................................465
5.21 BYTE .............................................................................................................465
5.22 CHANGE_LOG_ENTRIES ...................................................................................465
5.23 CHANGELOG_ENTRY ........................................................................................466
5.24 CheckGroupMembership ..................................................................................466
5.25 ClientAuthorizationInfo ....................................................................................466
5.26 ClientExtensions .............................................................................................466
5.27 ClientUUID .....................................................................................................466
5.28 ConcretePTFromAbstractPT ..............................................................................467
5.29 ConfigNC........................................................................................................467
5.30 dc, DC ...........................................................................................................467
5.31 DefaultNC ......................................................................................................468
5.32 DelSubRef ......................................................................................................468
5.33 DescendantObject ...........................................................................................469
5.34 DomainNameFromDN ......................................................................................469
5.35 DN ................................................................................................................469
5.36 DNBinary .......................................................................................................469
5.37 DomainNameFromNT4AccountName ..................................................................469
5.38 DRS_EXTENSIONS ..........................................................................................469
5.39 DRS_EXTENSIONS_INT....................................................................................470
5.40 DRS_HANDLE .................................................................................................473
5.41 DRS_OPTIONS ................................................................................................474
5.42 DRS_MORE_GETCHGREQ_OPTIONS ..................................................................476
5.43 DRS_SecBuffer ...............................................................................................476
5.44 DRS_SecBufferDesc.........................................................................................478
5.45 DRS_SPN_CLASS ............................................................................................478
5.46 DS_REPL_OP_TYPE .........................................................................................478
5.47 DSAObj ..........................................................................................................478
5.48 DSA_RPC_INST...............................................................................................479
5.49 DSName ........................................................................................................479
5.50 DSNAME ........................................................................................................479
5.50.1 DSNAME Equality .......................................................................................481
5.51 DSTIME .........................................................................................................481
5.52 DWORD .........................................................................................................482
5.53 ENTINF ..........................................................................................................482
5.54 ENTINF_GetValue ............................................................................................482
5.55 ENTINF_SetValue ............................................................................................483
5.56 ENTINF_EnumerateAttributes ...........................................................................483
5.57 ENTINFLIST ....................................................................................................483
5.58 Expunge ........................................................................................................484
5.59 FILETIME .......................................................................................................484
5.60 FilteredGCPAS ................................................................................................484
5.61 FilteredPAS ....................................................................................................484
5.62 FindChar ........................................................................................................485
5.63 FindCharRev ...................................................................................................485
5.64 FOREST_TRUST_INFORMATION ........................................................................486
5.64.1 Record .....................................................................................................486
5.64.2 Determining If a Name Is in a Trusted Forest ................................................489
5.65 FOREST_TRUST_RECORD_TYPE ........................................................................495
17 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.66 ForestRootDomainNC .......................................................................................496
5.67 FullReplicaExists .............................................................................................496
5.68 GCPAS ...........................................................................................................496
5.69 GetFilteredAttributeSet ....................................................................................496
5.70 GetNCType .....................................................................................................497
5.71 GetAttrVals ....................................................................................................498
5.72 GetCallerAuthorizationInfo ...............................................................................498
5.73 GetDefaultObjectCategory ................................................................................498
5.74 GetDomainNC .................................................................................................498
5.75 GetDSNameFromAttrVal...................................................................................499
5.76 GetDSNameFromDN ........................................................................................499
5.77 GetDSNameFromNetworkAddress .....................................................................499
5.78 GetForestFunctionalLevel .................................................................................499
5.79 GetFSMORoleOwner ........................................................................................499
5.80 GetInstanceNameFromSPN ...............................................................................500
5.81 GetObjectNC ..................................................................................................500
5.82 GetProxyEpoch ...............................................................................................500
5.83 GetProxyType .................................................................................................500
5.84 GetServiceClassFromSPN .................................................................................500
5.85 GetServiceNameFromSPN ................................................................................501
5.86 groupType Bit Flags .........................................................................................501
5.87 GUID .............................................................................................................501
5.88 GuidFromString ..............................................................................................502
5.89 GuidToString ..................................................................................................502
5.90 handle_t ........................................................................................................502
5.91 instanceType Bit Flags .....................................................................................502
5.92 Is2PartSPN .....................................................................................................503
5.93 Is3PartSPN .....................................................................................................503
5.94 IsAdlds ..........................................................................................................503
5.95 IsBuiltinPrincipal .............................................................................................503
5.96 IsDomainNameInTrustedForest .........................................................................503
5.97 IsDomainSidInTrustedForest ............................................................................503
5.98 IsDCAccount ...................................................................................................504
5.99 IsForwardLinkAttribute ....................................................................................504
5.100 IsGC ..............................................................................................................504
5.101 IsGetNCChangesPermissionGranted ...................................................................504
5.102 IsGUIDBasedDNSName ....................................................................................505
5.103 IsMemberOfBuiltinAdminGroup .........................................................................505
5.104 IsRecycleBinEnabled ........................................................................................505
5.105 IsRevealFilteredAttribute ..................................................................................505
5.106 IsPrivilegedAccessManagementEnabled ..............................................................506
5.107 IsRevealSecretRequest ....................................................................................506
5.108 IsServerExtensionsChanged .............................................................................507
5.109 IsUPNInTrustedForest ......................................................................................507
5.110 IsValidServiceName .........................................................................................507
5.111 KCCFailedConnections .....................................................................................508
5.112 KCCFailedLinks ...............................................................................................508
5.113 LARGE_INTEGER .............................................................................................508
5.114 LDAP_CONN_PROPERTIES ................................................................................508
5.115 LDAP_SERVER_DIRSYNC_OID LDAP Search Control ............................................509
5.115.1 Abstract Types ..........................................................................................509
5.115.1.1 AttributeList ........................................................................................509
5.115.1.2 AttributeListElement .............................................................................509
5.115.1.3 AttributeVals .......................................................................................510
5.115.1.4 Control ...............................................................................................510
5.115.1.5 DirSyncControlValue .............................................................................510
5.115.1.6 DirSyncSearchArg ................................................................................510
5.115.1.7 LDAPString ..........................................................................................511
18 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.115.1.8 SearchResultEntry ................................................................................511
5.115.1.9 SearchResultEntryList ...........................................................................511
5.115.2 Concrete Types .........................................................................................511
5.115.2.1 Cookie ................................................................................................511
5.115.3 ProcessDirSyncSearchRequest .....................................................................512
5.115.4 DirSyncReqToGetChgReq ............................................................................513
5.115.5 GetChgReplyToSearchResult .......................................................................514
5.115.6 TransformEntinfToSearchEntry ....................................................................515
5.115.7 TransformReplValInfNativeListToSearchEntry ................................................516
5.115.8 TransformDSNameToLdapDN ......................................................................517
5.115.9 LDAPDisplayNameFromAttrTyp ....................................................................517
5.115.10 GetResponseDirSyncControlValue ................................................................517
5.115.11 GetUsnUtdVectorFromCookie ......................................................................518
5.115.12 SecurityCheckForChanges ...........................................................................519
5.115.13 IsFilteredAttributePresent ...........................................................................520
5.116 LDAPConnections ............................................................................................520
5.117 LinkStamp ......................................................................................................521
5.118 LinkValueStamp ..............................................................................................521
5.119 LinkValueStampCompare .................................................................................522
5.120 LocalAttidFromRemoteAttid ..............................................................................523
5.121 LONG ............................................................................................................523
5.122 LONGLONG ....................................................................................................523
5.123 LPWSTR .........................................................................................................523
5.124 MakeAttid.......................................................................................................523
5.125 MakeProxyValue..............................................................................................523
5.126 MasterReplicaExists .........................................................................................524
5.127 MD5_CTX .......................................................................................................524
5.128 MD5Final ........................................................................................................524
5.129 MD5Init .........................................................................................................524
5.130 MD5Update ....................................................................................................524
5.131 MergeUTD ......................................................................................................524
5.132 MTX_ADDR.....................................................................................................525
5.133 NCType Bits ...................................................................................................525
5.134 NetworkAddress ..............................................................................................526
5.135 NewPrefixTable ...............................................................................................526
5.136 Nt4ReplicationState .........................................................................................526
5.137 NT4SID ..........................................................................................................527
5.138 NTSAPI_CLIENT_GUID .....................................................................................527
5.139 NTDSTRANSPORT_OPT Values ..........................................................................527
5.140 NULLGUID ......................................................................................................527
5.141 ObjExists .......................................................................................................527
5.142 OID ...............................................................................................................527
5.143 OID_t ............................................................................................................527
5.144 OidFromAttid ..................................................................................................528
5.145 parent ...........................................................................................................528
5.146 PARTIAL_ATTR_VECTOR_V1_EXT ......................................................................528
5.147 partialAttributeSet ...........................................................................................528
5.148 PartialGCReplicaExists .....................................................................................528
5.149 PAS_DATA......................................................................................................529
5.150 PdcChangeLog ................................................................................................529
5.151 PerformAddOperation ......................................................................................529
5.152 PerformAddOperationAsSystem ........................................................................530
5.153 PrefixTable .....................................................................................................530
5.154 PrefixTableEntry..............................................................................................530
5.155 PROPERTY_META_DATA_EXT ............................................................................530
5.156 PROPERTY_META_DATA_EXT_VECTOR ...............................................................531
5.157 proxiedObjectName Value Format .....................................................................531
5.158 RDN ..............................................................................................................531
19 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.159 rdnType .........................................................................................................531
5.160 RecycleObj .....................................................................................................532
5.161 RemoveObj ....................................................................................................532
5.162 REPLENTINFLIST .............................................................................................532
5.163 ReplicatedAttributes ........................................................................................533
5.164 ReplicationQueue ............................................................................................533
5.165 REPLTIMES .....................................................................................................533
5.166 replUpToDateVector, ReplUpToDateVector ..........................................................534
5.167 REPLVALINF_V1 ..............................................................................................534
5.168 REPLVALINF_V3 ..............................................................................................535
5.169 REPLVALINF_NATIVE .......................................................................................535
5.170 REPS_FROM ...................................................................................................535
5.171 REPS_TO .......................................................................................................538
5.172 repsFrom, RepsFrom .......................................................................................540
5.173 repsTo, RepsTo ...............................................................................................542
5.174 Rid ................................................................................................................543
5.175 Right .............................................................................................................543
5.176 RIGHT Values .................................................................................................543
5.177 RPCClientContexts...........................................................................................544
5.178 RPCOutgoingContexts ......................................................................................544
5.179 sAMAccountType Values ...................................................................................544
5.180 SCHEMA_PREFIX_TABLE ..................................................................................545
5.181 SchemaInfo ....................................................................................................545
5.182 SchemaNC .....................................................................................................545
5.183 SchemaObj ....................................................................................................545
5.184 ServerExtensions ............................................................................................546
5.185 SID ...............................................................................................................546
5.186 SidFromStringSid ............................................................................................546
5.187 StampLessThanOrEqualUTD .............................................................................546
5.188 StartsWith ......................................................................................................546
5.189 StringSidFromSid ............................................................................................547
5.190 SubString .......................................................................................................547
5.191 Syntax ...........................................................................................................547
5.192 SYNTAX_ADDRESS ..........................................................................................547
5.193 SYNTAX_DISTNAME_BINARY ............................................................................547
5.194 systemFlags Values .........................................................................................549
5.195 UCHAR...........................................................................................................549
5.196 ULARGE_INTEGER ...........................................................................................549
5.197 ULONG ..........................................................................................................549
5.198 ULONGLONG ..................................................................................................549
5.199 UndeleteObject ...............................................................................................549
5.200 UnbindFromDSA() ...........................................................................................550
5.201 UpdateRefs ....................................................................................................550
5.202 UPTODATE_CURSOR_V1 ..................................................................................551
5.203 UPTODATE_CURSOR_V2 ..................................................................................551
5.204 UPTODATE_VECTOR_V1_EXT............................................................................551
5.205 UPTODATE_VECTOR_V2_EXT............................................................................552
5.206 userAccountControl Bits ...................................................................................552
5.207 UserNameFromNT4AccountName ......................................................................553
5.208 USHORT.........................................................................................................553
5.209 USN ..............................................................................................................553
5.210 USN_VECTOR .................................................................................................553
5.211 UUID .............................................................................................................554
5.212 ValidateDRSDemotionInput ..............................................................................554
5.213 ValidateDRSInput ............................................................................................554
5.214 Value .............................................................................................................555
5.215 VALUE_META_DATA_EXT_V1 ............................................................................555
5.216 VALUE_META_DATA_EXT_V3 ............................................................................555
20 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.217 VALUE_META_DATA_EXT_NATIVE .....................................................................556
5.218 ValueFromATTRVAL .........................................................................................556
5.219 VAR_SIZE_BUFFER_WITH_VERSION .................................................................556
5.220 WCHAR ..........................................................................................................556
6 Security ............................................................................................................... 557
6.1 Security Considerations for Implementers ..........................................................557
6.2 Index of Security Parameters ...........................................................................557
7 Appendix A: Full IDL ............................................................................................ 558
8 Appendix B: Product Behavior ............................................................................. 585
9 Change Tracking .................................................................................................. 593
10 Index ................................................................................................................... 594
21 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1 Introduction
The Directory Replication Service (DRS) Remote Protocol is an RPC protocol for replication and
management of data in Active Directory.
The protocol consists of two RPC interfaces named drsuapi and dsaop. The name of each drsuapi
method begins with "IDL_DRS", while the name of each dsaop method begins with "IDL_DSA". This
protocol was originally implemented in Windows 2000 Server operating system and is available in all
subsequent server releases. It is not available in Windows NT 3.1 operating system, Windows NT 3.51
operating system, or Windows NT 4.0 operating system.
Some functionality exposed by these RPC protocols is also available using the Lightweight Directory
Access Protocol (LDAP) protocol ([MS-ADTS] section 3.1.1.3); the overlap is described in section
1.4.
The special typographical conventions used in this document are described in section 3.2.
State is included in the state model for this specification only as necessitated by the requirement that
a licensee implementation of the protocols of applicable Windows Server releases has to be capable of
receiving messages and responding in the same manner as applicable Windows Server releases.
Behavior is specified in terms of request message received, processing based on current state,
resulting state transformation, and response message sent. Unless otherwise specified, all behaviors
are required elements of the protocol. Any specified behavior not explicitly qualified with MAY or
SHOULD is to be treated as if it were specified as a MUST behavior.
Note that information that is applicable to Active Directory Lightweight Directory Services (AD LDS) on
applicable Windows Server releases is also generally applicable to AD LDS on Windows clients. For
more information, see [MS-ADTS] section 1.
Pervasive Concepts
This specification uses [KNUTH1] section 2.3.4.2 as a reference for the graph-related terms oriented
tree, root, vertex, arc, initial vertex, and final vertex.
attribute: An identifier for a value or set of values. See also attribute in the Glossary (section 1.1).
object: A set of attributes, each with its associated values. Two attributes of an object have special
significance:
Identifying attribute: A designated single-valued attribute appears on every object. The value of
this attribute identifies the object. For the set of objects in a replica, the values of the identifying
attribute are distinct.
Note that an object is a value, not a variable; a replica is a variable. The process of adding,
modifying, or deleting an object in a replica replaces the entire value of the replica with a new
value.
22 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
As the term "replica" suggests, it is often the case that two replicas contain "the same objects". In
this usage, objects in two replicas are considered "the same" if they have the same value of the
identifying attribute and if there is a process in place (that is, replication) to converge the values
of the remaining attributes. When the members of a set of replicas are considered to be the same,
it is common to say "an object" as a shorthand way of referring to the set of corresponding objects
in the replicas.
object class: A set of restrictions on the construction and update of objects. An object class must be
specified when an object is created. An object class specifies a set of must-have attributes (every
object of the class must have at least one value of each) and may-have attributes (every object of
the class may have a value of each). An object class also specifies a set of possible superiors (the
parent object of an object of the class must have one of these classes). An object class is defined
by a classSchema object.
child object, children: An object that is not the root of its oriented tree. The children of an object O
is the set of all objects whose parent is O.
See [MS-ADTS] section 3.1.1.1.3 for the particular use made of these definitions in this specification.
Sections 1.5, 1.8, 1.9, 2, 3, 4, and 5 of this specification are normative. All other sections and
examples in this specification are informative.
1.1 Glossary
abstract type: A type used in this specification whose representation need not be standardized for
interoperability because the type's use is internal to the specification. See also concrete type.
access control list (ACL): A list of access control entries (ACEs) that collectively describe the
security rules for authorizing access to some resource; for example, an object or set of objects.
Active Directory: The Windows implementation of a general-purpose directory service, which uses
LDAP as its primary access protocol. Active Directory stores information about a variety of
objects in the network such as user accounts, computer accounts, groups, and all related
credential information used by Kerberos [MS-KILE]. Active Directory is either deployed as
Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory
Services (AD LDS), which are both described in [MS-ADOD]: Active Directory Protocols
Overview.
Active Directory Domain Services (AD DS): A directory service (DS) implemented by a domain
controller (DC). The DS provides a data store for objects that is distributed across multiple
DCs. The DCs interoperate as peers to ensure that a local change to an object replicates
correctly across DCs. AD DS is a deployment of Active Directory [MS-ADTS].
Active Directory Lightweight Directory Services (AD LDS): A directory service (DS)
implemented by a domain controller (DC). AD LDS is a deployment of Active Directory [MS-
ADTS]. The most significant difference between AD LDS and Active Directory Domain
Services (AD DS) is that AD LDS does not host domain naming contexts (domain NCs). A
server can host multiple AD LDS DCs. Each DC is an independent AD LDS instance, with its
own independent state. AD LDS can be run as an operating system DS or as a directory service
provided by a standalone application (Active Directory Application Mode (ADAM)).
ancestor object: An object A is an ancestor of object O if there is a directed path from A to O (in
other words, A is on the path from O to the root of the tree containing O).
23 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
application naming context (application NC): A specific type of naming context (NC), or an
instance of that type, that supports only full replicas (no partial replicas). An application NC
cannot contain security principal objects in Active Directory Domain Services (AD DS), but can
contain security principal objects in Active Lightweight Directory Services (AD LDS). A forest
can have zero or more application NCs in either AD DS or AD LDS. An application NC can
contain dynamic objects. Application NCs do not appear in the global catalog (GC). The root
of an application NC is an object of class domainDNS.
attribute: An identifier for a single or multivalued data element that is associated with a directory
object. An object consists of its attributes and their values. For example, cn (common name),
street (street address), and mail (email addresses) can all be attributes of a user object. An
attribute's schema, including the syntax of its values, is defined in an attributeSchema object.
attribute syntax: Specifies the format and range of permissible values of an attribute. The syntax
of an attribute is defined by several attributes on the attributeSchema object, as specified in
[MS-ADTS] section 3.1.1.2. Attribute syntaxes supported by Active Directory include Boolean,
Enumeration, Integer, LargeInteger, String(UTC-Time), Object(DS-DN), and String(Unicode).
authentication: The ability of one entity to determine the identity of another entity.
binary large object (BLOB): A collection of binary data stored as a single entity in a database.
binary OID: An object identifier (OID) in a Basic Encoding Rules (BER)–encoded binary format,
as specified in [ITUX690] section 8.19.
built-in principal: A security principal within the built-in domain whose SID is identical in every
domain.
checksum: A value that is the summation of a byte stream. By comparing the checksums
computed from a data item at two different times, one can quickly assess whether the data
items are identical.
child object, children: An object that is not the root of its tree. The children of an object o are
the set of all objects whose parent is o. See section 1 of [MS-ADTS] and section 1 of [MS-
DRSR].
compression chunk: Portions of replication data that occur when compression is used for that
data. Compression chunks are created by dividing the replication data into smaller units that are
suitable for the particular algorithm. The chunk size is specific to the compression algorithm
being employed.
24 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
concrete type: A type whose representation has to be standardized for interoperability. Specific
cases include types in the IDL definition of an RPC interface, types sent over RPC but whose
representation is unknown to RPC, and types stored as byte strings in directory attributes.
configuration naming context (config NC): A specific type of naming context (NC), or an
instance of that type, that contains configuration information. In Active Directory, a single
config NC is shared among all domain controllers (DCs) in the forest. A config NC cannot
contain security principal objects.
constructed attribute: An attribute whose values are computed from normal attributes (for read)
and/or have effects on the values of normal attributes (for write).
container: An object in the directory that can serve as the parent for other objects. In the
absence of schema constraints, all objects would be containers. The schema allows only
objects of specific classes to be containers.
control access right: An extended access right that can be granted or denied on an access
control list (ACL).
critical object: A subset of the objects in the default naming context (NC), identified by the
attribute isCriticalSystemObject having the value TRUE. The objects that are marked in this
way are essential for the operation of a domain controller (DC) hosting the NC.
crossRef object: An object residing in the partitions container of the config NC that describes
the properties of a naming context (NC), such as its domain naming service name,
operational settings, and so on.
cyclic redundancy check (CRC): An algorithm used to produce a checksum (a small, fixed
number of bits) against a block of data, such as a packet of network traffic or a block of a
computer file. The CRC is a broad class of functions used to detect errors after transmission or
storage. A CRC is designed to catch random errors, as opposed to intentional errors. If errors
might be introduced by a motivated and intelligent adversary, a cryptographic hash function has
to be used instead.
default naming context (default NC): When Active Directory is operating as Active
Directory Domain Services (AD DS), the default naming context (default NC) is the
domain naming context (domain NC) whose full replica is hosted by a domain controller
(DC), except when the DC is a read-only domain controller (RODC), in which case the
default NC is a filtered partial NC replica. When operating as AD DS, a DC's default NC is the
NC of its default NC replica, and the default NC contains the DC's computer object. When
Active Directory is operating as AD LDS, the default NC is the naming context (NC)
specified by the msDS-DefaultNamingContext attribute on the nTDSDSA object for the DC.
See nTDSDSA object.
deleted-object: An object that has been deleted, but remains in storage until a configured
amount of time (the deleted-object lifetime) has passed, after which the object is transformed
to a recycled-object. Unlike a recycled-object or a tombstone, a deleted-object maintains
virtually all the state of the object before deletion, and can be undeleted without loss of
information. Deleted-objects exist only when the Recycle Bin optional feature is enabled.
digest: The fixed-length output string from a one-way hash function that takes a variable-length
input string and is probabilistically unique for every different input string. Also, a cryptographic
checksum of a data (octet) stream.
directory: The database that stores information about objects such as users, groups, computers,
printers, and the directory service that makes this information available to users and
applications.
directory object: An Active Directory object, which is a specialization of the "object" concept
that is described in [MS-ADTS] section 1 or [MS-DRSR] section 1, Introduction, under Pervasive
25 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Concepts. An Active Directory object can be identified by the objectGUID attribute of a
dsname according to the matching rules defined in [MS-DRSR] section 5.50, DSNAME. The
parent-identifying attribute (not exposed as an LDAP attribute) is parent. Active Directory
objects are similar to LDAP entries, as defined in [RFC2251]; the differences are specified in
[MS-ADTS] section 3.1.1.3.1.
directory service agent (DSA): A term from the X.500 directory specification [X501] that
represents a component that maintains and communicates directory information.
domain: A set of users and computers sharing a common namespace and management
infrastructure. At least one computer member of the set has to act as a domain controller
(DC) and host a member list that identifies all members of the domain, as well as optionally
hosting the Active Directory service. The domain controller provides authentication of
members, creating a unit of trust for its members. Each domain has an identifier that is shared
among its members. For more information, see [MS-AUTHSOD] section 1.1.1.5 and [MS-ADTS].
domain controller (DC): The service, running on a server, that implements Active Directory, or
the server hosting this service. The service hosts the data store for objects and interoperates
with other DCs to ensure that a local change to an object replicates correctly across all DCs.
When Active Directory is operating as Active Directory Domain Services (AD DS), the DC
contains full NC replicas of the configuration naming context (config NC), schema
naming context (schema NC), and one of the domain NCs in its forest. If the AD DS DC is
a global catalog server (GC server), it contains partial NC replicas of the remaining
domain NCs in its forest. For more information, see [MS-AUTHSOD] section 1.1.1.5.2 and
[MS-ADTS]. When Active Directory is operating as Active Directory Lightweight Directory
Services (AD LDS), several AD LDS DCs can run on one server. When Active Directory is
operating as AD DS, only one AD DS DC can run on one server. However, several AD LDS DCs
can coexist with one AD DS DC on one server. The AD LDS DC contains full NC replicas of the
config NC and the schema NC in its forest. The domain controller is the server side of
Authentication Protocol Domain Support [MS-APDS].
domain naming context (domain NC): A specific type of naming context (NC), or an instance
of that type, that represents a domain. A domain NC can contain security principal objects; no
other type of NC can contain security principal objects. Domain NCs appear in the global
catalog (GC). A domain NC is hosted by one or more domain controllers (DCs) operating
as AD DS. In AD DS, a forest has one or more domain NCs. A domain NC cannot exist in AD
LDS. The root of a domain NC is an object of class domainDNS; for directory replication [MS-
DRSR], see domainDNS.
domain security identifier (domain SID): The SID of the root object of a domain NC. The
relative identifier (RID) portion of the domain SID is always zero. Every security principal
object in a domain NC has an objectSid attribute equal to the domain SID except for the
RID portion.
26 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DSA GUID: The objectGUID of a DSA object.
dsname: A tuple that contains between one and three identifiers for an object. The term dsname
does not stand for anything. The possible identifiers are the object's GUID (attribute
objectGuid), security identifier (SID) (attribute objectSid), and distinguished name (DN)
(attribute distinguishedName). A dsname can appear in a protocol message and as an attribute
value (for example, a value of an attribute with syntax Object(DS-DN)). Given a DSName, an
object can be identified within a set of NC replicas according to the matching rules defined in
[MS-DRSR] section 5.49.
dynamic endpoint: A network-specific server address that is requested and assigned at run time.
For more information, see [C706].
endpoint: A network-specific address of a remote procedure call (RPC) server process for remote
procedure calls. The actual name and type of the endpoint depends on the RPC protocol
sequence that is being used. For example, for RPC over TCP (RPC Protocol Sequence
ncacn_ip_tcp), an endpoint might be TCP port 1025. For RPC over Server Message Block (RPC
Protocol Sequence ncacn_np), an endpoint might be the name of a named pipe. For more
information, see [C706].
expunge: To permanently remove an object from a naming context (NC) replica, without
converting it to a tombstone.
extended canonical name: Same as a canonical name, except that the rightmost forward slash
('/') is replaced with a newline character.
filtered attribute set: The subset of attributes that are not replicated to the filtered partial NC
replica and the filtered GC partial NC replica. The filtered attribute set is part of the state of
the forest and is used to control the attributes that replicate to a read-only domain
controller (RODC). The searchFlags schema attribute is used to define this set.
flexible single master operation (FSMO): A read or update operation on a naming context
(NC), such that the operation must be performed on the single designated master replica of
that NC. The master replica designation is "flexible" because it can be changed without losing
the consistency gained from having a single master. This term, pronounced "fizmo", is never
used alone; see also FSMO role, FSMO role owner, and FSMO object.
forest: For Active Directory Domain Services (AD DS), a set of naming contexts (NCs)
consisting of one schema naming context (schema NC), one configuration naming
context (config NC), one or more domain naming contexts (domain NCs), and zero or
more application naming contexts (application NCs). Because a set of NCs can be
arranged into a tree structure, a forest is also a set containing one or several trees of NCs. For
AD LDS, a set of NCs consisting of one schema NC, one config NC, and zero or more
application NCs. (In Microsoft documentation, an AD LDS forest is called a "configuration
set".)
forest root domain NC: For Active Directory Domain Services (AD DS), the domain naming
context (domain NC) within a forest whose child is the forest's configuration naming
context (config NC). The fully qualified domain name (FQDN) of the forest root domain
NC serves as the forest's name.
27 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
forward link attribute: An attribute whose values include object references (for example, an
attribute of syntax Object(DS-DN)). The forward link values can be used to compute the values
of a related attribute, a back link attribute, on other objects. If an object o refers to object r
in forward link attribute f, and there exists a back link attribute b corresponding to f, then a
back link value referring to o exists in attribute b on object r. The relationship between the
forward and back link attributes is expressed using the linkId attribute on the attributeSchema
objects representing the two attributes. The forward link's linkId is an even number, and the
back link's linkId is the forward link's linkId plus one. A forward link attribute can exist with
no corresponding back link attribute, but not vice-versa. For more information, see [MS-ADTS].
FSMO role: A set of objects that can be updated in only one naming context (NC) replica (the
FSMO role owner's replica) at any given time. For more information, see [MS-ADTS] section
3.1.1.1.11. See also FSMO role owner.
FSMO role object: An object in a directory that represents a specific FSMO role. This object is
an element of the FSMO role and contains the fSMORoleOwner attribute.
FSMO role owner: The domain controller (DC) holding the naming context (NC) replica in
which the objects of a FSMO role can be updated.
full NC replica: A naming context (NC) replica that contains all the attributes of the objects
it contains. A full replica accepts originating updates.
fully qualified domain name (FQDN): (1) An unambiguous domain name that gives an absolute
location in the Domain Name System's (DNS) hierarchy tree, as defined in [RFC1035] section
3.1 and [RFC2181] section 11.
(2) In Active Directory, a fully qualified domain name (FQDN) (1) that identifies a
domain.
GC partial attribute set (PAS): The subset of attributes that replicate to a GC partial NC
replica. A particular GC partial attribute set (PAS) is part of the state of the forest and is
used to control the attributes that replicate to global catalog servers (GC servers). The
isMemberOfPartialAttributeSet schema attribute is used to define this set.
global catalog (GC): A unified partial view of multiple naming contexts (NCs) in a distributed
partitioned directory. The Active Directory directory service GC is implemented by GC
servers. The definition of global catalog is specified in [MS-ADTS] section 3.1.1.1.8.
global catalog server (GC server): A domain controller (DC) that contains a naming context
(NC) replica (one full, the rest partial) for each domain naming context in the forest.
global group: An Active Directory group that allows user objects from its own domain and
global groups from its own domain as members. Also called domain global group. Universal
groups can contain global groups. A group object g is a global group if and only if
GROUP_TYPE_ACCOUNT_GROUP is present in g! groupType; see [MS-ADTS] section 2.2.12,
"Group Type Flags". A global group that is also a security-enabled group is valid for inclusion
within ACLs anywhere in the forest. If a domain is in mixed mode, then a global group in that
domain that is also a security-enabled group allows only user object as members. See also
domain local group, security-enabled group.
globally unique identifier (GUID): A term used interchangeably with universally unique
identifier (UUID) in Microsoft protocol technical documents (TDs). Interchanging the usage of
these terms does not imply or require a specific algorithm or mechanism to generate the value.
Specifically, the use of this term does not imply or require that the algorithms described in
[RFC4122] or [C706] must be used for generating the GUID. See also universally unique
identifier (UUID).
28 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
group object: In Active Directory, a group object has an object class group. A group has a
forward link attribute member; the values of this attribute either represent elements of the
group (for example, objects of class user or computer) or subsets of the group (objects of
class group). The representation of group subsets is called "nested group membership". The
back link attribute memberOf enables navigation from group members to the groups
containing them. Some groups represent groups of security principals and some do not and
are, for instance, used to represent email distribution lists.
Interface Definition Language (IDL): The International Standards Organization (ISO) standard
language for specifying the interface for remote procedure calls. For more information, see
[C706] section 4.
Internet host name: The name of a host as defined in [RFC1123] section 2.1, with the extensions
described in [MS-HNDS].
invocation ID: The invocationId attribute. An attribute of an nTDSDSA object. Its value is a
unique identifier for a function that maps from update sequence numbers (USNs) to
updates to the NC replicas of a domain controller (DC). See also nTDSDSA object.
Knowledge Consistency Checker (KCC): A component of the Active Directory replication that
is used to create spanning trees for domain controller to domain controller replication and
to translate those trees into settings of variables that implement the replication topology.
LDAP connection: A TCP connection from a client to a server over which the client sends
Lightweight Directory Access Protocol (LDAP) requests and the server sends responses to the
client's requests.
Lightweight Directory Access Protocol (LDAP): The primary access protocol for Active
Directory. Lightweight Directory Access Protocol (LDAP) is an industry-standard protocol,
established by the Internet Engineering Task Force (IETF), which allows users to query and
update information in a directory service (DS), as described in [MS-ADTS]. The Lightweight
Directory Access Protocol can be either version 2 [RFC1777] or version 3 [RFC3377].
lingering object: An object that still exists in an NC replica even though it has been deleted and
garbage-collected from other replicas. This occurs, for instance, when a domain controller
(DC) goes offline for longer than the tombstone lifetime.
local domain controller (local DC): A domain controller (DC) on which the current method is
executing.
Lost and Found container: A container holding objects in a given naming context (NC) that do
not have parent objects due to add and remove operations that originated on different domain
controllers (DCs). The container is a child of the NC root and has RDN CN=LostAndFound in
domain NCs and CN=LostAndFoundConfig in config NCs.
Microsoft Interface Definition Language (MIDL): The Microsoft implementation and extension
of the OSF-DCE Interface Definition Language (IDL). MIDL can also mean the Interface
Definition Language (IDL) compiler provided by Microsoft. For more information, see [MS-
RPCE].
29 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Directory Domain Services (AD DS), the SID is present if and only if the NC is a domain
naming context (domain NC). Active Directory supports organizing several NCs into a tree
structure.
NC replica: A variable containing a tree of objects whose root object is identified by some
naming context (NC).
NetBIOS domain name: The name registered by domain controllers (DCs) on [1C] records of
the NBNS (WINS) server (see section 6.3.4). For details of NetBIOS name registration, see [MS-
WPO] sections 7.1.4 and 10.4.
nonreplicated attribute: An attribute whose values are not replicated between naming context
(NC) replicas. The nonreplicated attributes of an object are, in effect, local variables of the
domain controller (DC) hosting the NC replica containing that object, since changes to these
attributes have no effect outside that DC.
nTDSDSA object: An object of class nTDSDSA that is always located in the configuration
naming context (config NC). This object represents a domain controller (DC) in the
forest. See [MS-ADTS] section 6.1.1.2.2.1.2.1.1.
object: A set of attributes, each with its associated values. For more information on objects, see
[MS-ADTS] section 1 or [MS-DRSR] section 1.
object class: A set of restrictions on the construction and update of objects. An object class can
specify a set of "must-have" attributes (every object of the class must have at least one value of
each) and "may-have" attributes (every object of the class may have a value of each). An object
class can also specify the allowable classes for the parent object of an object in the class. An
object class can be defined by single inheritance; an object whose class is defined in this way is
a member of all object classes used to derive its most specific class. An object class is defined in
a classSchema object. See section 1 of [MS-ADTS] and section 1 of [MS-DRSR].
object identifier (OID): In the Lightweight Directory Access Protocol (LDAP), a sequence of
numbers in a format described by [RFC1778]. In many LDAP directory implementations, an OID
is the standard internal representation of an attribute. In the directory model used in this
specification, the more familiar ldapDisplayName represents an attribute.
object of class x (or x object): An object o such that one of the values of its objectClass
attributes is x. For instance, if objectClass contains the value user, o is an object of class user.
This is often contracted to "user object".
object reference: An attribute value that references an object. Reading a reference gives the
distinguished name (DN) of the object.
objectClass: The objectClass attribute. The attribute on an object that holds the object class
name of each object class of the object.
objectGUID: The attribute on an Active Directory object whose value is a GUID that uniquely
identifies the object. The GUID value of an object's objectGUID is assigned when the object
was created and is immutable thereafter. The integrity of object references between NCs and
of replication depends on the integrity of the objectGUID attribute. For a descrption of the
general concept of an "object", see [MS-ADTS] section 1. For more detailed information see
[MS-ADTS] section 3.1.1.1.3.
objectSid: The objectSid attribute. The attribute on an object whose value is a SID that
identifies the object as a security principal object. The value of an object's objectSid is
assigned when the security principal object was created and is immutable thereafter unless the
object moves to another domain. The integrity of authentication depends on the integrity of
the objectSid attribute.
30 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
opnum: An operation number or numeric identifier that is used to identify a specific remote
procedure call (RPC) method or a method in an interface. For more information, see [C706]
section 12.5.2.12 or [MS-RPCE].
optional feature: A non-default behavior that modifies the Active Directory state model. An
optional feature is enabled or disabled in a specific scope, such as a forest or a domain. For
more information, refer to [MS-ADTS] section 3.1.1.9.
oriented tree: A directed acyclic graph such that for every vertex v, except one (the root), there
is a unique edge whose tail is v. There is no edge whose tail is the root. For more information,
see [KNUTH1] section 2.3.4.2.
originating update: An update that is performed to an NC replica via any protocol except
replication. An originating update to an attribute or link value generates a new stamp for the
attribute or link value.
parent object: An object is either the root of a tree of objects or has a parent. If two objects have
the same parent, they must have different values in their relative distinguished names
(RDNs). See also, object in section 1 of [MS-ADTS] and section 1 of [MS-DRSR].
partial attribute set (PAS): The subset of attributes that replicate to partial naming context
(NC) replicas. Also, the particular partial attribute set that is part of the state of a forest and
that is used to control the attributes that replicate to global catalog (GC) servers.
partial NC replica: An NC replica that contains a schema-specified subset of attributes for the
objects it contains. A partial NC replica is not writable—it does not accept originating
updates. See also writable NC replica.
Partitions container: A child object of the configuration naming context (config NC) root.
The relative distinguished name (RDN) of the Partitions container is "cn=Partitions" and
its class is crossRefContainer ([MS-ADTS] section 2.30). See also crossRef object.
PDC emulator: A DC that is designated to track changes made to the accounts of all computers in
a domain. The PDC emulator is the only computer to receive these changes directly and is
specialized so as to ensure consistency and to eliminate the potential for conflicting entries in
the Active Directory database. A domain has only one PDC emulator.
prefix table: A data structure that is used to translate between an object identifier (OID) and a
compressed representation for OIDs. See [MS-DRSR] section 5.14.
primary domain controller (PDC): A domain controller (DC) designated to track changes
made to the accounts of all computers on a domain. It is the only computer to receive these
changes directly, and is specialized so as to ensure consistency and to eliminate the potential for
conflicting entries in the Active Directory database. A domain has only one PDC.
primary domain controller (PDC) role owner: The domain controller (DC) that hosts the
primary domain controller emulator FSMO role for a given domain naming context (NC).
Privileged Access Management: An optional feature that enables the removal of a link value
from the state of a domain controller (DC) at a specified date and time.
read permission: The authorization to read an attribute of an object. For more information, see
[MS-ADTS] section 5.1.3.
read-only domain controller (RODC): A domain controller (DC) that does not accept
originating updates. Additionally, an RODC does not perform outbound replication. An RODC
cannot be the primary domain controller (PDC) for its domain.
31 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Recycle Bin: An optional feature that modifies the state model of object deletions and
undeletions, making undeletion of deleted-objects possible without loss of the object's
attribute values. For more information, see [MS-ADTS] section 3.1.1.9.1.
recycled-object: An object that has been deleted, but remains in storage until a configured
amount of time (the tombstone lifetime) has passed, after which the object is permanently
removed from storage. Unlike a deleted-object, most of the state of the object has been
removed, and the object can no longer be undeleted without loss of information. By keeping
the recycled-object in existence for the tombstone lifetime, the deleted state of the object is
able to replicate. Recycled-objects exist only when the Recycle Bin optional feature is
enabled.
relative distinguished name (RDN): The name of an object relative to its parent. This is the
leftmost attribute-value pair in the distinguished name (DN) of an object. For example, in
the DN "cn=Peter Houston, ou=NTDEV, dc=microsoft, dc=com", the RDN is "cn=Peter
Houston". For more information, see [RFC2251].
relative identifier (RID): The last item in the series of SubAuthority values in a security
identifier (SID) [SIDD]. It distinguishes one account or group from all other accounts and
groups in the domain. No two accounts or groups in any domain share the same RID.
remote procedure call (RPC): A communication protocol used primarily between client and
server. The term has three definitions that are often used interchangeably: a runtime
environment providing for communication facilities between computers (the RPC runtime); a set
of request-and-response message exchanges between computers (the RPC exchange); and the
single message from an RPC exchange (the RPC message). For more information, see [C706].
replicated update: An update performed to a naming context (NC) replica by the replication
system, to propagate the effect of an originating update at another NC replica. The stamp
assigned during the originating update to attribute values or a link value is preserved by
replication.
replication: The process of propagating the effects of all originating writes to any replica of a
naming context (NC), to all replicas of the NC. If originating writes cease and replication
continues, all replicas converge to a common application-visible state.
replication cycle: Sometimes referred to simply as "cycle". A series of one or more replication
responses associated with the same invocationId, concluding with the return of a new up-to-
date vector.
replication epoch: A state variable of a DC that changes when a DC is no longer compatible for
replication with its former partners. A server receiving a replication request tests the client's
replication epoch against its own, and refuses the request if the two are not equal.
replication latency: The time lag between a final originating update to a naming context (NC)
replica and all NC replicas reaching a common application-visible state.
RPC protocol sequence: A character string that represents a valid combination of a remote
procedure call (RPC) protocol, a network layer protocol, and a transport layer protocol, as
described in [C706] and [MS-RPCE].
RPC transport: The underlying network services used by the remote procedure call (RPC) runtime
for communications between network nodes. For more information, see [C706] section 2.
32 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
schema: The set of attributes and object classes that govern the creation and update of
objects.
schema naming context (schema NC): A specific type of naming context (NC) or an instance
of that type. A forest has a single schema NC, which is replicated to each domain controller
(DC) in the forest. No other NC replicas can contain these objects. Each attribute and class
in the forest's schema is represented as a corresponding object in the forest's schema NC. A
schema NC cannot contain security principal objects.
secret data: An implementation-specific set of attributes on objects of class user that contain
security-sensitive information about the security principal.
security context: A data structure containing authorization information for a particular security
principal in the form of a collection of security identifiers (SIDs). One SID identifies the
principal specifically, whereas others represent other capabilities. A server uses the
authorization information in a security context to check access to requested resources.
security descriptor: A data structure containing the security information associated with a
securable object. A security descriptor identifies an object's owner by its security
identifier (SID). If access control is configured for the object, its security descriptor
contains a discretionary access control list (DACL) with SIDs for the security principals who
are allowed or denied access. Applications use this structure to set and query an object's
security status. The security descriptor is used to guard access to an object as well as to
control which type of auditing takes place when the object is accessed. The security
descriptor format is specified in [MS-DTYP] section 2.4.6; a string representation of security
descriptors, called SDDL, is specified in [MS-DTYP] section 2.5.1.
security identifier (SID): An identifier for security principals that is used to identify an account
or a group. Conceptually, the SID is composed of an account authority portion (typically a
domain) and a smaller integer representing an identity relative to the account authority,
termed the relative identifier (RID). The SID format is specified in [MS-DTYP] section 2.4.2;
a string representation of SIDs is specified in [MS-DTYP] section 2.4.2 and [MS-AZOD] section
1.1.1.2.
security principal: A unique entity, also referred to as a principal, that can be authenticated by
Active Directory. It frequently corresponds to a human user, but also can be a service that
offers a resource to other security principals. Other security principals might be a group, which
is a set of principals. Groups are supported by Active Directory.
security provider: A pluggable security module that is specified by the protocol layer above the
remote procedure call (RPC) layer, and will cause the RPC layer to use this module to secure
messages in a communication session with the server. The security provider is sometimes
referred to as an authentication service. For more information, see [C706] and [MS-RPCE].
server object: A class of object in the configuration naming context (config NC). A server
object can have an nTDSDSA object as a child.
service account: A stored set of attributes that represent a principal that provides a security
context for services.
service class: The first part of a service principal name. See [MS-KILE] section 3.1.5.11.
service principal name (SPN): The name a client uses to identify a service for mutual
authentication. (For more information, see [RFC1964] section 2.1.1.) An SPN consists of
either two parts or three parts, each separated by a forward slash ('/'). The first part is the
service class, the second part is the host name, and the third part (if present) is the service
name. For example, "ldap/dc-01.fabrikam.com/fabrikam.com" is a three-part SPN where "ldap"
is the service class name, "dc-01.fabrikam.com" is the host name, and "fabrikam.com" is the
service name. See [SPNNAMES] for more information about SPN format and composing a
unique SPN.
33 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
session key: A relatively short-lived symmetric key (a cryptographic key negotiated by the client
and the server based on a shared secret). A session key's lifespan is bounded by the session
to which it is associated. A session key has to be strong enough to withstand cryptanalysis for
the lifespan of the session.
SHA1 hash: A hashing algorithm defined in [FIPS180] that was developed by the National
Institute of Standards and Technology (NIST) and the National Security Agency (NSA).
site: A collection of one or more well-connected (reliable and fast) TCP/IP subnets. By defining
sites (represented by site objects) an administrator can optimize both Active Directory
access and Active Directory replication with respect to the physical network. When users log in,
Active Directory clients find domain controllers (DCs) that are in the same site as the user, or
near the same site if there is no DC in the site. See also Knowledge Consistency Checker
(KCC). For more information, see [MS-ADTS].
stamp: Information that describes an originating update by a domain controller (DC). The
stamp is not the new data value; the stamp is information about the update that created the
new data value. A stamp is often called metadata, because it is additional information that
"talks about" the conventional data values. A stamp contains the following pieces of
information: the unique identifier of the DC that made the originating update; a sequence
number characterizing the order of this change relative to other changes made at the originating
DC; a version number identifying the number of times the data value has been modified; and
the time when the change occurred.
STATUS code: A 32-bit quantity where zero represents success and nonzero represents failure.
The specific failure codes used in this specification are Windows error codes.
subordinate reference object (sub-ref object): The naming context (NC) root of a parent NC
has a list of all the NC roots of its child NCs in the subRefs attribute ([MS-ADA3] section
2.282). Each entry in this list is a subordinate reference and the object named by the entry is
denominated a subordinate reference object. An object is a subordinate reference object
if and only if it is in such a list. If a server has replicas of both an NC and its child NC, then the
child NC root is the subordinate reference object, in the context of the parent NC. If the
server does not have a replica of the child NC, then another object, with distinguishedName
([MS-ADA1] section 2.177) and objectGUID ([MS-ADA3] section 2.44) attributes equal to the
child NC root, is present in the server and is the subordinate reference object.
tombstone: An object that has been deleted, but remains in storage until a configured amount of
time (the tombstone lifetime) has passed, after which the object is permanently removed from
storage. By keeping the tombstone in existence for the tombstone lifetime, the deleted state of
the object is able to replicate. Tombstones exist only when the Recycle Bin optional feature
is not enabled.
Unicode: A character encoding standard developed by the Unicode Consortium that represents
almost all of the written languages of the world. The Unicode standard [UNICODE5.0.0/2007]
provides three forms (UTF-8, UTF-16, and UTF-32) and seven schemes (UTF-8, UTF-16, UTF-16
BE, UTF-16 LE, UTF-32, UTF-32 LE, and UTF-32 BE).
universal group: An Active Directory group that allows user objects, global groups, and
universal groups from anywhere in the forest as members. A group object g is a universal
group if and only if GROUP_TYPE_UNIVERSAL_GROUP is present in g! groupType. A security-
enabled universal group is valid for inclusion within ACLs anywhere in the forest. If a domain is
in mixed mode, then a universal group cannot be created in that domain. See also domain
local group, security-enabled group.
34 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
universally unique identifier (UUID): A 128-bit value. UUIDs can be used for multiple
purposes, from tagging objects with an extremely short lifetime, to reliably identifying very
persistent objects in cross-process communication such as client and server interfaces, manager
entry-point vectors, and RPC objects. UUIDs are highly likely to be unique. UUIDs are also
known as globally unique identifiers (GUIDs) and these terms are used interchangeably in
the Microsoft protocol technical documents (TDs). Interchanging the usage of these terms does
not imply or require a specific algorithm or mechanism to generate the UUID. Specifically, the
use of this term does not imply or require that the algorithms described in [RFC4122] or [C706]
must be used for generating the UUID.
update: An add, modify, or delete of one or more objects or attribute values. See originating
update, replicated update.
user object: An object of class user. A user object is a security principal object; the principal is a
person or service entity running on the computer. The shared secret allows the person or
service entity to authenticate itself, as described in ([MS-AUTHSOD] section 1.1.1.1).
Windows error code: A 32-bit quantity where zero represents success and nonzero represents
failure. The specific failure codes are specified in [MS-ERREF].
writable naming context (NC) replica: A naming context (NC) replica that accepts originating
updates. A writable NC replica is always full, but a full NC replica is not always writable.
Partial replicas are not writable. See also read-only full NC replica.
MAY, SHOULD, MUST, SHOULD NOT, MUST NOT: These terms (in all caps) are used as defined
in [RFC2119]. All statements of optional behavior use either MAY, SHOULD, or SHOULD NOT.
1.2 References
Links to a document in the Microsoft Open Specifications library point to the correct section in the
most recently published version of the referenced document. However, because individual documents
in the library are not updated at the same time, the section numbers in the documents may not
match. You can confirm the correct section numbering by checking the Errata.
We conduct frequent surveys of the normative references to assure their continued availability. If you
have any issue with finding a normative reference, please contact dochelp@microsoft.com. We will
assist you in finding the relevant information.
[C706] The Open Group, "DCE 1.1: Remote Procedure Call", C706, August 1997,
https://publications.opengroup.org/c706
35 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[ITUX690] ITU-T, "ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical
Encoding Rules (CER) and Distinguished Encoding Rules (DER)", Recommendation X.690, July 2002,
http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
[MS-LSAD] Microsoft Corporation, "Local Security Authority (Domain Policy) Remote Protocol".
[MS-SAMR] Microsoft Corporation, "Security Account Manager (SAM) Remote Protocol (Client-to-
Server)".
[MS-SRPL] Microsoft Corporation, "Directory Replication Service (DRS) Protocol Extensions for SMTP".
[RFC1034] Mockapetris, P., "Domain Names - Concepts and Facilities", STD 13, RFC 1034, November
1987, https://www.rfc-edit.org/info/rfc1034
[RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April 1992, https://www.rfc-
editor.org/info/rfc1321
[RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification version 1.3", RFC 1951, May
1996, https://www.rfc-editor.org/info/rfc1951
[RFC1964] Linn, J., "The Kerberos Version 5 GSS-API Mechanism", RFC 1964, June 1996,
https://www.rfc-editor.org/info/rfc1964
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC
2119, March 1997, https://www.rfc-editor.org/info/rfc2119
[RFC2251] Wahl, M., Howes, T., and Kille, S., "Lightweight Directory Access Protocol (v3)", RFC 2251,
December 1997, https://www.rfc-editor.org/info/rfc2251
[RFC2252] Wahl, M., Coulbeck, A., Howes, T., and Kille, S., "Lightweight Directory Access Protocol
(v3): Attribute Syntax Definitions", RFC 2252, December 1997, https://www.rfc-
editor.org/info/rfc2252
[RFC2253] Wahl, M., Kille, S., and Howe, T., "Lightweight Directory Access Protocol (v3): UTF-8 String
Representation of Distinguished Names", RFC 2253, December 1997, https://www.rfc-
editor.org/info/rfc2253
36 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[RFC2254] Howes, T., "The String Representation of LDAP Search Filters", RFC 2254, December 1997,
https://www.rfc-editor.org/info/rfc2254
[RFC2821] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821, April 2001, https://www.rfc-
editor.org/info/rfc2821
[RFC4122] Leach, P., Mealling, M., and Salz, R., "A Universally Unique Identifier (UUID) URN
Namespace", RFC 4122, July 2005, https://www.rfc-editor.org/info/rfc4122
[SCHNEIER] Schneier, B., "Applied Cryptography, Second Edition", John Wiley and Sons, 1996, ISBN:
0471117099, http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471117099.html
[KNUTH1] Knuth, D., "The Art of Computer Programming: Volume 1/Fundamental Algorithms (Second
Edition)", Reading, MA: Addison-Wesley, 1973, ASIN: B000NV8YOA.
[MS-LSAT] Microsoft Corporation, "Local Security Authority (Translation Methods) Remote Protocol".
[NELSON] Nelson, G., "Systems Programming with Modula-3", Englewood Cliffs, NJ: Prentice Hall,
1991, ISBN: 0135904641.
1.3 Overview
This document specifies the Directory Replication Service (DRS) Remote Protocol, an RPC protocol for
replication between domain controllers and management of Active Directory. The protocol
consists of two RPC interfaces, named drsuapi and dsaop. The name of each drsuapi method begins
with "IDL_DRS", while the name of each dsaop method begins with "IDL_DSA".
The DRS Remote Protocol contains methods that are diverse in function and fall into the following
categories:
Context handle methods: IDL_DRSBind, IDL_DRSUnbind. These methods create and destroy RPC
context handles that maintain volatile state used by drsuapi methods. The dsaop methods do not
use context handles.
37 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Windows NT 4.0 Replication support method: IDL_DRSGetNT4ChangeLog. This method is used in
the implementation of Active Directory support for replication to Windows NT 4.0 backup domain
controllers (BDCs), specifically in the implementation of moving the PDC Emulator FSMO role
from one DC to another without triggering a full sync of Windows NT 4.0 BDCs (see [MS-NRPC]
section 3.6).
The specification of each method in section 4, includes an Informative summary of behavior that
provides a detailed introduction to the method.
The drsuapi RPC interface is a "context handle"–based RPC interface; [C706] specifies what this
means. A client obtains a DRS_HANDLE for a particular DC by calling IDL_DRSBind, then calls any
other drsuapi method on that DC, passing the DRS_HANDLE as the first parameter. The client's
DRS_HANDLE remains valid for making method calls until the client calls IDL_DRSUnbind, or until
the server unilaterally invalidates the DRS_HANDLE (for example, by crashing).
The only state associated with a DRS_HANDLE is the state established by IDL_DRSBind. This state
is immutable for as long as the DRS_HANDLE remains valid. Therefore, if a client creates two
binding handles to the same DC by using the same parameters to IDL_DRSBind, the server
behavior of a drsuapi method is not affected by the client's choice of binding handle passed to the
method.
Because the state associated with a DRS_HANDLE is immutable so long as the DRS_HANDLE
remains valid, there are no special considerations involved in making concurrent method calls
using the same DRS_HANDLE; the client is free to make concurrent method calls.
Two methods use the "cookie" design pattern. In this pattern, the client sends an initial request
containing a designated null value for a certain parameter. The server response contains a value
that is opaque to the client or contains the designated null value. If the value is not null, and the
response indicates that another client request is required to complete some higher-level operation,
the client sends the opaque value returned by the server in the next request rather than sending
the designated null value. The exchange of requests and responses continues until some response
indicates that the higher-level operation is complete.
IDL_DRSGetNCChanges: In this instance of the "cookie" pattern, the server returns a "cookie"
in the response that completes the higher-level operation. The client can use this cookie at the
start of the next higher-level operation. The higher-level operation is a complete replication
38 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cycle that improves the client's up-to-date vector. See section 4.1.10.1 for an explanation
of replication cycles.
Otherwise, all method requests are independent, apart from their dependencies on the state of the
directory. The potential dependencies are varied, and understanding them requires
understanding the state model specified in [MS-ADTS] section 3.1.1. Here are some examples:
State-based sequencing issues also exist between methods specified in this document and LDAP,
because LDAP provides another way to change the state of the directory.
dwInVersion=2, and
InfoType=DS_REPL_INFO_METADATA_FOR_ATTR_VALUE, or
DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE, or DS_REPL_INFO_CURSORS_2_FOR_NC,
or DS_REPL_INFO_CURSORS_3_FOR_NC.
For the first call to this method for a specific InfoType, the client sets dwEnumerationContext in
pmsgIn to zero. The server returns an implementation-specific value for dwEnumerationContext in
39 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut. On subsequent calls to this method with the same InfoType, the client sets the input
dwEnumerationContext in pmsgIn to the last value of that field returned from the server. The
purpose of this field is to allow the client to gather all the requested information, but in more than
one server call. The final call is identified when the method returns ERROR_NO_MORE_ITEMS. See
the server implementation section for IDL_DRSGetReplInfo (4.1.13.3) for exact details.
The role of the DRS_HANDLE type, described in the previous section (Sequencing Issues), plays a
central role in capability negotiation, as explained in the specification of IDL_DRSBind.
The type that is most central to this protocol is DSNAME. DSNAME is the concrete type for the
abstract DSNAME specified in [MS-ADTS] section 3.1.1.1.5. A DSNAME identifies an object. Nearly
every method in the DRS protocol contains a DSNAME either in its request or its response.
Another basic type in the DRS Remote Protocol is ENTINF. An ENTINF structure contains the DSNAME
of an object (or object to be) and a list of attributes with associated values–ATTRBLOCK ENTINF and
ATTRBLOCK are used in the following ways:
This protocol includes replication that is based on the IP protocol, which is implemented as the
IDL_DRSGetNCChanges method (section 4.1.10). Active Directory also supports replication based on
the SMTP protocol; SMTP-based replication is specified in [MS-SRPL].
40 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Some of the Active Directory state exposed by this protocol is also exposed by the Active Directory
implementation of LDAP; see [MS-ADTS] section 3.1.1.
Some methods in this protocol are exposed, in modified form, via LDAP. The LDAP versions are
specified in [MS-ADTS] section 3.1.1.3.
Controls: LDAP_SERVER_DIRSYNC_OID
The function of creating a crossRef object with IDL_DRSAddEntry can be performed as an LDAP
Add of a crossRef object.
1.5 Prerequisites/Preconditions
This protocol is based on RPC and therefore has the prerequisites identified in [MS-RPCE] as common
to all RPC interfaces.
The Active Directory service must be fully initialized as described in [MS-ADOD] section 2.6.
This protocol is appropriate for replicating (DC-to-DC only) and managing objects in a directory
service and for overall management of the directory service.
Supported Transports: RPC can be implemented on top of TCP and other protocol sequences as
described in section 2.1.
41 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Protocol Versions: Each of the protocol interfaces described in this document has a single
version number: 4.0 for drsuapi and 1.0 for dsaop.
This protocol uses Win32 error codes as defined in [MS-ERREF] section 2.2. Vendors SHOULD reuse
those values with their indicated meaning. Choosing any other value risks a collision in the future.
This protocol uses NTSTATUS values as defined in [MS-ERREF] section 2.3. Vendors can choose their
own values for this field, as long as the C bit (0x20000000) is set, indicating that it is a customer
code.
RPC interface UUID for dsaop methods 7c44d7d4-31d5-424c-bd5e- Section 4.2.1 – section
2b3e1f323d22 4.2.2
42 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
2 Message Transport
The following sections discuss RPC transport and security considerations for this protocol. Common
data types are defined and discussed in section 5. See section 3 for more details about the
organization of this protocol specification.
This protocol uses the following RPC protocol sequence: RPC over TCP as defined in [MS-RPCE]. A
server MAY listen on additional RPC protocol sequences. A client SHOULD attempt to connect using the
RPC-over-TCP protocol sequence.<1>
Implementations MUST use the UUIDs as specified in section 1.9. The RPC version number is 4.0 for
the drsuapi interface and 1.0 for the dsaop interface.
This section describes the security mechanisms used for this RPC-based protocol.
A DC authenticates using its service account. In AD DS, this is the Local System account on the
machine running the DC, represented by the computer object of the machine. In AD LDS, a DC's
service account is configured by the administrator.
In AD DS, connections for DC-to-DC communications MUST use mutual authentication and
encryption of protocol traffic. Mutual authentication is provided by Kerberos (see [MS-KILE] section
3.3.1).
In AD LDS, mutual authentication for DC-to-DC communications is not required. When a connection is
established, the client uses the GSS Negotiate protocol, which first attempts to use Kerberos, and if
Kerberos is unavailable, attempts NTLM (which does not give mutual authentication). If the msDS-
ReplAuthenticationMode attribute on the config NC root equals 2, all DCs in the AD LDS forest
require mutual authentication for DC-to-DC communications.
Connections from a non-DC client to a DC do not require mutual authentication. Therefore, NTLM is an
acceptable security provider in addition to Kerberos.
When a connection is established, the non-DC client uses the GSS Negotiate protocol, which first
attempts to use Kerberos and then, if Kerberos is unavailable, attempts NTLM (which does not give
mutual authentication).
In the absence of a trusted naming service, which maps service names to servers providing a given
service, the client of a distributed service must authenticate a service, not a server. The client
produces a service principal name (SPN), which is a name for the service it wants a connection to,
and the authentication system verifies that the server is a provider of the named service.
Kerberos verifies the services provided by a server by reading the servicePrincipalName attribute of
the server's computer object. The servicePrincipalName attribute contains a set of Unicode strings;
each string is an SPN. If the client produces an SPN that is not present on the computer object of the
server it has requested a connection to, the mutual authentication fails and so does the connection
attempt.
43 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Each DC maintains the values of the servicePrincipalName attribute on its own computer object.
For the protocols specified in this document, the SPN produced by a client differs for DC-to-DC
communications and non-DC-client-to-DC communications. The specific SPNs produced by a client in
each scenario are described in the following sections.
In either DC-to-DC or client-to-DC operations, to allow use of the DRS Remote Protocol when the RPC
endpoint mapper has been configured to disallow anonymous clients (see [MS-RPCE] section
3.1.1.1.3), the DC stores an SPN with the following format<2>:
In the preceding SPN description, <DSA GUID> is the DSA GUID of the DC and <DNS forest name>
is the FQDNs (2) of the forest of the DC.
This section describes the security and mutual authentication requirements for those DRS Remote
Protocol operations that involve DC-to-DC interactions.<3>
A DC client MUST authenticate the target DC by constructing an SPN for the service it is using. A DC
client constructs an SPN as described in the following section.
Two different scenarios are possible when an AD DS DC wants to connect to another DC for a DRS
protocol operation:
The scenario determines how the DC constructs an SPN for the service it is using:
A DC wants to connect to a GC server in the forest. The DC constructs the following SPN:
The forward slash ('/') is the literal separator between parts of the SPN.
<DRS interface GUID> is the fixed DRS RPC interface GUID, which has the well-known value of
"E3514235-4B06-11D1-AB04-00C04FC2DCD2".
44 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
<DNS domain name> is the FQDN (2) of the domain of the target DC.
<DNS forest name> is the FQDN of the forest of the target DC.
For example, the two SPNs that can be used for a DC named "dc1" with DSA GUID A5FF6869-AB5A-
11D2-91E2-08002BA3ED3B in the contoso.com domain and forest are as follows:
"E3514235-4B06-11D1-AB04-00C04FC2DCD2/A5FF6869-AB5A-11D2-91E2-
08002BA3ED3B/contoso.com"
"GC/dc1.contoso.com/contoso.com"
When an AD LDS DC wants to connect to another DC for a DRS protocol operation, it uses either of
the following SPN forms:
<DRS interface GUID> is the fixed DRS RPC interface GUID, which has the well-known value of
"E3514235-4B06-11D1-AB04-00C04FC2DCD2".
<DNS hostname> is the full DNS host name of the target DC.
The colon (':') is the literal separator between the host name and port number.
This section describes the security and mutual authentication requirements for those DRS Remote
Protocol operations that involve client-to-DC interactions.
45 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
2.2.4.1 Security Provider
To request authentication, a client program specifies the "GSS Negotiate" security provider
(RPC_C_AUTHN_GSS_NEGOTIATE). Regardless of whether mutual authentication is required, a client
MUST request integrity and encryption of the RPC messages by specifying an authentication level of
"packet privacy" (RPC_C_AUTHN_LEVEL_PKT_PRIVACY).
To authenticate the target DC, a client program constructs an SPN for the service it is using and
negotiates Kerberos as the security provider. A client constructs an SPN as described in the following
sections.
Three scenarios are possible when a client wants to connect to an AD DS DC for a DRS Remote
Protocol operation:
A client wants to connect to a particular DC by using its host name, regardless of the domain it
contains.
A client wants to connect to a GC server (see [MS-ADTS] section 3.1.1.1.10) in the forest.
The scenario determines how the client constructs an SPN for the service it is using:
A client wants to connect to a particular DC by using its host name, regardless of the domain it
contains. The client constructs any of the following three SPNs:
"ldap/<NetBIOS hostname>"
"ldap/<DNS hostname>"
The SPN that a client constructs depends on the information that the client has available. For
example, some clients have only a NetBIOS name for a DC, while others have only an Internet
host name for a DC.
A client wants to connect to a DC in a particular domain. The client constructs any of the following
three SPNs:
The SPN that a client constructs depends on the information that the client has available. For
example, some clients have only a NetBIOS name for a domain, while others have only a fully
qualified domain name (FQDN) (2) for a domain.
The forward slash ('/') is the literal separator between parts of the SPN.
46 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
<NetBIOS hostname> is the NetBIOS host name of the target DC.
<NetBIOS domain name> is the NetBIOS domain name of the target DC.
<DNS domain name> is the FQDN of the domain of the target DC.
<DSA GUID based DNS hostname> is the DNS host name of the target DC, constructed in the
form "<DSA GUID>._msdcs.<DNS forest name>".
<DNS forest name> is the FQDN of the forest of the target DC or the target GC server.
As an example, the two- and three-part SPNs that can be used for a DC named "dc1" in the
contoso.com domain are as follows:
"ldap/DC1"
"ldap/dc1.contoso.com"
"ldap/6B352A21-8622-4F6D-A5A9-45CE9D7A5FB7._msdcs.contoso.com"
"ldap/dc1.contoso.com/CONTOSO"
"ldap/dc1.contoso.com/contoso.com"
"GC/dc1.contoso.com/contoso.com"
"ldap/DC1/CONTOSO"
When a client wants to connect to an AD LDS DC for a DRS operation, it uses either of the following
SPN forms:
The forward slash ('/') is the literal separator between parts of the SPN.
<DNS hostname> is the full DNS host name of the target DC.
The colon (':') is the literal separator between the host name and port number.
47 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
store these two forms of SPN as values of the servicePrincipalName attribute of the object (in the
external AD DS domain) that corresponds to the security principal that the AD LDS service is
running as. This action allows mutual authentication to occur in "client-to-AD LDS DC" protocol
operations. When the requirements of this section are added to the requirements of section 2.2.3.3,
an AD LDS DC that stores SPNs stores four servicePrincipalName values in all.
This protocol is part of the Active Directory core family of protocols. To be fully compliant with Active
Directory, an implementation of this protocol must be used in conjunction with the full Active Directory
schema, containing all the schema attributes and classes specified in [MS-ADA1], [MS-ADA2], [MS-
ADA3], [MS-ADLS], and [MS-ADSC].
48 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
3 Background to Behavior Specifications
In this document, information that is relevant to each particular RPC method is grouped with the
specification of the behavior for that method. Information that is relevant to a particular RPC method
includes: the IDL definition of that method, definitions for all types used exclusively by that method,
and examples specific to that method.
Most methods specified in this document have no special client considerations. In such cases, the
entire specification of the method behavior is the specification of server behavior.
In cases where client behavior is specified, the client behavior in preparing a request is specified in the
section immediately preceding the section that specifies server behavior, and the client behavior in
processing a response is specified in the section immediately following the section that specifies server
behavior. This ordering follows the flow of processing a request.
The behavior specification for some methods is followed immediately by one or more examples that
show a request as seen by the server implementation of the method, the corresponding response
created by the server implementation of the method, and the effect of server request processing on
the state of the directory. Section 3.5.1 specifies the initial state used by all examples.
In cases where a type used in a method request or response is common to several methods, that type
is placed in Common Data Types, Variables and Procedures (section 5). This section is arranged
alphabetically, and so its table of contents serves as an index. This section is placed after the section
that contains method behavior specifications, because typically a reader will reference the common
types while reading the method specifications, and not the other way around.
Sections of this document are not self-contained; they contain both forward and backward references,
all of which are hyperlinked. In addition, the following typographical convention is used to indicate the
special meaning of certain names:
No special typographical convention is used for names that represent elements of sets; for example,
DRS_WRIT_REP. The name of the set type (for example, DRS_OPTIONS) is always clear from context,
and the elements of each set type are defined with the set type. Similarly, no special typographical
convention is used for names that represent Windows error codes; for example,
ERROR_INVALID_PARAMETER.
49 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
3.3 State Model
3.3.1 Preliminaries
3.3.2 Transactions
The specifications of client and server method behavior in this document do not mention transaction
boundaries because all methods use transactions in a systematic way, as described in the remainder
of this section.
In server processing of a normal method, a transaction begins implicitly on the first access to the
database that represents the persistent state of the DC, and ends implicitly before a method returns.
When a new logical thread of control is created (see Asynchronous Processing in section 3.4.6), the
originating thread implicitly ends its transaction before it returns, and the new logical thread of control
implicitly begins an unconnected transaction as described above.
If a transaction fails, and the method return would otherwise have been successful, the Windows
error code returned by the method is in one of the following sets:
If server processing of a normal method performs some updates and then detects an error condition,
it terminates the current transaction before returning the error code that describes the error condition.
If the transaction termination encounters an error condition, the method does not report the
transaction-related error condition. Instead, the method reports the original error condition.
When the specification includes a client preparing a method request or processing a method response,
the pattern is similar. When a client that is a DC prepares a method request, it implicitly begins a
transaction on the first access to the database that represents the persistent state of the client DC and
commits this transaction before sending the request. When a client that is a DC processes a method
response, it implicitly begins a transaction on the first access to the database that represents the
persistent state of the DC and commits this transaction when processing of the response is complete.
A client transaction is never in progress while the client waits for the server to respond to a method
request. There is no use of distributed transactions.
A concrete type is a type whose representation must be standardized for interoperability. In this
protocol specification, three cases apply:
Types in the IDL definition of the drsuapi and dsaop RPC interfaces that determine the format of
network requests and responses.
50 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Types that are hand marshaled onto the network, such as types that are sent in drsuapi and dsaop
requests and responses as octet strings whose actual structure is hidden from the IDL compiler.
The hand marshaling and corresponding hand unmarshaling are performed by the implementation
of Active Directory and by clients of the drsuapi and dsaop RPC interfaces.
Types that are hand marshaled into directory attributes, such as types that are stored in the
directory as octet strings. The hand marshaling and corresponding hand unmarshaling are
performed by the implementation of Active Directory and by clients of the Active Directory LDAP
interface [MS-ADTS] section 3.1.1.3.
Concrete types in the first category are specified by the C / IDL type declaration. Concrete types in the
second and third categories are specified pictorially. Some types are in multiple categories and are
specified both ways.
All other types in the specification are abstract, meaning that their use is internal to the specification.
Abstract types are based on the standard mathematical concepts set, sequence, directed graph, and
tuple.
This specification introduces the notion of an abstract attribute. An abstract attribute is an Active
Directory attribute that has an abstract type for use in pseudocode. An abstract attribute can have a
specified concrete representation, required for interoperability; in that case, the abstract attribute's
type definition specifies the correspondence between information in the abstract type and in the
concrete type. This relieves the specification pseudocode from concerns with storage allocation,
packing variable-length information into structures, and so on.
Pseudocode deals with a mixture of concrete and abstract types. The notations and conventions for
each are specified in section 3.4.
Identifiers for concrete types, structure fields, and constants are used unchanged. The names of
concrete types are often uppercase, with underscore characters ('_') to mark the divisions between
words.
Identifiers for object classes and attributes are LDAP display names from [MS-ADA1], [MS-ADA2],
[MS-ADA3], and [MS-ADSC]. These identifiers start with a lowercase letter; there are no capitalization
conventions for the letters that follow the initial lowercase letter. These identifiers, used in this
document to improve the readability of the examples, are equivalent to the ATTRTYP (section 5.14)
that actually identifies object classes and attributes. The mapping between ATTRTYP and the schema
object representing a class or attribute is specified in [MS-ADTS] section 3.1.1.2.6.
Identifiers for types and procedures introduced for specification purposes always start with an
uppercase letter, and start each word after the first word with an uppercase letter (Pascal case).
Identifiers for variables introduced for specification purposes always start with a lowercase letter, and
start each word after the first word with an uppercase letter (camel case).
51 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
3.4.2 Language Constructs for Concrete Types
Concrete types support structure assignments between types that are not identical. For example:
reqV1: DRS_MSG_REPADD_V1
reqV2: DRS_MSG_REPADD_V2
reqV2 := reqV1
Such an assignment is shorthand for a field-by-field assignment for fields with the same name in the
two structures. The preceding example is equivalent to the following:
reqV1: DRS_MSG_REPADD_V1
reqV2: DRS_MSG_REPADD_V2
reqV2.pNC := reqV1.pNC
reqV2.rtSchedule := reqV1.rtSchedule
reqV2.ulOptions := reqV1.ulOptions
The ADR built-in function returns the address of a variable. The ADDRESS OF type constructor creates
a pointer type. These are needed occasionally when dealing with concrete structures.
Pseudocode does not perform storage allocation for concrete response structures. An implementation
is free to allocate any amount of memory sufficient to contain the structures within the response.
The notation [first .. last] stands for the subrange first, first+1, ... , last. The type byte is the
subrange [0.. 255].
A sequence is an indexed collection of variables, called the elements of the sequence. The elements all
have the same type. The index type of a sequence is a zero-based subrange. S[i] denotes the element
of the sequence S that corresponds to the value i of the index type. The number of elements in a
sequence S is denoted S.length. Therefore, the index type of a sequence S is [0 .. S.length-1].
A sequence type can be open (index type not specified) or closed (index type specified):
Therefore:
s := []
sets a sequence-valued variable s to the empty sequence. A sequence of bytes can be written in the
more compact string form shown in the following example:
s := "\x55\x06\x02"
52 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If S is a sequence, and j ≥ i, then S[i .. j] is a new sequence of length j - i + 1, whose first element
has value S[i], second element has value S[i + 1], ... , and final element has value S[j]. The index set
of the new sequence is [0 .. j - i]. If j < i then S[i .. j] is the empty sequence.
A tuple is a set of name-value pairs: [name1: value1, name2: value2, ... , namen: valuen] where namek
is an identifier and valuek is the value bound to that identifier. Tuple types are defined as in the
following example:
This example defines DSName as a tuple type with a DN-valued field dn, a GUID-valued field guid,
and a SID-valued field sid.
dsName: DSName
Fields that are unspecified in a tuple constructor are assigned null values in the resulting tuple.
Access to the named fields of a tuple uses dot notation. Continuing the example:
d := dsName.dn
g := dsName.guid
s := dsName.sid
A tuple deconstructor can be written anywhere a tuple-valued variable can occur. The preceding
assignments are equivalent to the following:
The language includes sets. If S is a set, number(S) is the cardinality of the set S.
Therefore:
S := {}
If S is a set, the predicate x in S is true if x is a member of S. Therefore, the value of the expression:
13 in {1, 2, 3, 5, 7, 11}
is false.
If A and B are sets, A + B is the set union of A and B, A ∩ B is the set intersection of A and B, and A -
B is the set difference of A and B.
53 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The specification uses [KNUTH1] section 2.3.4.2 as a reference for the graph-related terms directed
graph, oriented tree, vertex, arc, initial vertex, and final vertex. In pseudocode, graphs are described
in terms of their vertex and arc sets, and individual arcs are represented as tuples.
The language supports coercion between abstract and concrete types when the correspondence
between the two is clear. For example, if stringSet is a set of unicodestring and stringArrayPtr is a
pointer to an array of pointers to null-terminated Unicode strings, the assignment:
stringSet := stringArrayPtr^
populates the abstract set of strings by copying from the concrete array of strings.
if boolean-expr then
stmts
else
stmts
endif
if boolean-expr then
stmts
else if boolean-expr then : disambiguated by indentation
stmts
endif
while boolean-expr
stmts
endwhile
return expr
raise expr
The keyword raise is used to raise an RPC exception. The operand of the raise expression specifies
the RPC exception to be raised. Details of how an RPC exception is raised are specified in [C706]
section 12.6.4.7.
Other constructs used (inspired by Modula-3; for more information, see [NELSON]):
: declare a procedure
: with typed args and result
procedure name(arg: type, arg: type, ... , arg: type): type
: declare a procedure
: with call-by-reference args
procedure name(var arg: type, ... , var arg: type): type
54 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
var: type : declare a variable with a type
var := expr : assignment
expr^ : pointer dereferencing
expr.id : field selection
List of infix and prefix operator binding precedence (strongest binding at the top of the list):
a - b + c
means:
(a - b) + c
The infix Boolean operators "and" and "or" are evaluated left to right, conditionally. The expression "p
and q" is true if both p and q are true. If p is false, q is not evaluated. The expression "p or q" is true
if at least one of p and q are true. If p is true, q is not evaluated.
The specification contains many accesses to specific directory attributes. The specification uses the
following concise notation for these accesses to aid readability. If o is a variable that contains a
DSName or a DN, then:
o!attr
... is an access to the attr attribute of the object named by the content of o, performed in the context
of the NC replicas held by the server. In this notation, the name attr is a constant (like objectGUID),
not a variable.
If the form o!attr occurs in an expression context, it denotes a value. There are three possibilities:
If the attr attribute is not present on o, the value of the expression is the distinguished value null.
If the attr attribute is present and declared multivalued, the value of the expression is a set that
contains all the values of attr. If only one value is present, the value of the expression is a set that
contains one element, the value.
55 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If the attr attribute is present and declared single-valued, the value of the expression is the value
of attr.
If the form o!attr occurs on the left side of an assignment statement, it is used as a variable. The attr
attribute need not already be present on o for this assignment to be well defined. The assignment:
o!attr := null
The distinguished value null is an admissible value for any type that is stored as the value of an
attribute. Suppose, for example, that attr is a single-valued integer attribute. If attr is not present on
object o, the assignment:
i := o!attr
... assigns the value null to the integer variable i. There is no ambiguity between this use of null and
the use of null as the value of a pointer, because pointer values cannot be stored as the value of an
attribute.
Used where a sequence value is expected; it is equivalent to [], the empty sequence.
Used where a set value is expected; it is equivalent to {}, the empty set.
Used within a set constructor, where it adds no element to the resulting set.
The value null cannot be used in other expressions involving normal values. Therefore:
i: integer
s: set
i := o!attr
s := { o!attr }
if i = null then /* attr not present on object o */
s := s + o!attr
endif
... is a valid pseudocode sequence. If the attr attribute is not present on object o, the branch of the if
statement will be executed, and the set s is empty. But the statement:
i := o!attr * 2
Queries in this specification are expressed in one of the following two forms:
56 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
rt := select one scope where predicate
In either form of query, scope specifies the set of values or objects to be examined, and predicate
specifies the subset of the scope that is the query result.
... where var is an identifier to be used in the predicate, and set-of-values-or-objects is a set of values
or DSNames that designate objects. These sets can be the result of evaluating any expression; for
example, they can be the values of local set-valued variables. But usually they are sets of values or
objects from the directory; for example, in the following form:
... the scope is the set of all values of attribute attr on object o; by the definition of null, the scope is
the empty set if o!attr = null.
There are three special forms for scopes that are sets of objects:
Here, o is a DSName or DN valued variable. The form children o denotes the set of children of the
object o within the NC of o. This form does not include the object o itself. The form subtree o denotes
the set of all descendants of o within the NC of o, plus the object o itself. The form all denotes the set
of all objects in all NC replicas held by the server.
The predicate is an arbitrary predicate that uses the scoping identifier (var, noted earlier) as a
variable. The query is evaluated by binding each value or object (in arbitrary order) to var, and then
evaluating the predicate. If the predicate is true, the value or object is said to satisfy the predicate.
If the query takes the form "select all", the result of the evaluation is the set of all values or objects in
the scope that satisfy the predicate. If the scope is a set of values, the type of the result is a set of
values; otherwise, the type of the result is a set of DSName.
If the query takes the form "select one", the result of the evaluation is any single value or object that
satisfies the predicate, or null if no value or object satisfies the predicate. If more than one result is
possible, the result is nondeterministic. If the scope is a set of values, the type of the result is the
type of the value; otherwise, the type of the result is DSName.
57 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
In the "children / subtree / all" forms, as specified, the scope includes normal objects, not
tombstones. Adding the qualifier "-ts-included" to these forms expands the scope to include both
normal objects and tombstones. For example, the expression:
... returns the set that contains the DSNames of all objects and tombstones in the subtree that is
rooted at the DSName nc.
Several methods involve "asynchronous processing" in which a method initiates a separate logical
thread of control with some initial state, and then the method execution continues independently.
However, all the documented operations are synchronous operations as specified in [MS-RPCE]. No
documented operations make use of RPC-defined asynchronous processing.
The phrase "logical thread of control" suggests that asynchronous processing can be implemented in a
variety of ways, including message processing (where each message represents a logical thread of
control), "heavyweight" processes that have exclusive use of an address space, system-level multi-
threading within a single address space, thread pooling, and so on.
A method that uses asynchronous processing always returns its response immediately after initiating
the separate logical thread of control; there is never any interaction with the new logical thread of
control. The results of the new logical thread of control are visible only through its effects on the
database representing the persistent state of the DC. If the server crashes before the new logical
thread of control has completed all its documented effects, the new logical thread of control never has
any effects.
Asynchronous processing is always performed in the security context of the server itself, not the
security context of the client. Therefore, all necessary access checks MUST be performed before the
new logical thread of control is initiated.
This section specifies the test setup that is used for most of the examples presented in section 4. The
behavior of certain methods can be highlighted only by starting from a different state. The example
section for such a method specifies the difference between the initial state used for that example and
the state given here.
The configuration is a forest with two domains CONTOSO.COM (Forest Root Domain) and
ASIA.CONTOSO.COM (Domain NC):
Forest: CONTOSO.COM
The forest functional level is DS_BEHAVIOR_WIN2003 functional level; therefore only Windows
Server 2003 operating system or higher versions of DCs are present in the forest. All DCs are
running Windows Server 2003 Enterprise Edition.
58 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Domains:
Sites:
Default-First-Site-Name
Default-Second-Site-Name
DCs:
Domain: CONTOSO.COM
Domain: ASIA.CONTOSO.COM
Domain-joined computer:
Domain: CONTOSO.COM
Users added:
Domain: CONTOSO.COM
Domain: ASIA.CONTOSO.COM
Groups added:
Domain: CONTOSO.COM
objectSid: S-1-5-21-254470460-2440132622-709970653-1114
member: null
objectSid: S-1-5-32-544
59 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
3.5.2 Data Display Conventions
The typical (server behavior only) example shows an initial state, a request, a response, and a final
state.
The initial and final states highlight the changes for methods that perform updates. If the method is a
query, then only the initial state is shown.
States are rendered using the LDP tool. The LDP transcript shown has been edited slightly for clarity.
Specifically:
The "ld" and "&msg" are not shown for each search request. Nor is the "0" that means "typesOnly
= false".
The actual attribute list is shown, in italics, within square brackets. The LDP tool does not show it
in the transcript it produces.
The numeric constant that controls the search scope is replaced by its [RFC2251] name:
baseObject, singleLevel, or wholeSubtree.
assuming that the search requested that only the repsTo attribute be returned.
Requests and responses are rendered by using the Windows debugger in the context of the server (for
server behavior) or client (for client behavior), with editing of the transcript for clarity. The following
two edits are performed consistently:
Where the value of a parameter is a binary large object (BLOB), the value is not shown, but
instead expressed as binary blob.
The server MUST start the RPC service to listen on the incoming RPC. For server configurations, see
section 2.1.
It is possible to run multiple AD LDS DCs on the same computer. All of these AD LDS DCs listen on
the same RPC interface ID. So that clients can distinguish between different instances of AD LDS that
are running on the same computer, each RPC endpoint is annotated (as specified in [C706]) with a
string containing the LDAP port number on which the DC listens. For example, if two AD LDS DCs are
running on a computer, with one listening on port 389 and the other listening on port 50000, the RPC
endpoints of the AD LDS DCs are annotated with "389" and "50000", respectively.
For a client to establish an RPC connection to an AD LDS DC, the client needs to know the name of the
computer and the number of the LDAP port on which the AD LDS DC is listening. First, the client
establishes a connection to the endpoint mapper service on the computer. Next, the client enumerates
all endpoints that are registered for the desired interface ID. Finally, the client selects the endpoint
whose annotation equals the LDAP port number of the desired AD LDS DC.
60 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
AD DS DCs do not annotate their RPC endpoints. RPC endpoint annotation is not required for AD DS,
because it is not possible to run multiple AD DS DCs on a computer.
61 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4 RPC Methods and Their Behavior
The methods for the drsuapi RPC interface are described in section 4.1.
The methods for the dsaop RPC interface are described in section 4.2.
This section specifies the methods for the drsuapi RPC interface of this protocol and the processing
rules for the methods.<5>
Method Description
IDL_DRSBind Creates a context handle necessary to call any other method in this interface.
Opnum: 0
IDL_DRSUpdateRefs Adds or deletes a value from the repsTo attribute of a specified NC replica.
Opnum: 4
IDL_DRSGetNT4ChangeLog Returns a sequence of PDC change log entries or the Windows NT 4.0 operating
system replication state.
Opnum: 11
IDL_DRSCrackNames Looks up each of a set of objects in the directory and returns it to the caller in
the requested format.
Opnum: 12
62 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Method Description
IDL_DRSExecuteKCC Validates the replication interconnections of DCs and updates them if necessary.
Opnum: 18
IDL_DRSAddSidHistory Adds one or more SIDs to the sIDHistory attribute of a given object.
Opnum: 20
IDL_DRSGetObjectExistence Helps the client check the consistency of object existence between its replica of
an NC and the server's replica of the same NC.
Opnum: 23
IDL_DRSQuerySitesByCost Determines the communication cost from a "from" site to one or more "to"
sites.
Opnum: 24
IDL_DRSInitDemotion Performs the first phase of the removal of a DC from an AD LDS forest.
Opnum: 25
IDL_DRSReplicaDemotion Replicates off all changes to the specified NC and moves any FSMOs held to
another server.
Opnum: 26
IDL_DRSAddCloneDC Creates a new domain controller object by copying attributes from an existing
domain controller object.
Opnum: 28
63 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The methods will affect only the directory instance that is bound to the current context. If a server has
several directory instances installed, the other instances will remain unchanged.
The following considerations apply to the order of method calls. See section 1.3.2 for details.
IDL_DRSBind must be called before any other method in order to obtain a context handle.
After the IDL_DRSUnbind method is called, the context handle that was passed to IDL_DRSUnbind
cannot be used for other method calls.
All other method calls are independent, apart from their dependencies on the state of the
directory.
Because the order of method call is generally nonsequential (except as noted above), the method
sections following this section are arranged alphabetically by method name.
ULONG IDL_DRSAddEntry(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ADDENTRYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDENTRYREPLY* pmsgOut
);
hDrs: The RPC context handle that is returned by the IDL_DRSBind method.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.1.1.1 DRS_MSG_ADDENTRYREQ
The DRS_MSG_ADDENTRYREQ union defines the request messages that are sent to the
IDL_DRSAddEntry method.
typedef
[switch_type(DWORD)]
union {
64 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)]
DRS_MSG_ADDENTRYREQ_V1 V1;
[case(2)]
DRS_MSG_ADDENTRYREQ_V2 V2;
[case(3)]
DRS_MSG_ADDENTRYREQ_V3 V3;
} DRS_MSG_ADDENTRYREQ;
4.1.1.1.2 DRS_MSG_ADDENTRYREQ_V1
typedef struct {
[ref] DSNAME* pObject;
ATTRBLOCK AttrBlock;
} DRS_MSG_ADDENTRYREQ_V1;
4.1.1.1.3 DRS_MSG_ADDENTRYREQ_V2
typedef struct {
ENTINFLIST EntInfList;
} DRS_MSG_ADDENTRYREQ_V2;
4.1.1.1.4 DRS_MSG_ADDENTRYREQ_V3
typedef struct {
ENTINFLIST EntInfList;
DRS_SecBufferDesc* pClientCreds;
} DRS_MSG_ADDENTRYREQ_V3;
4.1.1.1.5 DRS_MSG_ADDENTRYREPLY
65 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_ADDENTRYREPLY union defines the response messages received from the
IDL_DRSAddEntry method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_ADDENTRYREPLY_V1 V1;
[case(2)]
DRS_MSG_ADDENTRYREPLY_V2 V2;
[case(3)]
DRS_MSG_ADDENTRYREPLY_V3 V3;
} DRS_MSG_ADDENTRYREPLY;
4.1.1.1.6 DRS_MSG_ADDENTRYREPLY_V1
The DRS_MSG_ADDENTRYREPLY_V1 structure defines the response message received from the
IDL_DRSAddEntry method. This response version is obsolete.<7>
typedef struct {
GUID Guid;
NT4SID Sid;
DWORD errCode;
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} DRS_MSG_ADDENTRYREPLY_V1;
errCode: 0 if successful or a DIRERR error code (section 4.1.1.1.25) if a fatal error occurred.
4.1.1.1.7 DRS_MSG_ADDENTRYREPLY_V2
The DRS_MSG_ADDENTRYREPLY_V2 structure defines the response message received from the
IDL_DRSAddEntry method.
typedef struct {
[unique] DSNAME* pErrorObject;
DWORD errCode;
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
66 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[range(0,10000)] ULONG cObjectsAdded;
[size_is(cObjectsAdded)] ADDENTRY_REPLY_INFO* infoList;
} DRS_MSG_ADDENTRYREPLY_V2;
pErrorObject: Null, or the identity of the object that was being added when an error occurred.
infoList: The identities of the added objects. The item order matches the item order of values in the
EntInfList field in the request structure.
4.1.1.1.8 DRS_MSG_ADDENTRYREPLY_V3
The DRS_MSG_ADDENTRYREPLY_V3 structure defines the response message received from the
IDL_DRSAddEntry method.
typedef struct {
DSNAME* pdsErrObject;
DWORD dwErrVer;
[switch_is(dwErrVer)] DRS_ERROR_DATA* pErrData;
[range(0,10000)] ULONG cObjectsAdded;
[size_is(cObjectsAdded)] ADDENTRY_REPLY_INFO* infoList;
} DRS_MSG_ADDENTRYREPLY_V3;
pdsErrObject: Null, or the identity of the object that was being added when an error occurred.
infoList: The identities of the added objects. The item order matches the item order of values in the
EntInfList field in the request structure.
4.1.1.1.9 ADDENTRY_REPLY_INFO
typedef struct {
GUID objGuid;
NT4SID objSid;
} ADDENTRY_REPLY_INFO;
67 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.1.1.10 DIRERR_DRS_WIRE_V1
The DIRERR_DRS_WIRE_V1 union defines the error that occurred during processing of a request sent
to the IDL_DRSAddEntry method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
ATRERR_DRS_WIRE_V1 AtrErr;
[case(2)]
NAMERR_DRS_WIRE_V1 NamErr;
[case(3)]
REFERR_DRS_WIRE_V1 RefErr;
[case(4)]
SECERR_DRS_WIRE_V1 SecErr;
[case(5)]
SVCERR_DRS_WIRE_V1 SvcErr;
[case(6)]
UPDERR_DRS_WIRE_V1 UpdErr;
[case(7)]
SYSERR_DRS_WIRE_V1 SysErr;
} DIRERR_DRS_WIRE_V1;
RefErr: Referral.
4.1.1.1.11 ATRERR_DRS_WIRE_V1
typedef struct {
DSNAME* pObject;
ULONG count;
PROBLEMLIST_DRS_WIRE_V1 FirstProblem;
} ATRERR_DRS_WIRE_V1;
pObject: The identity of the object being processed when the error occurred.
4.1.1.1.12 PROBLEMLIST_DRS_WIRE_V1
68 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} PROBLEMLIST_DRS_WIRE_V1;
4.1.1.1.13 INTFORMPROB_DRS_WIRE_V1
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
ATTRTYP type;
BOOL valReturned;
ATTRVAL Val;
} INTFORMPROB_DRS_WIRE_V1;
type: The attribute that was being processed when the error occurred.
4.1.1.1.14 NAMERR_DRS_WIRE_V1
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
DSNAME* pMatched;
} NAMERR_DRS_WIRE_V1;
4.1.1.1.15 REFERR_DRS_WIRE_V1
69 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The REFERR_DRS_WIRE_V1 structure defines a referral to other DCs.
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
CONTREF_DRS_WIRE_V1 Refer;
} REFERR_DRS_WIRE_V1;
4.1.1.1.16 NAMERESOP_DRS_WIRE_V1
typedef struct {
UCHAR nameRes;
UCHAR unusedPad;
USHORT nextRDN;
} NAMERESOP_DRS_WIRE_V1;
4.1.1.1.17 DSA_ADDRESS_LIST_DRS_WIRE_V1
The DSA_ADDRESS_LIST_DRS_WIRE_V1 structure defines a linked list entry for a referral network
name.
4.1.1.1.18 CONTREF_DRS_WIRE_V1
The CONTREF_DRS_WIRE_V1 structure defines a linked list entry for a continuation referral.
70 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DSA_ADDRESS_LIST_DRS_WIRE_V1* pDAL;
struct CONTREF_DRS_WIRE_V1* pNextContRef;
BOOL bNewChoice;
UCHAR choice;
} CONTREF_DRS_WIRE_V1;
refType: The type of referral. This field MUST be one of the following values.
Value Meaning
pDAL: A list of network names of the DCs to which the referral is directed.
choice: The choice to use in the continuation referral. This field MUST be one of the following values:
Value Meaning
4.1.1.1.19 SECERR_DRS_WIRE_V1
typedef struct {
71 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SECERR_DRS_WIRE_V1;
4.1.1.1.20 SVCERR_DRS_WIRE_V1
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SVCERR_DRS_WIRE_V1;
4.1.1.1.21 UPDERR_DRS_WIRE_V1
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} UPDERR_DRS_WIRE_V1;
4.1.1.1.22 SYSERR_DRS_WIRE_V1
typedef struct {
DWORD dsid;
72 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SYSERR_DRS_WIRE_V1;
4.1.1.1.23 DRS_ERROR_DATA
The DRS_ERROR_DATA union defines the error responses that are received from the
IDL_DRSAddEntry method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_ERROR_DATA_V1 V1;
} DRS_ERROR_DATA;
4.1.1.1.24 DRS_ERROR_DATA_V1
The DRS_ERROR_DATA_V1 structure defines the error response received from the IDL_DRSAddEntry
method.
typedef struct {
DWORD dwRepError;
DWORD errCode;
[switch_is(errCode)] DIRERR_DRS_WIRE_V1* pErrInfo;
} DRS_ERROR_DATA_V1;
errCode: A DIRERR code (section 4.1.1.1.25) that specifies the error category.
The DIRERR codes classify an error that occurs during a search for, or the update of, a directory
object.
73 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value and symbolic name Description
0x00000003 Referral.
referralError
The PROBLEM error codes describe the problems that can be reported by an update operation.
0x000003EE Attribute or value already exists (multiple values specified for a single-
PR_PROBLEM_ATT_OR_VALUE_EXISTS valued attribute OR duplicate value specified for a multi-valued
attribute).
74 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value and symbolic name Description
75 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value and symbolic name Description
4.1.1.2.1 ConstructReplSpn
procedure ConstructReplSpn(
dnsHostName: unicodestring,
guid: GUID): unicodestring
This procedure returns a replication SPN with the given DNS host name (in dnsHostName) and
GUID (in guid). The service class of the resulting SPN is DRS_SPN_CLASS. For example, given
dnsHostName = "dc-01.fabrikam.com" and guid being the GUID whose string representation is
"{d66e9688-66a5-4a52-8af2-17b110febe0c}", the return value is:
E3514235-4B06-11D1-AB04-00C04FC2DCD2/d66e9688-66a5-4a52-8af2-17b110febe0c/dc-
01.fabrikam.com
4.1.1.2.2 CreateCrossRef
procedure CreateCrossRef(
hDrs: DRS_HANDLE,
e: ENTINF,
pmsgOut: ADDRESS OF DRS_MSG_ADDENTRYREPLY,
ver: DWORD,
info: ADDRESS OF ADDENTRY_REPLY_INFO): boolean
Informative summary of behavior: This procedure creates a crossRef object. If the crossRef object
exists already in a disabled state, it will mark the crossRef object as enabled.
76 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
prefixTable := NewPrefixTable()
/* Check whether the crossRef object for the given ncName exists. */
cr := select one v from subtree ConfigNC()
where v!ncName = ncNameV and crossRef in v!objectClass
cr!dnsRoot := dnsRootV
77 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
return true
4.1.1.2.3 CreateNtdsDsa
procedure CreateNtdsDsa(
hDrs: DRS_HANDLE,
e: ENTINF,
entList: ADDRESS OF ENTINFLIST,
pmsgOut: ADDRESS OF DRS_MSG_ADDENTRYREPLY,
ver: DWORD,
info: ADDRESS OF ADDENTRY_REPLY_INFO): boolean
domainName := GetDomainNameFromEntinf(e)
78 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if not accessAllowed then
SetErrorData(SV_PROBLEM_DIR_ERROR, serviceError,
ERROR_ACCESS_DENIED, pmsgOut, ver)
return false
endif
correctOrder := DoAttributesSatisfyPreCheckForCreateNtdsDsa (entList)
79 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
return true
4.1.1.2.4 UseCredsForAccessCheck
procedure UseCredsForAccessCheck(creds: DRS_SecBufferDesc): DWORD
This procedure gets authorization information for a client (using the ClientAuthorizationInfo abstract
type, which is a security token) by authenticating the given credentials. Any access checks performed
during the remainder of the RPC call are performed against this information.
4.1.1.2.5 IsDomainToBeCreated
procedure IsDomainToBeCreated(
entList: ADDRESS OF ENTINFLIST,
ncName: DSName): boolean
This procedure searches all the ENTINF values in entList for any request to create a crossRef object cr
such that cr!nCName = ncName. It returns true if such a cr is found; otherwise, it returns false.
4.1.1.2.6 GetDomainNameFromEntinf
procedure GetDomainNameFromEntinf(e: ENTINF): DSName
Informative summary of behavior: This procedure examines the values for the hasMasterNCs
attribute found in e and returns the domain NC. The hasMasterNCs attribute always contains the
dsnames of the schema NC, the config NC, and the default domain NC of the DC represented by e.
The domain NC is identified by a process of elimination.
prefixTable: PrefixTable
attr:ATTR
j:DWORD
prefixTable := NewPrefixTable()
return null
4.1.1.2.7 ENTINF_GetAttribute
procedure ENTINF_GetAttribute (
entInf: ENTINF,
attribute: ATTRTYP,
prefixTable: PrefixTable
): ATTR
80 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Informative summary of behavior: The ENTINF_GetAttribute procedure scans an ENTINF structure and
returns the first ATTR structure for the requested attribute. The attribute parameter is based on
dc.prefixTable, while the attributes within entInf are based on the prefixTable parameter.
attrType: ATTRTYP
oid : OID
oid := OidFromAttid(dc.prefixTable, attribute)
attrType := MakeAttid(prefixTable, oid)
4.1.1.2.8 SetErrorData
procedure SetErrorData(
problem: USHORT,
errCode: ULONG,
extendedError: ULONG,
pmsgOut: ADDRESS OF DRS_MSG_ADDENTRYREPLY,
version: ULONG)
This procedure sets the error message fields of pmsgOut: the problem, errCode, and extendedErr
fields of pmsgOut^.V2 if version = 2 or the pErrData field of pmsgOut^.V3 if version = 3. If
problem, errCode, and extendedError are all 0, the error information is the result of the last call to
PerformAddOperation or PerformAddOperationAsSystem.
4.1.1.2.9 ClientIpMatch
procedure ClientIpMatch(
hDrs: DRS_HANDLE,
dnsRoot: set of unicodestring): boolean
This function returns true if the IP address of the client with DRS_HANDLE hDrs matches one of the IP
addresses of the DNS host names in the set dnsRoot.
4.1.1.2.10 PerformModifyEntInf
procedure PerformModifyEntInf(
hDrs: DRS_HANDLE,
e: ENTINF,
info: ADDRESS OF ADDENTRY_REPLY_INFO): boolean
This function performs a modify operation on the object e.pName^. It enforces all security, schema,
and other constraints and follows all processing rules as used by the LDAP modify operation (see
[MS-ADTS]). The objectGUID and objectSid of the object being modified are returned in the info
output structure. If the operation succeeds, PerformModifyEntInf returns true. If the operation fails for
some reason, PerformModifyEntInf sets an appropriate error code (as defined by the LDAP modify
operation) in the info structure, and returns false.
4.1.1.2.11 DoAttributesSatisfyPreCheckForCreateNtdsDsa
procedure DoAttributesSatisfyPreCheckForCreateNtdsDsa(
e: ENTINF): Boolean
81 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
This procedure searches the ENTINF to verify that if both attributes hasMasterNCs and msDS-
hastMasterNCs are present, that msDS-hasMasterNCs comes before hasMasterNCs in the attribute
order. False is returned if both are present but in the wrong order; otherwise true is
returned.
Informative summary of behavior: A disabled crossRef object cr is one with cr!Enabled = false.
Enabling a disabled crossRef object cr means setting cr!nCName and cr!dnsRoot, and removing
cr!Enabled.
This method enables, creates, or modifies one or more objects, as requested by the client, in a single
transaction. It enables crossRef objects, creates crossRef objects and nTDSDSA objects, and modifies
arbitrary objects. The client uses an ENTINF structure to specify the state of each enabled, created, or
modified object:
Enabling a crossRef object: The dnsRoot attribute of a disabled crossRef object contains a set of
one or more DNS host names, expressed as Unicode strings. The request to enable a crossRef
object succeeds only if the IP address of the client that is making the request matches the IP
address of one of the DNS host names in the dnsRoot attribute. When a disabled crossRef object is
enabled through this method, the server is not required to be the Domain Naming Master FSMO
role owner.
The client has to specify the nCName and dnsRoot attributes. The trustParent and rootTrust
attributes are optional.
Creating a crossRef object: If the request creates a crossRef object, it succeeds only if the server
owns the forest's Domain Naming Master FSMO role. The access check is the same as when a
crossRef object is created through LDAP.
The client specifies the same attributes that are required during an LDAP Add of a crossRef object,
namely the new object's DN, plus all must-have attributes of the crossRef class. See [MS-ADTS]
section 6.1.1.2.1.1 for the specification of crossRef objects.
Creating an nTDSDSA object: Creating an nTDSDSA object is not possible with LDAP. To create an
nTDSDSA object, the hasMasterNCs attribute in the request has to identify the forest's schema
NC and config NC, and the DC's default NC; that is, the domain of the DC corresponding to the
new nTDSDSA object. If the default NC exists on the server as the nTDSDSA object is being
created by IDL_DRSAddEntry, the client has to have the control access right DS-Replication-
Manage-Topology on the default NC. Otherwise, the client has to have the right to enable or
create the crossRef object that corresponds to the default NC, and has to enable or create this
crossRef object in the same IDL_DRSAddEntry request.
The client specifies the new object's DN, plus the hasMasterNCs attribute. To create an nTDSDSA
object for a functional DC, the request will contain invocationId, dMDLocation, options, msDS-
Behavior-Version, and systemFlags. See [MS-ADTS] section 6.1.1.2.2.1.2.1.1 for the specification
of nTDSDSA objects.
If the serverReference attribute is given a value in the request, the computer object to which the
serverReference attribute points is updated with a new replication SPN.
Modifying an object: To modify an existing object (other than enabling a crossRef object), the
client-supplied ENTINF structure includes ENTINF_REMOTE_MODIFY in the ulFlags field and
specifies the modified attributes and their values. The client has to have the same rights as those
needed to perform the modification via LDAP. The DC enforces the same schema and other
constraints on the modification as if performed via LDAP. Performing the modification by using
IDL_DRSAddEntry rather than LDAP allows changes to multiple objects to be made in a single
transaction.<8>
82 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ULONG
IDL_DRSAddEntry(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ADDENTRYREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDENTRYREPLY *pmsgOut)
ext: DRS_EXTENSIONS_INT
pEntInfList: ADDRESS OF ENTINFLIST
pClientCreds: ADDRESS OF DRS_SecBufferDesc
objCls : ATTRTYP
ncNameV: DSName
infoList: ADDENTRY_REPLY_INFO
cObjects: ULONG
res: boolean
prefixTable: PrefixTable
ValidateDRSInput(hDrs, 17)
/* Validate parameters. */
if not (dwInVersion in {2,3}) then
SetErrorData(SV_PROBLEM_UNAVAILABLE, 0, ERROR_DS_UNAVAILABLE,
pmsgOut, 2)
return 0
endif
83 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cObjects := 0
if dwInVersion = 2 then
pEntInfList := pmsgIn^.V2.EntInfList
pClientCreds := null
else
pEntInfList := pmsgIn^.V3.EntInfList
pClientCreds := pmsgIn^.V3.pClientCreds
endif
/* Walk through each item in the EntInfList and perform the requested
* operation. */
e := pEntInfList
while e ≠ null
if ENTINF_REMOTE_MODIFY in e^.ulFlags then
if DSAObj()!msDS-Behavior-Version ≥ DS_BEHAVIOR_WIN2008 then
res := PerformModifyEntInf(
hDrs, e^.Entinf, ADR(infoList[cObjects]))
if not res then
return 0
endif
else
/* Not supported (Win2k3 or older DC). */
SetErrorData(SV_PROBLEM_UNAVAILABLE,
0,
ERROR_DS_UNAVAILABLE,
pmsgOut,
pdwOutVersion^)
return 0
endif
else
objCls := ENTINF_GetValue(e^.Entinf, objectClass, prefixTable)
if objCls = crossRef then
/* Create or enable a crossRef object. */
res := CreateCrossRef(hDrs, e^.Entinf, psmgOut, pdwOutVersion^,
ADR(infoList[cObjects]))
if not res then
return 0
endif
else if objCls = nTDSDSA then
/* Create an nTDSDSA object. */
res := CreateNtdsDsa(hDrs, e^.Entinf, pEntInfList, pmsgOut,
pdwOutVersion^, ADR(infoList[cObjects]))
if not res then
return 0
endif
else
/* Not supported. */
SetErrorData(SV_PROBLEM_BUSY, 0, ERROR_DS_DRA_INVALID_PARAMETER,
pmsgOut, pdwOutVersion^)
return 0
endif
endif
e := e^.pNextEntInf
cObjects := cObjects + 1
endwhile
if pdwOutVersion^ = 2 then
pmsgOut^.V2.cObjectsAdded := cObjects
pmsgOut^.V2.infoList := infoList
84 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else
pmsgOut^.V3.cObjectsAdded := cObjects
pmsgOut^.V3.infoList := infoList
endif
return 0
The IDL_DRSAddSidHistory method adds one or more SIDs to the sIDHistory attribute of a given
object.
ULONG IDL_DRSAddSidHistory(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ADDSIDREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDSIDREPLY* pmsgOut
);
dwInVersion: Version of the request message. Must be set to 1, because no other version is
supported.
pdwOutVersion: Pointer to the version of the response message. The value must be 1, because no
other version is supported.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.2.1.1 DRS_MSG_ADDSIDREQ
The DRS_MSG_ADDSIDREQ union defines the request messages that are sent to the
IDL_DRSAddSidHistory method. Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_ADDSIDREQ_V1 V1;
} DRS_MSG_ADDSIDREQ;
85 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.2.1.2 DRS_MSG_ADDSIDREQ_V1
typedef struct {
DWORD Flags;
[string] WCHAR* SrcDomain;
[string] WCHAR* SrcPrincipal;
[string, ptr] WCHAR* SrcDomainController;
[range(0,256)] DWORD SrcCredsUserLength;
[size_is(SrcCredsUserLength)] WCHAR* SrcCredsUser;
[range(0,256)] DWORD SrcCredsDomainLength;
[size_is(SrcCredsDomainLength)]
WCHAR* SrcCredsDomain;
[range(0,256)] DWORD SrcCredsPasswordLength;
[size_is(SrcCredsPasswordLength)]
WCHAR* SrcCredsPassword;
[string] WCHAR* DstDomain;
[string] WCHAR* DstPrincipal;
} DRS_MSG_ADDSIDREQ_V1;
SrcDomain: Name of the domain to query for the SID of SrcPrincipal. The domain name can be
an FQDN (1) or a NetBIOS name.
SrcPrincipal: Name of a security principal (user, computer, or group) in the source domain. This
is the source security principal, whose SIDs will be added to the destination security principal. If
Flags contains DS_ADDSID_FLAG_PRIVATE_CHK_SECURE, this parameter is not used and is not
validated. Otherwise, if Flags does not contain DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ, this
name is a domain-relative Security Accounts Manager (SAM) name. Otherwise, it is a DN.
SrcDomainController: Name of the primary domain controller (PDC) (or PDC role owner) in
the source domain. The DC name can be an Internet host name or a NetBIOS name. This
parameter is only used when Flags contains neither DS_ADDSID_FLAG_PRIVATE_CHK_SECURE
nor DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ. If Flags contains
DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ, this parameter is not used, but it is validated.
SrcCredsUser: User name for the credentials to be used in the source domain.
SrcCredsDomain: Domain name for the credentials to be used in the source domain. The domain
name can be an FQDN (1) or a NetBIOS domain name.
DstDomain: Name of the destination domain in which DstPrincipal resides. The domain name can
be an FQDN (1) or a NetBIOS name.
DstPrincipal: Name of a security principal (user, computer, or group) in the destination domain. This
is the destination principal, to which the source principal's SIDs will be added. If Flags contains
DS_ADDSID_FLAG_PRIVATE_CHK_SECURE, this parameter is not used and is not validated.
Otherwise, if Flags does not contain DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ, this name is a
domain-relative SAM name. Otherwise, it is a DN.
86 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.2.1.3 DRS_MSG_ADDSIDREPLY
The DRS_MSG_ADDSIDREPLY union defines the response messages received from the
IDL_DRSAddSidHistory method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_ADDSIDREPLY_V1 V1;
} DRS_MSG_ADDSIDREPLY;
4.1.2.1.4 DRS_MSG_ADDSIDREPLY_V1
The DRS_MSG_ADDSIDREPLY_V1 structure defines the response message received from the
IDL_DRSAddSidHistory method.
typedef struct {
DWORD dwWin32Error;
} DRS_MSG_ADDSIDREPLY_V1;
4.1.2.1.5 DRS_ADDSID_FLAGS
The DRS_ADDSID_FLAGS type consists of bit flags that indicate how the SID is to be added to the
security principal.
The valid bit flags are shown in the following diagram. The flags are represented in little-endian byte
order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X X X X X X X X X X X X X X X X X X X D C X X X X X X
E S
L
87 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.2.2 Method-Specific Abstract Types and Procedures
4.1.2.2.1 ConnectionCtx
The ConnectionCtx abstract type represents a connection to a specific server with a given set of
credentials. It does not imply any particular protocol or transport. It provides a means for pseudocode
to compactly represent the notion of the target server and corresponding credentials for an operation.
Procedures that take a ConnectionCtx as an input perform their operations against the server
represented by the ConnectionCtx, using the credentials associated with the ConnectionCtx.
4.1.2.2.2 ConnectToDC
procedure ConnectToDC(dcname: unicodestring): ConnectionCtx
Creates a ConnectionCtx for the DC named by dcname, associating the credentials of the client's
security context, which MUST be retrieved using the method described in [MS-RPCE] section
3.3.3.4.3, with the ConnectionCtx. dcname can be the Internet host name or the NetBIOS name of
the DC. If the ConnectionCtx cannot be created, the procedure returns null.
4.1.2.2.3 ConnectToDCWithCreds
procedure ConnectToDCWithCreds(
dcname: unicodestring,
username: unicodestring,
pwd: unicodestring,
domain: unicodestring): ConnectionCtx
Creates a ConnectionCtx for the DC named by dcname, associating the credentials of user username,
password pwd, and user-domain domain with the ConnectionCtx. dcname can be the Internet host
name or the NetBIOS name of the DC. If the ConnectionCtx cannot be created, it returns null.
4.1.2.2.4 GenerateFailureAudit
procedure GenerateFailureAudit()
Generates a failure audit event on the server on which it is called if auditing is enabled. The generated
audit event indicates that an operation failed. This procedure does nothing if auditing is not enabled.
The content of the audit event is an implementation-specific behavior.
4.1.2.2.5 GenerateSuccessAudit
procedure GenerateSuccessAudit()
Generates a success audit event on the server on which it is called if auditing is enabled. The
generated audit event indicates that an operation succeeded. This procedure does nothing if auditing
is not enabled. The content of the audit event is an implementation-specific behavior.
4.1.2.2.6 GenerateSuccessAuditRemotely
procedure GenerateSuccessAuditRemotely(ctx: ConnectionCtx): boolean
If auditing is enabled on the server associated with ctx, the GenerateSuccessAuditRemotely procedure
generates a success audit event on that server and returns true. The generated audit event indicates
88 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
that an operation succeeded. Returns false if auditing is not enabled on that server. The content of the
audit event is an implementation-specific behavior.<9>
4.1.2.2.7 GetKeyLength
procedure GetKeyLength(hDrs: DRS_HANDLE): integer
Returns the key length, in bits, of the encryption used on the hDrs connection. Returns 0 if no
encryption is in use on the connection.
4.1.2.2.8 FindGC
procedure FindGC(): unicodestring
Returns the Internet host name of a DC that is a GC server in the forest (see [MS-ADTS] section
6.3.6), or null if such a DC cannot be found.
4.1.2.2.9 GetPDC
procedure GetPDC(domainName: unicodestring): unicodestring
Returns the Internet host name of the DC that holds the PDC FSMO role for the domain whose
name is domainName (see [MS-ADTS] section 6.1.5.4), or null if such a DC cannot be found.
domainName can be either the FQDN (1) or the NetBIOS name of the domain.
4.1.2.2.10 HasAdminRights
procedure HasAdminRights(ctx: ConnectionCtx) : boolean
Returns true if the credentials associated with ctx have administrative rights on the DC associated
with ctx. Possessing administrative rights is defined as having the ability to write to (that is, change
the membership of) the Domain Admins group in the domain that is the default domain NC on the
DC associated with ctx.
4.1.2.2.11 IsAuditingEnabled
procedure IsAuditingEnabled (): boolean
Returns true if auditing on the server on which it is called is enabled, and returns false otherwise.
4.1.2.2.12 IsLocalRpcCall
procedure IsLocalRpcCall(hDrs: DRS_HANDLE): boolean
Returns true if the RPC call that is being processed on hDrs originated from the same computer as the
computer that is processing the call.
4.1.2.2.13 IsNT4SP4OrBetter
procedure IsNT4SP4OrBetter(ctx: ConnectionCtx): boolean
89 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If the DC named in ctx is running Windows NT 4.0 and is not running at least Windows NT 4.0
operating system Service Pack 4 (SP4), this procedure returns false. Otherwise, it returns true.<10>
4.1.2.2.14 IsAuditingGroupPresent
procedure IsAuditingGroupPresent(dcname: unicodestring, nETBIOSName: unicodestring): DWORD
Returns ERROR_NO_SUCH_ALIAS if the DC represented by the dcname does not have a domain local
group whose sAMAccountName is the value of the nETBIOSName parameter appended with three
dollar signs $$$. Otherwise, it returns ERROR_SUCCESS. This group is not present by default and
must be created by the administrator of the directory service.
4.1.2.2.15 IsWellKnownDomainRelativeSid
procedure IsWellKnownDomainRelativeSid(sid: SID): boolean
Returns true if sid consists of the domain SID of the server's default domain and of a RID (as
specified in [MS-DTYP] section 2.4.2) whose value is less than 1000, and returns false otherwise.
4.1.2.2.16 LastRID
procedure LastRID(sid: SID): Rid
Extracts and returns the RID from the SID sid. See [MS-DTYP] section 2.4.2.
4.1.2.2.17 RemoteQuery
procedure RemoteQuery(
ctx: ConnectionCtx,
query: unicodestring): select-return-value
Performs the select statement represented by the string query against the server associated with ctx,
using the credentials associated with ctx. Returns the results of the select operation. The return value
of this function is the same type as the return value of the select statement performed.
Informative summary of behavior: The IDL_DRSAddSidHistory method adds the SIDs associated with
one principal (the source principal) to the sIDHistory attribute of another principal (the destination
principal). The source principal's objectSid and any SIDs in the source principal's sIDHistory are added
to the destination principal's sIDHistory. This method is called on a DC whose default NC contains the
destination principal. If necessary, the destination DC will contact a DC whose default NC contains the
source principal as part of executing this method.
This method has three different variants on this behavior, and the caller indicates which variant is
desired by specifying a combination of flags in pmsgIn^.V1.flags.
90 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
variant, the source and destination principals are in the same domain. The values of the objectSid
and sIDHistory attributes of the source principal are added to the destination principal's sIDHistory
attribute, and then the source principal is deleted. See [MS-ADTS] section 3.1.1.5.5 for more
information about the delete operation. Loosely speaking, the destination principal adopts the
source principal as an "alias" and the source principal disappears.
The preceding are the only variants supported by the IDL_DRSAddSidHistory method. In particular,
the case of source and destination principals in different domains within the same forest is not
supported.
ULONG
IDL_DRSAddSidHistory(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_ADDSIDREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)] DRS_MSG_ADDSIDREPLY *pmsgOut)
flags: DRS_ADDSID_FLAGS
srcPrinc: DSName
dstPrinc: DSName
srcPrincInDst: DSName
srcNc: DSName
dstNc: DSName
crSrc: DSName
crDst: DSName
partCtr: DSName
srcDomainController: unicodestring
srcCtx: ConnectionCtx
srcPrincSid: SID
srcPrincSidHistory: set of SID
rt: ULONG
ValidateDRSInput(hDrs, 20)
pdwOutVersion^ := 1
pmsgOut^.V1.dwWin32Error := ERROR_DS_INTERNAL_FAILURE
flags := pmsgIn^.V1.flags
if DS_ADDSID_FLAG_PRIVATE_CHK_SECURE in flags then
/* First mode of operation: verify connection security.
* If connecting from off-machine, connection must have 128-bit
* encryption or better. */
if (not IsLocalRpcCall(hDrs)) and
(GetKeyLength(hDrs) < 128) then
pmsgOut^.V1.dwWin32Error := ERROR_DS_MUST_RUN_ON_DST_DC
return ERROR_DS_MUST_RUN_ON_DST_DC
else
return 0
endif
endif
91 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Second mode of operation: add objectSid/sidHistory from source
* principal to destination principal, then delete source
* principal. */
92 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Validation of object state. */
if (not ObjExists(srcPrinc)) or
(not (user in srcPrinc!objectClass or
group in srcPrinc!objectClass)) or
(not ObjExists(dstPrinc)) or
(not (user in dstPrinc!objectClass or
group in dstPrinc!objectClass)) or
(srcPrinc = dstPrinc) or
(IsWellKnownDomainRelativeSid(srcPrinc!objectSid)) or
(IsWellKnownDomainRelativeSid(dstPrinc!objectSid)) then
pmsgOut^.V1.dwWin32Error := ERROR_INVALID_PARAMETER
return 0
endif
/* Check that this machine has rights to delete the source principal. */
if (not AccessCheckObject(srcPrinc, RIGHT_DELETE)) and
(not AccessCheckObject(srcPrinc.parent, RIGHT_DS_DELETE_CHILD))
then
pmsgOut^.V1.dwWin32Error := ERROR_ACCESS_DENIED
return 0
endif
/* Save the source principal's SID and SID history and then delete the principal */
srcPrincSid := srcPrinc!objectSid
srcPrincSidHistory := srcPrinc!sIDHistory
rt = RemoveObj(srcPrinc,false)
if(rt ≠ 0) then
pmsgOut^.V1.dwWin32Error := rt
return 0
endif
GenerateSuccessAudit()
return 0
endif
93 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if crDst = null then
pmsgOut^.V1.dwWin32Error :=
ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST
return 0
endif
dstNC := crDst!nCName
94 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
srcPrincSid := srcPrinc!objectSid
srcPrincSidHistory := srcPrinc!sIDHistory
else
/* The current DC is not a GC server.
* We need to locate a GC server and perform an IDL_DRSCrackNames query against it in order
95 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
for the SID search to be Forest scoped */
gcDomainController : unicodestring
hDrsGc: DRS_HANDLE
crackMsgIn: DRS_MSG_CRACKREQ_V1
crackOut: DS_NAME_RESULTW
gcDomainController := FindGC()
/* Bind to GC */
hDrsGc := BindToDSA(gcDomainController)
if hDrsGc = null then
pmsgOut^.V1.dwWin32Error := STATUS_DS_GC_NOT_AVAILABLE
return 0
endif
crackMsgIn.dwFlags := DS_NAME_FLAG_GCVERIFY
crackMsgIn.formatOffered := DS_STRING_SID_NAME
crackMsgIn.formatDesired := DS_UNIQUE_ID_NAME
crackMsgIn.cNames := 1
crackMsgIn.rpNames[0] := srcPrincSid
crackNamesErr := IDL_DRSCrackNames(
hDrsGc,
dwInVersion,
crackMsgIn,
pdwOutVersion,
ADR(crackOut))
if crackNamesErr ≠ 0 then
if crackNamesErr = DS_NAME_ERROR_NOT_UNIQUE then
pmsgOut^.V1.dwWin32Error := ERROR_DS_SRC_SID_EXISTS_IN_FOREST
return 0
elseif crackNamesErr ≠ DS_NAME_ERROR_NOT_FOUND and
crackNamesErr ≠ DS_NAME_ERROR_DOMAIN_ONLY then
pmsgOut^.V1.dwWin32Error := ERROR_DS_INTERNAL_FAILURE
return 0
endif
UnbindFromDSA(hDrsGc)
endif
96 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut^.V1.dwWin32Error := ERROR_NO_SUCH_ALIAS
return 0
endif
97 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
GenerateSuccessAudit()
return 0
This flag is used when the caller wants to check whether an RPC call to DC1 is secure.
A client invokes the IDL_DRSAddSidHistory method against DC1 with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_ADDSIDREQ_V1
Flags = 0x40000000
pdwOutVersion = 1
pmsgOut = DRS_MSG_ADDSIDREPLY_V1
dwWin32Error: 0
In this example, the user "Kim Akers" has an account in domain DC=contoso, DC=com with a
Windows NT 4.0 account name "CONTOSO\kimakers". There is another account in the same domain
for the user "Kim Akers" with the Windows NT 4.0 account name "CONTOSO\kimakers1". The domain
administrator wants to add a SID of "CONTOSO\Kimakers1" account to the SIDHistory of
"CONTOSO\kimakers" and delete "CONTOSO\Kimakers1".
Querying the user object whose sAMAccountName is kimakers in the domain NC DC=CONTOSO,
DC=COM on DC1:
Matched DNs:
Getting 1 entry:
98 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
>> Dn: CN=Kim Akers,CN=Users,DC=contoso,DC=com
Querying the user object whose sAMAccountName is kimakers1 in the domain NC DC=CONTOSO,
DC=COM on DC1:
Matched DNs:
Getting 1 entries:
A client invokes the IDL_DRSAddSidHistory method against DC1 with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_ADDSIDREQ_V1
Flags = 0x80000000
pdwOutVersion = 1
pmsgOut = DRS_MSG_ADDSIDREPLY_V1
dwWin32Error: 0
99 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ldap_search_s("DC=contoso,DC=com", wholeSubtree, "(sAMAccountName=kimakers)",
[objectClass, distinguishedName, sAMAccountName, objectSid, sIDHistory])
Matched DNs:
Getting 1 entry:
Matched DNs:
Getting 0 entries:
The user "Kim Akers" has an account in domain DC=contoso, DC=com with a Windows NT 4.0
account name "CONTOSO\kimakers". The user has another account in a separate forest in domain
DC=legacycontoso,DC=com with a Windows NT 4.0 account name "LEGACYCONTOSO\kimakers1".
The domain administrator wants to add the SID of "LEGACYCONTOSO\Kimakers1" account to the
sIDHistory of "CONTOSO\kimakers". The administrator's account name in the LEGACYCONTOSO
domain is LegacyContosoAdmin with password Passw0rd123. LEGACYCONTOSO is the NetBIOS name
for the LEGACYCONTOSO.com domain.
Querying the user object whose sAMAccountName is kimakers in the domain NC DC=CONTOSO,
DC=COM on DC1:
Matched DNs:
Getting 1 entry:
100 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> sAMAccountName: KimAkers
Matched DNs:
Getting 1 entries:
A client invokes the IDL_DRSAddSidHistory method against DC1 with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_ADDSIDREQ_V1
Flags = 0
SrcDomain = "legacycontoso.com"
SrcPrincipal = "KimAkers1"
SrcCredsDomain = "legacycontoso"
SrcCredsDomainLength = 13
SrcCredsUser = "LegacyContosoAdmin"
SrcCredsUserLength = 18
SrcCredsPassword = "Passw0rd123"
SrcCredsPasswordLength = 11
DstDomain = "contoso"
DstPrincipal = "KimAkers"
pdwOutVersion = 1
101 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut = DRS_MSG_ADDSIDREPLY_V1
dwWin32Error: 0
Matched DNs:
Getting 1 entry:
Matched DNs:
Getting 1 entries:
The IDL_DRSBind method creates a context handle that is necessary to call any other method in this
interface.
ULONG IDL_DRSBind(
[in] handle_t rpc_handle,
[in, unique] UUID* puuidClientDsa,
[in, unique] DRS_EXTENSIONS* pextClient,
102 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[out] DRS_EXTENSIONS** ppextServer,
[out, ref] DRS_HANDLE* phDrs
);
phDrs: A pointer to an RPC context handle (as specified in [C706]), which can be used in calls to
other methods in this interface.
Exceptions Thrown: This method does not throw exceptions beyond those thrown by the underlying
RPC protocol.
The client uses puuidClientDsa to pass an identifier. If the client uses the returned DRS_HANDLE for
subsequent calls to the IDL_DRSWriteSPN method, then the client MUST pass NTDSAPI_CLIENT_GUID
in puuidClientDsa. For any other uses, the server places no constraints on the value of puuidClientDsa
other than those specified in section 4.1.3.2.<11>
The client uses pextClient to pass a properly initialized DRS_EXTENSIONS_INT structure to the server.
If the client is a DC, it reads the value of msDS-ReplicationEpoch from its nTDSDSA object and
assigns this value to the dwReplEpoch field of the DRS_EXTENSIONS_INT structure; otherwise, it
sets the dwReplEpoch field of the DRS_EXTENSIONS_INT structure to zero. If the client is a DC, it
reads the value of objectGUID from the Config NC object and assigns this value to the
ConfigObjGUID field of the DRS_EXTENSIONS_INT structure; otherwise, it sets the ConfigObjGUID
field of the DRS_EXTENSIONS_INT structure to the NULL GUID value.
The remaining information in the DRS_EXTENSIONS_INT structure must be consistent with the client's
capabilities. This information affects the versions of response structures that the server returns in
method calls using the DRS_HANDLE returned by IDL_DRSBind. In descriptions of method calls that
use a DRS_HANDLE, this handle is sometimes called the client's RPC context.<12>
If a method of this protocol takes a parameter named dwInVersion, the client uses that parameter to
specify the version of the referent of the next parameter to that method, often named pmsgIn. The
referent of this parameter is called the method's request. The dwInVersion parameter is called the
request version. For example, if the client passes dwInVersion = 7 to IDL_DRSGetNCChanges, the
client also passes a DRS_MSG_GETCHGREQ_V7 request.
If a method of this protocol takes an integer parameter named pdwOutVersion, the server uses that
parameter to return the version number of the referent of the next parameter to that method, often
named pmsgOut. The referent of this parameter is called the method's response. The referent of
pdwOutVersion is called the response version. For example, when the server returns pdwOutVersion^
= 9 from IDL_DRSGetNCChanges, the server also returns a DRS_MSG_GETCHGREPLY_V9 response.
Most methods in this protocol are capable of generating only a certain response version from a certain
request version. The following special cases apply:
103 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
returning a version 6 response, it is also capable of returning a version 7 response, which is a
compressed form of a version 6 response. Compression of IDL_DRSGetNCChanges responses is
not controlled by the state of the client's RPC context; it is controlled on a per-request basis by
the client; see DRS_USE_COMPRESSION in section 5.41.
IDL_DRSAddEntry can generate either a version 2 or version 3 response from either a version 2 or
version 3 request. The server generates a version 3 response when
DRS_EXT_ADDENTRYREPLY_V3 is set in the client's RPC context; otherwise, the server generates
a version 2 response.
IDL_DRSDomainControllerInfo has only one request version; it contains an InfoLevel field. The
InfoLevel, not the dwInputVersion, determines the response version. Similarly,
IDL_DRSGetReplInfo has two request versions, which both contain an InfoType field. The
InfoType, not the dwInputVersion, determines the response version.
The following tables describe how the server determines the response version based on the request
version, the DRS_EXTENSIONS_INT structure specified when creating the DRS_HANDLE, and in some
cases, the contents of the request message.
IDL_DRSReplicaSync
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
IDL_DRSGetNCChanges
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
4 - 1
5 - 1
7 DRS_EXT_GETCHGREPLY_V6 6
8 DRS_EXT_GETCHGREPLY_V6 6
10 DRS_EXT_GETCHGREPLY_V6 6
10 DRS_EXT_GETCHGREPLY_V9 9
10 DRS_EXT_GETCHGREPLY_V9, DRS_EXT_GETCHGREPLY_V6 9
IDL_DRSUpdateRefs
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
IDL_DRSReplicaAdd
104 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
2 - -
IDL_DRSReplicaDel
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
IDL_DRSReplicaModify
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
IDL_DRSVerifyNames
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSGetMemberships
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSInterDomainMove
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
2 - 2
IDL_DRSGetNT4ChangeLog
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSCrackNames
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSWriteSPN
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSRemoveDsServer
105 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSRemoveDsDomain
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSDomainControllerInfo
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - request.InfoLevel 1
IDL_DRSAddEntry
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
2 - 2
3 - 2
2 DRS_EXT_ADDENTRYREPLY_V3 3
3 DRS_EXT_ADDENTRYREPLY_V3 3
IDL_DRSExecuteKCC
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSGetReplInfo
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - request.InfoType 2
2 - request.InfoType 2
IDL_DRSAddSidHistory
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSGetMemberships2
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSReplicaVerifyObjects
106 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - -
IDL_DRSGetObjectExistence
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSQuerySitesByCost
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSInitDemotion
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSReplicaDemotion
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSFinishDemotion
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSAddCloneDC
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSWriteNgcKey
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DRSReadNgcKey
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DSAPrepareScript
107 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
IDL_DSAExecuteScript
Request version DRS_EXTENSIONS bit set in client's RPC context Response version
1 - 1
1 Possible values are 0x1, 0x2, and 0xffffffff (see section 4.1.5).
2 Possible values are detailed in section 4.1.13.
The server returns an error if puuidClientDsa^ is set to the NULL GUID. Otherwise, the server retains
the UUID passed as puuidClientDsa^ and the DRS_EXTENSIONS_INT structure passed as
pextClient^, and associates them with the RPC context handle, phDrs, in an implementation-specific
manner.
The following tables specify the capability assertions made by a server that sets bits in the
DRS_EXTENSIONS_INT structure returned from IDL_DRSBind. Each row of a table gives a request
version (including both dwInVersion and the InfoLevel of IDL_DRSDomainControllerInfo and the
InfoType of IDL_DRSGetReplInfo) and the DRS_EXTENSIONS_INT bit or bits that the server sets to
indicate support for that request. For instance, every server supports a version 1 request to
IDL_DRSReplicaSync, but a server does not support a version 5 request to IDL_DRSGetNCChanges
unless it has set both the DRS_EXT_GETCHGREQ_V5 and DRS_EXT_RESTORE_USN_OPTIMIZATION
bits. For AD LDS, the IDL_DRSDomainControllerInfo method is disabled regardless of the InfoLevel
set by the bits.
A server supports version 4 and version 7 requests to IDL_DRSGetNCChanges only via the SMTP
replication transport (see [MS-SRPL]). These cases are noted in the relevant table. A server supports
all other requests only via the RPC transport.
IDL_DRSReplicaSync
1 -
IDL_DRSGetNCChanges
5 DRS_EXT_GETCHGREQ_V5
DRS_EXT_RESTORE_USN_OPTIMIZATION
108 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS_INT bit(s)
8 DRS_EXT_GETCHGREQ_V8
DRS_EXT_RESTORE_USN_OPTIMIZATION
10 DRS_EXT_GETCHGREQ_V10
DRS_EXT_RESTORE_USN_OPTIMIZATION
IDL_DRSUpdateRefs
1 -
IDL_DRSReplicaAdd
1 -
2 DRS_EXT_ASYNCREPL
IDL_DRSReplicaDel
1 -
IDL_DRSReplicaModify
1 -
IDL_DRSVerifyNames
1 -
IDL_DRSGetMemberships
1 -
IDL_DRSInterDomainMove
2 DRS_EXT_MOVEREQ_V2
IDL_DRSGetNT4ChangeLog
109 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS_INT bit(s)
1 -
IDL_DRSCrackNames
1 -
IDL_DRSWriteSPN
1 -
IDL_DRSRemoveDsServer
1 DRS_EXT_REMOVEAPI
IDL_DRSRemoveDsDomain
1 DRS_EXT_REMOVEAPI
IDL_DRSDomainControllerInfo
1 DRS_EXT_DCINFO_V1
InfoLevel = 0x1
1 DRS_EXT_DCINFO_V2
InfoLevel = 0x2
1 DRS_EXT_LH_BETA2
InfoLevel = 0x3
1 DRS_EXT_DCINFO_VFFFFFFFF
InfoLevel = 0xffffffff
IDL_DRSAddEntry
2 DRS_EXT_ADDENTRY_V2
3 DRS_EXT_NONDOMAIN_NCS
IDL_DRSExecuteKCC
110 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Request version DRS_EXTENSIONS_INT bit(s)
1 DRS_EXT_KCC_EXECUTE
IDL_DRSGetReplInfo
1 -
2 DRS_EXT_GETCHGREQ_V8
2 DRS_EXT_POST_BETA3
InfoType = [3..5]
2 DRS_EXT_GETCHGREQ_V8
InfoType = 6
2 DRS_EXT_GETCHGREPLY_V6
InfoType = [7..10]
IDL_DRSAddSidHistory
1 DRS_EXT_ADD_SID_HISTORY
IDL_DRSGetMemberships2
1 DRS_EXT_GETMEMBERSHIPS2
IDL_DRSReplicaVerifyObjects
1 DRS_EXT_WHISTLER_BETA3
IDL_DRSGetObjectExistence
1 DRS_EXT_WHISTLER_BETA3
IDL_DRSQuerySitesByCost
1 DRS_EXT_WHISTLER_BETA3
IDL_DRSInitDemotion
1 DRS_EXT_ADAM
111 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
IDL_DRSReplicaDemotion
1 DRS_EXT_ADAM
IDL_DRSFinishDemotion
1 DRS_EXT_ADAM
IDL_DSAPrepareScript
1 -
IDL_DSAExecuteScript
1 -
The client receives a DRS_EXTENSIONS_INT structure from the server as the referent of ppextServer.
A server supports only a subset of the possible request versions, including both dwInVersion and the
InfoLevel of IDL_DRSDomainControllerInfo and the InfoType of IDL_DRSGetReplInfo. The server
informs the client of its capabilities via the DRS_EXTENSIONS_INT structure returned from
IDL_DRSBind, as described in Server Behavior of the IDL_DRSBind Method (section 4.1.3.2).
The client retains the context handle phDrs^ for use in method calls on the drsuapi interface. Once a
valid handle has been acquired by the client, the handle remains valid until either the server
unilaterally breaks the RPC connection (for example, by crashing) or until IDL_DRSUnbind has been
performed.
Querying the nTDSDSA objects for the root domain NC DC=CONTOSO, DC=COM for DC1 and DC2
respectively:
ldap_search_s("CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com", baseObject, "(objectClass=*)",
[objectClass, cn, distinguishedName, objectGUID, msDS-Behavior-Version])
112 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Matched DNs:
Getting 1 entries:
ldap_search_s("CN=NTDS Settings,CN=DC2,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com", baseObject, "(objectClass=*)",
[objectClass, cn, distinguishedName, objectGUID, msDS-Behavior-Version])
Matched DNs:
Getting 1 entries:
DC2 invokes the IDL_DRSBind method against DC1, with the following parameters (DRS_HANDLE to
DC1 omitted):
pextClient:
cb: 0x30
dwFlags:
DRS_EXT_BASE
DRS_EXT_ASYNCREPL
DRS_EXT_REMOVEAPI
DRS_EXT_MOVEREQ_V2
113 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_EXT_GETCHG_DEFLATE
DRS_EXT_DCINFO_V1
DRS_EXT_RESTORE_USN_OPTIMIZATION
DRS_EXT_KCC_EXECUTE
DRS_EXT_ADDENTRY_V2
DRS_EXT_LINKED_VALUE_REPLICATION
DRS_EXT_DCINFO_V2
DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD
DRS_EXT_CRYPTO_BIND
DRS_EXT_GET_REPL_INFO
DRS_EXT_STRONG_ENCRYPTION
DRS_EXT_DCINFO_VFFFFFFFF
DRS_EXT_TRANSITIVE_MEMBERSHIP
DRS_EXT_ADD_SID_HISTORY
DRS_EXT_POST_BETA3
DRS_EXT_GETCHGREQ_V5
DRS_EXT_GET_MEMBERSHIPS2
DRS_EXT_GETCHGREQ_V6
DRS_EXT_NONDOMAIN_NCS
DRS_EXT_GETCHGREQ_V8
DRS_EXT_GETCHGREPLY_V5
DRS_EXT_GETCHGREPLY_V6
DRS_EXT_GETCHGREPLY_V9
DRS_EXT_WHISTLER_BETA3
DRS_EXT_W2K3_DEFLATE
DRS_EXT_GETCHGREQ_V10
Pid: 632
dwReplEpoch:0
dwFlagsExt: 0
114 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Return code of 0 (DRS_HANDLE to DC1 omitted) with the following values:
ppextServer:
cb: 0x30
dwFlags:
DRS_EXT_BASE
DRS_EXT_ASYNCREPL
DRS_EXT_REMOVEAPI
DRS_EXT_MOVEREQ_V2
DRS_EXT_GETCHG_DEFLATE
DRS_EXT_DCINFO_V1
DRS_EXT_RESTORE_USN_OPTIMIZATION
DRS_EXT_KCC_EXECUTE
DRS_EXT_ADDENTRY_V2
DRS_EXT_LINKED_VALUE_REPLICATION
DRS_EXT_DCINFO_V2
DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD
DRS_EXT_GET_REPL_INFO
DRS_EXT_STRONG_ENCRYPTION
DRS_EXT_DCINFO_VFFFFFFFF
DRS_EXT_TRANSITIVE_MEMBERSHIP
DRS_EXT_ADD_SID_HISTORY
DRS_EXT_POST_BETA3
DRS_EXT_GETCHGREQ_V5
DRS_EXT_GET_MEMBERSHIPS2
DRS_EXT_GETCHGREQ_V6
DRS_EXT_NONDOMAIN_NCS
DRS_EXT_GETCHGREQ_V8
DRS_EXT_GETCHGREPLY_V5
DRS_EXT_GETCHGREPLY_V6
DRS_EXT_GETCHGREPLY_V9
DRS_EXT_WHISTLER_BETA3
DRS_EXT_W2K3_DEFLATE
115 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_EXT_GETCHGREQ_V10
Pid: 632
dwReplEpoch: 0
dwFlagsExt: 0
No change in state.
The IDL_DRSCrackNames method looks up each of a set of objects in the directory and returns it to
the caller in the requested format.
ULONG IDL_DRSCrackNames(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_CRACKREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_CRACKREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.4.1.1 DRS_MSG_CRACKREQ
The DRS_MSG_CRACKREQ union defines the request messages sent to the IDL_DRSCrackNames
method. Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
116 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_MSG_CRACKREQ_V1 V1;
} DRS_MSG_CRACKREQ;
4.1.4.1.2 DRS_MSG_CRACKREQ_V1
typedef struct {
ULONG CodePage;
ULONG LocaleId;
DWORD dwFlags;
DWORD formatOffered;
DWORD formatDesired;
[range(1,10000)] DWORD cNames;
[string, size_is(cNames)] WCHAR** rpNames;
} DRS_MSG_CRACKREQ_V1;
CodePage: The character set used by the client. This field SHOULD be ignored by the server.
LocaleId: The locale used by the client. This field SHOULD be ignored by the server.
dwFlags: Zero or more of the following bit flags, which are presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X T G X X X X X X X X X X X X X X X X X X F X X X X X X X
R C P
O
formatOffered: The format of the names in rpNames. This can be one of the values from
DS_NAME_FORMAT (section 4.1.4.1.3) or one of the following.
Value Meaning
117 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value Meaning
0xFFFFFFFD
DS_LIST_INFO_FOR_SERVER Get DNS host name and server reference for a given DC.
0xFFFFFFFB
DS_MAP_SCHEMA_GUID Get LDAP display name from schema GUID. The given schema
0xFFFFFFF8 GUID must be in the curly braced GUID string format as
specified in [MS-DTYP] section 2.3.4.3.
DS_USER_PRINCIPAL_NAME_AND_ALTSECID Compares input names against the user principal name and the
0xFFFFFFEF values of the altSecurityIdentities attribute.
formatDesired: Format of the names in the rItems field of the DS_NAME_RESULTW structure,
which is returned inside the DRS_MSG_CRACKREPLY message. This can be one of the values from
DS_NAME_FORMAT or one of the following.
Value Meaning
118 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.4.1.3 DS_NAME_FORMAT
The DS_NAME_FORMAT enumeration describes the format of a name sent to or received from the
IDL_DRSCrackNames method.
typedef enum
{
DS_UNKNOWN_NAME = 0,
DS_FQDN_1779_NAME = 1,
DS_NT4_ACCOUNT_NAME = 2,
DS_DISPLAY_NAME = 3,
DS_UNIQUE_ID_NAME = 6,
DS_CANONICAL_NAME = 7,
DS_USER_PRINCIPAL_NAME = 8,
DS_CANONICAL_NAME_EX = 9,
DS_SERVICE_PRINCIPAL_NAME = 10,
DS_SID_OR_SID_HISTORY_NAME = 11,
DS_DNS_DOMAIN_NAME = 12
} DS_NAME_FORMAT;
DS_UNKNOWN_NAME: The server looks up the name by using the algorithm specified in the
LookupUnknownName procedure.
DS_NT4_ACCOUNT_NAME: Windows NT 4.0 (and prior) name format. The account name is in the
format domain\user and the domain-only name is in the format domain\.
4.1.4.1.4 DS_NAME_RESULT_ITEMW
typedef struct {
DWORD status;
[string, unique] WCHAR* pDomain;
[string, unique] WCHAR* pName;
} DS_NAME_RESULT_ITEMW,
*PDS_NAME_RESULT_ITEMW;
119 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
status: Status of the crack name operation for the corresponding element of the rpNames field in
the request. The status is one of the values from the enumeration DS_NAME_ERROR.
pDomain: DNS domain name of the domain in which the named object resides.
4.1.4.1.5 DS_NAME_RESULTW
typedef struct {
DWORD cItems;
[size_is(cItems)] PDS_NAME_RESULT_ITEMW rItems;
} DS_NAME_RESULTW,
*PDS_NAME_RESULTW;
rItems: Translated names that correspond one-to-one with the elements in the rpNames field of the
request.
4.1.4.1.6 DRS_MSG_CRACKREPLY
The DRS_MSG_CRACKREPLY union defines the response messages received from the
IDL_DRSCrackNames method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_CRACKREPLY_V1 V1;
} DRS_MSG_CRACKREPLY;
4.1.4.1.7 DRS_MSG_CRACKREPLY_V1
The DRS_MSG_CRACKREPLY_V1 structure defines the response message received from the
IDL_DRSCrackNames method.
typedef struct {
DS_NAME_RESULTW* pResult;
} DRS_MSG_CRACKREPLY_V1;
4.1.4.1.8 DS_NAME_ERROR
120 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Symbolic name Description
121 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Symbolic name Description
4.1.4.2.1 CanonicalNameFromCanonicalNameEx
procedure CanonicalNameFromCanonicalNameEx(
name: unicodestring): unicodestring
This procedure converts name from extended canonical name format to canonical name format
by replacing the last newline character in name with a forward slash character. If name is not in the
correct format, "domain/container/container/.../container\nleaf" (where \n designates a newline
character), this procedure returns null.
4.1.4.2.2 DomainDNSNameFromDomain
procedure DomainDNSNameFromDomain(domainNC: DSName): unicodestring
If the domain NC, whose root has the DSName domainNC, is hosted in the forest, this procedure
returns the DNS domain name of that domain NC. Otherwise, null is returned.
4.1.4.2.3 DomainFromDomainDNSName
procedure DomainFromDomainDNSName(domainName: unicodestring): DSName
If the DC hosts an NC replica of the domain NC whose DNS domain name is domainName, this
procedure returns the DSName of the root of that domain NC. Otherwise, it returns null.
4.1.4.2.4 DomainNameFromCanonicalName
122 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure DomainNameFromCanonicalName(
canonicalName: unicodestring): unicodestring
Given a name in canonical format, this procedure extracts and returns the domain FQDN (1). If the
input is not in canonical name format, then null is returned. For example, when the input is
"example.fabrikam.com/container/username", the returned domain FQDN (1) is
"example.fabrikam.com".
4.1.4.2.5 DomainNameFromSid
procedure DomainNameFromSid(domainSid: SID): unicodestring
Looks up the domain SID domainSid among trusted domains and domains in trusted forests. If
domainSid is the domain SID of a trusted domain, then the name of this domain is returned. If the
input is null, then null is returned.
4.1.4.2.6 DomainNameFromUPN
procedure DomainNameFromUPN(upn: unicodestring): unicodestring
Parses and returns the domain name from a UPN-formatted string upn. The domain name is the
component after the '@'. For example, when the input is "username@example.fabrikam.com", then
"example. fabrikam.com" is returned. If upn is not in UPN format, then null is returned.
4.1.4.2.7 DomainNetBIOSNameFromDomain
procedure DomainNetBIOSNameFromDomain(domainNC: DSName): unicodestring
If the domain NC, whose root has the DSName domainNC, is hosted in the forest, this procedure
returns the NetBIOS domain name of that domain NC. Otherwise, null is returned.
4.1.4.2.8 DomainSidFromSid
procedure DomainSidFromSid(sid: SID): SID
Removes the last subauthority from the input security identifier sid and returns the resulting
security identifier, which is the domain SID. If the input is null, the procedure returns null. See [MS-
DTYP] section 2.4.2 for more details on SIDs.
4.1.4.2.9 CrackNames
procedure CrackNames(DRS_MSG_CRACKREQ_V1 msgIn, DS_NAME_RESULTW *pmsgOut): ULONG
The CrackNames method implements the core functionality of IDL_DRSCrackNames, that is, looking
up directory object names that are provided in one format (for example, SPNs) and returning them
in a different format (for example, DNs).
i: DWORD
rt: set of DSName
serverObj, siteObj, attr, class, er: DSName
guid: GUID
123 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if msgIn.formatOffered in {
all constants in DS_NAME_FORMAT enumeration,
DS_NT4_ACCOUNT_NAME_SANS_DOMAIN,
DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX,
DS_ALT_SECURITY_IDENTITIES_NAME,
DS_STRING_SID_NAME,
DS_USER_PRINCIPAL_NAME_AND_ALTSECID} then
/* Regular name lookup. */
for i := 0 to msgIn.cNames - 1
/* Perform the lookup based on the input format. */
msgOut^.rItems[i] := LookupName(
msgIn.dwFlags, msgIn.formatOffered, msgIn.formatDesired,
msgIn.rpNames[i])
endfor
msgOut^.cItems = msgIn.cNames
else if msgIn.formatOffered = DS_LIST_ROLES then
/* Return the list of FSMO role owners. */
i := 0
foreach role in {FSMO_SCHEMA, FSMO_DOMAIN_NAMING, FSMO_PDC,
FSMO_RID, FSMO_INFRASTRUCTURE}
msgOut^.rItems[i].pName := GetFSMORoleOwner(role).dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_SITES then
/* Return the list of known sites. */
rt := select all o from children
DescendantObject(ConfigNC(),"CN=Sites,")
where o!objectCategory = GetDefaultObjectCategory(site)
i := 0
foreach siteObj in rt
msgOut^.rItems[i].pName := siteObj.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_SERVERS_IN_SITE then
/* Return all DCs in a site named msgIn.rpNames[0]. */
rt := select all o from subtree msgIn.rpNames[0]
where o!objectCategory = GetDefaultObjectCategory(server)
i := 0
foreach serverObj in rt
msgOut^.rItems[i].pName := serverObj.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_DOMAINS then
/* Return all known AD domains. */
rt := select all o from
subtree DescendantObject(ConfigNC(), "CN=Partitions,")
where o!objectCategory = GetDefaultObjectCategory(crossRef)
and FLAG_CR_NTDS_DOMAIN in o!systemFlags
i := 0
foreach crObj in rt
msgOut^.rItems[i].pName := crObj!ncName.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_NCS then
/* Return all known NCs. */
rt := select all o from
subtree DescendantObject(ConfigNC(), "CN=Partitions,")
where o!objectCategory = GetDefaultObjectCategory(crossRef)
i := 0
foreach crObj in rt
msgOut^.rItems[i].pName := crObj!ncName.dn
124 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_DOMAINS_IN_SITE then
/* Return the list of domains that are hosted by DCs in a site
* named msgIn.rpNames[0]. */
/* First find all DCs in a site named msgIn.rpNames[0]. */
rt := select all o from subtree msgIn.rpNames[0]
where o!objectCategory = GetDefaultObjectCategory(nTDSDSA)
/* Gather the list of all domains from DSA object. */
hostedDomains := null
foreach dsaObj in rt
/* Union operation eliminates duplicates. */
hostedDomains := hostedDomains + dsaObj!hasMasterNCs
endfor
i := 0
foreach domain in hostedDomains
if domain ≠ SchemaNC() and domain ≠ ConfigNC() then
msgOut^.rItems[i].pName := domain.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endif
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_SERVERS_FOR_DOMAIN_IN_SITE then
/* Return all DSAs hosting domain msgIn.rpNames[0] in a site named
* msgIn.rpNames[1]. */
rt := select all o from subtree msgIn.rpNames[1]
where o!objectCategory = GetDefaultObjectCategory(nTDSDSA)
and msgIn.rpNames[0] in o!msDS-hasMasterNCs
/* Return the list of server objects (parents of DSAs). */
i := 0
foreach dsaObj in rt
serverObj := select one o from subtree ConfigNC() where
o!objectGUID = dsaObj!parent
msgOut^.rItems[i].pName := serverObj.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_SERVERS_WITH_DCS_IN_SITE then
/* Return all servers that have DSA objects in a site named
* msgIn.rpNames[0]. */
rt := select all o from subtree msgIn.rpNames[0]
where o!objectCategory = GetDefaultObjectCategory(nTDSDSA)
and o!hasMasterNCs ≠ null
/* Return the list of server objects (parents of DSAs). */
i := 0
foreach dsaObj in rt
serverObj := select one o from subtree ConfigNC() where
o!objectGUID = dsaObj!parent
msgOut^.rItems[i].pName := serverObj.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i + 1
endfor
msgOut^.cItems := i
else if msgIn.formatOffered = DS_LIST_INFO_FOR_SERVER then
/* Returns the DSA object, the dnsHostName and the serverReference
* for the server specified by msgIn.rpNames[0]. */
serverObj := GetDSNameFromDN(msgIn.rpNames[0])
dsaObj := select one o from subtree msgIn.rpNames[0]
where o!objectCategory = GetDefaultObjectCategory(nTDSDSA)
if dsaObj ≠ null then
/* Ok, looks like a valid server object. */
msgOut^.rItems[0].pName := dsaObj.dn
msgOut^.rItems[0].status := DS_NAME_NO_ERROR
msgOut^.rItems[1].pName := serverObj!dnsHostName
msgOut^.rItems[1].status := DS_NAME_NO_ERROR
125 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgOut^.rItems[2].pName := serverObj!serverReference
msgOut^.rItems[2].status := DS_NAME_NO_ERROR
msgOut^.cItems := 3
endif
else if msgIn.formatOffered = DS_LIST_GLOBAL_CATALOG_SERVERS then
/* Returns the list of GC servers, including the info which site
* each GC belongs to. */
rt := select all o from subtree ConfigNC()
where O!objectCategory = GetDefaultObjectCategory(nTDSDSA)
and NTDSDSA_OPT_IS_GC in o!options and o!invocationId ≠ null
i := 0
foreach dsaObj in rt
/* server object is the parent of the DSA object. */
serverObj := select one o from subtree ConfigNC() where
o!objectGUID = dsaObj!parent
/* Site object is the parent of the server object. */
siteObj := select one o from subtree ConfigNC() where
o!objectGUID = serverObj!parent
msgOut^.rItems[i].pDomain := serverObj!dnsHostName
msgOut^.rItems[i].pName := leftmost RDN of siteObj.dn
msgOut^.rItems[i].status := DS_NAME_NO_ERROR
i := i+1
endfor
msgOut.cItems := i
else if msgIn.formatOffered = DS_MAP_SCHEMA_GUID then
for i := 0 to msgIn.cNames - 1
/* Map a guid contained in msgIn.rpNames[i] to attribute or class
* or propertySet.*/
/* Assume no match by default. */
msgOut^.rItems[i].status := DS_NAME_ERROR_SCHEMA_GUID_NOT_FOUND
126 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgOut^.rItems[i].pName := er!displayName
msgOut^.rItems[i].status :=
DS_NAME_ERROR_SCHEMA_GUID_CONTROL_RIGHT
endif
endif
endif
endif
endif
endfor
msgOut^.cItems := msgIn.cNames
endif
return ERROR_SUCCESS
4.1.4.2.10 LookupName
procedure LookupName(
flags: DWORD,
formatOffered: DWORD,
formatDesired: DWORD,
name: unicodestring): DS_NAME_RESULT_ITEMW
Informative summary of behavior: The LookupName procedure performs the lookup of a single name
in a given input format and produces the output name in the given output format.
domainName := null
127 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else if formatOffered = DS_CANONICAL_NAME_EX then
rt := LookupCanonicalName(CanonicalNameFromCanonicalNameEx(name))
domainName := DomainNameFromCanonicalName(name)
else if formatOffered in {DS_NT4_ACCOUNT_NAME_SANS_DOMAIN,
DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX} then
rt := LookupAttr(flags, sAMAccountName, name)
else if formatOffered = DS_ALT_SECURITY_IDENTITIES_NAME then
rt := LookupAttr(flags, altSecurityIdentities, name)
else if formatOffered = DS_USER_PRINCIPAL_NAME_AND_ALTSECID then
rt := LookupUPNAndAltSecID(flags, true, name)
domainName := DomainNameFromUPN(name)
else
rt := null
endif
result.pName^ := null
result.pDomain^ := null
result.status := DS_NAME_NO_ERROR
if rt = null then
/* No match. */
result.status := DS_NAME_ERROR_NOT_FOUND
return result
endif
obj := rt[0]
128 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
result.status := DS_NAME_ERROR_IS_SID_USER
endif
else if obj!sAMAccountType in {SAM_NON_SECURITY_GROUP_OBJECT,
SAM_GROUP_OBJECT} then
if fSidHistory then
result.status := DS_NAME_ERROR_IS_SID_HISTORY_GROUP
else
result.status := DS_NAME_ERROR_IS_SID_GROUP
endif
else if obj!sAMAccountType in {SAM_NON_SECURITY_ALIAS_OBJECT,
SAM_ALIAS_OBJECT} then
if fSidHistory then
result.status := DS_NAME_ERROR_IS_SID_HISTORY_ALIAS
else
result.status := DS_NAME_ERROR_IS_SID_ALIAS
endif
else
if fSidHistory then
result.status := DS_NAME_ERROR_IS_SID_HISTORY_UNKNOWN
else
result.status := DS_NAME_ERROR_IS_SID_UNKNOWN
endif
endif
endif
result.pName^ := names[0]
result.pDomain^ := DomainDNSNameFromDomain(GetObjectNC(obj))
129 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
result.status = DS_NAME_NO_ERROR
return result
4.1.4.2.11 LookupAttr
procedure LookupAttr(
flags: DWORD,
att: ATTRTYP,
attrValue: unicodestring): set of DSName
Informative summary of behavior: The LookupAttr procedure is a helper function that looks up an
object in an NC replica based on an attributeName=attributeValue criterion. It returns the set of
objects that match the criterion.
4.1.4.2.12 LookupCanonicalName
procedure LookupCanonicalName(name: unicodestring): DSName
curObj: DSName
label: unicodestring
4.1.4.2.13 GetCanonicalName
procedure GetCanonicalName(
obj: DSName, extended: boolean): unicodestring
130 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Informative summary of behavior: The GetCanonicalName function constructs the canonical name of
an object by walking up its ancestors to the NC root.
result: unicodestring
4.1.4.2.14 LookupSPN
procedure LookupSPN(flags: DWORD, name: unicodestring): set of DSName
Informative summary of behavior: LookupSPN is a helper function that implements the service
principal name (SPN) lookup algorithm.
131 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if dcGuid ≠ null then
/* Find DSA object with this objectGUID value. */
obj := select one o from subtree ConfigNC()
where o!objectGUID = dcGuid
if obj ≠ null then
/* Get the server object. */
obj := obj!parent
if obj ≠ null then
/* server!serverReference points to the DC's computer
* object.*/
rt := {obj!serverReference}
endif
endif
endif
endif
return rt
4.1.4.2.15 LookupSID
procedure LookupSID(flags: DWORD, sid: SID): set of DSName
Informative summary of behavior: The LookupSID procedure is a helper function that implements the
SID lookup algorithm.
4.1.4.2.16 LookupUnknownName
procedure LookupUnknownName(
flags: DWORD,
name: unicodestring,
formatDesired: DWORD): DS_NAME_RESULT_ITEMW
Informative summary of behavior: The server uses LookupUnknownName to look up names of format
DS_UNKNOWN_NAME. LookupUnknownName looks up the name by trying formats in the specific
order listed in the foreach statement shown below until a lookup succeeds and produces the output
name in the given output format.
result: DS_NAME_RESULT_ITEMW
format: DWORD
132 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if result.status ≠ DS_NAME_ERROR_NOT_FOUND then
return result
endif
endfor
return result
4.1.4.2.17 LookupUPNAndAltSecID
procedure LookupUPNAndAltSecID(
flags: DWORD,
IncludingAltSecID: boolean,
name: unicodestring): set of DSName
Informative summary of behavior: Returns DSNames of objects, with the given value as a value of
userPrincipalName, altSecurityIdentities, or sAMAccountName.
if rt ≠ null then
return rt
endif
return rt
4.1.4.2.18 LookupFPO
procedure LookupFPO(
fCanonicalEx: boolean,
obj: DSName,
result: DS_NAME_RESULT_ITEMW
): DS_NAME_RESULT_ITEMW
Informative summary of behavior: LookupFPO is a helper function that attempts to resolve the domain
and account name of an object, with an appropriate status value.
pReferencedDomain: PLSAPR_REFERENCED_DOMAIN_LIST
TranslatedName: LSAPR_TRANSLATED_NAMES_EX
NtStatus: NTSTATUS
pReferencedDomain := null
TranslatedName := null
133 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
NtStatus := TranslateFPOToName(obj, ADR(pReferencedDomain),
ADR(TranslatedName))
if (NtStatus = 0x0 and pReferencedDomain ≠ null and TranslatedName ≠ null)
then
result.pDomain^ :=
pReferencedDomains^.Domains[TranslatedName.DomainIndex].Name
if fCanonicalNameEx then
result.pName^ := result.pDomain^ + {"\n"} + TranslatedName.Name
else
result.pName^ := result.pDomain^ + {"\"} + TranslatedName.Name
endif
result.status := DS_NAME_ERROR_IS_FPO
return result
else
result.status := DS_NAME_ERROR_RESOLVING
endif
4.1.4.2.19 MapSPN
procedure MapSPN(spn: unicodestring,
spnMappings: set of unicodestring):
unicodestring
The MapSPN procedure performs an SPN mapping operation on spn according to the map specified in
spnMappings, and returns the mapped version of spn. The mapping operation is used to change the
service class of the SPN. An SPN service class is the first part of an SPN; for example, "ldap" is the
service class of the SPN "ldap/fabrikam.com".
Each value of spnMappings consists of an alias, followed by an equals sign (=), followed by a comma-
separated list of one or more SPN service classes. Thus, each value must be in the following format:
alias=serviceClass1,serviceClass2,serviceClass3,...,serviceClassN
If the service class portion of spn corresponds to one of the serviceClassX values in value v of
spnMappings, then the return value of this procedure is the SPN value this is constructed from spn by
substituting the alias value from v as the service class of spn. If no mapping is found (that is, if there
is no such v), or if spn is not an SPN, then null is returned.
{"ldap=ldap,otherldap", "host=alerter,appmgmt,cisvc"}
4.1.4.2.20 ParseCanonicalName
procedure ParseCanonicalName(
name: unicodestring,
var firstPart: unicodestring,
var remainder: unicodestring)
The ParseCanonicalName procedure parses the first label from the canonical name string name and
returns the first label in firstPart and the remainder of the string in remainder. For example, name =
"container1/container2/leaf" is parsed as firstPart:= "container1" and remainder:= "container2/leaf".
As another example, name = "example.fabrikam.com/container/username" is parsed as firstPart:=
134 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
"example.fabrikam.com" and remainder:= "container/username". If name does not contain a slash
character, then it is parsed as firstPart:= name and remainder:= null.
4.1.4.2.21 RetrieveDCSuffixFromDn
procedure RetrieveDCSuffixFromDn(dn: unicodestring): unicodestring
The RetrieveDCSuffixFromDn procedure parses the distinguished name (DN) syntactically and
returns the suffix that consists entirely of the DN components whose attribute type is "DC". For
example, given "CN=Administrator,CN=Users,DC=fabrikam,DC=com", this procedure would return
"DC=fabrikam,DC=com".
4.1.4.2.22 UserNameFromUPN
procedure UserNameFromUPN(upn: unicodestring): unicodestring
Parses and returns the user name from a UPN-formatted string upn. The user name is the component
before the '@'. For example, when the input is "username@example.fabrikam.com", then "username"
is returned. If the input is not in UPN format, then null is returned.
4.1.4.2.23 TranslateFPOToName
procedure TranslateFPOToName(
obj: DSName,
ppReferencedDomains: PLSAPR_REFERENCED_DOMAIN_LIST*,
pTranslatedNames: PLSAPR_TRANSLATED_NAMES_EX
): NTSTATUS
hlsaPolicy: LSAPR_HANDLE
mappedCount: unsigned long
systemName: unicodeString
objectAttributes: LSAPR_OBJECT_ATTRIBUTES
desiredAccess: DWORD
sidEnumBuffer: LSAPR_SID_ENUM_BUFFER
sidInfo: LSAPR_SID_INFORMATION
NtStatus: NTSTATUS
sidEnumBuffer.Entries := 1
sidInfo.Sid := obj!Sid
sidEnumBuffer.SidInfo := ADR(sidInfo)
systemName := ""
objectAttributes.Length := 0
objectAttributes.RootDirectory := null
objectAttributes.ObjectName := null
objectAttributes.attributes := 0
objectAttributes.SecurityDescriptor := null
objectAttributes.SecurityQualityOfService := null
desiredAccess := 0x00000800
135 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If hlsaPolicy ≠ null
LsarClose(ADR(hlsaPolicy))
return NtStatus
4.1.4.2.24 ConstructOutput
procedure ConstructOutput(
obj: DSName,
formatDesired: DWORD): set of unicodestring
Informative summary of behavior: ConstructOutput is a helper function that constructs the name of
the object in the required output format. Note that the returned set of values might be empty or
might contain more than one value. These situations are handled by the caller function,
LookupName (section 4.1.4.2.10).
4.1.4.2.25 IsDomainOnly
Informative summary of behavior: The function determines whether the given DSName is one of the
domain NCs present in the forest.
cr: DSName
136 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cr := select one domainNC from subtree ConfigNC() where
(crossRef in domainNC!objectClass and
domainNC!nCName = obj!distinguishedName)
if cr = null then
return FALSE
else
return TRUE
endif
Informative summary of behavior: The IDL_DRSCrackNames method is a generic method that is used
to look up information in the directory. The most common usage is looking up directory object
names that are provided in one format (for example, SPNs) and returning them in a different format
(for example, DNs). One special mode occurs when the input format is not specified, in which case
the server tries to "guess" the format of the name by following some heuristics. The method can also
be used to look up generic information in the directory, such as the list of sites or the list of servers in
a specific site.
ULONG
IDL_DRSCrackNames(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_CRACKREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_CRACKREPLY *pmsgOut)
msgIn: DRS_MSG_CRACKREQ_V1
msgOut: DS_NAME_RESULTW
ULONG result
ValidateDRSInput(hDrs, 12)
pdwOutVersion^ := 1
pmsgOut^.V1.pResult^.cItems := 0
pmsgOut^.V1.pResult^.rItems := null
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V1
if DS_NAME_FLAG_GCVERIFY in msgIn.dwFlags and
not IsGC() then
return ERROR_DS_GCVERIFY_ERROR
endif
137 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.4.4 Examples of the IDL_DRSCrackNames Method
When user "Kim Akers" logs on to the computer MS1.Contoso.com using her Windows NT 4.0 account
name "CONTOSO\kimakers", the domain controller needs to obtain a fully qualified domain name
(FQDN) (1) that corresponds to the Windows NT 4.0 account name. The domain controller DC1 calls
IDL_DRSCrackNames to translate the Windows NT 4.0 account name to an FQDN (1).
Querying the user object with name KimAkers in the domain NC DC=CONTOSO, DC=COM on DC1:
Matched DNs:
Getting 1 entries:
Querying the crossRef object for the domain NC CONTOSO.COM on DC1 by performing the following
LDAP search:
ldap_search_s("CN=CONTOSO,CN=Partitions,CN=Configuration,DC=contoso,DC=com",
baseObject, "(objectClass=crossRef)", [objectClass, nCName, dnsRoot, nETBIOSName])
Matched DNs:
Getting 1 entries:
DC1 invokes the IDL_DRSCrackNames method against itself with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_CRACKREQ_V1
CodePage = 0x4e4
LocaleId = US-EN
138 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwFlags = 0
formatOffered = DS_NT4_ACCOUNT_NAME
formatDesired = DS_FQDN_1779_NAME
cNames: 1
rpNames: "CONTOSO\kimakers"
pdwMessageOut = 1
pmsgOut = DRS_MSG_CRACKREPLY_V1
pResult: DS_NAME_RESULTW
cNames: 1
rItems: DS_NAME_RESULT_ITEMW
pDomain: "contoso.com"
status: DS_NAME_NO_ERROR
The final state is the same as the initial state; there is no change.
ULONG IDL_DRSDomainControllerInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_DCINFOREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_DCINFOREPLY* pmsgOut
);
139 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.5.1.1 DRS_MSG_DCINFOREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_DCINFOREQ_V1 V1;
} DRS_MSG_DCINFOREQ,
*PDRS_MSG_DCINFOREQ;
4.1.5.1.2 DRS_MSG_DCINFOREQ_V1
typedef struct {
[string] WCHAR* Domain;
DWORD InfoLevel;
} DRS_MSG_DCINFOREQ_V1;
Domain: The domain for which the client requests information. The domain can be an FQDN (1) or
a NetBIOS domain name.
InfoLevel: The response version requested by the client: 1, 2, 3, or 0xFFFFFFFF. The responses at
InfoLevel 1, 2, and 3 all contain information about DCs in the given domain. The information at
InfoLevel 1 is a subset of the information at InfoLevel 2, which is a subset of the information at
InfoLevel 3. InfoLevel 3 includes information about the RODCs in the given domain. InfoLevel
0xFFFFFFFF server returns information about the active LDAP connections.
4.1.5.1.3 DRS_MSG_DCINFOREPLY
The DRS_MSG_DCINFOREPLY union defines the response messages received from the
IDL_DRSDomainControllerInfo method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_DCINFOREPLY_V1 V1;
[case(2)]
DRS_MSG_DCINFOREPLY_V2 V2;
[case(3)]
DRS_MSG_DCINFOREPLY_V3 V3;
[case(0xFFFFFFFF)]
DRS_MSG_DCINFOREPLY_VFFFFFFFF VFFFFFFFF;
140 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DRS_MSG_DCINFOREPLY;
4.1.5.1.4 DRS_MSG_DCINFOREPLY_V1
The DRS_MSG_DCINFOREPLY_V1 structure defines the response message received from the
IDL_DRSDomainControllerInfo method, when the client has requested InfoLevel = 1.
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_1W* rItems;
} DRS_MSG_DCINFOREPLY_V1;
rItems: DC information.
4.1.5.1.5 DRS_MSG_DCINFOREPLY_V2
The DRS_MSG_DCINFOREPLY_V2 structure defines the response message received from the
IDL_DRSDomainControllerInfo method, when the client has requested InfoLevel = 2.
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_2W* rItems;
} DRS_MSG_DCINFOREPLY_V2;
rItems: DC information.
4.1.5.1.6 DRS_MSG_DCINFOREPLY_V3
The DRS_MSG_DCINFOREPLY_V3 structure defines the response message received from the
IDL_DRSDomainControllerInfo method when the client has requested InfoLevel = 3.
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_3W* rItems;
} DRS_MSG_DCINFOREPLY_V3;
rItems: DC information.
4.1.5.1.7 DRS_MSG_DCINFOREPLY_VFFFFFFFF
The DRS_MSG_DCINFOREPLY_VFFFFFFFF structure defines the response message received from the
IDL_DRSDomainControllerInfo method, when the client has requested InfoLevel = 0xFFFFFFFF.
141 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW* rItems;
} DRS_MSG_DCINFOREPLY_VFFFFFFFF;
4.1.5.1.8 DS_DOMAIN_CONTROLLER_INFO_1W
typedef struct {
[string, unique] WCHAR* NetbiosName;
[string, unique] WCHAR* DnsHostName;
[string, unique] WCHAR* SiteName;
[string, unique] WCHAR* ComputerObjectName;
[string, unique] WCHAR* ServerObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
} DS_DOMAIN_CONTROLLER_INFO_1W;
fIsPdc: True if and only if the DC is the PDC FSMO role owner.
fDsEnabled: A Boolean value that indicates whether or not the machine is a domain controller. This
value MUST be TRUE.
4.1.5.1.9 DS_DOMAIN_CONTROLLER_INFO_2W
typedef struct {
[string, unique] WCHAR* NetbiosName;
[string, unique] WCHAR* DnsHostName;
[string, unique] WCHAR* SiteName;
[string, unique] WCHAR* SiteObjectName;
[string, unique] WCHAR* ComputerObjectName;
[string, unique] WCHAR* ServerObjectName;
[string, unique] WCHAR* NtdsDsaObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
BOOL fIsGc;
GUID SiteObjectGuid;
GUID ComputerObjectGuid;
GUID ServerObjectGuid;
GUID NtdsDsaObjectGuid;
142 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DS_DOMAIN_CONTROLLER_INFO_2W;
fIsPdc: True if and only if the DC is the PDC FSMO role owner.
fDsEnabled: A Boolean value that indicates whether or not the machine is a domain controller. This
value MUST be TRUE.
ComputerObjectGuid: The objectGUID attribute of the computer object that corresponds to the DC.
ServerObjectGuid: The objectGUID attribute of the server object that corresponds to the DC.
NtdsDsaObjectGuid: The objectGUID attribute of the nTDSDSA object that corresponds to the DC.
4.1.5.1.10 DS_DOMAIN_CONTROLLER_INFO_3W
typedef struct {
[string, unique] WCHAR* NetbiosName;
[string, unique] WCHAR* DnsHostName;
[string, unique] WCHAR* SiteName;
[string, unique] WCHAR* SiteObjectName;
[string, unique] WCHAR* ComputerObjectName;
[string, unique] WCHAR* ServerObjectName;
[string, unique] WCHAR* NtdsDsaObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
BOOL fIsGc;
BOOL fIsRodc;
GUID SiteObjectGuid;
GUID ComputerObjectGuid;
GUID ServerObjectGuid;
GUID NtdsDsaObjectGuid;
} DS_DOMAIN_CONTROLLER_INFO_3W;
143 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
SiteObjectName: DN of the site object.
fIsPdc: True if and only if the DC is the PDC FSMO role owner.
fDsEnabled: A Boolean value that indicates whether or not the machine is a domain controller. This
value MUST be TRUE.
4.1.5.1.11 DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
typedef struct {
DWORD IPAddress;
DWORD NotificationCount;
DWORD secTimeConnected;
DWORD Flags;
DWORD TotalRequests;
DWORD Reserved1;
[string, unique] WCHAR* UserName;
} DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW;
IPAddress: The IPv4 address of the client that established the LDAP connection to the server. If the
client is connected with IPv6, this field MUST be zero.
Flags: Zero or more of the bit flags from LDAP_CONN_PROPERTIES indicating the properties of this
connection.
UserName: Name of the security principal that established the LDAP connection.
144 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
the server. For level 0xffffffff, the server returns information about the LDAP connections on the
server that are currently open.
Regular read access checks apply to the information that is returned to the caller. Therefore, if the
caller does not have read permission on data that needs to be returned, this data is not included in
the response. See [MS-ADTS] section 3.1.1.4.3 for more information about access check behavior in
read operations.
For information about the Windows versions in which information levels were introduced and
supported, see the following behavior note.<14>
Note The server behavior of the IDL_DRSDomainControllerInfo method uses the CrackNames
procedure defined in section 4.1.4.2.9.
ULONG
IDL_DRSDomainControllerInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_DCINFOREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)] DRS_MSG_DCINFOREPLY *pmsgOut)
msgIn: DRS_MSG_DCINFOREQ_V1
infoLevel, i: integer
domainName: unicodestring
dcSet: set of DSName
serversContainer, crObj, dcObj, dsaObj, svrObj, siteObj, obj, v: DSName
lc: DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
rI1: ADDRESS OF DS_DOMAIN_CONTROLLER_INFO_1W
rI2: ADDRESS OF DS_DOMAIN_CONTROLLER_INFO_2W
rI3: ADDRESS OF DS_DOMAIN_CONTROLLER_INFO_3W
found: boolean
crackMsgIn: DRS_MSG_CRACKREQ_V1
crackOut: DS_NAME_RESULTW
outV: DWORD
userAccountControl: set of integer
ValidateDRSInput(hDrs, 16)
msgIn := pmsgIn^.V1
infoLevel := msgIn.InfoLevel
domainName := msgIn.Domain
pdwOutVersion^ := infoLevel
if infoLevel = 1 then
pmsgOut^.V1.cItems := 0
pmsgOut^.V1.rItems := null
else if infoLevel = 2 then
pmsgOut^.V2.cItems := 0
pmsgOut^.V2.rItems := null
else if infoLevel = 3 then
pmsgOut^.V3.cItems := 0
pmsgOut^.V3.rItems := null
else if infoLevel = 0xFFFFFFFF then
pmsgOut^.VFFFFFFFF.cItems := 0
pmsgOut^.VFFFFFFFF.rItems := null
endif
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
endif
145 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if infoLevel = 0xFFFFFFFF then
/* Enumerate the LDAP connections. */
if not IsMemberOfBuiltinAdminGroup() then
return ERROR_ACCESS_DENIED
endif
pmsgOut^.VFFFFFFFF.cItems := number(dc.ldapConnections)
i := 0
foreach lc in dc.ldapConnections
pmsgOut^.VFFFFFFFF.rItems[i].IPAddress := lc.iPAddress
pmsgOut^.VFFFFFFFF.rItems[i].NotificationCount :=
lc.notificationCount
pmsgOut^.VFFFFFFFF.rItems[i].secTimeConnected :=
lc.secTimeConnected
pmsgOut^.VFFFFFFFF.rItems[i].Flags := lc.flags
pmsgOut^.VFFFFFFFF.rItems[i].TotalRequests := lc.totalRequests
pmsgOut^.VFFFFFFFF.rItems[i].UserName := lc.userName
pmsgOut^.VFFFFFFFF.rItems[i].Reserved1 := 0
i := i + 1
endfor
return 0
endif
/* Verify that the given domain name matches the default domain NC.
* First check if it is the nETBiosName or dNSHostName of the default
* domain NC by searching for the crossRef object. If this doesn't
* find a match, call IDL_DRSCrackNames to check if the given
* domain name is a name for the default domain NC. */
i := 0
while i < 3 and not found
if crackOut.rItems[i].status = DS_NAME_NO_ERROR
then
if crackOut.rItems[i].pName = DefaultNC().dn
then
found := true
else
return ERROR_INVALID_PARAMETER
endif
endif
i := i + 1
endwhile
endif
146 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if not found then
return ERROR_DS_OBJ_NOT_FOUND
endif
if infoLevel = 1 then
pmsgOut^.V1.cItems := number(dcSet)
i := 0
foreach dcObj in dcSet
rI1 := ADR(pmsgOut^.V1.rItems[i])
rI1^.DnsHostName := dcObj!dNSHostName
rI1^.ComputerObjectName := dcObj.dn
/* sAMAccountName excluding the "$" at the end. */
rI1^.NetbiosName := SubString(dcObj!sAMAccountName, 0,
dcObj!samAccountName.length-1)
rI1^.fDsEnabled := true
i := 0
foreach dcObj in dcSet
rI2 := ADR(pmsgOut^.V2.rItems[i])
rI2^.DnsHostName := dcObj!dNSHostName
rI2^.ComputerObjectName := dcObj.dn
/* sAMAccountName excluding the "$" at the end. */
rI2^.NetbiosName := SubString(dcObj!samAccountName, 0,
dcObj!samAccountName.length-1)
rI2^.ComputerObjectGUID := dcObj.guid
rI2^.fDsEnabled := true
147 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* select a server object from the serverReferenceBL, it is
preferred that the server object has a child object with
CN "NTDS Settings" */
svrObj :=
select one v from all where v.dn in dcObj!serverReferenceBL
and DescendantObject(v, "CN=NTDS Settings") ≠ null
if svrObj = null then
svrObj :=
select one v from all where v.dn in dcObj!serverReferenceBL
endif
if svrObj ≠ null then
rI2^.ServerObjectName := svrObj.dn
rI2^.ServerObjectGuid := svrObj.guid
serversContainer :=
select one o from all where o!objectGUID = svrObj!parent
siteObj := serversContainer!parent
rI2^.SiteObjectName := siteObj.dn
rI2^.SiteObjectGUID := siteObj.guid
dsaObj := DescendantObject(v, "CN=NTDS Settings,")
rI2^.NtdsDsaObjectGUID := dsaObj.guid
rI2^.fIsGc := (NTDSDSA_OPT_IS_GC in dsaObj!options)
rI2^.fIsPdc := (dsaObj = GetFSMORoleOwner(FSMO_PDC))
endif
i := i + 1
endfor
else
/* infoLevel = 3 */
pmsgOut^.V3.cItems := number(dcSet)
i := 0
foreach dcObj in dcSet
rI3 := ADR(pmsgOut^.V3.rItems[i])
rI3^.DnsHostName := dcObj!dNSHostName
rI3^.ComputerObjectName := dcObj.dn
/* sAMAccountName excluding the "$" at the end. */
rI3^.NetbiosName := SubString(dcObj!samAccountName, 0,
dcObj!samAccountName.length-1)
rI3^.ComputerObjectGUID := dcObj.guid
rI3^.fDsEnabled := true
serversContainer :=
select one o from all where o!objectGUID = svrObj!parent
siteObj := serversContainer!parent
rI3^.SiteObjectName := siteObj.dn
rI3^.SiteObjectGUID := siteObj.guid
dsaObj := DescendantObject(v, "CN=NTDS Settings,")
rI3^.NtdsDsaObjectGUID := dsaObj.guid
rI3^.fIsGC := (NTDSDSA_OPT_IS_GC in dsaObj!options)
rI3^.fIsPDC := (dsaObj = GetFSMORoleOwner(FSMO_PDC))
rI3^.fIsRodc := ((ADS_UF_PARTIAL_SECRETS_ACCOUNT ∩
148 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dcObj!userAccountControl) ≠ null)
endif
i := i + 1
endfor
endif
endif
return 0
An application running on DC2 invokes the DRSDomainControllerInfo method on DC2 to retrieve the
NetBIOS and DNS host names for all DCs in the domain NC CONTOSO.COM.
Querying the crossRef object for the domain NC CONTOSO.COM on DC2 by performing an LDAP
search with base scope on the DN
'CN=CONTOSO,CN=Partitions,CN=Configuration,DC=contoso,DC=com':
Matched DNs:
Getting 1 entries:
Querying the DC1 computer object in domain NC DC=CONTOSO, DC=COM by performing an LDAP
search with base scope on the DN 'CN=DC1,OU=Domain Controllers,DC=contoso,DC=com':
Matched DNs:
Getting 1 entries:
149 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> whenChanged: 07/15/2006 19:39:05 Pacific Standard Daylight Time;
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> localPolicyFlags: 0;
150 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> isCriticalSystemObject: TRUE;
Querying the DC1 computer object in domain NC DC=CONTOSO, DC=COM by performing an LDAP
search with base scope on the DN 'CN=DC2,OU=Domain Controllers,DC=contoso,DC=com':
Matched DNs:
Getting 1 entries:
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> localPolicyFlags: 0;
151 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> accountExpires: 09/14/30828 02:48:05 UNC ;
1> logonCount: 8;
HOST/DC2; HOST/DC2.contoso.com;
DC2 invokes the IDL_DRSDomainControllerInfo method against itself with the following parameters
(DRS_HANDLE to DC2 is omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_DCINFOREQ_V1
Domain = "contoso.com"
InfoLevel = 1
152 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pdwOutVersion^ = 1
pmsgOut = DRS_MSG_DCINFOREPLY_V1
cItems: 2
rItems[0]: DS_DOMAIN_CONTROLLER_INFO_1W
NetbiosName: "DC1"
DnsHostName: "DC1.contoso.com"
SiteName: "Default-First-Site-Name"
fIsPdc: 1
fDsEnabled: 1
rItems[1]: DS_DOMAIN_CONTROLLER_INFO_1W
NetbiosName: "DC2"
DnsHostName: "DC2.contoso.com"
SiteName: "Default-First-Site-Name"
fIsPdc: 0
fDsEnabled: 1
The final state is the same as the initial state; there is no change.
The IDL_DRSExecuteKCC method validates the replication interconnections of DCs and updates
them if necessary.
ULONG IDL_DRSExecuteKCC(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_KCC_EXECUTE* pmsgIn
);
153 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Return Values: 0 if successful, otherwise a Windows error code.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.6.1.1 DRS_MSG_KCC_EXECUTE
The DRS_MSG_KCC_EXECUTE union defines the request messages sent to the IDL_DRSExecuteKCC
method. Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_KCC_EXECUTE_V1 V1;
} DRS_MSG_KCC_EXECUTE;
4.1.6.1.2 DRS_MSG_KCC_EXECUTE_V1
typedef struct {
DWORD dwTaskID;
DWORD dwFlags;
} DRS_MSG_KCC_EXECUTE_V1;
dwTaskID: MUST be 0.
dwFlags: Zero or more of the following bit flags, which are presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X D A X X X X X X X X X X X X X X X X X X X X X X X X
P S
4.1.6.2.1 ExecuteKCCTasks
154 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure ExecuteKCCTasks(): ULONG
This procedure executes the tasks necessary for maintaining the replication topology between DCs.
These tasks include activities such as maintenance of kCCFailedLinks and kCCFailedConnections,
maintenance of intrasite and intersite connections, and updates of RODC objects (as appropriate).
See [MS-ADTS] section 6.2.2 for a full list of these tasks.
If an error occurs, a Windows error code is returned. If successful, the method returns 0.
Informative summary of behavior: The IDL_DRSExecuteKCC method triggers the execution of tasks
that generate and maintain the replication topology between DCs.<15> See [MS-ADTS] section
6.2.2 for more information related to the tasks performed by the KCC upon receipt of an
IDL_DRSExecuteKCC request.
ULONG
IDL_DRSExecuteKCC(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_KCC_EXECUTE *pmsgIn)
msgIn: DRS_MSG_KCC_EXECUTE_V1
ValidateDRSInput(hDrs, 18)
msgIn := pmsgIn^.V1
if msgIn.dwTaskID ≠ 0 then
return ERROR_INVALID_PARAMETER
endif
The IDL_DRSFinishDemotion method either performs one or more steps toward the complete removal
of a DC from an AD LDS forest, or it undoes the effects of the first phase of removal (performed by
IDL_DRSInitDemotion). This method is supported by AD LDS only.
ULONG IDL_DRSFinishDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_FINISH_DEMOTIONREQ* pmsgIn,
155 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_FINISH_DEMOTIONREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.7.1.1 DRS_MSG_FINISH_DEMOTIONREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_FINISH_DEMOTIONREQ_V1 V1;
} DRS_MSG_FINISH_DEMOTIONREQ;
4.1.7.1.2 DRS_MSG_FINISH_DEMOTIONREQ_V1
typedef struct {
DWORD dwOperations;
UUID uuidHelperDest;
[string] LPWSTR szScriptBase;
} DRS_MSG_FINISH_DEMOTIONREQ_V1;
dwOperations: Zero or more of the following bit flags, which are presented in little-endian byte
order.
156 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X U U D C R X X X X X X X X X X X X X X X X F X X X X X X X
2 1
szScriptBase: The path name of the folder in which to store SPN unregistration scripts. Required
when DS_DEMOTE_UNREGISTER_SPNS is specified in dwOperations.
4.1.7.1.3 DRS_MSG_FINISH_DEMOTIONREPLY
The DRS_MSG_FINISH_DEMOTIONREPLY union defines the response messages received from the
IDL_DRSFinishDemotion method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_FINISH_DEMOTIONREPLY_V1 V1;
} DRS_MSG_FINISH_DEMOTIONREPLY;
4.1.7.1.4 DRS_MSG_FINISH_DEMOTIONREPLY_V1
typedef struct {
DWORD dwOperationsDone;
DWORD dwOpFailed;
DWORD dwOpError;
157 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DRS_MSG_FINISH_DEMOTIONREPLY_V1;
dwOperationsDone: The set of operations that were successfully performed. This can include the
following values: DS_DEMOTE_ROLLBACK_DEMOTE, DS_DEMOTE_COMMIT_DEMOTE,
DS_DEMOTE_DELETE_CSMETA, DS_DEMOTE_UNREGISTER_SCPS,
DS_DEMOTE_UNREGISTER_SPNS. This MUST include any value from the input element
DRS_MSG_FINISH_DEMOTIONREQ_V1.dwOperations whose corresponding operations (see
pseudocode in section 4.1.7.3) succeeded.
dwOpFailed: The set of operations that failed during demotion. This can include the same values as
the dwOperationsDone field. This MUST include any value from the input element
DRS_MSG_FINISH_DEMOTIONREQ_V1.dwOperations whose corresponding operations (see
pseudocode in section 4.1.7.3) failed.
dwOpError: The Win32 error code (as specified in [MS-ERREF] section 2.2) of the first failed
operation (if any), from the following operations: DS_DEMOTE_ROLLBACK_DEMOTE,
DS_DEMOTE_COMMIT_DEMOTE, DS_DEMOTE_DELETE_CSMETA, or
DS_DEMOTE_UNREGISTER_SCPS.
4.1.7.2.1 RemoveADLDSServer
procedure RemoveADLDSServer(): DWORD
The RemoveADLDSServer procedure connects to any available replication partner and uses the
IDL_DRSRemoveDsServer method to delete the nTDSDSA object that corresponds to this DC. If no
replication partner is available, or if a replication partner is available and either no such nTDSDSA
object exists or the deletion is successful, RemoveADLDSServer returns ERROR_SUCCESS; otherwise,
it returns a Win32 error.
4.1.7.2.2 RemoveADLDSSCP
procedure RemoveADLDSSCP(): DWORD
4.1.7.2.3 RemoveADLDSSPNs
procedure RemoveADLDSSPNs(szScriptBase: unicodestring): boolean
The RemoveADLDSSPNs procedure connects to an AD DS DC and attempts to delete any SPN values
registered for the AD LDS DC on the object (in the external AD DS domain) that corresponds to the
security principal that the AD LDS service is running as. Sections 2.2.3.2 and 2.2.4.2 specify the
SPN values removed by this procedure. If no such SPN values exist or the deletion is successful,
RemoveADLDSSPNs returns TRUE; otherwise, it returns FALSE, indicating that a batch file was created
in the folder specified by the szScriptBase parameter. This batch file contains commands that an
administrator can run to clean up the SPNs.
158 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Note When the procedure fails to create a batch file for any reason, RemoveADLDSSPNs returns
TRUE.
Informative summary of behavior: The IDL_DRSFinishDemotion method either performs one or more
steps toward the complete removal of a DC from an AD LDS forest, or it undoes the effects of the
first phase of removal (performed by IDL_DRSInitDemotion).<16>
ULONG
IDL_DRSFinishDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_FINISH_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_FINISH_DEMOTIONREPLY* pmsgOut
)
msgIn: DRS_MSG_FINISH_DEMOTIONREQ_V1
msgOut: DRS_MSG_FINISH_DEMOTIONREPLY_V1
ret: DWORD
res: boolean
ValidateDRSInput(hDrs, 27)
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V1
if DS_DEMOTE_OPT_FAIL_ON_UNKNOWN_OP in msgIn.dwOperations then
/* unknown operation bit is set */
return ERROR_INVALID_PARAMETER
endif
if DS_DEMOTE_UNREGISTER_SPNS in msgIn.dwOperations
and msgIn.szScriptBase = null then
/* szScriptBase must be specified when UNREGISTER_SPN is
* requested */
return ERROR_INVALID_PARAMETER
endif
if not IsMemberOfBuiltinAdminGroup() then
/* only BA is allowed to demote an AD LDS service */
return ERROR_DS_DRA_ACCESS_DENIED
endif
pdwOutVersion^ := 1
msgOut.dwOperationDone := 0
msgOut.dwOpFailed := 0
msgOut.dwOpError := ERROR_SUCCESS
dc.fEnableUpdates := TRUE
msgOut.dwOperationDone :=
msgOut.dwOperationDone + {DS_DEMOTE_ROLLBACK_DEMOTE}
msgOut.dwOpError := ERROR_SUCCESS
159 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* no other operations are allowed on rollback */
/* End operations corresponding to dwOperations value of DS_DEMOTE_ROLLBACK_DEMOTE */
else
if DS_DEMOTE_COMMIT_DEMOTE in msgIn.dwOperations then
/* Begin operations corresponding to dwOperations value of DS_DEMOTE_COMMIT_DEMOTE */
After this call to IDL_DRSFinishDemotion completes, the server must discontinue being a
DC, which for AD LDS means stopping the MS-DRSR protocol, the MS-DSSP protocol, the LDAP
protocol, and if they are already enabled also the MS-ADCAP protocol, the WS-Enumeration
protocol, the WS-Transfer protocol, the MS-WSTIM protocol, the MS-WSDS protocol, and the MS-
WSPELD protocol. In addition, the state model, constraints and processing rules, and so on,
in MS-ADTS must also be stopped.
msgOut.dwOperationDone :=
msgOut.dwOperationDone + {DS_DEMOTE_COMMIT_DEMOTE}
msgOut.dwOpError := ERROR_SUCCESS
/* End operations corresponding to dwOperations value of DS_DEMOTE_COMMIT_DEMOTE */
endif
if DS_DEMOTE_DELETE_CSMETA in msgIn.dwOperations then
/* Begin operations corresponding to dwOperations value of DS_DEMOTE_DELETE_CSMETA */
ret := RemoveADLDSServer()
if ret = ERROR_SUCCESS then
msgOut.dwOperationDone :=
msgOut.dwOperationDone + {DS_DEMOTE_DELETE_CSMETA}
else
msgOut.dwOpFailed =
msgOut.dwOpFailed + {DS_DEMOTE_DELETE_CSMETA}
if msgOut.dwOpError = ERROR_SUCCESS then
msgOut.dwOpError := ret
endif
endif
/* End operations corresponding to dwOperations value of DS_DEMOTE_DELETE_CSMETA */
endif
if DS_DEMOTE_UNREGISTER_SCPS in msgIn.dwOperations then
/* Begin operations corresponding to dwOperations value of DS_DEMOTE_UNREGISTER_SCPS */
ret := RemoveADLDSSCP()
if ret = ERROR_SUCCESS then
msgOut.dwOperationDone :=
msgOut.dwOperationDone + {DS_DEMOTE_UNREGISTER_SCPS}
else
msgOut.dwOpFailed =
msgOut.dwOpFailed + {DS_DEMOTE_UNREGISTER_SCPS}
if msgOut.dwOpError = ERROR_SUCCESS then
msgOut.dwOpError := ret
endif
endif
/* End operations corresponding to dwOperations value of DS_DEMOTE_UNREGISTER_SCPS */
endif
if DS_DEMOTE_UNREGISTER_SPNS in msgIn.dwOperations then
/* Begin operations corresponding to dwOperations value of DS_DEMOTE_UNREGISTER_SPNS */
res := RemoveADLDSSPNs(msgIn.szScriptBase)
if res = TRUE then
msgOut.dwOperationDone :=
msgOut.dwOperationDone + {DS_DEMOTE_UNREGISTER_SPNS}
else
msgOut.dwOpFailed =
msgOut.dwOpFailed + {DS_DEMOTE_UNREGISTER_SPNS}
endif
/* End operations corresponding to dwOperations value of DS_DEMOTE_UNREGISTER_SPNS */
endif
endif
pmsgOut^ := msgOut
pdwMsgOut^ := 1
return ERROR_SUCCESS
160 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.8 IDL_DRSGetMemberships (Opnum 9)
ULONG IDL_DRSGetMemberships(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_REVMEMB_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REVMEMB_REPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.8.1.1 DRS_MSG_REVMEMB_REQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REVMEMB_REQ_V1 V1;
} DRS_MSG_REVMEMB_REQ;
4.1.8.1.2 DRS_MSG_REVMEMB_REQ_V1
typedef struct {
[range(1,10000)] ULONG cDsNames;
[size_is(cDsNames,)] DSNAME** ppDsNames;
DWORD dwFlags;
[range(1,7)] REVERSE_MEMBERSHIP_OPERATION_TYPE OperationType;
DSNAME* pLimitingDomain;
161 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DRS_MSG_REVMEMB_REQ_V1;
ppDsNames: The DSName of the object whose reverse membership is being requested, plus the
DSNames of groups of the appropriate type(s) of which it is already known to be a member.
dwFlags: Zero or more of the following bit flags, which are presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X X A X X X X X X X X X X X X X X X X X X X X X X X X
pLimitingDomain: Domain filter; resulting objects that are not from this domain are neither
returned nor followed transitively.
4.1.8.1.3 REVERSE_MEMBERSHIP_OPERATION_TYPE
typedef enum
{
RevMembGetGroupsForUser = 1,
RevMembGetAliasMembership,
RevMembGetAccountGroups,
RevMembGetResourceGroups,
RevMembGetUniversalGroups,
GroupMembersTransitive,
RevMembGlobalGroupsNonTransitive
} REVERSE_MEMBERSHIP_OPERATION_TYPE;
162 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
RevMembGlobalGroupsNonTransitive: Non-transitive membership in global groups, excluding
built-in groups.
4.1.8.1.4 DRS_MSG_REVMEMB_REPLY
The DRS_MSG_REVMEMB_REPLY union defines the response messages received from the
IDL_DRSGetMemberships method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REVMEMB_REPLY_V1 V1;
} DRS_MSG_REVMEMB_REPLY;
4.1.8.1.5 DRS_MSG_REVMEMB_REPLY_V1
The DRS_MSG_REVMEMB_REPLY_V1 structure defines the response message received from the
IDL_DRSGetMemberships method.
typedef struct {
ULONG errCode;
[range(0,10000)] ULONG cDsNames;
[range(0,10000)] ULONG cSidHistory;
[size_is(cDsNames,)] DSNAME** ppDsNames;
[size_is(cDsNames)] DWORD* pAttributes;
[size_is(cSidHistory,)] NT4SID** ppSidHistory;
} DRS_MSG_REVMEMB_REPLY_V1;
Value Meaning
STATUS_TOO_MANY_CONTEXT_IDS The number of groups is greater than the number that can be
0xC000015A returned to the caller.
ppDsNames: The filtered group membership. This list contains the combined membership for all the
names specified in ppDsNames field of the input DRS_MSG_REVMEMB_REQ_V1 structure.
pAttributes: Properties of the returned groups. Values are chosen from SE_GROUP values.
163 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Symbolic name Value
SE_GROUP_MANDATORY 0x00000001
SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
SE_GROUP_ENABLED 0x00000004
4.1.8.2.2 Closure
procedure Closure(
vSet: set of DSName,
aSet: ArcSet,
v: DSName): set of DSName
The Closure procedure returns the set of vertices that can be reached from vertex v in the directed
graph that consists of vertex set vSet and arc set aSet. A vertex u can be reached from v if and only if
there is a sequence v[0], v[1], ... , v[k], where v[0]=v, v[k]=u, and v[i] is in vSet and [initial:v[i-1],
final:v[i]) is in aSet for i=1,2,...,k.
4.1.8.2.3 DomainOf
procedure DomainOf(o: DSName): DSName
The DomainOf procedure returns the DSName of the domain NC to which the given DSName o
belongs. It returns null upon failure.
4.1.8.2.4 GetDSNameOfEnterpriseRODCsGroup
procedure GetDSNameOfEnterpriseReadonlyDomainControllerGroup(): DSName
This procedure constructs a SID s consisting of the domain SID of the root domain and the relative
identifier (RID) of the Enterprise Read-only Domain Controllers Group (as defined in [MS-ADTS]
section 6.1.1.6.14), and returns the DSName of the object o for which o! objectSid = s. If no such
object o exists, this procedure returns null.
4.1.8.2.5 GetDSNameFromPrimaryGroupId
procedure GetDSNameFromPrimaryGroupId(rid: Rid): DSName
This procedure constructs a SID s consisting of the domain SID of the DC's default domain and the
given relative identifier rid, and returns the DSName of the object o for which o!objectSid = s. If no
such object o exists, then this procedure will return null.
4.1.8.2.6 IsMatchedGroup
164 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure IsMatchedGroup(
w: DSName,
op: REVERSE_MEMBERSHIP_OPERATION_TYPE,
limitingDomain: DSName): boolean
Informative summary of behavior: The IsMatchedGroup procedure checks whether an object should
be included in the result for the specified IDL_DRSGetMemberships operation.
return result
4.1.8.2.7 Neighbors
procedure Neighbors(
vSet: set of DSName,
aSet: ArcSet,
v: DSName): set of DSName
The Neighbors procedure returns the set of vertices adjacent to vertex v in the directed graph that
consists of vertex set vSet and arc set aSet. A vertex u is adjacent to v if u is in vSet and [initial:v,
final:u] is in aSet. Note that because this is a directed graph, the fact that vertex u is adjacent to
vertex v does not imply that vertex v is adjacent to vertex u.
165 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
For a GroupMembersTransitive request, a reversed graph of G is used because member relation is
queried rather than membership. The reversed graph has the same vertex set as G, but the arcs in
the arc set are in the opposite direction as those in A.
For other types of requests, a subgraph of G is used. The vertex set of this subgraph consists of only
the DSName values of interest for that particular request type, and the arc set is reduced to the arcs
that link two vertices in the vertex set of the subgraph.
Starting from the graph, this method computes a set of objects for each DSName in the input
parameters. The set could be either transitive closure of the object or the immediate neighbors of the
object in the graph, depending on the type of request. The union of these sets is returned as the
result.
ULONG
IDL_DRSGetMemberships(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_REVMEMB_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REVMEMB_REPLY *pmsgOut)
msgIn: DRS_MSG_REVMEMB_REQ_V1
vSet, wSet, uSet: set of DSName
aSet, aSetR: ArcSet
u,v,w: DSName
op, i: integer
transitive: boolean
t: SID
ValidateDRSInput(hDrs, 9)
pdwOutVersion^ := 1
pmsgOut^.V1.errCode := 0
pmsgOut^.V1.cDsNames := 0
pmsgOut^.V1.cSidHistory := 0
pmsgOut^.V1.ppDsNames := null
pmsgOut^.V1.pAttributes := null
pmsgOut^.V1.ppSidHistory := null
msgIn := pmsgIn^.V1
if dwInVersion ≠ 1 then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
if not AccessCheckCAR(DefaultNC(), DS-Replication-Get-Changes) then
return ERROR_DS_DRA_ACCESS_DENIED
endif
op := msgIn.OperationType
if (op = RevMembGetUniversalGroups) and not IsGC() then
return ERROR_DS_GC_REQUIRED
endif
/* Edges */
aSet := {}
aSetR := {}
foreach v in vSet
foreach u in vSet
166 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (u in v!memberOf)
or (u = GetDSNameFromPrimaryGroupId(v!primaryGroupId)) then
aSet := aSet + {[initial: v, final: u]}
aSetR := aSetR + {[initial: u, final: v]}
endif
endfor
endfor
/* Calculate GroupMembersTransitive. */
if op = GroupMembersTransitive then
wSet := {}
for i := 0 to msgIn.ppDsNames.cDsNames - 1
u := msgIn.ppDsNames[i]
if u in vSet then
wSet := wSet + (Closure(uSet, aSetR, u) - {u})
endif
endfor
foreach w in wSet
pmsgOut^.V1.ppDsNames[pmsgOut^.V1.cDsNames] := w
pmsgOut^.V1.cDsNames:= pmsgOut^.V1.cDsNames + 1
endfor
return 0
endif
foreach w in wSet
foreach t in w!sIDHistory
if not (t in pmsgOut^.V1.ppSidHistory) then
pmsgOut^.V1.ppSidHistory[pmsgOut^.V1.cSidHistory] := t
pmsgOut^.V1.cSidHistory := pmsgOut^.V1.cSidHistory + 1
endif
endfor
pmsgOut^.V1.ppDsNames[pmsgOut^.V1.cDsNames] := w
167 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (DRS_REVMEMB_FLAG_GET_ATTRIBUTES in msgIn.dwFlags) then
pmsgOut^.V1.pAttributes[pmsgOut^.V1.cDsNames] :=
{SE_GROUP_MANDATORY,SE_GROUP_ENABLED_BY_DEFAULT,
SE_GROUP_ENABLED}
else
pmsgOut^.V1.pAttributes[pmsgOut^.V1.cDsNames] := 0
endif
pmsgOut^.V1.cDsNames := pmsgOut^.V1.cDsNames + 1
endfor
return 0
ULONG IDL_DRSGetMemberships2(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETMEMBERSHIPS2_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETMEMBERSHIPS2_REPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.9.1.1 DRS_MSG_GETMEMBERSHIPS2_REQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_GETMEMBERSHIPS2_REQ_V1 V1;
} DRS_MSG_GETMEMBERSHIPS2_REQ;
168 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1: Version 1 request.
4.1.9.1.2 DRS_MSG_GETMEMBERSHIPS2_REQ_V1
typedef struct {
[range(1,10000)] ULONG Count;
[size_is(Count)] DRS_MSG_REVMEMB_REQ_V1* Requests;
} DRS_MSG_GETMEMBERSHIPS2_REQ_V1;
4.1.9.1.3 DRS_MSG_GETMEMBERSHIPS2_REPLY
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_GETMEMBERSHIPS2_REPLY_V1 V1;
} DRS_MSG_GETMEMBERSHIPS2_REPLY;
4.1.9.1.4 DRS_MSG_GETMEMBERSHIPS2_REPLY_V1
typedef struct {
[range(0,10000)] ULONG Count;
[size_is(Count)] DRS_MSG_REVMEMB_REPLY_V1* Replies;
} DRS_MSG_GETMEMBERSHIPS2_REPLY_V1;
Replies: Sequence of reverse membership replies, in the same order as the Requests field of the
request message.
ULONG
IDL_DRSGetMemberships2(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETMEMBERSHIPS2_REQ *pmsgIn,
169 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETMEMBERSHIPS2_REPLY *pmsgOut)
error, i: ULONG
dummyVersion: DWORD
ValidateDRSInput(hDrs, 21)
pdwOutVersion^ := 1
pMsgOut^.V1.Count := 0
pMsgOut^.V1.Replies := null
if dwInVersion ≠ 1 then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
pmsgOut^.V1.Count := pmsgIn^.V1.Count
for i := 0 to pmsgIn^.V1.Count - 1
/* Call IDL_DRSGetMemberships as a local procedure. */
error := IDL_DRSGetMemberships(null, 1, ADR(pmsgIn^.V1.Request[i]),
ADR(dummyVersion), ADR(pmsgOut^.V1.Replies[i]))
if error ≠ 0 then
return error
endif
endfor
return 0
ULONG IDL_DRSGetNCChanges(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETCHGREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETCHGREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
170 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.10.1 Overview
The response (msgOut, of a type in the union DRS_MSG_GETCHGREPLY) contains a set of updates
that the client is to apply to its NC replica. Commonly, this set of updates is too large to send in a
single response; in this case, multiple IDL_DRSGetNCChanges requests and responses must be sent
before the server sends a response that indicates no additional updates are available.
This sequence of requests and responses is called a replication cycle, or "cycle". A client DC can
request an action on a FSMO role (for example, a change in the FSMO role owner) by using a
special replication cycle called an extended operation.
1. The client explicitly signals the start of a special single-response cycle when it requests an
extended operation. Such cycles always consist of a single response which sets
msgOut.fMoreData = false.
3. The client sends values of msgIn.uuidInvocIdSrc and msgIn.usnvecFrom that were returned by
the server as msgOut.uuidInvocIdSrc and msgOut.usnvecTo in the final message of some other
cycle.
5. The server implementation MAY<17> declare the supplied values of msgIn.uuidInvocIdSrc and
msgIn.usnvecFrom as too stale to use.
If the server starts a new cycle based on items 4 or 5, the server ignores msgIn.usnvecFrom, treating
it as though it were zero.
The fields msgOut.usnvecTo and msgIn.usnvecFrom have the same type, USN_VECTOR. The internal
format of USN_VECTOR is determined entirely by the server implementation and is subject only to the
requirement that msgIn.usnvecFrom = 0 represents the start of a cycle. The server MAY<18> use
USN_VECTOR to encode the start of a cycle.
Any server response message with msgOut.fMoreData = false is the final response in a cycle.
For any cycle that is not an extended operation, the goal of the server is to send updates such
that at the conclusion of the cycle, the client NC replica contains all updates that were present in the
server NC replica at the start of the cycle. More concretely, if cycleStartUtd is the server's
msgIn.pNC^!replUpToDateVector on receipt of the first request in a cycle where msgIn.ulExtendedOp
= 0, then the final response in the cycle MUST contain msgOut.pUpToDateVecSrc such that
HasUpdateKnowledge(msgOut.pUpToDateVecSrc^, cycleStartUtd) = true:
procedure HasUpdateKnowledge(
utd1: UPTODATE_VECTOR_V2_EXT,
utd2: UPTODATE_VECTOR_V2_EXT): boolean
begin
171 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
i: integer
j: integer
return true
end HasUpdateKnowledge
The server MAY<19> advance the cycle goal on each request such that it includes updates that the
server has applied since the first request in the cycle.
The cycle goal includes a cursor c for the server DC such that:
c.uuidDsa is the value of the invocationId attribute of the server's nTDSDSA object.
c.usnHighPropUpdate is the highest USN such that the server can assert that, including the
updates in this response, the client has applied any update with stamp s where s.uuidOriginating
= c.uuidDsa and s.usnOriginating ≤ c.usnHighPropUpdate. If the server has originated no updates
in the NC, it MAY<20> set c.usnHighPropUpdate to 0.
c.timeLastSyncSuccess is the time at which the server sends the final response.
Replicate Single Object (EXOP_REPL_OBJ): Adds any changes to the specified object to the
response.<24>
Replicate Single Object including Secret Data (EXOP_REPL_SECRETS): Adds any changes to the
specified object to the response. In addition, it also adds the secret attribute values of the
specified object to the response, regardless of whether they have recent changes. See the
IsSecretAttribute procedure in section 4.1.10.3.11 for a list of these attributes.<25>
4.1.10.2.1 DRS_MSG_GETCHGREQ
172 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_GETCHGREQ union defines request messages that are sent to the
IDL_DRSGetNCChanges method. There are no V1, V2, V3, V6, or V9 messages.
typedef
[switch_type(DWORD)]
union {
[case(4)]
DRS_MSG_GETCHGREQ_V4 V4;
[case(5)]
DRS_MSG_GETCHGREQ_V5 V5;
[case(7)]
DRS_MSG_GETCHGREQ_V7 V7;
[case(8)]
DRS_MSG_GETCHGREQ_V8 V8;
[case(10)]
DRS_MSG_GETCHGREQ_V10 V10;
[case(11)]
DRS_MSG_GETCHGREQ_V11 V11;
} DRS_MSG_GETCHGREQ;
V4: Version 4 request (Windows 2000 operating system SMTP replication [MS-SRPL]).
V10: Version 10 request (Windows Server 2008 R2 operating system RPC replication).
V11: Version 11 request (Windows Server v1803 operating system RPC replication).
4.1.10.2.2 DRS_MSG_GETCHGREQ_V3
The DRS_MSG_GETCHGREQ_V3 structure defines a portion of the request message that is sent to the
IDL_DRSGetNCChanges method as part of SMTP replication ([MS-SRPL]). This is not a complete
request message; it is embedded in DRS_MSG_GETCHGREQ_V4 and
DRS_MSG_GETCHGREQ_V7.<26>
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME* pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecDestV1;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrVecDestV1;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
} DRS_MSG_GETCHGREQ_V3;
pNC: NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecDestV1: Stamp filter describing updates that the client has already applied.
173 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pPartialAttrVecDestV1: A set of one or more attributes whose values are to be replicated to the
client's partial replica.
PrefixTableDest: Prefix table with which to convert the ATTRTYP values in pPartialAttrVecDestV1
to OIDs.
4.1.10.2.3 DRS_MSG_GETCHGREQ_V4
typedef struct {
UUID uuidTransportObj;
[ref] MTX_ADDR* pmtxReturnAddress;
DRS_MSG_GETCHGREQ_V3 V3;
} DRS_MSG_GETCHGREQ_V4;
uuidTransportObj: The objectGUID of the interSiteTransport object that identifies the transport by
which to send the reply.
4.1.10.2.4 DRS_MSG_GETCHGREQ_V5
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME* pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecDestV1;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
} DRS_MSG_GETCHGREQ_V5;
pNC: NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecDestV1: Stamp filter that describes updates the client has already applied.
174 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ulFlags: DRS_OPTIONS bit field.
4.1.10.2.5 DRS_MSG_GETCHGREQ_V7
typedef struct {
UUID uuidTransportObj;
[ref] MTX_ADDR* pmtxReturnAddress;
DRS_MSG_GETCHGREQ_V3 V3;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
} DRS_MSG_GETCHGREQ_V7;
uuidTransportObj: The objectGUID of the interSiteTransport object that identifies the transport by
which to send the reply.
pPartialAttrSet: A set of one or more attributes whose values are to be replicated to the client's
partial replica, or null if the client has a full replica.
pPartialAttrSetEx: A set of one or more attributes whose values are to be added to the client's
existing partial replica, or null.
PrefixTableDest: Prefix table with which to convert the ATTRTYP values in pPartialAttrSet and
pPartialAttrSetEx to OIDs.
4.1.10.2.6 DRS_MSG_GETCHGREQ_V8
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME* pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
} DRS_MSG_GETCHGREQ_V8;
175 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
uuidDsaObjDest: DSA GUID of the client DC.
pNC: NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecDest: Stamp filter describing updates the client has already applied.
pPartialAttrSet: A set of one or more attributes whose values are to be replicated to the client's
partial replica, or null if the client has a full replica.
pPartialAttrSetEx: A set of one or more attributes whose values are to be added to the client's
existing partial replica, or null.
PrefixTableDest: Prefix table with which to convert the ATTRTYP values in pPartialAttrSet and
pPartialAttrSetEx to OIDs.
4.1.10.2.7 DRS_MSG_GETCHGREQ_V10
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME* pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulMoreFlags;
} DRS_MSG_GETCHGREQ_V10;
pNC: NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecDest: Stamp filter describing updates the client has already applied.
176 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cMaxObjects: Approximate cap on the number of objects to include in the reply.
pPartialAttrSet: A set of one or more attributes whose values are to be replicated to the client's
partial replica, or null if the client has a full replica.
pPartialAttrSetEx: A set of one or more attributes whose values are to be added to the client's
existing partial replica, or null.
PrefixTableDest: Prefix table with which to convert the ATTRTYP values in pPartialAttrSet and
pPartialAttrSetEx to OIDs.
4.1.10.2.8 DRS_MSG_GETCHGREQ_V11
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME* pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT* pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulMoreFlags;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_GETCHGREQ_V11;
pNC: NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecDest: Stamp filter describing updates the client has already applied.
177 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pPartialAttrSet: A set of one or more attributes whose values are to be replicated to the client's
partial replica, or null if the client has a full replica.
pPartialAttrSetEx: A set of one or more attributes whose values are to be added to the client's
existing partial replica, or null.
PrefixTableDest: Prefix table with which to convert the ATTRTYP values in pPartialAttrSet and
pPartialAttrSetEx to OIDs.
correlationID: An identifier for the operation that the DC can use for implementation-defined
troubleshooting. There are no normative constraints on this value, nor does the value figure in any
normative processing rules.
4.1.10.2.9 DRS_MSG_GETCHGREPLY
The DRS_MSG_GETCHGREPLY union defines the response messages received from the
IDL_DRSGetNCChanges method. There are no V3, V4, V5, or V8 messages.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_GETCHGREPLY_V1 V1;
[case(2)]
DRS_MSG_GETCHGREPLY_V2 V2;
[case(6)]
DRS_MSG_GETCHGREPLY_V6 V6;
[case(7)]
DRS_MSG_GETCHGREPLY_V7 V7;
[case(9)]
DRS_MSG_GETCHGREPLY_V9 V9;
} DRS_MSG_GETCHGREPLY;
4.1.10.2.10 DRS_MSG_GETCHGREPLY_V1
The DRS_MSG_GETCHGREPLY_V1 structure defines the response message received from the
IDL_DRSGetNCChanges method.
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME* pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V1_EXT* pUpToDateVecSrcV1;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
178 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST* pObjects;
BOOL fMoreData;
} DRS_MSG_GETCHGREPLY_V1;
pNC: The NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecSrcV1: Stamp filter that describes updates the server has already applied.
cNumBytes: Size in bytes of items in or referenced by elements in the pObjects linked list.
pObjects: Linked list of object updates that the client applies to its NC replica.
fMoreData: False if and only if this is the last response in a replication cycle.
4.1.10.2.11 DRS_MSG_GETCHGREPLY_V2
typedef struct {
DRS_COMPRESSED_BLOB CompressedV1;
} DRS_MSG_GETCHGREPLY_V2;
4.1.10.2.12 DRS_MSG_GETCHGREPLY_V6
The DRS_MSG_GETCHGREPLY_V6 structure defines the response message received from the
IDL_DRSGetNCChanges method. This message version is a superset of DRS_MSG_GETCHGREPLY_V1.
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME* pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V2_EXT* pUpToDateVecSrc;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST* pObjects;
BOOL fMoreData;
179 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ULONG cNumNcSizeObjects;
ULONG cNumNcSizeValues;
[range(0,1048576)] DWORD cNumValues;
[size_is(cNumValues)] REPLVALINF_V1* rgValues;
DWORD dwDRSError;
} DRS_MSG_GETCHGREPLY_V6;
pNC: The NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecSrc: Stamp filter that describes updates the server has already applied.
cNumBytes: Size in bytes of items in or referenced by elements in the pObjects linked list.
pObjects: Linked list of object updates that the client applies to its NC replica.
fMoreData: False if and only if this is the last response in a replication cycle.
rgValues: Link value updates for the client to apply to its NC replica.
4.1.10.2.13 DRS_MSG_GETCHGREPLY_V7
typedef struct {
DWORD dwCompressedVersion;
DRS_COMP_ALG_TYPE CompressionAlg;
DRS_COMPRESSED_BLOB CompressedAny;
} DRS_MSG_GETCHGREPLY_V7;
4.1.10.2.14 DRS_MSG_GETCHGREPLY_V9
180 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_GETCHGREPLY_V9 structure defines the response message received from the
IDL_DRSGetNCChanges method. This message version contains all the same elements as a
DRS_MSG_GETCHGREPLY_V6 structure except that the data type of rgValues is changed from
REPLVALINF_V1* to REPLVALINF_V3*. The data in a REPLVALINF_V3 structure is a superset of the
data in a REPLVALINF_V1 structure. Therefore, the data in the DRS_MSG_GETCHGREPLY_V9
structure is a superset of the data in the DRS_MSG_GETCHGREPLY_V6 structure.
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME* pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V2_EXT* pUpToDateVecSrc;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST* pObjects;
BOOL fMoreData;
ULONG cNumNcSizeObjects;
ULONG cNumNcSizeValues;
[range(0,1048576)] DWORD cNumValues;
[size_is(cNumValues)] REPLVALINF_V3* rgValues;
DWORD dwDRSError;
} DRS_MSG_GETCHGREPLY_V9;
pNC: The NC root of the replica to replicate or the FSMO role object for an extended operation.
pUpToDateVecSrc: Stamp filter that describes updates the server has already applied.
cNumBytes: Size in bytes of items in or referenced by elements in the pObjects linked list.
pObjects: Linked list of object updates that the client applies to its NC replica.
fMoreData: False if and only if this is the last response in a replication cycle.
rgValues: Link value updates for the client to apply to its NC replica.
4.1.10.2.15 DRS_MSG_GETCHGREPLY_NATIVE
181 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_GETCHGREPLY_NATIVE structure is an alias for the
DRS_MSG_GETCHGREPLY_V9 data structure.
4.1.10.2.16 DRS_MSG_GETCHGREPLY_NATIVE_VERSION_NUMBER
4.1.10.2.17 COMPRESSED_DATA
typedef struct {
ULONG cbDecompressedSize;
ULONG cbCompressedSize;
BYTE data[];
} COMPRESSED_DATA;
data: Data stream. The data is padded with zeros, if necessary, so that the block ends on a double
word boundary.
4.1.10.2.18 DRS_COMP_ALG_TYPE
typedef enum
{
DRS_COMP_ALG_NONE = 0,
DRS_COMP_ALG_UNUSED = 1,
DRS_COMP_ALG_MSZIP = 2,
DRS_COMP_ALG_WIN2K3 = 3
} DRS_COMP_ALG_TYPE;
DRS_COMP_ALG_NONE: No compression.
4.1.10.2.19 DRS_COMPRESSED_BLOB
The DRS_COMPRESSED_BLOB structure defines a concrete type that results from marshaling a data
structure into a byte stream by using RPC and compressing that byte stream.
typedef struct {
DWORD cbUncompressedSize;
DWORD cbCompressedSize;
[size_is(cbCompressedSize)] BYTE* pbCompressedData;
} DRS_COMPRESSED_BLOB;
182 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cbCompressedSize: Size in bytes of the pbCompressedData array.<29>
Padding: Data is padded with zeros, if necessary, so that the block ends on an alignment boundary of
LONG.
4.1.10.2.20 ENCRYPTED_PAYLOAD
The ENCRYPTED_PAYLOAD packet is the concrete type for a value of an encrypted attribute.
typedef struct {
UCHAR Salt[16];
ULONG CheckSum;
UCHAR EncryptedData[];
} ENCRYPTED_PAYLOAD;
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
...
...
CheckSum
EncryptedData (variable)
...
CheckSum (4 bytes): A 32-bit CRC32 checksum of the data that is encrypted along with the data.
EncryptedData (variable): A variable-length byte array that represents the encrypted value.
The following values are error codes for an extended operation request to the
IDL_DRSGetNCChanges method.
EXOP_ERR_SUCCESS (0x00000001)
EXOP_ERR_UNKNOWN_OP (0x00000002)
EXOP_ERR_FSMO_NOT_OWNER (0x00000003)
EXOP_ERR_UPDATE_ERR (0x00000004)
EXOP_ERR_EXCEPTION (0x00000005)
EXOP_ERR_UNKNOWN_CALLER (0x00000006)
EXOP_ERR_RID_ALLOC (0x00000007)
183 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
EXOP_ERR_FSMO_OWNER_DELETED (0x00000008)
EXOP_ERR_FSMO_PENDING_OP (0x00000009)
EXOP_ERR_MISMATCH (0x0000000A)
EXOP_ERR_COULDNT_CONTACT (0x0000000B)
EXOP_ERR_FSMO_REFUSING_ROLES (0x0000000C)
EXOP_ERR_DIR_ERROR (0x0000000D)
EXOP_ERR_FSMO_MISSING_SETTINGS (0x0000000E)
EXOP_ERR_ACCESS_DENIED (0x0000000F)
EXOP_ERR_PARAM_ERR (0x00000010)
EXOP_FSMO_REQ_ROLE (0x00000001)
EXOP_FSMO_REQ_RID_ALLOC (0x00000002)
EXOP_FSMO_RID_REQ_ROLE (0x00000003)
EXOP_FSMO_REQ_PDC (0x00000004)
EXOP_FSMO_ABANDON_ROLE (0x00000005)
EXOP_REPL_OBJ (0x00000006)
EXOP_REPL_SECRETS (0x00000007)
4.1.10.2.23 PROPERTY_META_DATA
The PROPERTY_META_DATA structure contains attribute and stamp information. For more details,
see section 4.1.10.5.9.
The binary portion of the DNBinary value of the msDS-RevealedUsers attribute contains this structure.
4.1.10.3.1 AbstractLinkValStampFromConcreteLinkValStamp
184 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure AbstractLinkValStampFromConcreteLinkValStamp(
concreteStamp: VALUE_META_DATA_EXT_NATIVE) : LinkValueStamp
linkValueStamp : LinkValueStamp
linkValueStamp := concreteStamp.MetaData
linkValueStamp.timeCreated := concreteStamp.timeCreated
linkValueStamp.timeExpired := concreteStamp.timeExpired
return linkValueStamp
4.1.10.3.2 AbstractPASFromConcretePAS
procedure AbstractPASFromConcretePAS(
concretePAS: PARTIAL_ATTR_VECTOR_V1_EXT,
prefixTable: PrefixTable): sequence of ATTRTYP
for i := 0 to (concretePAS.cAttrs - 1)
abstractPAS[i] := LocalAttidFromRemoteAttid(
prefixTable, concretePAS.rgPartialAttr[i])
endfor
return abstractPAS
4.1.10.3.3 AbstractUTDFromConcreteUTD
procedure AbstractUTDFromConcreteUTD(
concreteUTD: UPTODATE_VECTOR_V2_EXT): sequence of ReplUpToDateVector
abstractUTD: ReplUpToDateVector
for i := 0 to (concreteUTD.length - 1)
abstractUTD[i].uuidDsa := concreteUTD.rgCursors[i].uuidDsa
abstractUTD[i].usnHighPropUpdate :=
concreteUTD.rgCursors[i].usnHighPropUpdate
abstractUTD[i].timeLastSyncSuccess :=
concreteUTD.rgCursors[i].timeLastSyncSuccess
endfor
return concreteUTD
4.1.10.3.4 AttributeAndStamp
185 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
type AttributeAndStamp = [attribute: ATTRTYP, stamp: AttributeStamp]
This abstract type encapsulates the ATTRTYP of an attribute (based on dc.prefixTable) and its
associated AttributeStamp on an object.
4.1.10.3.5 AttributeStampCompare
procedure AttributeStampCompare(
stamp1: AttributeStamp,
stamp2: AttributeStamp): integer
4.1.10.3.6 ConcretePASFromAbstractPAS
procedure ConcretePASFromAbstractPAS(
abstractPAS: sequence of ATTRTYP) : PARTIAL_ATTR_VECTOR_V1_EXT
concretePAS : PARTIAL_ATTR_VECTOR_V1_EXT
i: DWORD
concretePAS.dwVersion := 1
concretePAS.dwReserved1 := 0
concretePAS.cAttrs := abstractPAS.length
for i := 0 to (abstractPAS.length - 1)
concretePAS.rgPartialAttr[i] := abstractPAS[i]
endfor
return concretePAS
4.1.10.3.7 ConcreteUTDFromAbstractUTD
procedure ConcreteUTDFromAbstractUTD(
abstractUTD: sequence of ReplUpToDateVector):
UPTODATE_VECTOR_V1_EXT
concreteUTD: UPTODATE_VECTOR_V1_EXT
concreteUTD.dwVersion := 1
concreteUTD.dwReserved1 := 0
concreteUTD.dwReserved2 := 0
concreteUTD.cNumCursors := abstractUTD.length
for i := 0 to (abstractUTD.length - 1)
concreteUTD.rgCursors[i].uuidDsa := abstractUTD[i].uuidDsa
concreteUTD.rgCursors[i].usnHighPropUpdate :=
186 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
abstractUTD[i].usnHighPropUpdate
endfor
return concreteUTD
4.1.10.3.8 GetNCChangesNativeReply
procedure GetNCChangesNativeReply(
replyMessage: DRS_MSG_GETCHGREPLY,
version: DWORD): DRS_MSG_GETCHGREPLY_NATIVE
msgReplyNative: DRS_MSG_GETCHGREPLY_NATIVE
i: DWORD
if (version = 1) then
msgReplyNative := 0
msgReplyNative := replyMessage.V1
msgReplyNative.pUpToDateVecSrc^.dwVersion := 2
msgReplyNative.pUpToDateVecSrc^.cNumCursors :=
replyMessage.V1.pUpToDateVecSrcV1^.cNumCursors
for i := 0 to (replyMessage.V1.pUpToDateVecSrcV1^.cNumCursors - 1)
msgReplyNative.pUpToDateVecSrc^.rgCursors[i] :=
replyMessage.V1.pUpToDateVecSrcV1^.rgCursors[i]
msgReplyNative.pUpToDateVecSrc^.rgCursors[i].timeLastSyncSuccess := 0
endfor
else if (version = 6) then
msgReplyNative := 0
msgReplyNative := replyMessage.V6
msgReplyNative.rgValues :=
ReplValInfNativeListFromReplValInfV1List(replyMessage.V6.rgValues)
else
msgReplyNative = replyMessage.V9
endif
return msgReplyNative
4.1.10.3.9 GetStampsForUpdate
procedure GetStampsForUpdate(
replEntinfList: REPLENTINFLIST,
prefixTable: PrefixTable): set of AttributeAndStamp
tupleEntry: AttributeAndStamp
attrStamps: set of AttributeStamp
i: DWORD
for i := 0 to (replEntinfList.pMetaDataExt.cNumProps - 1)
187 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
tupleEntry.attribute := LocalAttidFromRemoteAttid(
prefixTable, replEntinfList.Entinf.AttrBlock.pAttr[i].attrTyp)
tupleEntry.stamp := AbstractAttrStampFromConcereteAttrStamp(
replEntinfList.pMetaDataExt.rgMetaData[i])
attrStamps := attrStamps + {tupleEntry}
endfor
return attrStamps
4.1.10.3.10 GetWellKnownObject
procedure GetWellKnownObject(
nc: DSName,
guid: GUID): DSName
Informative summary of behavior: The GetWellKnownObject procedure returns the DSName of the
well-known object with the given guid in a specified NC replica.
attrVals := {nc!wellKnownObjects}
for each attrVal in attrVals do
if (attrVal.binary = guid) then
return attrVal.dn
endif
endfor
return null
4.1.10.3.11 IsSecretAttribute
procedure IsSecretAttribute(attribute : ATTRTYP): boolean
The IsSecretAttribute procedure returns true if attribute is an attribute that contains secret data.
Otherwise, the procedure returns false.
return (attribute in
{currentValue, dBCSPwd, initialAuthIncoming, initialAuthOutgoing,
lmPwdHistory, ntPwdHistory, priorValue, supplementalCredentials,
trustAuthIncoming, trustAuthOutgoing, unicodePwd} )
4.1.10.3.12 IsUserIncluded
procedure IsUserIncluded(
userSid: SID
groupOrAccountSid: SID)
The IsUserIncluded procedure returns true if userSid = groupOrAccountSid, or if the object identified
by userSid is a member of the set returned by IDL_DRSGetMemberships (section 4.1.8) with the
GroupMembersTransitive option applied to the object identified by groupOrAccountSid.
4.1.10.3.13 ObjAtts
188 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
type ObjAtts = [obj: DSName, atts: sequence of ATTRTYP]
The ObjAtts abstract type encapsulates the identity of an object (obj) and a sequence of ATTRTYP
values (atts, based on dc.prefixTable) for attributes of that object.
4.1.10.3.14 ObjAttVal
type ObjAttVal = [obj: DSName; att: ATTRTYP, val: attribute value]
The ObjAttVal abstract type encapsulates the identity of an object (obj), the ATTRTYP of an
attribute of that object (att, based on dc.prefixTable), and a value of that attribute (val).
4.1.10.3.15 PerformModifyDNOperation
procedure PerformModifyDNOperation(
currentDN: DN,
newParentObject: DSName,
newRDN: RDN)
4.1.10.3.16 RemoveAttrVal
procedure RemoveAttrVal(
obj: DSName,
attr: ATTRTYP,
attributeValue: attribute value)
The RemoveAttrVal procedure removes the value attributeValue from the attribute attr on the object
with DSName obj.
4.1.10.3.17 SetAttrStamp
procedure SetAttrStamp(
obj: DSName,
attr: ATTRTYP,
stamp: AttributeStamp)
The SetAttrStamp procedure sets the AttributeStamp for the attribute attr on the object obj to
stamp.
4.1.10.3.18 SetAttrVal
procedure SetAttrVal(
obj: DSName,
attr: ATTRTYP,
attributeValue: attribute value)
The SetAttrVal procedure sets the value attributeValue for the attribute attr on the object obj.
4.1.10.3.19 SetLinkStamp
procedure SetLinkStamp(
189 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
obj: DSName,
attr: ATTRTYP,
val: attribute value,
stamp: AttributeStamp)
The SetLinkStamp procedure sets the LinkValueStamp for the attribute value val on the attribute attr
on the object obj to stamp.
Informative summary of behavior: The following three tasks can be accomplished by sending an
IDL_DRSGetNCChanges request to a server:
1. Replicate objects from the server's NC replica. The ReplicateNCRequestMsg procedure specifies
the process of building DRS_MSG_GETCHGREQ to perform this task.
2. Replicate a single object from the server's NC replica. The ReplSingleObjRequestMsg procedure
specifies the process of building DRS_MSG_GETCHGREQ to perform this task.
After the DC constructs the request message, it sends the message by using the specified transport:
SMTP (as specified in [MS-SRPL]) if rf ≠ null and if rf.uuidTransport is the objectGUID of the
interSiteTransport object t, where t!cn = "SMTP"; otherwise, the IP transport (RPC over TCP).
4.1.10.4.1 ReplicateNCRequestMsg
procedure ReplicateNCRequestMsg(
hDrs: DRS_HANDLE,
version: DWORD,
nc: DSName,
rf: RepsFrom,
ulFlags: ULONG,
ulMoreFlags: ULONG,
cMaxObjects: ULONG,
cMaxBytes: ULONG,
var msgRequest: DRS_MSG_GETCHGREQ)
hDrs: The DRS_HANDLE that is derived by sending an IDL_DRSBind message to the server.
version: The version number of the input message negotiated between the client and server.
rf: The RepsFrom that corresponds to the server from which to replicate.
ulFlags: Zero or more of the following bit flags. The client MUST supply the same flags for each
request in a given replication cycle, with the exception of DRS_ADD_REF, DRS_GET_ANC,
DRS_USE_COMPRESSION, and DRS_GET_NC_SIZE.
DRS_ADD_REF: Requests that the server add an entry to the repsTo attribute for the client
on the root object of the NC replica that is being replicated.
190 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_WRIT_REP: Indicates that the client contains (or is constructing) a full, writable NC
replica.
DRS_ASYNC_REP: Requests that the server send only the root object of the NC replica.
DRS_GET_ANC: Signals the server to send all updates for each ancestor object of object o
before sending updates for object o.
DRS_FULL_SYNC_PACKET: Requests that the server send all attributes of the objects in its
reply, rather than sending only the updated attributes.
DRS_SYNC_FORCED: Signals the server to honor the request even if its replication has
otherwise been disabled.
DRS_USE_COMPRESSION: Requests that the server reply by using one of the compressed
reply versions (DRS_MSG_GETCHGREPLY_V2 or DRS_MSG_GETCHGREPLY_V7).
DRS_REF_GCSPN: Requests that the server add an entry to repsTo for the client on the root
object of the NC replica that is being replicated. When repsTo is set using this flag, the
notifying client DC contacts the server DC using the service principal name that begins with
"GC" (section 2.2.3.2).
ulMoreFlags: Zero or more of the following bit flags. The client MUST supply the same flags for
each request in a given replication cycle, with the exception of DRS_GET_TGT.
DRS_GET_TGT: Signals the server to send all updates for the target object of a link value
update before sending the link value update.
msgRequest: The procedure populates corresponding fields in this structure depending on the
value that is passed in the version parameter.
msgIn: DRS_MSG_GETCHGREQ_V10
msgRequest: DRS_MSG_GETCHGREQ
prefixEntry: PrefixTableEntry
partialAttrSetSeq: sequence of DSName
schemaSignature: sequence of BYTE
ncType: ULONG
/* NTDSDSA_OPT_DISABLE_INBOUND_REPL defined in
* [MS-ADTS] section 6.1.1.2.2.1.2.1.1, "nTDSDSA Object"*/
if NTDSDSA_OPT_DISABLE_INBOUND_REPL in DSAObj()!options and
191 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
not DRS_SYNC_FORCED in ulFlags then
return ERROR_DS_DRA_SINK_DISABLED
endif
msgIn.ulMoreFlags := ulMoreFlags
msgIn.cMaxObjects := cMaxObjects
msgIn.cMaxBytes := cMaxBytes
msgIn.ulExtendedOp := 0
msgIn.uuidDsaObjDest := dc.serverGuid
msgIn.pNC := ADR(nc)
msgIn.liFsmoInfo := 0
if (ObjExists(nc)) then
msgIn.pUpToDateVecDest :=
ConcreteUTDFromAbstractUTD(nc!replUpToDateVector)
else
msgIn.pUpToDateVecDest := null
endif
if AmIRODC()then
if DRS_WRIT_REP in ulFlags then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
ext := ServerExtensions(hDrs)
if not DRS_EXT_LH_BETA2 in ext.dwFlags and
msgIn.pNC^ = SchemaNC() then
ulFlags := ulFlags + {DRS_WRIT_REP}
endif
endif
ncType = GetNCType(nc)
if not NCT_GC_PARTIAL in ncType then
ulFlags := ulFlags + {DRS_GET_ALL_GROUP_MEMBERSHIP}
endif
msgIn.ulFlags := ulFlags
if (DRS_WRIT_REP in ulFlags) or
(not DRS_SYNC_PAS in ulFlags) then
msgIn.pPartialAttrSetEx := null
else
msgIn.pPartialAttrSetEx := ConcretePASFromAbstractPAS(rf.pasData)
endif
192 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (NCT_GC_PARTIAL in ncType and
NCT_FILTERED_ATTRIBUTE_SET in ncType)} then
msgIn.pPartialAttrSet := FilteredGCPAS()
else if NCT_FILTERED_ATTRIBUTE_SET in ncType then
msgIn.pPartialAttrSet := FilteredPAS()
else if NCT_GC_PARTIAL in ncType then
msgIn.pPartialAttrSet := GCPAS()
else
msgIn.pPartialAttrSet := null
endif
endif
msgIn.PrefixTableDest = ConcretePTFromAbstractPT(dc.prefixTable)
if version = 5 then
msgRequest.V5 := msgIn
msgRequest.V5.pUpToDateVecDestV1 := msgIn.pUpToDateVecDest
else if version = 8 then
msgRequest.V8 := msgIn
else
msgRequest.V10 := msgIn
endif
4.1.10.4.2 ReplSingleObjRequestMsg
procedure ReplSingleObjRequestMsg(
hDrs: DRS_HANDLE,
version: DWORD,
nc: DSName,
object: DSName,
rf: RepsFrom,
ulFlags: ULONG,
ulMoreFlags: ULONG,
cMaxObjects: ULONG,
cMaxBytes: ULONG,
fWithSecrets: boolean,
var msgRequest: DRS_MSG_GETCHGREQ): DWORD
Informative summary of behavior: The client can send an IDL_DRSGetNCChanges request to the
server to replicate changes from a single object. The ReplSingleObjRequestMsg procedure specifies
how the request message is constructed for this operation. The arguments for this method are the
same as those for the procedure ReplicateNCRequestMsg, with the following exceptions:
fWithSecrets: The object's secret attributes should be replicated. Only RODCs need to make,
and can make, this request.
msgRequest: DRS_MSG_GETCHGREQ
msgIn: DRS_MSG_GETCHGREQ_V10
ncType: ULONG
193 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
client */
if (not PartialGCReplicaExists(nc) and
not FullReplicaExists(nc)) then
return ERROR_DS_DRA_BAD_NC
endif
if fWithSecrets then
msgIn.ulExtendedOp := EXOP_REPL_SECRETS
else
msgIn.ulExtendedOp := EXOP_REPL_OBJ
endif
if AmIRODC()then
if DRS_WRIT_REP in ulFlags then
return ERROR_INVALID_PARAMETER
endif
ext := ServerExtensions(hDrs)
if not DRS_EXT_LH_BETA2 in ext.dwFlags and
msgIn.pNC^ = SchemaNC() then
ulFlags := ulFlags + {DRS_WRIT_REP}
endif
endif
ncType = GetNCType(nc)
if not NCT_GC_PARTIAL in ncType then
ulFlags := ulFlags + {DRS_GET_ALL_GROUP_MEMBERSHIP}
endif
msgIn.ulFlags := ulFlags
msgIn.ulMoreFlags := ulMoreFlags
msgIn.cMaxObjects := cMaxObjects
msgIn.cMaxBytes := cMaxBytes
msgIn.uuidDsaObjDest := dc.serverGuid
msgIn.pNC := ADR(object)
msgIn.liFsmoInfo := 0
msgIn.pUpToDateVecDest :=
ConcreteUTDFromAbstractUTD(nc!replUpToDateVector)
msgIn.pPartialAttrSetEx := null
msgIn.PrefixTableDest = ConcretePTFromAbstractPT(dc.prefixTable)
194 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
* usnVec fieldwas retrieved. Otherwise, this field contains
* zeros.*/
if version = 5 then
msgRequest.V5 := msgIn
msgRequest.V5.pUpToDateVecDestV1 := msgIn.pUpToDateVecDest
else if version = 8 then
msgRequest.V8 := msgIn
else
msgRequest.V10 := msgIn
endif
return 0
4.1.10.4.3 PerformExtendedOpRequestMsg
procedure PerformExtendedOpRequestMsg (
hDrs: DRS_HANDLE,
version: DWORD,
nc: DSName,
roleOwnerObject: DSName,
rf: RepsFrom,
ulFlags: ULONG,
ulMoreFlags: ULONG,
ulExtendedOp: ULONG,
cMaxObjects: ULONG,
cMaxBytes: ULONG,
var msgRequest: DRS_MSG_GETCHGREQ): DWORD
The arguments for this method are the same as those for the procedure ReplicateNCRequestMsg, with
the following exceptions:
ulExtendedOp: The requested extended operation. The client MUST supply the same value of this
field for each request in a given replication cycle. The possible values are:
EXOP_FSMO_REQ_RID_ALLOC, for a RID allocation from the RID Master FSMO role owner.
roleOwnerObject: The client sets this value based on the value of ulExtendedOp, as per the
following table:
195 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ulExtendedOp roleOwnerObject
EXOP_FSMO_REQ_PDC DefaultNC().
The procedure returns a Windows error code if it not able to construct msgRequest.
msgIn: DRS_MSG_GETCHGREQ_V10
serverObj: DSName
computerObj: DSName
ridSetReferences: DSName
msgIn.ulFlags := ulFlags
msgIn.ulMoreFlags := ulMoreFlags
msgIn.cMaxObjects := cMaxObjects
msgIn.cMaxBytes := cMaxBytes
msgIn.ulExtendedOp := ulExtendedOp
msgIn.uuidDsaObjDest := dc.serverGuid
msgIn.pNC := ADR(roleOwnerObject)
msgIn.pUpToDateVecDest :=
ConcreteFromAbstractUTD(nc!replUpToDateVector)
msgIn.pPartialAttrSetEx := null
msgIn.pPartialAttrSet := null
msgIn.PrefixTableDest := 0
196 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgIn.usnvecFrom := rf.usnVec
msgIn.uuidInvocIdSrc := rf.uuidInvocId
endif
if version = 5 then
msgRequest.V5 := msgIn
msgRequest.V5.pUpToDateVecDestV1 := msgIn.pUpToDateVecDest
else if version = 8 then
msgRequest.V8 := msgIn
else
msgRequest.V10 := msgIn
endif
return 0
Informative summary of behavior: The IDL_DRSGetNCChanges method returns a response for a single
request in a cycle.
This method is invoked through the drsuapi RPC interface. It is also invoked as a local procedure for
requests that are received using the SMTP transport ([MS-SRPL]).
ULONG
IDL_DRSGetNCChanges(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETCHGREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETCHGREPLY *pmsgOut)
err: ULONG
msgIn: DRS_MSG_GETCHGREQ_V10
ncRoot: DSName
obj: DSName
msgOut: DRS_MSG_GETCHGREPLY_NATIVE
schemaSignature: sequence of BYTE
prefixEntry: PrefixTableEntry
responseSmtpAddress: unicodestring
fullReplicaFlags: set of integer
fullReplicaRequest : boolean
ValidateDRSInput(hDrs, 3)
pdwOutVersion^ := 1
pmsgOut^ := 0
197 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if IsGetNCChangesPermissionGranted(msgIn) == FALSE then
return ERROR_DRA_ACCESS_DENIED
endif
/* Validate inputs. */
obj := msgIn.pNC^
if AmILHServer() = false then
/* Downlevel OS does not understand
DRS_SPECIAL_SECRET_PROCESSING flags. They just ignore it.
*/
msgIn.ulFlags := msgIn.ulFlags - {DRS_SPECIAL_SECRET_PROCESSING}
endif
if msgIn.ulExtendedOp = 0 then
/* Validate normal replication request. */
if not FullReplicaExists(obj) and not PartialGCReplicaExists(obj)
then
return ERROR_DS_CANT_FIND_EXPECTED_NC
endif
else
/* Validate extended operation request. */
if not ObjExists(obj) then
return ERROR_DS_CANT_FIND_EXPECTED_NC
endif
endif
if AmILHServer() then
if (msgIn.pPartialAttrSet = null and
msgIn.pPartialAttrSetEx = null) then
fullReplicaRequest := true
else
fullReplicaRequest := false
endif
else
if (DRS_WRITE_REP in msgIn.ulFlags) then
fullReplicaRequest := true
else
fullReplicaRequest := false
endif
endif
if (fullReplicaRequest) then
/* Validate Full Replica request. */
if not IT_WRITE in obj!instanceType then
return ERROR_DRA_SOURCE_IS_PARTIAL
endif
if DRS_SYNC_PAS in msgIn.ulFlags then
return ERROR_INVALID_PARAMETER
endif
else
/* Validate Partial Replica request. */
if msgIn.pPartialAttrSet = null
or msgIn.pPartialAttrSet.cAttrs = 0 then
return ERROR_INVALID_PARAMETER
endif
if DRS_SYNC_PAS in msgIn.ulFlags and
(msgIn.pPartialAttrSetEx = null
or msgIn.pPartialAttrSetEx.cAttrs = 0) then
return ERROR_INVALID_PARAMETER
endif
if msgIn.PrefixTableDest.PrefixCount = 0 then
return ERROR_INVALID_PARAMETER
endif
endif
if IT_NC_GOING in ncRoot!instanceType
/* NC replica is no longer accepting requests. */
return ERROR_DRA_NO_REPLICA
endif
198 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if msgIn.uuidInvocIdSrc ≠ DSAObj()!invocationId then
msgIn.usnvecFrom := 0
endif
/* Construct response. */
if msgIn.ulExtendedOp = 0 then
/* Perform normal replication. */
err := GetReplChanges(hDrs, null, null, msgIn, msgOut)
else
/* Perform extended operation. Errors are returned in
* msgOut.ulExtendedErr. */
ProcessFsmoRoleRequest(hDrs, msgIn, msgOut)
err := 0
endif
if err = 0 then
msgOut.pNC := msgIn.pNC
msgOut.usnvecFrom := msgIn.usnvecFrom
msgOut.uuidDsaObjSrc := dc.serverGuid
msgOut.PrefixTableSrc := ConcretePTFromAbstractPT(dc.prefixTable)
msgOut.uuidInvocIdSrc := DSAObj()!invocationId
return err
4.1.10.5.1 TransformInput
procedure TransformInput(
hDrs: DRS_HANDLE,
requestVersion: DWORD,
requestUnion: DRS_MSG_GETCHGREQ,
var nativeRequest: DRS_MSG_GETCHGREQ_V10,
pdwOutVersion: ADDRESS OF DWORD,
var responseSmtpAddress: unicodestring): ULONG
Informative summary of behavior: The TransformInput procedure transforms the received request
message into a V10 request, which is a superset of the supported request messages.
199 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
extClient := ClientExtensions(hDrs)
responseSmtpAddress := null
if requestVersion = 10
/* Windows Server 2008 R2 RPC request. */
nativeRequest := requestUnion.V10
if DRS_EXT_GETCHGREPLY_V9 in extClient.dwFlags then
pdwOutVersion^ = 9
else if DRS_EXT_GETCHGREPLY_V6 in extClient.dwFlags then
pdwOutVersion^ = 6
else
return ERROR_REVISION_MISMATCH
endif
else if requestVersion = 8
/* Windows Server 2003 RPC request. */
nativeRequest := requestUnion.V8
nativeRequest.ulMoreFlags := 0
if not DRS_EXT_GETCHGREPLY_V6 in extClient.dwFlags then
return ERROR_REVISION_MISMATCH
else
pdwOutVersion^ := 6
endif
200 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pdwOutVersion^ := 1
else
/* Unsupported request. */
return ERROR_REVISION_MISMATCH
endif
extServer := ServerExtensions(hDrs)
optionalFeatures := list of msDS-OptionalFeature objects from the
Optional Features container /* [MS-ADTS] section 6.1.1.2.4.1.3 */
4.1.10.5.2 GetReplChanges
procedure GetReplChanges(
hDrs: DRS_HANDLE,
searchFilter: LDAPString,
dirSyncFlags: ULONG,
msgIn: DRS_MSG_GETCHGREQ_V10,
var msgOut: DRS_MSG_GETCHGREPLY_NATIVE): ULONG
Informative summary of behavior: The GetReplChanges procedure processes an LDAP Search request
with LDAP_SERVER_DIRSYNC_OID control or a normal replication request; that is, an
IDL_DRSGetNCChanges request that is not a FSMO role request. It adds changed objects and link
values to the response, subject to the scope (msgIn.pNC^, msgIn.ulFlags), filter criteria
(msgIn.pUpToDateVecDest, msgIn.ulFlags, msgIn.pPartialAttrSet, msgIn.pPartialAttrSetEx,
searchFilter, dirSyncFlags), response limits (msgIn.cMaxObjects, msgIn.cMaxBytes), and the previous
server cookie (msgIn.usnvecFrom) in the request. It returns 0 if successful, otherwise a Windows
error code.
err: ULONG
ncRoot: DSName
pUtd: ADDRESS OF UPTODATE_VECTOR_V1_EXT
scope: set of DSName
attribute: ATTRTYP
partialAttrs: set of ATTRTYP
partialAttrsEx: set of ATTRTYP
changedObjs: set of ObjAtts
changedLinks: set of ObjAttVal
responseObjs: set of ObjAtts
responseLinks: set of ObjAttVal
anc: ObjAtts
201 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
clientDSA : DSName
updRefs: DRS_MSG_UPDREFS_V1 /* See IDL_DRSUpdateRefs structures. */
tgt: DSName
if AmIRODC() then
return ERROR_DS_DRA_SOURCE_DISABLED
endif
202 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
responseObjs, responseLinks)
if not msgOut.fMoreData
msgOut.pUpToDateVecSrc := The cycle goal, as specified in
section 4.1.10.1.2.
203 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
return 0
4.1.10.5.3 GetReplScope
procedure GetReplScope(
msgIn: DRS_MSG_GETCHGREQ_V10,
searchFilter: LDAPString): set of DSName
Informative summary of behavior: The GetReplScope procedure returns the set of objects considered
for normal replication or for an LDAP Search request with LDAP_SERVER_DIRSYNC_OID control: the
objects in the requested NC replica (msgIn.pNC^) or a subset thereof, as indicated by the request
flags (msgIn.ulFlags) and the search filter (searchFilter). If the DRS_ASYNC_REP request flag is
specified, the subset includes only the NC root. If the DRS_CRITICAL_ONLY request flag is specified,
the subset includes only those objects with isCriticalSystemObject = true and their ancestors.
ncRoot := GetObjectNC(msgIn.pNC^)
204 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else
scope := select all o from subtree-ts-included ncRoot where true
foreach o in ncRoot!subRefs
if (ObjectMatchesSearchFilter(o, searchFilter) = true) then
scope := scope + {o}
endif
endfor
endif
return scope
4.1.10.5.4 ObjectMatchesSearchFilter
procedure ObjectMatchesSearchFilter (
o: DSNAME,
searchFilter: LDAPString) : boolean
This procedure returns true if the search filter (searchFilter) is null. If the search filter is not null, it
returns true if the object whose DSNAME is "o" matches the search filter; otherwise it returns false.
See [MS-ADTS] for search filter processing, specifically section 3.1.1.3.1.3.1, Search Filters.
4.1.10.5.5 GetChangesInScope
procedure GetChangesInScope(
scope: set of DSName,
pUtd: ADDRESS OF UPTODATE_VECTOR_V1_EXT,
ulExtendedOp: DWORD,
partialAttrs: set of ATTRTYP,
partialAttrsEx: set of ATTRTYP,
dirSyncFlags: ULONG,
var changedObjs: set of ObjAtts,
var changedLinks: set of ObjAttVal)
Informative summary of behavior: The GetChangesInScope procedure inspects the objects in scope
and returns the object and link value updates that are sent to the client over the course of the
replication cycle or as a result of processing LDAP Search request with
LDAP_SERVER_DIRSYNC_OID control, as determined by the up-to-date vector (pUtd), the
extended operation (ulExtendedOp), flags (dirSyncFlags) associated with the
LDAP_SERVER_DIRSYNC_OID control, and the partial replica attribute filters (partialAttrs and
partialAttrsEx).
o: DSName
a: ATTRTYP
attrsFound: set of ATTRTYP
attrsReq: set of ATTRTYP
stamp: AttributeStamp
cursor: UPTODATE_CURSOR_V2
/* Get the set of objects in scope with attribute stamps that the
* client did not have knowledge of at the beginning of this
* cycle. */
changedObjs := {}
foreach o in scope
attrsFound := {}
attrsReq := {}
foreach a of o's object class
stamp := AttrStamp(o, a)
if stamp ≠ null and
((ulExtendedOp = EXOP_REPL_SECRETS and IsSecretAttribute(a))
or not FilterAttribute(o, a, stamp, pUtd,
partialAttrs, partialAttrsEx, dirSyncFlags)) then
205 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attrsFound := attrsFound + {a}
endif
if(a = instanceType or a = proxiedObjectName) then
attrsReq := attrsReq + {a}
endif
endfor
if attrsFound ≠ {} then
changedObjs := changedObjs + [obj: o, atts: attrsFound + attrsReq]
else if (IT_NC_HEAD in o!instanceType and pUtd ≠ null)
stamp := AttrStamp(o, uSNChanged)
cursor := select one c from pUtd^.rgCursors where c.uuidDsa =
stamp.uuidOriginating
if cursor = null or cursor.usnHighPropUpdate < stamp.usnOriginating
then
changedObjs := changedObjs + [obj: o, atts: attrsFound + attrsReq]
endif
endif
endfor
/* Get the set of link values in scope with stamps that the client
* did not have knowledge of at the beginning of this cycle. */
if (GetForestFunctionalLevel() ≥ 1 or dc.fLinkValueStampEnabled = true) then
changedLinks := {}
foreach o in scope
foreach a in Link Attributes of o's object class
foreach v in GetAttVals(o, a, true)
stamp := LinkStamp(o, a, v)
/* If v was last updated in win2k forest mode
* then it does not have LinkValueStamp associated with it.
* LinkStamp() returns null in that case and this value will
* not be added to changedLinks.
*/
if stamp ≠ null
and not FilterAttribute(o, a, stamp, pUtd,
partialAttrs, partialAttrsEx, dirSyncFlags) then
changedLinks := changedLinks + [obj: o, att: a, val: v]
endif
endfor
endfor
endfor
endif
4.1.10.5.6 FilterAttribute
procedure FilterAttribute(
o: DSName,
attribute: ATTRTYP,
s: AttributeStamp,
pUtd: ADDRESS OF UPTODATE_VECTOR_V1_EXT,
partialAttrs: set of ATTRTYP,
partialAttrsEx: set of ATTRTYP,
dirSyncFlags: ULONG): boolean
If the client's up-to-date vector pUtd asserts that the client has already applied the update with
stamps, the update is filtered out, provided that attribute is not in the partialAttrsEx set. The
elements of partialAttrsEx are not subject to filtering by the up-to-date vector.
If partialAttrs is not null (indicating the client has a partial replica) and attribute is not in
partialAttrs + partialAttrsEx, then the update is filtered out.
206 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If partialAttrs is not null, attribute is member, o is of class group, and o is not a universal
group, then the update is filtered out.
If attribute is the naming attribute (that is, cn for objects of class container, as shown below) for
the object class of o, the update is filtered out.
filtered: boolean
cursor: UPTODATE_CURSOR_V2
filtered := false
207 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
AccessCheckObject(o.parent, RIGHT_DS_LIST_CONTENTS) = false) and
attribute ≠ isDeleted and
attribute ≠ isRecycled then
filtered := true
endif
endif
return filtered
4.1.10.5.7 GetResponseSubset
procedure GetResponseSubset(
msgIn: DRS_MSG_GETCHGREQ_V10,
changedObjs: set of ObjAtts,
changedLinks: set of ObjAttVal,
var msgOut: DRS_MSG_GETCHGREPLY_NATIVE,
var responseObjs: set of ObjAtts,
var responseLinks: set of ObjAttVal)
The GetResponseSubset procedure selects subsets of the changed objects and link values to include
in this response. It utilizes the cookie msgIn.usnvecFrom—which is zero or a value returned to the
client in a previous response—and the client-requested limits msgIn.cMaxObjects and
msgIn.cMaxBytes to determine the subsets. This procedure then sets msgOut.usnvecTo to a new
cookie that the client presents in its next request as msgIn.usnvecFrom.
The server SHOULD<30> choose a subset such that the response will contain no more objects than
msgIn.cMaxObjects and no more bytes (before any compression is applied) than msgIn.cMaxBytes.
It is valid for the response to contain no objects or link values. It is valid for an object or a link value
to appear multiple times in a single response, and the object's attribute values or the link values
need not be identical. It is valid for an object or a link value to appear both in the current response
and in an earlier response in the same cycle, and the object's attribute values or the link values need
not be identical.
If the server determines, by using state that is maintained via msgIn.usnvecFrom and
msgOut.usnvecTo, that inclusive of what it is sending in this response, it will have sent at least
changedObjs and changedLinks to the client, then it concludes the cycle by returning with
msgOut.fMoreData = false. Therefore, if this is the first response message of a cycle, the server only
returns with msgOut.fMoreData = false if responseObjs = changedObjs and responseLinks =
changedLinks.
Subject to resource constraints on the server, if neither changedObjs nor changedLinks increases
during a sequence of calls, the server eventually returns msgOut.fMoreData = false.
4.1.10.5.8 AddObjToResponse
procedure AddObjToResponse(
hDrs: DRS_HANDLE,
o: ObjAtts,
ncRoot: DSName,
ulFlags: set of integer,
ulExtendedOp: DWORD,
clientDSA: DSName,
var msgOut: DRS_MSG_GETCHGREPLY_NATIVE) : ULONG
err: ULONG
re: REPLENTINFLIST
208 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pAttr: ADDRESS OF ATTR
attribute: ATTRTYP
attrObj: DSName
attrVals: sequence of attribute values
i: DWORD
j: DWORD
err := 0
/* Construct a REPLENTINFLIST to represent the changes. */
re := all zeros
re.fIsNcPrefix := (o.obj = ncRoot)
if name in o.atts and not re.fIsNcPrefix then
re.pParentGuid := ADR(o.obj!parent)
endif
re.EntInf.pName := ADR(o.obj)
re.EntInf.AttrBlock.pAttrs := array of ATTR of size o.atts.length
re.EntInf.AttrBlock.attrCount := o.atts.length
re.pMetaDataExt := PROPERTY_META_DATA_EXT_VECTOR
with rgMetaData of size o.atts.length
re.pMetaDataExt^.cNumProps := o.atts.length
for i := 0 to o.atts.length - 1
attribute := o.atts[i]
attrObj := SchemaObj(attribute)
re.pMetaDataExt^.rgMetaData[i] = AttrStamp(o.obj, attribute)
pAttr := ADR(re.EntInf.AttrBlock.pAttrs[i])
pAttr^.attrTyp := attribute
pAttr^.AttrVal.valCount := 0
if AmILHServer() and
DRS_SPECIAL_SECRET_PROCESSING in ulFlags and
IsSecretAttribute(attribute) then
/* secret attribute, send a null value */
pAttr^.AttrVal.pAVal = null
re.pMetaDataExt^.rgMetaData[i].timeChanged = 0
else
/* not special processing */
attrVals := GetAttrVals(o, attribute, false)
pAttr^.AttrVal.pAVal := ARRAY OF ATTRVAL
WITH SIZE attrVals.length
for j := 0 to attrVals.length - 1
/* If attribute is a link value attribute, then add it to the
* response here only if it does not have a LinkValueStamp
* associated with it. This can happen if the current forest
* functional level is DS_BEHAVIOR_WIN2000 or the attribute
* value attrVals[j] was last updated when the forest
* functional level was DS_BEHAVIOR_WIN2000. If the
* attribute value has a LinkValueStamp associated with it,
* then it will be sent in the response packet by method
* AddLinkToResponse. Forest functional levels are listed
* in [MS-ADTS] section 6.1.4.4,
* "msDS-Behavior-Version: Forest Functional Level".
*/
if (attrObj!linkID = null) or
((attrObj!linkID ≠ null) and
209 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
(LinkStamp(o.obj, attribute, attrVals[j]) = null) then
pAttr^.AttrVal.pAVal[j] := ATTRVALFromValue(
attrVals[j], Syntax(attribute), dc.prefixTable)
pAttr^.AttrVal.valCount := pAttr^.AttrVal.valCount + 1
endif
endfor /* j := */
endif
return err
4.1.10.5.9 UpdateRevealedList
procedure UpdateRevealedList(
rodcDSA: DSName,
revealedObject: DSName,
attribute: ATTRTYP)
Informative summary of behavior: The UpdateRevealedList procedure adds or updates an entry for
the attribute attribute of the object revealedObject on the msDS-RevealedUsers attribute of the
computer object that corresponds to the nTDSDSA object rodcDSA. The msDS-RevealedUsers
attribute is of type DNBinary. The binary portion of the attribute value contains a
PROPERTY_META_DATA structure in its binary form. The DN portion of attribute value contains
revealedObject.
serverObj: DSName
computerObj: DSName
attrSchemaObj: DSName
revealedObjectsNew: set of DNBinary
obj: DNBinary
propMetadata: PROPERTY_META_DATA
propMetadataCurrent: PROPERTY_META_DATA
newRevealedObjectVal: DNBinary
210 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
foreach obj in computerObj!msDS-RevealedUsers
propMetadata := loophole(obj.binary, PROPERTY_META_DATA)
if (obj.object_dn ≠ revealedObject) or
(propMetaData.attrType ≠ attribute) or
(StampCompare(propMetaData.propMetadataExt,
AttrStamp(revealedObject, attribute) > 0) then
revealedObjectsNew := revealedObjectsNew + { obj }
endif
endfor
4.1.10.5.10 AddLinkToResponse
procedure AddLinkToResponse(
v: ObjAttVal,
msgIn: DRS_MSG_GETCHGREQ_V10,
var msgOut: DRS_MSG_GETCHGREPLY_NATIVE)
rv: REPLVALINF_NATIVE
rvs: sequence of REPLVALINF_NATIVE
stamp: LinkValueStamp
filterGroups: boolean
filterGroups := true;
if AmILHServer() then
if DRS_GET_ALL_GROUP_MEMBERSHIP in msgIn.ulFlags then
filterGroups := false
endif
else
if DRS_WRITE_REP in msgIn.ulFlags then
filterGroups := false
endif
endif
211 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
rv.attrType := v.att
rv.AVal := ATTRVALFromValue(v.val, Syntax(v.att), dc.prefixTable)
stamp := LinkStamp(v.obj, v.att, v.val)
rv.fIsPresent := stamp.timeDeleted = 0
rv.MetaData := stamp
4.1.10.5.11 EncryptValuesIfNecessary
procedure EncryptValuesIfNecessary(
hDrs: DRS_HANDLE,
var attr: ATTR) : ULONG
212 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Compute encryption key. */
MD5Init(md5Context)
MD5Update(md5context, sessionKey, sessionKey.length)
MD5Update(md5context, salt, 16)
MD5Final(md5Context)
return 0
4.1.10.5.12 ProcessFsmoRoleRequest
procedure ProcessFsmoRoleRequest(
hDrs: DRS_HANDLE,
msgIn: DRS_MSG_GETCHGREQ_V10,
var msgOut: DRS_MSG_GETCHGREPLY_NATIVE)
fsmoObj: DSName
clientDsaObj: DSName
serverObj: DSName: DSName
rodcObj: DSNAME: DSName
clientComputerObj: DSName
clientRidSetObj: DSName
ownerDsaObj: DSName
scope: set of DSName
ridAllocLoHi: ULONGLONG
ridAllocHi: DWORD
ridReqHi: DWORD
ridAvailLoHi: ULONGLONG
ridAvailLo: DWORD
ridAvailHi: DWORD
changedObjs: set of ObjAtts
changedLinks: set of ObjAttVal
fsmoObj := msgIn.pNC^
if not ObjExists(fsmoObj) then
213 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgOut.ulExtendedRet := EXOP_ERR_UPDATE_ERR
return
endif
if msgIn.uuidDsaObjDest = null then
msgOut.ulExtendedRet := EXOP_ERR_UPDATE_ERR
return
endif
clientDsaObj := select one o from ConfigNC()where
o!objectGUID = msgIn.uuidDsaObjDest
if clientDsaObj = null then
msgOut.ulExtendedRet := EXOP_ERR_UNKNOWN_CALLER
return
endif
fsmoObj!fSMORoleOwner := clientDsaObj
scope := GetRoleScope(fsmoObj)
else if msgIn.ulExtendedOp = EXOP_FSMO_ABANDON_ROLE then
/* Request a change in the FSMO role owner from the current owner
* to the server. The server will refuse to take the FSMO role if
* it is not a full replica and cannot own FSMO. */
if AmIRODC() then
msgOut.ulExtendedRet := EXOP_ERR_FSMO_REFUSING_ROLES
endif
/* Locate or create the RID Set object for the client DC. */
serverObj := clientDsaObj!parent
clientComputerObj := serverObj!serverReference
if clientComputerObj!rIDSetReferences = null then
clientRidSetObj := An implementation-defined DSName in the
default NC such that not ObjExists(clientRidSetObj)
214 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Create object with DSName clientRidSetObj such that
rIDSet in clientRidSetObj!objectClass
/* Windows Behavior: Windows sets clientRidSetObj to be a child
* of clientComputerObj. */
clientComputerObj!rIDSetReferences := clientRidSetObj
else
clientRidSetObj := clientComputerObj!rIDSetReferences
endif
/* Get the current RID allocation for the client DC. */
ridAllocLoHi := clientRidSetObj!rIDAllocationPool
ridAvailHi := most significant 32 bits of ridAvailLoHi
ridReqHi := most significant 32 bits of msgIn.liFsmoInfo
if ridAllocLoHi = 0 or ridAvailHi = 0 or ridReqHi ≥ ridAvailHi then
/* The client DC has indeed exhausted its current allocation,
* according to our records. */
/* Get the range of RIDs that have not yet been allocated to any
* DC. */
ridAvailLoHi := fsmoObj!rIDAvailablePool
ridAvailLo := least significant 32 bits of ridAvailLoHi
ridAvailHi := most significant 32 bits of ridAvailLoHi
msgOut.liFsmoInfo := ridAllocLoHi
endif
scope := GetRoleScope(fsmoObj) +
{clientComputerObj, clientRidSetObj}
else if EXOP_REPL_SECRETS in msgIn.ulExtendedOp and
AmILHServer() then
/* Request replication of a single object with secret.
* Secret replication is allowed only if these three conditions
* hold:
* 1. Caller is an RODC. An RODC will always be a member of
* "Enterprise Read-Only Domain Controllers" (RID 498)
* [MS-ADTS] section 6.1.1.6.14.
* 2. The object is configured to reveal secrets.
* 3. Outbound secret replication is not disabled.
*/
serverObj := clientDsaObj!parent
rodcObj := serverObj!serverReference
if CheckGroupMembership(
GetCallerAuthorizationInfo(), SidFromStringSid("S-1-5-22"))
and RevealSecretsForUserAllowed(rodcObj, fsmoObj)
and (not NTDSDSA_OPT_DISABLE_OUTBOUND_REPL
in DSAObj()!options
or DRS_SYNC_FORCED in msgIn.ulFlags) then
scope := {fsmoObj}
else
scope := {}
endif
215 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else if EXOP_REPL_OBJ in msgIn.ulExtendedOp
if AmILHServer() = true and
NTDSDSA_OPT_DISABLE_OUTBOUND_REPL in DSAObj()!options and
not DRS_SYNC_FORCED in msgIn.ulFlags then
/* replication of single object is disabled */
pmsgOut.dwDRSError := ERROR_DS_DRA_SOURCE_DISABLED
return
endif
scope := {fsmoObj}
else
/* Unrecognized request. */
msgOut.ulExtendedRet := EXOP_ERR_UNKNOWN_OP
return
endif
if scope ≠ {} then
/* Add updates in scope to the response. */
GetChangesInScope(scope, msgIn.pUpToDateVecDest, msgIn.ulExtendedOp,
msgIn.pPartialAttrSet, msgIn.pPartialAttrSet,
0, changedObjs, changedLinks)
foreach o in changedObjs
AddObjToResponse(
hDrs, o, GetObjectNC(msgIn.pNC^), msgIn.ulFlags, msgIn.ulExtendedOp, msgOut)
endfor
foreach v in changedLinks
AddLinkToResponse(v, msgIn, msgOut)
endfor
endif
msgOut.ulExtendedRet := EXOP_ERR_SUCCESS
return
4.1.10.5.13 RevealSecretsPolicy
typedef enum
{
RevealSecretsDeny = 0,
RevealSecretsAllow = 1,
RevealSecretsNoPolicy = 2
} RevealSecretsPolicy;
4.1.10.5.14 GetRevealSecretsPolicyForUser
procedure GetRevealSecretsPolicyForUser(
rodcObj: DSName, userObj: DSName): RevealSecretsPolicy
216 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
RODC from receiving the secrets, RevealSecretsDenied is returned. If the policy explicitly allows the
RODC to receive the secrets, RevealSecretsAllow is returned. In all other cases, RevealSecretsNoPolicy
is returned.
neverRevealObj: DSName
revealObj: DSName
/* An RODC can always cache secrets of its own account
*/
if rodcObj = userObj /* see section 5 DSNAME for DSName equality */
then
return RevealSecretsAllow
endif
/* An RODC can always cache secrets of its own
* secondary Kerberos TGT account but not other
* secondary Kerberos TGT accounts.
* See [MS-KILE]
*/
if rodcObj!msDS-KrbTgtLink = userObj then
return RevealSecretsAllow
endif
krbtgts = select o from children DefaultNC() where
o!msDS-KrbTgtLink ≠ null
foreach krbtgt in krtgts do
if userObj = krbtg!msDS-KrbTgtLink then
return RevealSecretsDeny
endif
endfor
4.1.10.5.15 RevealSecretsForUserAllowed
procedure RevealSecretsForUserAllowed(
rodcObj: DSName, userObj: DSName): boolean
217 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
policy: RevealSecretsPolicy
allowed: boolean
policy = GetRevealSecretsPolicyForUser(rodcObj, userObj)
if (policy = RevealSecretsDeny) then
allowed := false
else if (policy = RevealSecretsAllow) then
allowed := true
else
allowed := false
endif
return allowed
4.1.10.5.16 GetRoleScope
procedure GetRoleScope(fsmoObj: DSName): set of DSName
Informative summary of behavior: The GetRoleScope procedure returns the set of objects in the
FSMO role identified by the FSMO role object fsmoObj.
/* Scope always includes fsmoObj. For the PDC Emulation Role, scope
* includes only fsmoObj. */
scope := {fsmoObj}
218 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
where infrastructureUpdate in o!objectClass and
not o!proxiedObjectName = null
scope := scope + r
endif
return scope
4.1.10.5.17 SortResponseLinks
procedure SortResponseLinks(var msgOut: DRS_MSG_GETCHGREPLY_NATIVE)
The SortResponseLinks procedure sorts the contents of msgOut.rgValues in ascending order according
to the comparison method CompareLinks():
/* Returns 1
if val1 > val2, 0 if val1 = val2, or -1 if val1 < val2. */
return c
219 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
end
4.1.10.5.18 ReplValInfV1ListFromReplValInfNativeList
procedure ReplValInfV1ListFromReplValInfNativeList(
replValInfNativeList : REPLVALINF_NATIVE*) : REPLVALINF_V1*
return returnList
4.1.10.5.19 ReplValInfNativeListFromReplValInfV1List
procedure ReplValInfNativeListFromReplValInfV1List(
replValInfV1List : REPLVALINF_V1*) : REPLVALINF_NATIVE*
return returnList
4.1.10.5.20 TransformOutput
procedure TransformOutput(
msgOut: DRS_MSG_GETCHGREPLY_NATIVE,
flags: DRS_OPTIONS,
pdwOutVersion: ADDRESS OF DWORD,
pmsgOut: ADDRESS OF DRS_MSG_GETCHGREPLY): ULONG
Informative summary of behavior: The TransformOutput procedure transforms the native reply (a
superset of all supported reply messages) into the reply version supported by the client, optionally
compressing it. The compression algorithms used for the DRS_COMP_ALG_WIN2K3 algorithm type are
specified in section 4.1.10.5.21. The compression algorithm used for the DRS_COMP_ALG_MSZIP
algorithm type is specified in [RFC1951].
220 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pickled: sequence of BYTE
compressed: sequence of BYTE
allowedAlgs: set of DRS_COMP_ALG_TYPE
compressAlg: DRS_COMP_ALG_TYPE
compress: boolean
if compress then
/* Note that the only difference between the compression processing of a V2 and */
/* a V7 message is that a V7 message can use the DRS_COMP_ALG_WIN2K3 compression */
/* algorithm and a V2 message can not. */
/* Return V7 (compressed V6 or V9). */
if not DRS_EXT_GETCHGREPLY_V7 in ext.dwFlags then
return ERROR_REVISION_MISMATCH
endif
221 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
type UPTODATE_VECTOR_V1_EXT) to UPTODATE_VECTOR_V2_EXT by
creating a new UPTODATE_VECTOR_V1_EXT with a V1 cursor for each
V2 cursor, sans the timeLastSyncSuccess field.
/* V1 has the NC size in the ulExtendedRet field. */
if msgOut.cNumNcSizeObjects > 0 then
pmsgOut^.V1.ulExtendedRet := msgOut.cNumNcSizeObjects
endif
if compress then
/* Serialize msgOut into a byte stream. */
pickled := Pickling of pmsgOut^.V1, as specified by
[C311] Part 2, "IDL/NDR Pickles" and
[MS-RPCE] sections 2.2.6 and 2.2.7, "Type Serialization
Version 1" and "Type Serialization Version 2"
return 0
4.1.10.5.21 CompressOrDecompressWin2k3
procedure CompressOrDecompressWin2k3(
inputBuffer: sequence of BYTE,
inputSize: DWORD
ref outputBuffer: sequence of BYTE,
comp: BOOLEAN)
inputSize: The DWORD value that indicates the size of inputBuffer in bytes.
The LZ77 compression algorithm is used to analyze input data and determine how to reduce the size
of that input data by replacing redundant information with metadata. Sections of the data that are
222 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
identical to sections of the data that have been encoded are replaced by a small amount of metadata
that indicates how to expand those sections again. The encoding algorithm is used to take that
combination of data and metadata and serialize it into a stream of bytes that can later be decoded and
decompressed.
The following terms are associated with the compression algorithm. Some of the terms also apply to
the DIRECT2 encoding algorithm defined in the next section.
coding position: The position of the byte in the input stream that is currently being coded (the
beginning of the lookahead buffer).
lookahead buffer: The byte sequence from the coding position to the end of the input stream.
window: A buffer that indicates the number of bytes from the coding position backward. A window of
size W contains the last W processed bytes.
pointer: Information about the beginning of the match in the window (referred to as "B" in the
example later in this section) and its length (referred to as "L" in the example later in this section).
match: The string that is used to find a match of the byte sequence between the lookahead buffer and
the window.
2. Find the longest match in the window for the lookahead buffer.
3. Output the P,C pair, where P is the pointer to the match in the window, and C is the first byte in
the lookahead buffer that does not match.
4. If the lookahead buffer is not empty, move the coding position (and the window) L+1 bytes
forward.
5. Return to step 2.
Compression Process
The compression algorithm searches the window for the longest match with the beginning of the
lookahead buffer and then outputs a pointer to that match. Because even a 1-byte match might not
be found, the output cannot contain only pointers. The compression algorithm solves this problem by
outputting after the pointer the first byte in the lookahead buffer after the match. If no match is
found, the algorithm outputs a null-pointer and the byte at the coding position.
The following table shows the input stream that is used for this compression example. The bytes in the
input, "AABCBBABC", occupy the first nine positions of the stream.
Input stream
Position 1 2 3 4 5 6 7 8 9
Byte A A B C B B A B C
223 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The following table shows the output from the compression process. The table includes the following
columns:
Step: Indicates the number of the encoding step. A step in the table finishes every time that the
encoding algorithm makes an output. With the compression algorithm, this process happens in each
pass through step 3.
Position: Indicates the coding position. The first byte in the input stream has the coding position 1.
Byte: Shows the first byte in the lookahead buffer after the match.
Output: Presents the output in the format (B,L)C, where (B,L) is the pointer (P) to the match. This
gives the following instructions to the decoder: Go back B bytes in the window and copy L bytes to the
output. C is the explicit byte.
Note One or more pointers might be included before the explicit byte that is shown in the Byte
column. That is, a metadata pointer does not always need to be followed by an explicit byte. An input
stream of "ABCABCABC", for example, can be represented as "(0,0)A(0,0)B(0,0)C(3,3)(6,3)" using the
(B,L)C notation, with the last two elements being pointers without explicit bytes. The compressed
output can be any combination of pointers and explicit bytes.
1. 1 -- A (0,0)A
2. 2 A B (1,1)B
3. 4 -- C (0,0)C
4. 5 B B (2,1)B
5. 7 AB C (5,2)C
The result of compression, conceptually, is the output column—that is, a series of bytes and optional
metadata that indicates whether that byte is preceded by some sequence of bytes that is already in
the output.
Because representing the metadata itself requires bytes in the output stream, it is inefficient to
represent a single byte that has previously been encoded by two bytes of metadata (offset and
length). The overhead of the metadata bytes equals or exceeds the cost of outputting the bytes
directly. Therefore, the protocol considers sequences of bytes to be a match only if the sequences
have three or more bytes in common.
The basic notion of the DIRECT2 encoding algorithm is that data appears unchanged in the
compressed representation, and metadata is encoded in the same output stream, and in line with, the
data.
The key to decoding the compressed data is recognizing what bytes are metadata and what bytes are
data. The decoder MUST be able to identify the presence of metadata in the compressed and encoded
data stream. Bitmasks are inserted periodically in the byte stream to provide this information to the
decoder.
This section describes the bitmasks that enable the decoder to distinguish data from metadata. It also
describes the process of encoding the metadata.
224 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Bitmask
To distinguish data from metadata in the compressed byte stream, the data stream begins with a 4-
byte bitmask that indicates to the decoder whether the next byte to be processed is data (a "0" value
in the bit), or if the next byte (or series of bytes) is metadata (a "1" value in the bit). If a "0" bit is
encountered, the next byte in the input stream is the next byte in the output stream. If a "1" bit is
encountered, the next byte or series of bytes is metadata that MUST be interpreted further.
For example, a bitmask of 0x01000000 indicates that the first seven bytes are actual data, followed
by encoded metadata that starts at the eighth byte. The metadata is followed by 24 additional bytes
of data. A bitmask of 0x112000000 indicates that there will be metadata in the 4th, 8th, and 11th
elements (note that the actual byte positions in the compressed data might be different because
metadata elements will range from 2 to 6 bytes in length), with the remaining elements being data
bytes.
When the bitmask has been consumed, the next four bytes in the input stream are another bitmask.
The bitmask must also contain a "1" in the bit following the last encoded element, to indicate the end
of the compressed data. For example, given a hypothetical 8-bit bitmask, the string "ABCABCDEF" is
compressed as (0,0)A(0,0)B(0,0)C(3,3)D(0,0)E(0,0)F. Its bitmask would be b'00010001' (0x11). This
would indicate three bytes of data, followed by metadata, followed by an additional 3 bytes, finally
terminated with a "1" to indicate the end of the stream.
The final end bit is always necessary, even if an additional bitmask has to be allocated. If the string in
the above example was "ABCABCDEFG", for example, it would require an additional bitmask. It would
begin with the bitmask b'00010000', followed by the compressed data, and followed by another
bitmask with a "1" as the next bit to indicate the end of the stream.
Encoding Metadata
In the output stream, actual data bytes are stored unchanged. Bitmasks are stored periodically to
indicate whether the next byte or bytes are data or metadata. If the next bit in the bitmask is a "1",
the next set of bytes in the input data stream is metadata (unless the last element of data was read,
in which case the "1" bit would indicate the end of the stream as noted above). This metadata
contains an offset back to the start of the data to be copied to the output stream, and the length of
the data to be copied.
To represent the metadata as efficiently as possible, the encoding of that metadata is not fixed in
length. The encoding algorithm supports the largest possible floating compression window to increase
the probability of finding a large match; the larger the window, the greater the number of bytes that
are needed for the offset. The encoding algorithm also supports the longest possible match; the longer
the match length, the greater the number of bytes that are needed to encode the length.
Metadata Offset
The protocol assumes the metadata is two bytes in length. The three low-order bits are used to
encode the length. The high-order 13 bits are a first complement of the offset, which is represented as
a negative signed value in 2's complement. The offset is only encoded with those 13 bits. This value
cannot be extended and defines the maximum size of the compression floating window. For example,
the metadata 0x0018 is converted into the offset b'000000000011', and the length b'000'. The offset
is '-4', computed by inverting the offset bits, treating the result as a 2's complement, and converting it
to an integer.
Match Length
Unlike the metadata offset, the match length is extensible. If the length is less than 10 bytes, it is
encoded in the three low-order bits of the 2-byte metadata. Although three bits seems to allow for a
maximum length of six (the value b'111' is reserved), because the minimum match is three bytes,
these three bits actually allow for the expression of lengths from three to nine. The match length goes
from L = b'000' + 3 bytes, to L = b'110' + 3 bytes. Because smaller lengths are much more common
225 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
than the larger lengths, the algorithm tries to optimize for smaller lengths. To encode a length
between three and nine, we use the three bits that are "in-line" in the 2-byte metadata.
If the length of the match is greater than nine bytes, an initial bit pattern of b'111' is put in the three
bits. This does not signify a length of 10 bytes, but instead a length that is greater than or equal to
10, which is included in the low-order nibble of the following byte.
Every other time that the length is greater than nine, an additional byte follows the initial 2-byte
metadata. The first time that the additional byte is included, the low-order nibble is used as the
additive length. The high-order nibble is "reserved" for the next metadata instance when the length is
greater than nine. Therefore, the first time that the decoder encounters a length that is greater than
nine, it reads the next byte from the data stream and the low-order nibble is extracted and used to
compute the length for this metadata instance. The high-order nibble is remembered and used the
next time that the decoder encounters a metadata length that is greater than nine. The third time that
a length that is greater than nine is encountered, another extra byte is added after the 2-byte
metadata, with the low-order nibble used for this length and the high-order nibble reserved for the
fourth length that is greater than nine, and so on.
If the nibble from this "shared" byte is all "1s" (for example, b'1111'), another byte is added after the
shared byte to hold more length. In this manner, a length of 24 is encoded as follows:
b'111' (in the three bits in the original two bytes of metadata), plus
b'111' means 10 bytes plus b'1110', which is 14, which results in a total of 24.
If the length is more than 24, the next byte is also used in the length calculation. In this manner, a
length of 25 is encoded as follows:
b'111' (in the three bits in the original two bytes of metadata), plus
b'1111' (in the nibble of the "shared" byte of extended length), plus
This scheme is good for lengths of up to 278 (a length of 10 in the three bits in the original two bytes
of metadata, plus a length of 15 in the nibble of the "shared" byte of extended length, plus a length of
up to 254 in the extra byte).
A "full" (all b'1') bit pattern (b'111', b'1111', and b'11111111') means that there is more length in the
following two bytes.
The final two bytes of length differ from the length information that comes earlier in the metadata. For
lengths that are equal to 280 or greater, the length is calculated only from these last two bytes, and is
not added to the previous length bits. The value in the last two bytes, a 16-bit integer, is three less
than the metadata length. These last two bytes allow for a match length of up to 32,768 bytes + 3
bytes (the minimum match length).
Note Length is computed from the bits that are included in the metadata plus the minimum match
length of three.
Match
length Length bits in the metadata
226 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Match
length Length bits in the metadata
+
b'1110' (in the high-order or lower-order nibble, as appropriate, of the shared byte)
A "full" bit pattern in that last half word does not mean that more metadata is coming after the last
bytes.
The LZ77 compression algorithm produces a well-compressed encoding for small valued lengths, but
as the length increases, the encoding becomes less well compressed. A match length of greater than
278 bytes requires a relatively large number of bits: 3+4+8+16. This includes three bits in the
original two bytes of metadata, four bits in the nibble in the "shared" byte, eight bits in the next byte,
and 16 bits in the final two bytes of metadata.
4.1.10.5.22 GetOptionalFeatureBit
procedure GetOptionalFeatureBit(featureGuid: GUID, var bit: integer): boolean
Informative summary of behavior: The GetOptionalFeatureBit procedure obtains the bit number in the
dwFlagsExt and dwExtCaps fields of the DRS_EXTENSIONS_INT structure that corresponds to the
optional feature identified by featureGuid.
227 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (featureGUID = GUID of Recycle Bin optional feature)
/* [MS-ADTS] section 6.1.1.2.4.1.3.1 */
bit := DRS_EXT_RECYCLE_BIN
return true
else
return false
endif
The client processes an IDL_DRSGetNCChanges response in relation to the current state of its NC
replica as detailed in ProcessGetNCChangesReply below. This processing, though sometimes complex,
is critical to ensuring that each NC replica arrives at the same abstract state.
4.1.10.6.1 ProcessGetNCChangesReply
procedure ProcessGetNCChangesReply(
hDrs: DRS_HANDLE,
rf: RepsFrom,
msgIn: DRS_MSG_GETCHGREQ_V10,
dwOutVersion: ULONG,
msgOut: DRS_MSG_GETCHGREPLY) : ULONG
msgReplyNative: DRS_MSG_GETCHGREPLY_NATIVE
replEntinfList: REPLENTINFLIST
continueProcessing: boolean
writableReplica: boolean
sourcePrefixTable: PrefixTable
attributesAndStamps: set of AttributeAndStamp
linkValueCount: DWORD
clientSchemaSignature: sequence of BYTE
serverSchemaSignature: sequence of BYTE
fServerSchemaMoreRecent: boolean
lastElement: DWORD
ulResult : ULONG
228 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ulResult := msgReplyNative.dwDRSError
if (ulResult = 0) then
sourcePrefixTable :=
AbstractPTFromConcretePT(msgReplyNative.PrefixTableSrc)
else
return ulResult
endif
/* If the source has the Recycle Bin optional feature enabled, then it must
* be enabled locally, unless the Schema partition is being updating.
*/
if msgReplyNative.pNC^ ≠ SchemaNC() and
ServerExtensions(hDrs).RB and not IsRecycleBinEnabled()
then
EnableRecycleBin()
return ERROR_DS_DRS_EXTENSIONS_CHANGED
endif
/* If the source has the Privileged Access Management optional feature enabled,
* then it must be enabled locally unless the Schema partition is being updated.
*/
if msgReplyNative.pNC^ ≠ SchemaNC() and
ServerExtensions(hDrs).GR9 and not IsPrivilegedAccessManagementEnabled()
then
EnablePrivilegedAccessManagement()
return ERROR_DS_DRS_EXTENSIONS_CHANGED
endif
if (ulResult = 0) then
attributesAndStamps := GetStampsForUpdate(
replEntinfList,
sourcePrefixTable)
/* Process objects that are moved across an NC. */
continueProcessing := PrepareCrossNCMove(
replEntinfList,
sourcePrefixTable)
endif
if continueProcessing and (ulResult = 0) then
if (DRS_WRIT_REP in msgIn.ulFlags) then
writableReplica := true
else
writableReplica := false
endif
229 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
continueProcessing := AdjustInstanceTypeAttrVal(
msgReplyNative.pNC^,
writableReplica ,
replEntinfList,
prefixTable)
endif
if continueProcessing and (ulResult = 0) then
if (not ObjExists(replEntinfList.Entinf.pName^)) then
ulResult := AddObject(
replEntinfList,
sourcePrefixTable,
attributesAndStamps)
else
ulResult := UpdateObject(
replEntinfList,
sourcePrefixTable,
attributesAndStamps)
endif
endif
replEntinfList := replEntinfList.pNextEntInf^
endwhile
return ulResult
4.1.10.6.2 EnableRecycleBin
230 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure EnableRecycleBin()
4.1.10.6.3 EnablePrivilegedAccessManagement
procedure EnablePrivilegedAccessManagement()
4.1.10.6.4 PrepareCrossNCMove
procedure PrepareCrossNCMove(
replEntinfList: REPLENTINFLIST,
sourcePrefixTable: PrefixTable): boolean
231 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
proxiedNameAttrVal: ATTRVAL
proxiedNameValue: DNBinary
localProxiedNameValue: DNBinary
proxyEpoch: DWORD
localProxyEpoch: DWORD
proxyObject: DSName
proxyObjectNameValue: DNBinary
isProxy: boolean
objClassVal: ATTRVAL
proxiedNameAttrVal := ENTINF_GetValue(
replEntinfList.Entinf,
proxiedObjectName,
sourcePrefixTable)
if (proxiedNameAttrVal = null) then
/* Update is not related to cross NC move. Therefore, continue
processing the replicated update. */
return true
endif
232 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
localProxyEpoch := GetProxyEpoch(localProxiedNameValue)
endif
if (localProxyEpoch < proxyEpoch) then
Expunge(proxyObject)
endif
endif
endif
return true /* Continue processing the replicated update. */
4.1.10.6.5 AdjustInstanceTypeAttrVal
procedure AdjustInstanceTypeAttrVal(
ncReplicated: DSName,
writableReplica: DSName,
var replEntinfList: REPLENTINFLIST,
prefixTable: PrefixTable) : boolean
instanceTypeAttrVal: ATTRVAL
instanceTypeAdjustedAttrVal: ATTRVAL
instanceTypeVal: ULONG
instanceTypeAdjustedVal: ULONG
ncSubRef: DSName
instanceTypeAttrVal := ENTINF_GetValue(replEntinfList.Entinf,
instanceType, prefixTable)
if (instanceTypeAttrVal = null) then
/* If instanceType attribute is not present in Entinf
* then there is no value to adjust. */
return true
endif
instanceTypeVal := ValueFromATTRVAL(
instanceTypeAttrVal, Syntax(instanceType), prefixTable)
233 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
endif
/* If sub-ref object does not exist or exists but the child NC is not
* locally instantiated, then continue processing this entry to
* add or update the sub-ref object.
*/
instanceTypeAdjustedVal := instanceTypeVal + {IT_NC_ABOVE,
IT_UNINSTANT, IT_NC_HEAD}
else
if (not writableReplica) and
(IT_WRITE in instanceTypeVal) then
/* If the client NC replica is a partial replica then remove the
* IT_WRITE flag from the instanceTypeVal to mark the object as
* read-only.
*/
instanceTypeAdjustedVal := instanceTypeVal - {IT_WRITE}
else
instanceTypeAdjustedVal := instanceTypeVal
endif
endif
instanceTypeAdjustedAttrVal := ATTRVALFromValue(
instanceTypeAdjusted, Syntax(instanceType), prefixTable)
ENTINF_SetValue(replEntinfList.Entinf, instanceType,
instanceTypeAdjustedAttrVal, prefixTable)
return true
4.1.10.6.6 SetResetInstanceTypeBits
procedure SetResetInstanceTypeBits(y: DWORD): DWORD
4.1.10.6.7 PerformModifyOperation
procedure PerformModifyOperation(
data: ENTINF,
updateObject: DSNAME,
prefixTable: PrefixTable): integer
The PerformModifyOperation procedure performs a modify operation with the given ENTINF to modify
updateObject, an existing object in the directory. For more details, see [MS-ADTS] section
3.1.1.5.3.
234 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
For each ATTR attr in data.AttrBlock, let attribute be the ATTRTYP returned by
LocalAttidFromRemoteAttid(prefixTable, attr.attrType). Then on the object modified by
PerformModifyOperation, if the attribute whose ATTRTYP is attribute is present, all previous values
are removed and replaced with the values attr.AttrVal.pAVal[0... attr.AttrVal.valCount]. If the
attribute whose ATTRTYP is attribute is not present, it is added with the values attr.AttrVal.pAVal[0...
attr.AttrVal.valCount].
If the modify operation succeeds, the procedure returns 0. If the modify operation fails, the procedure
returns a Windows error code.
4.1.10.6.8 NameObject
procedure NameObject(
replEntinfList: REPLENTINFLIST,
sourcePrefixTable: PrefixTable,
nc: DSName,
attributesAndStamps: set of AttributeAndStamp): DWORD
Informative summary of behavior: The NameObject procedure performs the necessary steps to
identify an unused name for an object, whether it is being added new or renamed. This procedure has
the following input parameters:
sourcePrefixTable: The prefix table from the server to translate attribute IDs.
The method returns a Windows error code if it encounters an error while updating the object.
parentObject: DSNAME
newParentObject: DSNAME
235 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
* object is deleted and if the new object is not a deleted object
* then FindBestParentObject will return DSName of "Lost and Found
* container". Otherwise, the parent object will remain the same. */
newParentObject := FindBestParentObject(parentObject, replEntinfList,
sourcePrefixTable, nc, attributesAndStamps)
return ERROR_SUCCESS;
4.1.10.6.9 AddObject
procedure AddObject(
replEntinfList: REPLENTINFLIST,
sourcePrefixTable: PrefixTable,
nc: DSName,
attributesAndStamps: set of AttributeAndStamp): DWORD
Informative summary of behavior: The AddObject procedure performs a replicated update by adding
an object to the NC replica. This procedure has the following input parameters:
sourcePrefixTable: The prefix table from the server to translate attribute IDs.
The procedure returns a Windows error code if it encounters an error while adding the object.
newObject: DSName
dwResult: DWORD
objectClassAttr: ATTRVAL
isDeletedAttr: ATTRVAL
isDeletedValue: boolean
ncNameValue: DSName
ncNameAtt: ATTRVAL
partitionsContainer: DSName
parentObject: DSName
236 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ncName,
sourcePrefixTable)
ncNameVal := ValueFromATTRVal(ncNameAtt,Syntax(ncNameAtt),sourcePrefixTable)
isDeletedAttr := ENTINF_GetValue(
replEntinfList.Entinf,
isDeleted,
sourcePrefixTable)
If(isDeleted Value)
DelSubRef(ncNameVal)
endif
endif
return dwResult
4.1.10.6.10 UpdateObject
procedure UpdateObject(
replEntinfList: REPLENTINFLIST,
sourcePrefixTable: PrefixTable,
nc: DSName,
attributesAndStamps: set of AttributeAndStamp): DWORD
sourcePrefixTable: The prefix table from the server to translate attribute IDs.
The method returns a Windows error code if encounters an error while updating the object.
237 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
updateObject: DSName
stampRemote: AttributeStamp
stampLocal: AttributeStamp
attribute: ATTRTYP
nameAttrAndStamp: AttributeAndStamp
attrAndStamp: AttributeAndStamp
isDeletedAttrAndStamp: AttributeAndStamp
dwResult: DWORD
updateObject := replEntinfList.Entinf.pName^
dwResult := PerformModifyOperation(replEntinfList.Entinf,
updateObject,
sourcePrefixTable
)
238 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
return dwResult
endif
return dwResult
4.1.10.6.11 FindBestParentObject
procedure FindBestParentObject(
parentObject: DSName,
replEntinfList: REPLENTINFLIST,
sourcePrefixTable: PrefixTable,
nc: DSName,
var attributesAndStamps: set of AttributeAndStamp): DSName
239 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
sourcePrefixTable: The prefix table from the server.
attributesAndStamps: The AttributeAndStamp set that corresponds to the replicated update (can
be modified by this procedure).
isDeletedAttr: ATTRVAL
isDeletedValue: boolean
attrAndStamp: AttributeAndStamp
isDeletedAttr := ENTINF_GetValue(
replEntinfList.Entinf,
isDeleted,
sourcePrefixTable)
if (isDeletedAttr = null) then
isDeletedValue := false
else
isDeletedValue := ValueFromATTRVal(
isDeletedAttr, Syntax(isDeleted), sourcePrefixTable)
endif
return parentObject
4.1.10.6.12 ResolveNameConflict
procedure ResolveNameConflict(
replEntinfList: REPLENTINFLIST,
parentObject: DSName,
var attributesAndStamps: set of AttributeAndStamp): DN
attributesAndStamps: The AttributeAndStamp set that corresponds to the replicated update (can be
modified by this procedure).
objectRDN: RDN
240 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
objectDN: DN
rdnValue: unicodestring
duplicateObject: DSName
nameAttrStamp: AttributeAndStamp
guidUpdateObj: GUID
stampExistingObj: AttributeStamp
stampUpdateObj: AttributeStamp
/* Remove existing attribute stamp for name and add in a new one
* so that the update is seen as an originating update. */
attributesAndStamps := attributesAndStamps - {nameAttrStamp}
nameAttrStamp := originating update stamp
/* See MS-ADTS section 3.1.1.1.9 */
attributeAndStamps := attributeAndStamps + {nameAttrStamp}
return newDN
else
/* Rename the existing object. */
newDN = MakeConflictDN(
existingObject!distinguishedName,
existingObject!objectGUID)
newRDN = The left most RDN of newDN
PerformModifyDNOperation(existingObject!distinguishedName,
null, newRDN)
return objectDN
endif
else
return objectDN /* No conflict case */
endif
4.1.10.6.13 MakeConflictDN
procedure MakeConflictDN(oldDN: DN, guid: GUID): DN
The MakeConflictDN procedure is used during name conflict resolution. For more details, see section
4.1.10.6.12.
A conflict name for DN oldDN and GUID guid is the DN newDN, such that newDN is the same as oldDN
with the exception of the AttributeValue portion (as specified in [RFC2253]) of the first RDN. This
portion is the concatenation of:
241 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The Unicode character 0x000A.
4.1.10.6.14 ProcessLinkValue
procedure ProcessLinkValue(
replValinf: REPLVALINF_NATIVE,
nc: DSName,
sourcePrefixTable: PrefixTable,
ulFlags: ULONG,
ulMoreFlags: ULONG): DWORD
Informative summary of behavior: The ProcessLinkValue procedure applies the replicated update of
a link value. Following are the input parameters for this procedure.
nc: The DSName of the root of the NC replica where the replicated update is applied.
updateObject: DSName
targetObject: DSName
isDeleted: boolean
attribute: ATTRTYP
attributeValue: attribute value
attributeValues: set of attribute value
newAttributeValue: attribute value
localValueStamp: LinkValueStamp
remoteValueStamp: LinkValueStamp
updateObject := replValinf.pObject^
if (IsRecycleBinEnabled()) then
isRecycled := updateObject!isRecycled
if (isRecycled = true) then
if (DRS_GET_ANC in ulFlags) then
/* Local object is recycled, and it is up-to-date.
Replicated update is not applied on a recycled object */
return 0
else
/* Local object is recycled, but it might not be up-to-date. */
return ERROR_DS_DRA_MISSING_PARENT
242 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
endif
else
isDeleted := updateObject!isDeleted
if (isDeleted = true) then
if (DRS_GET_ANC in ulFlags) then
/* Local object is deleted, and it is up-to-date.
Replicated update is not applied on a deleted object.*/
return 0
else
/* Local object is deleted, but it might not be up-to-date. */
return ERROR_DS_DRA_MISSING_PARENT
endif
endif
endif
attribute := replValinf.attrTyp
attributeValues := GetAttrVals(updateObject, attribute, true)
attributeValue := select one k from attributeValues where
(k = ValueFromATTRVAL(
sourcePrefixTable, Syntax(attribute), replValInf.pAval))
if (attributeValue = null) then
localValueStamp := null
else
/* If attributeValue was last updated when the forest functional
* level was DS_BEHAVIOR_WIN2000, no LinkValueStamp is
* associated with attributeValue. In that case the procedure
* LinkStamp() returns null.
*/
localValueStamp :=
LinkStamp(updateObject, attribute, attributeValue)
endif
remoteValueStamp := AbstractLinkValStampFromConcreteLinkValStamp(
replValinf.MetaData)
if (localValueStamp = null) or
(LinkValueStampCompare(localValueStamp, remoteValueStamp) < 0)
then
/* The replicated update is more up to date. Apply that change and
* modify the stamp. */
newAttributeValue = ValueFromATTRVAL(
sourcePrefixTable, Syntax(attribute), replValInf.pAval)
targetObject := GetDSNameFromAttrVal( replValinf.attrTyp, replValInf.pAval)
if (targetObject = null)
return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
if ((IsRecycleBinEnabled() and targetObject!isRecycled) or
(not IsRecycleBinEnabled() and targetObject!isDeleted)) then
if (DRS_GET_TGT in ulMoreFlags) then
/* nothing to do */
return 0
else
return ERROR_DS_DRA_RECYCLED_TARGET
endif
if (not attributeValue = null) then
/* Remove the old attribute value. */
RemoveAttrVal(updateObject, attribute, attributeValue)
endif
243 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
SetLinkStamp(updateObject, attribute, newAttributeValue,
remoteValueStamp)
endif
return 0
4.1.10.6.15 UpdateRepsFrom
procedure UpdateRepsFrom(
rf: RepsFrom,
msgReplyNative: DRS_MSG_GETCHGREPLY_NATIVE,
dsaServer: DSName,
ulResult: DWORD)
Informative summary of behavior: Using the UpdateRepsFrom procedure, the client updates the
repsFrom abstract variable after it applies the response message received from the server. Following
are the input parameters for this procedure.
ulResult: A Windows error code that indicates whether or not the replicated updates in the
response message are applied successfully.
rfOld: RepsFrom
currentTime: DSTIME
nc: DSName
nc := msgReplyNative.pNC^
rfOld := select one v from nc!repsFrom where
(v.uuidDsa = dsaServer!objectGUID)
if rfOld ≠ null then
nc!repsFrom := nc!repsFrom - {rfOld} /* remove old entry */
endif
4.1.10.6.16 UpdateUTDandPAS
procedure UpdateUTDandPAS(
msgReplyNative: DRS_MSG_GETCHGREPLY_NATIVE,
partialAttrSetEx: PARTIAL_ATTR_VECTOR_V1_EXT,
nc: DSName)
244 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Informative summary of behavior: If the client has applied all replicated updates in the response
message of IDL_DRSGetNCChanges from the server, and if the replication cycle is complete, then
the client updates the replUpToDateVector and partialAttributeSet abstract attributes, as specified in
the UpdateUTDandPAS procedure. This procedure has the following input parameters.
nc: The DSName of the root of the NC replica where the replicated update is applied.
return
4.1.10.6.17 DecryptValuesIfNecessary
procedure DecryptValuesIfNecessary(
hDrs: DRS_HANDLE,
prefixTable: PrefixTable,
var attrBlock: ATTRBLOCK): DWORD
245 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Informative summary of behavior: The values of several attributes are encrypted by the server and
conversely have to be decrypted by the client before processing object updates. The client decrypts
the encrypted data by using MD5 digest (as specified in [RFC1321]), a CRC32 checksum (as
specified in [ISO/IEC 13239]), and RC4 stream cipher (as specified in [SCHNEIER] section 17.1). The
DecryptValuesIfNecessary procedure specifies the process of attribute value decryption.
attrBlock: The ATTRBLOCK structure that is derived from the response of the
IDL_DRSGetNCChanges message. If attrBlock has attribute values that need to be decrypted, then
the values are decrypted in place. That is, at the end of the procedure call, the pVal field in the
ATTRVAL structure refers to the decrypted attribute value.
localAttid: ATTRTYP
attr: ATTR
pPayload: ADDRESS OF ENCRYPTED_PAYLOAD
salt: sequence of BYTE
sessionKey: sequence of BYTE
i: integer
j: integer
crcComputed: ULONG
crcReceived: ULONG
md5Context: MD5_CTX
for j := 0 to (attrBlock.attrCount - 1)
attr := attrBlock.pAttr[j]
localAttid = LocalAttidFromRemoteAttid(prefixTable, attr.attrTyp)
if IsSecretAttribute(localAttid) then
/* Decrypt all values of this attribute. */
for i := 0 to (attr.AttrVal.valCount - 1)
pPayload := attr.AttrVal.pAVal[i].pVal
salt := pPayload^.Salt
/* Compute encryption key. */
MD5Init(md5Context)
MD5Update(md5context, sessionKey, sessionKey.length)
MD5Update(md5context, salt, 16)
MD5Final(md5Context)
246 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
crcReceived := pPayload^.Checksum
if (not crcComputed = crcReceived) then
/* Checksums don't match. Stop processing the reply message.
*/
return SEC_E_ALGORITHM_MISMATCH
endif
4.1.10.6.18 DecompressReplyMessage
procedure DecompressReplyMessage(
msgOut: DRS_MSG_GETCHREPLY,
dwOutVersion: DWORD): DRS_MSG_GETCHGREPLY_NATIVE
Informative summary of behavior: Compression subdivides a data stream into sequences of bytes
called compression chunks. The DecompressReplyMessage procedure decompresses the data
stream.
if (dwOutVersion = 2) or
(dwOutVersion = 7) then
/* decompress data that is compressed.
*/
if (dwOutVersion = 2) then
pInBuffer := msgOut.V2.CompressedV1.pbCompressedData
cbInBufferCompress := msgOut.CompressedV1.cbCompressedSize
cbInBufferDeCompress := msgOut.CompressedV1.cbUncompressedSize
compressionAlg := DRS_COMP_ALG_MSZIP
else if (dwOutVersion = 7) then
pInBuffer := msgOut.V7.CompressedAny.pbCompressedData
cbInBufferCompress := msgOut.V7.CompressedAny.cbCompressedSize
cbInBufferDecompress :=
msgOut.V7.CompressedAny.cbUncompressedSize
compressionAlg := msgOut.V7.CompressionAlg
endif
247 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
4.1.10.6.19 DecompressMessage
procedure DecompressMessage(
pInBuffer: sequence of BYTE,
cbInBufferCompress: DWORD,
cbInBufferDecompress: DWORD,
DRS_COMP_ALG_TYPE: compressionAlg
ref pOutputBuffer: sequence of BYTE)
Informative summary of behavior: Compression subdivides a data stream into sequences of bytes
called compression chunks. The DecompressMessage procedure decompresses the data stream.
The following table identifies the size of the compression chunk for each algorithm type.
COMP_ALG_MSZIP 32768
COMP_ALG_W2K3 65536
248 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cbOutputBuffer :=
cbOutputBuffer + pInBlock^.cbDecompressedSize
cbInputProcessed := cbInputProcessed +
pInBlock^.cbCompressedSize
Round up value in cbInputProcessed such that
ADR(pInBlock[cbInputProcessed]) align on double word
boundary.
endwhile
endif
Querying the nTDSDSA objects for the root domain NC DC=CONTOSO, DC=COM for DC1:
ldap_search_s("CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com", baseObject, "(objectClass=*)",
[objectClass, cn ... objectGUID])
Matched DNs:
Getting 1 entries:
Querying the user object "CN=Kim Akers, CN=Users, DC=CONTOSO, DC=COM" on DC1:
Matched DNs:
Getting 1 entries:
249 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> sn: Dow;
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> pwdLastSet: 07/17/2006 13:50:33 Pacific Standard Time Pacific Daylight Time;
1> logonCount: 0;
Querying the repsFrom attribute on the NC root object for domain DC=CONTOSO, DC=COM on
DC2:
Matched DNs:
250 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Getting 1 entries:
V1.usnvec.usnHighPropUpdate: 29322
V1.uuidDsaObj: c20bc312-4d35-4cc0-9903-b1073368af4a
V1.uuidInvocId: c20bc312-4d35-4cc0-9903-b1073368af4a
V1.uuidTransportObj: 00000000-0000-0000-0000-000000000000
V1.mtx_address: c20bc312-4d35-4cc0-9903-b1073368af4a._msdcs.contoso.com
V1.cbPASDataOffset: 0
Querying the user object "CN=Kim Akers, CN=Users, DC=CONTOSO, DC=COM" on DC2 returns no
entries because the object is not present on DC2.
Getting 0 entries:
DC2 invokes the IDL_DRSGetNCChanges method against DC1, with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 10
pmsgIn = DRS_MSG_GETCHGREQ_V10
usnvecFrom: USN_VECTOR
usnHighObjUpdate : 29322
usnHighPropUpdate : 29322
pUpToDateVecDest : UPTODATE_VECTOR_V1_EXT
251 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DSA Invoc ID: c20bc312-4d35-4cc0-9903-b1073368af4a, USN: 29335
ulFlags:
DRS_ASYNC_OP
DRS_WRIT_REP
DRS_INIT_SYNC
DRS_PER_SYNC
Fsmo Info: 0
PrefixTableDest : SCHEMA_PREFIX_TABLE
ulMoreFlags: 0
pdwOutVersion= DRS_MSG_GETCHGREPLY_NATIVE_VERSION_NUMBER
pmsgOut = DRS_MSG_GETCHGREPLY_NATIVE
usnvecFrom : USN_VECTOR
usnHighObjUpdate : 29322
usnHighPropUpdate : 29322
usnvecTo: USN_VECTOR
usnHighObjUpdate : 29379
usnHighPropUpdate : 29379
pUpToDateVecSrc : UPTODATE_VECTOR_V2_EXT
PrefixTableSrc : SCHEMA_PREFIX_TABLE
pObjects: REPLENTINFLIST
sn: Akers;
252 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
givenName: Kim;
objectGUID: 39ab8618-d3fd-410c-b627-64b65104384d;
codePage: 0;
countryCode: 0;
logonHours: 0
sAMAccountName: KimAkers;
sAMAccountType: SAM_NORMAL_USER_ACCOUNT;
userPrincipalName: KimAkers@contoso.com;
rgValues: (null)
Querying the repsFrom attribute on the NC root object for the domain DC=CONTOSO, DC=COM on
DC2:
Matched DNs:
Getting 1 entries:
253 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1.uuidDsaObj: c20bc312-4d35-4cc0-9903-b1073368af4a
Querying the user object "CN=Kim Akers, CN=Users, DC=CONTOSO,DC=COM" on DC2, which is now
present:
Matched DNs:
Getting 1 entries:
1> codePage: 0;
1> countryCode: 0;
254 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> sAMAccountType: SAM_NORMAL_USER_ACCOUNT;
User "Kim Akers" is added to the group ([MS-ADSC] section 2.14.) "GroupA" on DC1.
Querying the repsFrom attribute on the NC root object for the domain DC=CONTOSO, DC=COM on
DC2:
Matched DNs:
Getting 1 entries:
Matched DNs:
Getting 1 entries:
255 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> instanceType: 0x4 = ( IT_WRITE );
Querying the group object "CN=GroupA, CN=Users, DC=CONTOSO, DC=COM" on DC2, the member
attribute value is not returned, as it is currently empty because this group has no members on DC2.
Matched DNs:
Getting 1 entries:
256 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> sAMAccountType: 536870912;
DC2 invokes the method IDL_DRSGetNCChanges against DC1, with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 10
pmsgIn = DRS_MSG_GETCHGREQ_V10
usnvecFrom: USN_VECTOR
usnHighObjUpdate : 29379
usnHighPropUpdate : 29379
pUpToDateVecDest : UPTODATE_VECTOR_V1_EXT
Flags:
DRS_ASYNC_OP
DRS_WRIT_REP
DRS_INIT_SYNC
DRS_PER_SYNC
Fsmo Info: 0
PrefixTableDest : SCHEMA_PREFIX_TABLE
ulMoreFlags: 0
pdwOutVersion= DRS_MSG_GETCHGREPLY_NATIVE_VERSION_NUMBER
pmsgOut = DRS_MSG_GETCHGREPLY_NATIVE
257 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
uuidInvocIdSrc: _GUID {c20bc312-4d35-4cc0-9903-b1073368af4a}
usnvecFrom : USN_VECTOR
usnHighObjUpdate : 29379
usnHighPropUpdate : 29379
usnvecTo: USN_VECTOR
usnHighObjUpdate : 29389
usnHighPropUpdate : 29389
pUpToDateVecSrc : UPTODATE_VECTOR_V2_EXT
PrefixTableSrc : SCHEMA_PREFIX_TABLE
pObjects: (null)
rgValues: REPLVALINF_NATIVE
attrTyp: "member"
Querying the repsFrom attribute on the NC root object for the domain DC=CONTOSO, DC=COM on
DC2:
Matched DNs:
Getting 1 entries:
V1.usnvec.usnHighPropUpdate: 29389
V1.uuidDsaObj: c20bc312-4d35-4cc0-9903-b1073368af4a
V1.uuidInvocId: c20bc312-4d35-4cc0-9903-b1073368af4a
258 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1.uuidTransportObj: 00000000-0000-0000-0000-000000000000 V1.mtx_address:
c20bc312-4d35-4cc0-9903-b1073368af4a._msdcs.contoso.com
Matched DNs:
Getting 1 entries:
User Kim Akers changes the password by pressing CTRL+ALT+DELETE, and the password change is
processed by DC1.
Querying the repsFrom attribute on the NC root object for domain DC=CONTOSO, DC=COM on
DC2:
259 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Result <0>: (null)
Matched DNs:
Getting 1 entries:
V1.uuidDsaObj: c20bc312-4d35-4cc0-9903-b1073368af4a
V1.uuidInvocId: c20bc312-4d35-4cc0-9903-b1073368af4a
Matched DNs:
Getting 1 entries:
260 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> name: Kim Akers;
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> logonCount: 0;
Matched DNs:
Getting 1 entries:
261 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> whenChanged: 07/17/2006 14:05:21 Pacific Standard Daylight Time;
1> codePage: 0;
1> countryCode: 0;
DC2 invokes the method IDL_DRSGetNCChanges against DC1, with the following parameters
(DRS_HANDLE to DC1 omitted):
dwInVersion = 10
pmsgIn = DRS_MSG_GETCHGREQ_V10
usnvecFrom: USN_VECTOR
usnHighPropUpdate : 29389
usnHighObjUpdate : 29389
pUpToDateVecDest : UPTODATE_VECTOR_V1_EXT
Flags:
DRS_ASYNC_OP
262 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_WRIT_REP
DRS_INIT_SYNC
DRS_PER_SYNC
Fsmo Info: 0
PrefixTableDest : SCHEMA_PREFIX_TABLE
ulMoreFlags: 0
pdwOutVersion= DRS_MSG_GETCHGREPLY_NATIVE_VERSION_NUMBER
pmsgOut = DRS_MSG_GETCHGREPLY_NATIVE
usnvecFrom : USN_VECTOR
usnHighObjUpdate : 29389
usnHighPropUpdate : 29389
usnvecTo : USN_VECTOR
usnHighObjUpdate : 29438
usnHighPropUpdate : 29438
pUpToDateVecSrc : UPTODATE_VECTOR_V2_EXT
PrefixTableSrc : SCHEMA_PREFIX_TABLE
pObjects: REPLENTINFLIST
instanceType: IT_WRITE
263 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
supplementalCredentials: binary data
Querying the repsFrom attribute on the NC root object for domain DC=CONTOSO, DC=COM on
DC2:
Matched DNs:
Getting 1 entries:
>>Dn: DC=contoso,DC=com
V1.uuidInvocId: c20bc312-4d35-4cc0-9903-b1073368af4a
Querying the user object "CN=Kim Akers, CN=Users, DC=CONTOSO,DC=COM" on DC2, which has
now been updated:
Matched DNs:
Getting 1 entries:
264 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> whenChanged: 07/17/2006 15:12:35 Pacific Standard Daylight Time;
1> codePage: 0;
1> countryCode: 0;
If the server is the PDC emulator FSMO role owner, the IDL_DRSGetNT4ChangeLog method
returns either a sequence of PDC change log entries or the NT4 replication state, or both, as
requested by the client.
ULONG IDL_DRSGetNT4ChangeLog(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_NT4_CHGLOG_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_NT4_CHGLOG_REPLY* pmsgOut
);
265 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Return Values: 0 or ERROR_MORE_DATA if successful; another Windows error code if a failure
occurred.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.11.1.1 DRS_MSG_NT4_CHGLOG_REQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_NT4_CHGLOG_REQ_V1 V1;
} DRS_MSG_NT4_CHGLOG_REQ;
4.1.11.1.2 DRS_MSG_NT4_CHGLOG_REQ_V1
typedef struct {
DWORD dwFlags;
DWORD PreferredMaximumLength;
[range(0,10485760)] DWORD cbRestart;
[size_is(cbRestart)] BYTE* pRestart;
} DRS_MSG_NT4_CHGLOG_REQ_V1;
dwFlags: Zero or more of the following bit flags, which are presented in little-endian byte order:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X S C X X X X X X X X X X X X X X X X X X X X X X X X
N L
PreferredMaximumLength: The maximum size, in bytes, of the change log data that is to be
retrieved in a single operation.
266 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cbRestart: Zero if pRestart = null. Otherwise, the size, in bytes, of pRestart^.
pRestart: Null to request the change log from the beginning. Otherwise, a pointer to an opaque
value, returned in some previous call to IDL_DRSGetNT4ChangeLog, identifying the last change
log entry returned in that previous call.
4.1.11.1.3 DRS_MSG_NT4_CHGLOG_REPLY
The DRS_MSG_NT4_CHGLOG_REPLY union defines the response messages received from the
IDL_DRSGetNT4ChangeLog method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_NT4_CHGLOG_REPLY_V1 V1;
} DRS_MSG_NT4_CHGLOG_REPLY;
4.1.11.1.4 DRS_MSG_NT4_CHGLOG_REPLY_V1
The DRS_MSG_NT4_CHGLOG_REPLY_V1 structure defines the response message received from the
IDL_DRSGetNT4ChangeLog method.
typedef struct {
[range(0,10485760)] DWORD cbRestart;
[range(0,10485760)] DWORD cbLog;
NT4_REPLICATION_STATE ReplicationState;
DWORD ActualNtStatus;
[size_is(cbRestart)] BYTE* pRestart;
[size_is(cbLog)] BYTE* pLog;
} DRS_MSG_NT4_CHGLOG_REPLY_V1;
pRestart: Null if no entries were returned. Otherwise, a pointer to an opaque value identifying the
last entry returned in pLog.
pLog: The buffer containing the next entries from the change log.
4.1.11.1.5 NT4_REPLICATION_STATE
The NT4_REPLICATION_STATE structure defines the replication state for Windows NT 4.0 DCs,
whose interpretation is specified in [MS-ADTS] section 3.1.1.7.1.
typedef struct {
LARGE_INTEGER SamSerialNumber;
LARGE_INTEGER SamCreationTime;
LARGE_INTEGER BuiltinSerialNumber;
LARGE_INTEGER BuiltinCreationTime;
LARGE_INTEGER LsaSerialNumber;
267 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
LARGE_INTEGER LsaCreationTime;
} NT4_REPLICATION_STATE;
SamSerialNumber: The Windows NT 4.0 replication update sequence number for the SAM
database.
SamCreationTime: The time at which the Windows NT 4.0 replication update sequence number for
the SAM database was set to 1.
BuiltinSerialNumber: The Windows NT 4.0 replication update sequence number for the built-in
database.
BuiltinCreationTime: The time at which the Windows NT 4.0 replication update sequence number
for the built-in database was set to 1.
LsaSerialNumber: The Windows NT 4.0 replication update sequence number for the local security
authority (LSA) database.
LsaCreationTime: The time at which the Windows NT 4.0 replication update sequence number for
the LSA database was set to 1.
4.1.11.2.1 IsPDC
procedure IsPDC(): boolean
Returns true if the DC owns the PDC role for this domain, otherwise false.
4.1.11.2.2 GetWindowsErrorCode
procedure GetWindowsErrorCode(ntStatus: DWORD): DWORD
Returns the Windows error code corresponding to the specified STATUS code.
Informative summary of behavior: If the server is the PDC emulator FSMO role owner, it returns
either a sequence of PDC change log entries or the NT4 replication state, or both, as requested by
the client.
Multiple calls of this method might be required to retrieve the entire PDC change log. The client passes
pRestart = null on the first call in a series of calls; the server returns a sequence of change log
entries, including the first, a pointer to an opaque cookie, and a result code. If the server returns no
change log entries, it returns null instead of a pointer to a cookie. If the server returns the result code
zero, the sequence of change log entries in the response includes the final entry in the log.
The cookie encodes the serial number of the last change log entry returned. If the server returns
ERROR_MORE_DATA, the final change log entry in the response was not the final entry in the change
log. The client can make another call, with pRestart pointing to the cookie. The server processes this
call identically to a call with pRestart = null, except that it returns change log entries starting with the
entry following the last previously returned entry, as indicated by the cookie. By making enough calls
the client can retrieve the entire change log.
If the client includes a cookie that is either corrupted or identifies a nonexistent change log entry
(possibly because the cookie is too old), the server returns ERROR_INVALID_PARAMETER. If there are
268 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
change log entries to return, but the client specifies a bound on the size of the returned change log
entries that is too small to hold even a single entry, the server returns
ERROR_INSUFFICIENT_BUFFER.
The NT4 replication state is a small, fixed-size structure and the server simply copies it into the
response.
When the client requests both the PDC change log and the NT4 replication state, the server processes
the PDC change log request first. If an error occurs during this processing the server does not process
the request for NT4 replication state. If an error occurs while processing the NT4 replication state
request, the server returns no indication to the client that the PDC change log request succeeded.
ULONG
IDL_DRSGetNT4ChangeLog(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_NT4_CHGLOG_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_NT4_CHGLOG_REPLY *pmsgOut)
msgIn: DRS_MSG_NT4_CHGLOG_REQ_V1
readStatus, ntStatus: DWORD
sequenceNumber: integer
nextIndexToBeReturned, lastIndexToBeReturned: integer
lastReturnedSerialNumber: LONGLONG
lastReturnedIndex: integer
pChangeLog: ADDRESS OF CHANGE_LOG_ENTRIES
ValidateDRSInput(hDrs, 11)
pdwOutVersion^ := 1
pmsgOut^.V1.cbRestart := 0
pmsgOut^.V1.cbLog := 0
pmsgOut^.V1.ReplicationState.SamSerialNumber := 0
pmsgOut^.V1.ReplicationState.SamCreationTime := 0
pmsgOut^.V1.ReplicationState.BuiltinSerialNumber := 0
pmsgOut^.V1.ReplicationState.BuiltinCreationTime := 0
pmsgOut^.V1.ReplicationState.LsaSerialNumber := 0
pmsgOut^.V1.ReplicationState.LsaCreationTime := 0
pmsgOut^.V1.ActualNtStatus := 0
pmsgOut^.V1.pRestart := null
pmsgOut^.V1.pLog := null
/* Access check */
if not AccessCheckCAR(DefaultNC(), DS-Replication-Get-Changes) then
return ERR0R_ACCESS_DENIED
endif
ntStatus := 0
readStatus := 0
if DRS_NT4_CHGLOG_GET_CHANGE_LOG in msgIn.dwFlags then
/* Return NT4 change log entries. */
/* Determine the position of the first entry in the change log that
* needs to be returned. If pRestart = null, this is the first
269 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
* entry of the change log, otherwise it is the entry following the
* entry identified in the cookie pRestart^. */
if msgIn.pRestart = null then
sequenceNumber := 1
nextIndexToBeReturned := 0
else
sequenceNumber :=
(Sequence number extracted from msgIn.pRestart^) + 1
lastReturnedSerialNumber :=
Serial number extracted from msgIn.pRestart^
lastReturnedIndex := select one i in dc.pdcChangeLog where
dc.pdcChangeLog[i].SerialNumber = lastReturnedSerialNumber
if lastReturnedIndex = null then
/* Cookie is old or corrupted.
* The STATUS code STATUS_INVALID_PARAMETER corresponds to
* the Windows error code ERROR_INVALID_PARAMETER. */
ntStatus := STATUS_INVALID_PARAMETER
else
nextIndexToBeReturned := lastReturnedIndex + 1
endif
endif
if ntStatus = 0 and
nextIndexToBeReturned < dc.pdcChangeLog.length then
/* Entries to be returned. First, determine how many entries fit
* into the response message */
lastIndexToBeReturned := the largest integer q such that
q < dc.pdcChangeLog.length and
the size in bytes of
dc.pdcChangeLog[nextIndexToBeReturned .. q]
is <= msgIn.PreferredMaximumLength
if lastIndexToBeReturned < nextIndexToBeReturned then
/* Client's PreferredMaximumLength is too small for a single
* entry, so return no entries.
* The STATUS code STATUS_BUFFER_TOO_SMALL corresponds to
* the Windows error code ERROR_INSUFFICIENT_BUFFER. */
ntStatus := STATUS_BUFFER_TOO_SMALL
else
/* Client's PreferredMaximumLength is large enough for one or
* more entries. Fill in pChangeLog^ from dc.pdcChangeLog */
pChangeLog^.Size := 0x00000010
pChangeLog^.Version := 0x00000001
pChangeLog^.SequenceNumber := sequenceNumber
pChangeLog^.Flags := 0x00000000
pChangeLog^.ChangeLogEntries :=
dc.pdcChangeLog[nextIndexToBeReturned ..
lastIndexToBeReturned]
if a fatal error occurred while retrieving dc.pdcChangeLog then
ntStatus :=
STATUS code of error that occurred, high-order bit set
end
endif
if ntStatus = 0 then
/* No errors, complete the response message */
pmsgOut^.V1.pLog := pChangeLog
pmsgOut^.V1.cbLog := size in bytes of pmsgOut^.V1.pLog^
/* Construct a new cookie */
lastReturnedSerialNumber :=
dc.pdcChangeLog[lastIndexToBeReturned].SerialNumber
pmsgOut^.V1.pRestart :=
270 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ADDRESS OF implementation-specific struct
encapsulating lastReturnedSerialNumber and sequenceNumber
pmsgOut^.V1.cbRestart := size in bytes of pmsgOut^.V1.pRestart^
if lastIndexToBeReturned < dc.pdcChangeLog.length - 1 then
/* There are more entries to be returned.
* The STATUS code STATUS_MORE_ENTRIES corresponds to
* the Windows error code ERROR_MORE_DATA. */
ntStatus := STATUS_MORE_ENTRIES
endif
endif /* Response complete */
endif /* Entries returned */
endif /* Processed change log request */
return GetWindowsErrorCode(ntStatus)
DC=contoso, DC=com;
271 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The PDC role is transferred to DC1, which results in DC1 invoking the IDL_DRSGetNT4ChangeLog
method against DC2 with the following parameters (DRS_HANDLE to DC2 omitted):
dwMsgVersion = 1
pmsgIn =
dwFlags: DRS_NT4_CHGLOG_GET_CHANGE_LOG +
DRS_NT4_CHGLOG_GET_SERIAL_NUMBERS
PreferredMaximumLength: 0x4000
cbRestart: 0
pRestart: null
pmsgOut = DRS_MSG_NT4_CHGLOG_REPLY_V1
cbRestart = 0x10
cbLog = 0x2d00
ReplicationState = _NT4_REPLICATION_STATE
SamSerialNumber = 0x30`00000097
SamCreationTime = 0x1c6a7a9`792f51f6
BuiltinSerialNumber = 0x30`00000054
BuiltinCreationTime = 0x1c6a7a9`792f51f6
LsaSerialNumber = 0x1
LsaCreationTime = 0x1c6a832`0a495151
ActualNtStatus = 0
pRestart = "LMEM"
pLog = pointer to actual log (log data omitted)
The PDC change log entries on DC1 are synchronized with the change log entries on DC2; there is no
other change in state.
The IDL_DRSGetObjectExistence method helps the client check the consistency of object existence
between its replica of an NC and the server's replica of the same NC. Checking the consistency of
object existence means identifying objects that have replicated to both replicas and that exist in one
replica but not in the other. For the purposes of this method, an object exists within a NC replica if it
is either an object or a tombstone.
ULONG IDL_DRSGetObjectExistence(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_EXISTREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_EXISTREPLY* pmsgOut
);
272 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pdwOutVersion: A pointer to the version of the response message.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.12.1.1 DRS_MSG_EXISTREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_EXISTREQ_V1 V1;
} DRS_MSG_EXISTREQ;
4.1.12.1.2 DRS_MSG_EXISTREQ_V1
typedef struct {
UUID guidStart;
DWORD cGuids;
DSNAME* pNC;
UPTODATE_VECTOR_V1_EXT* pUpToDateVecCommonV1;
UCHAR Md5Digest[16];
} DRS_MSG_EXISTREQ_V1;
guidStart: The objectGUID of the first object in the client's object sequence.
pUpToDateVecCommonV1: The filter excluding objects from the client's object sequence.
Md5Digest: The digest of the objectGUID values of the objects in the client's object sequence.
4.1.12.1.3 DRS_MSG_EXISTREPLY
The DRS_MSG_EXISTREPLY union defines the response message versions received from the
IDL_DRSGetObjectExistence method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
273 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
union {
[case(1)]
DRS_MSG_EXISTREPLY_V1 V1;
} DRS_MSG_EXISTREPLY;
4.1.12.1.4 DRS_MSG_EXISTREPLY_V1
The DRS_MSG_EXISTREPLY_V1 structure defines the response message received from the
IDL_DRSGetObjectExistence method.
typedef struct {
DWORD dwStatusFlags;
[range(0,10485760)] DWORD cNumGuids;
[size_is(cNumGuids)] UUID* rgGuids;
} DRS_MSG_EXISTREPLY_V1;
dwStatusFlags: 1 if the digests of the object sequences on the client and server are the same, 0 if
they are different.
The following procedure is used in specifying both the client and server behavior of
IDL_DRSGetObjectExistence.
4.1.12.2.1 GuidSequence
Informative summary of behavior: The candidate set of objects is the set of all objects and
tombstones in the local replica of NC nc, excluding objects that have not yet replicated to both the
client and server replicas of NC nc. The exclusion of objects created too recently is performed using
the client-supplied up-to-date vector utd.
A cluster is any subset of the candidate set such that no object in the candidate set outside the cluster
has an objectGUID lying between the objectGUIDs of any two members of the cluster.
The cluster constructed by GuidSequence contains the object in the candidate set with the smallest
objectGUID greater than or equal to startGUID. The cluster contains as many objects as possible, but
no more than count.
Both the client and the server use GuidSequence to compute a cluster, create a sorted sequence of
objectGUIDs of objects in the cluster, and compute a digest of that sequence.
procedure GuidSequence(
startGUID: GUID,
count: ULONG,
nc: DSName,
utd: UPTODATE_VECTOR_V1_EXT,
var s: sequence of DSName,
var digest: sequence [0..15] of byte)
274 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1. A sequence s of objectGUIDs from the server's state.
2. Construct the GUID sequence S that contains the objectGUIDs of members of the set, sorted into
ascending order by GUID value.
3. Find the smallest integer i such that S[i] >= startGUID. If there is no such i, the result sequence s
is empty, otherwise the result sequence s is as follows:
The result digest is the value of ComputeDigest applied to the result sequence s, where
ComputeDigest is specified as follows:
md5Context : MD5_CTX
MD5Init(md5Context)
for i := 0 to s.length-1
MD5Update(md5Context, s[i], 16)
endfor
MD5Final(md5Context)
return md5Context.digest
IDL_DRSGetObjectExistence allows the client to perform this checking in clusters, as defined in the
informative summary of the GuidSequence procedure (section 4.1.12.2.1).
nc: DSName
utdClient, utdServer: UPTODATE_VECTOR_V1_EXT
guidStart: GUID
count: ULONG
nc: The NC containing the cluster that the client will check.
utdClient, utdServer: The up-to-date vectors of the client and server for the NC nc, respectively.
The client can obtain utdServer using IDL_DRSGetReplInfo.
guidStart: The lower bound on the smallest objectGUID in the cluster that the client will check.
275 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
count: The upper bound on the number of objects in the cluster that the client will check.
Given these inputs, the client creates the request message to IDL_DRSGetObjectExistence as
follows:<32>
msgIn: DRS_MSG_EXISTREQ_V1
s: sequence
digest: sequence [0..15] of byte
msgIn.pNC := nc
msgIn.pUpToDateVecCommonV1 := MergeUTD(utdClient, utdServer)
GuidSequence(
guidStart, count, nc, msgIn.pUpToDateVecCommonV1^, s, digest)
msgIn.guidStart := s[0]
msgIn.length := s.length
msgIn.Md5Digest := digest
pmsgIn^.V1 := msgIn
Informative summary of behavior: The server computes a cluster, an objectGUID sequence, and a
digest in the same manner as the client, but uses the server's NC replica. If the digest computed by
the server equals the digest in the client's request, the server returns dwStatusFlags = 1, otherwise
the server returns dwStatusFlags = 0 and the objectGUID sequence.
ULONG IDL_DRSGetObjectExistence (
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_EXISTREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_EXISTREPLY *pmsgOut)
msgIn: DRS_MSG_EXISTREQ_V1
nc: DSName
s: sequence of GUID
digest: sequence [0..15] of byte
msgOut: DRS_MSG_EXISTREPLY_V1
*pdwOutVersion = 1;
ValidateDRSInput(hDrs, 23)
pdwOutVersion^ := 1
pmsgOut^.V1.dwStatusFlags := 0
pmsgOut^.V1.cNumGuids := 0
pmsgOut^.V1.rgGuids := null
276 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgOut.dwStatusFlags := 1
msgOut.cNumGuids := 0
msgOut.rgGuids := null
else if
msgOut.dwStatusFlags := 0
msgOut.cNumGuids := s.length
for i := 0 to s.length - 1
msgOut.rgGuids[i] := s[i]
endfor
endif
pmsgOut^.V1 := msgOut
return 0
Informative summary of behavior: If the server response contains dwStatusFlags = 0, the client
computes the difference between the client and the server sequences and takes whatever action is
required.
ULONG IDL_DRSGetReplInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETREPLINFO_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETREPLINFO_REPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.13.1.1 DRS_MSG_GETREPLINFO_REQ
The DRS_MSG_GETREPLINFO_REQ union defines the request message versions sent to the
IDL_DRSGetReplInfo method.
277 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_GETREPLINFO_REQ_V1 V1;
[case(2)]
DRS_MSG_GETREPLINFO_REQ_V2 V2;
} DRS_MSG_GETREPLINFO_REQ;
V2: Version 2 request. The V2 request structure is a superset of the V1 request structure.
4.1.13.1.2 DRS_MSG_GETREPLINFO_REQ_V1
typedef struct {
DWORD InfoType;
[string] LPWSTR pszObjectDN;
UUID uuidSourceDsaObjGuid;
} DRS_MSG_GETREPLINFO_REQ_V1;
pszObjectDN: DN of the object on which the operation is to be performed. The meaning of this
parameter depends on the value of the InfoType parameter.
4.1.13.1.3 DRS_MSG_GETREPLINFO_REQ_V2
typedef struct {
DWORD InfoType;
[string] LPWSTR pszObjectDN;
UUID uuidSourceDsaObjGuid;
DWORD ulFlags;
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszValueDN;
DWORD dwEnumerationContext;
} DRS_MSG_GETREPLINFO_REQ_V2;
pszObjectDN: DN of the object on which the operation is to be performed. The meaning of this
parameter depends on the value of the InfoType parameter.
ulFlags: Zero or more of the following bit flags, which are presented in little-endian byte order.
278 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X X M X X X X X X X X X X X X X X X X X X X X X X X X
T
pszValueDN: Null, or the DN of the link value for which to retrieve a stamp.
DS_REPL_INFO codes indicate the type of replication state information being requested.
Value Meaning
DS_REPL_INFO_NEIGHBORS Replication state data for each NC and source server pair, for
0x00000000 all NC replicas hosted by this DC.
DS_REPL_INFO_METADATA_2_FOR_OBJ Stamps for all the replicated attributes of the given object.
0x00000009
279 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value Meaning
4.1.13.1.5 DRS_MSG_GETREPLINFO_REPLY
typedef
[switch_type(DWORD)]
union {
[case(0)]
DS_REPL_NEIGHBORSW* pNeighbors;
[case(1)]
DS_REPL_CURSORS* pCursors;
[case(2)]
DS_REPL_OBJ_META_DATA* pObjMetaData;
[case(3)]
DS_REPL_KCC_DSA_FAILURESW* pConnectFailures;
[case(4)]
DS_REPL_KCC_DSA_FAILURESW* pLinkFailures;
[case(5)]
DS_REPL_PENDING_OPSW* pPendingOps;
[case(6)]
DS_REPL_ATTR_VALUE_META_DATA* pAttrValueMetaData;
[case(7)]
DS_REPL_CURSORS_2* pCursors2;
[case(8)]
DS_REPL_CURSORS_3W* pCursors3;
[case(9)]
DS_REPL_OBJ_META_DATA_2* pObjMetaData2;
[case(10)]
DS_REPL_ATTR_VALUE_META_DATA_2* pAttrValueMetaData2;
[case(0xFFFFFFFA)]
DS_REPL_SERVER_OUTGOING_CALLS* pServerOutgoingCalls;
[case(0xFFFFFFFB)]
UPTODATE_VECTOR_V1_EXT* pUpToDateVec;
[case(0xFFFFFFFC)]
DS_REPL_CLIENT_CONTEXTS* pClientContexts;
[case(0xFFFFFFFE)]
DS_REPL_NEIGHBORSW* pRepsTo;
} DRS_MSG_GETREPLINFO_REPLY;
280 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pConnectFailures: Connection failure data.
4.1.13.1.6 DS_REPL_NEIGHBORSW
typedef struct {
DWORD cNumNeighbors;
DWORD dwReserved;
[size_is(cNumNeighbors)] DS_REPL_NEIGHBORW rgNeighbor[];
} DS_REPL_NEIGHBORSW;
4.1.13.1.7 DS_REPL_NEIGHBORW
typedef struct {
[string] LPWSTR pszNamingContext;
[string] LPWSTR pszSourceDsaDN;
[string] LPWSTR pszSourceDsaAddress;
[string] LPWSTR pszAsyncIntersiteTransportDN;
DWORD dwReplicaFlags;
DWORD dwReserved;
UUID uuidNamingContextObjGuid;
UUID uuidSourceDsaObjGuid;
UUID uuidSourceDsaInvocationID;
UUID uuidAsyncIntersiteTransportObjGuid;
USN usnLastObjChangeSynced;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
FILETIME ftimeLastSyncAttempt;
DWORD dwLastSyncResult;
281 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DWORD cNumConsecutiveSyncFailures;
} DS_REPL_NEIGHBORW;
ftimeLastSyncSuccess: The time of the last successful replication from the server DC.
ftimeLastSyncAttempt: The time of the last attempt to replicate from the server DC.
4.1.13.1.8 DS_REPL_CURSORS
The DS_REPL_CURSORS structure defines a set of replication cursors for a given NC replica. This
structure is a concrete representation of a sequence of ReplUpToDateVector values.
typedef struct {
DWORD cNumCursors;
DWORD dwReserved;
[size_is(cNumCursors)] DS_REPL_CURSOR rgCursor[];
} DS_REPL_CURSORS;
4.1.13.1.9 DS_REPL_CURSOR
282 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DS_REPL_CURSOR structure defines a replication cursor for a given NC replica. This structure is
a concrete representation of a ReplUpToDateVector value.
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
} DS_REPL_CURSOR;
usnAttributeFilter: The update sequence number (USN) at which an update was applied on the
DC.
4.1.13.1.10 DS_REPL_CURSORS_2
The DS_REPL_CURSORS_2 structure defines a set of replication cursors for a given NC replica. This
structure is a concrete representation of a sequence of ReplUpToDateVector values; it is a superset of
DS_REPL_CURSORS.
typedef struct {
DWORD cNumCursors;
DWORD dwEnumerationContext;
[size_is(cNumCursors)] DS_REPL_CURSOR_2 rgCursor[];
} DS_REPL_CURSORS_2;
4.1.13.1.11 DS_REPL_CURSOR_2
The DS_REPL_CURSOR_2 structure defines a replication cursor for a given NC replica. This
structure is a concrete representation of a ReplUpToDateVector value; it is a superset of
DS_REPL_CURSOR.
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
} DS_REPL_CURSOR_2;
ftimeLastSyncSuccess: The time at which the last successful replication occurred from the DC
identified by uuidDsa. Used for replication latency reporting only.
4.1.13.1.12 DS_REPL_CURSORS_3W
The DS_REPL_CURSORS_3W structure defines a replication cursor for a given NC replica. This
structure is a concrete representation of a sequence of ReplUpToDateVector values; it is a superset of
DS_REPL_CURSORS_2.
283 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
DWORD cNumCursors;
DWORD dwEnumerationContext;
[size_is(cNumCursors)] DS_REPL_CURSOR_3W rgCursor[];
} DS_REPL_CURSORS_3W;
4.1.13.1.13 DS_REPL_CURSOR_3W
The DS_REPL_CURSOR_3W structure defines a replication cursor for a given NC replica. This
structure is a concrete representation of a ReplUpToDateVector value; it is a superset of
DS_REPL_CURSOR_2.
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
[string] LPWSTR pszSourceDsaDN;
} DS_REPL_CURSOR_3W;
ftimeLastSyncSuccess: The time at which the last successful replication occurred from the DC
identified by uuidDsa. Used for replication latency reporting only.
4.1.13.1.14 DS_REPL_OBJ_META_DATA
The DS_REPL_OBJ_META_DATA structure defines a set of attribute stamps for a given object. This
structure is a concrete representation of the sequence of AttributeStamp values for all attributes of a
given object.
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_ATTR_META_DATA rgMetaData[];
} DS_REPL_OBJ_META_DATA;
4.1.13.1.15 DS_REPL_ATTR_META_DATA
284 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DS_REPL_ATTR_META_DATA structure defines an attribute stamp for a given object. This
structure is a concrete representation of an AttributeStamp.
typedef struct {
[string] LPWSTR pszAttributeName;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
} DS_REPL_ATTR_META_DATA;
ftimeLastOriginatingChange: The date and time at which the last originating update was made.
usnOriginatingChange: The USN assigned to the last originating update by the DC that performed
it.
4.1.13.1.16 DS_REPL_OBJ_META_DATA_2
The DS_REPL_OBJ_META_DATA_2 structure defines a set of attribute stamps for a given object.
This structure is a concrete representation of the sequence of AttributeStamp values for all attributes
of a given object; it is a superset of DS_REPL_OBJ_META_DATA.
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_ATTR_META_DATA_2 rgMetaData[];
} DS_REPL_OBJ_META_DATA_2;
4.1.13.1.17 DS_REPL_ATTR_META_DATA_2
The DS_REPL_ATTR_META_DATA_2 structure defines an attribute stamp for a given object. This
structure is a concrete representation of an AttributeStamp; it is a superset of
DS_REPL_ATTR_META_DATA.
typedef struct {
[string] LPWSTR pszAttributeName;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
[string] LPWSTR pszLastOriginatingDsaDN;
} DS_REPL_ATTR_META_DATA_2;
285 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pszAttributeName: The lDAPDisplayName of the attribute to which the stamp corresponds.
ftimeLastOriginatingChange: The date and time at which the last originating update was made.
usnOriginatingChange: The USN assigned to the last originating update by the DC that performed
it.
4.1.13.1.18 DS_REPL_KCC_DSA_FAILURESW
The DS_REPL_KCC_DSA_FAILURESW structure defines a set of DCs that are in an error state with
respect to replication. This structure is a concrete representation of KCCFailedConnections and
KCCFailedLinks.
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_KCC_DSA_FAILUREW rgDsaFailure[];
} DS_REPL_KCC_DSA_FAILURESW;
4.1.13.1.19 DS_REPL_KCC_DSA_FAILUREW
typedef struct {
[string] LPWSTR pszDsaDN;
UUID uuidDsaObjGuid;
FILETIME ftimeFirstFailure;
DWORD cNumFailures;
DWORD dwLastResult;
} DS_REPL_KCC_DSA_FAILUREW;
ftimeFirstFailure: The date and time at which the DC entered an error state.
dwLastResult: The Windows error code, as specified in [MS-ERREF] section 2.2, for the last error.
286 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.13.1.20 DS_REPL_PENDING_OPSW
typedef struct {
FILETIME ftimeCurrentOpStarted;
DWORD cNumPendingOps;
[size_is(cNumPendingOps)] DS_REPL_OPW rgPendingOp[];
} DS_REPL_PENDING_OPSW;
4.1.13.1.21 DS_REPL_OPW
The DS_REPL_OPW structure defines a replication operation to be processed by a DC. This structure
is a concrete representation of a tuple in a ReplicationQueue sequence.
typedef struct {
FILETIME ftimeEnqueued;
ULONG ulSerialNumber;
ULONG ulPriority;
DS_REPL_OP_TYPE OpType;
ULONG ulOptions;
[string] LPWSTR pszNamingContext;
[string] LPWSTR pszDsaDN;
[string] LPWSTR pszDsaAddress;
UUID uuidNamingContextObjGuid;
UUID uuidDsaObjGuid;
} DS_REPL_OPW;
ftimeEnqueued: The date and time at which the operation was requested.
ulPriority: A ULONG specifying the priority value of this operation. Tasks with a higher priority value
are executed first. The priority is calculated by the server based on the type of operation and its
parameters.
4.1.13.1.22 DS_REPL_ATTR_VALUE_META_DATA
287 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DS_REPL_ATTR_VALUE_META_DATA structure defines a sequence of link value stamps. This
structure is a concrete representation of a sequence of LinkValueStamp values.
typedef struct {
DWORD cNumEntries;
DWORD dwEnumerationContext;
[size_is(cNumEntries)] DS_REPL_VALUE_META_DATA rgMetaData[];
} DS_REPL_ATTR_VALUE_META_DATA;
4.1.13.1.23 DS_REPL_VALUE_META_DATA
The DS_REPL_VALUE_META_DATA structure defines a link value stamp. This structure is a concrete
representation of a LinkValueStamp.
typedef struct {
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszObjectDn;
DWORD cbData;
[size_is(cbData), ptr] BYTE* pbData;
FILETIME ftimeDeleted;
FILETIME ftimeCreated;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
} DS_REPL_VALUE_META_DATA;
pbData: The binary_value portion of the attribute value if the attribute is of syntax Object(DN-
Binary), or the string_value portion of the attribute value if the attribute is of syntax Object(DN-
String); null otherwise.
ftimeDeleted: The date and time at which the last replicated update was made that deleted the
value, or 0 if the value is not currently deleted.
ftimeCreated: The date and time at which the first originating update was made.
ftimeLastOriginatingChange: The date and time at which the last originating update was made.
usnOriginatingChange: The USN assigned to the last originating update by the DC that performed
the update.
288 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
usnLocalChange: An implementation-specific value.
4.1.13.1.24 DS_REPL_ATTR_VALUE_META_DATA_2
typedef struct {
DWORD cNumEntries;
DWORD dwEnumerationContext;
[size_is(cNumEntries)] DS_REPL_VALUE_META_DATA_2 rgMetaData[];
} DS_REPL_ATTR_VALUE_META_DATA_2;
4.1.13.1.25 DS_REPL_VALUE_META_DATA_2
typedef struct {
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszObjectDn;
DWORD cbData;
[size_is(cbData), ptr] BYTE* pbData;
FILETIME ftimeDeleted;
FILETIME ftimeCreated;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
[string] LPWSTR pszLastOriginatingDsaDN;
} DS_REPL_VALUE_META_DATA_2;
pbData: The binary_value portion of the attribute value if the attribute is of syntax Object(DN-
Binary), or the string_value portion of the attribute value if the attribute is of syntax Object(DN-
String); null otherwise.
ftimeDeleted: The date and time at which the last replicated update was made that deleted the
value, or 0 if the value is not currently deleted.
ftimeCreated: The date and time at which the first originating update was made.
ftimeLastOriginatingChange: The date and time at which the last originating update was made.
289 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
uuidLastOriginatingDsaInvocationID: The invocation ID of the DC that performed the last
originating update.
usnOriginatingChange: The USN assigned to the last originating update by the DC that performed
the update.
4.1.13.1.26 DS_REPL_CLIENT_CONTEXTS
The DS_REPL_CLIENT_CONTEXTS structure defines a set of active RPC client connections. This
structure is a concrete representation of RPCClientContexts.
typedef struct {
[range(0,10000)] DWORD cNumContexts;
DWORD dwReserved;
[size_is(cNumContexts)] DS_REPL_CLIENT_CONTEXT rgContext[];
} DS_REPL_CLIENT_CONTEXTS;
4.1.13.1.27 DS_REPL_CLIENT_CONTEXT
The DS_REPL_CLIENT_CONTEXT structure defines an active RPC client connection. This structure is a
concrete representation of a tuple in an RPCClientContexts sequence.
typedef struct {
ULONGLONG hCtx;
LONG lReferenceCount;
BOOL fIsBound;
UUID uuidClient;
DSTIME timeLastUsed;
ULONG IPAddr;
int pid;
} DS_REPL_CLIENT_CONTEXT;
fIsBound: True if and only if the context has not yet been closed by the IDL_DRSUnbind method.
timeLastUsed: The date and time at which this context was last used in an RPC method call.
IPAddr: The IPv4 address of the client. If the client is connected with IPv6, this field MUST be 0.
pid: The process ID specified by the client in the pextClient parameter to IDL_DRSBind.
4.1.13.1.28 DS_REPL_SERVER_OUTGOING_CALLS
290 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DS_REPL_SERVER_OUTGOING_CALLS structure defines a set of outstanding requests from this
DC to other DCs. This structure is a concrete representation of RPCOutgoingContexts.
typedef struct {
[range(0,256)] DWORD cNumCalls;
DWORD dwReserved;
[size_is(cNumCalls)] DS_REPL_SERVER_OUTGOING_CALL rgCall[];
} DS_REPL_SERVER_OUTGOING_CALLS;
4.1.13.1.29 DS_REPL_SERVER_OUTGOING_CALL
typedef struct {
[string] LPWSTR pszServerName;
BOOL fIsHandleBound;
BOOL fIsHandleFromCache;
BOOL fIsHandleInCache;
DWORD dwThreadId;
DWORD dwBindingTimeoutMins;
DSTIME dstimeCreated;
DWORD dwCallType;
} DS_REPL_SERVER_OUTGOING_CALL;
fIsHandleBound: True if and only if the IDL_DRSBind method has completed and the
IDL_DRSUnbind method has not yet been called.
fIsHandleFromCache: True if and only if the context handle used was retrieved from the cache.
fIsHandleInCache: True if and only if the context handle is still in the cache.
dstimeCreated: The date and time when the context was created.
dwCallType: The call that the client is waiting on. MUST be one of the values in the following table.
Value Meaning
2 IDL_DRSBind
3 IDL_DRSUnbind
4 IDL_DRSReplicaSync
5 IDL_DRSGetNCChanges
6 IDL_DRSUpdateRefs
291 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Value Meaning
7 IDL_DRSReplicaAdd
8 IDL_DRSReplicaDel
9 IDL_DRSVerifyNames
10 IDL_DRSGetMemberships
11 IDL_DRSInterDomainMove
12 IDL_DRSGetNT4ChangeLog
13 IDL_DRSCrackNames
14 IDL_DRSAddEntry
15 IDL_DRSGetMemberships2
16 IDL_DRSGetObjectExistence
17 IDL_DRSGetReplInfo
18 IDL_DRSWriteSPN
4.1.13.2.1 GetDNFromInvocationID
procedure GetDNFromInvocationID(invocationID: GUID): DN
Returns the DN of the nTDSDSA object that has the specified invocation ID. If there is no such
nTDSDSA object, the results are unconstrained and the resulting behavior of protocol elements that
use this returned DN are also unconstrained.
4.1.13.2.2 GetDNFromObjectGuid
procedure GetDNFromObjectGuid(guid: GUID): DN
Returns the DN of the object with the specified object GUID. This is represented by the following
expression.
4.1.13.2.3 GetNCs
procedure GetNCs(): set of DSName
Returns a set containing the DSNames of all NCs hosted by this server.
4.1.13.2.4 GetUpToDatenessVector
292 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure GetUpToDatenessVector(nc: DSName): sequence of ReplUpToDateVector
Returns a sequence of ReplUpToDateVector (section 5.166), sorted in ascending order by the uuidDsa
field. The entries are retrieved from nc!replUpToDateVector plus an additional entry with uuidDsa set
to the invocation ID of this server, usnHighPropUpdate set to rootDSE!highestCommittedUSN, and
timeLastSyncSuccess set to the current time.
Informative summary of behavior: This method retrieves the replication state information of a DC.
Based on the value of the InfoType field in the request message, different information is returned,
which is summarized in the definition of DS_REPL_INFO in section 4.1.13.1.4.
ULONG
IDL_DRSGetReplInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETREPLINFO_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETREPLINFO_REPLY *pmsgOut)
msgIn: DRS_MSG_GETREPLINFO_REQ_V2
infoType: DWORD
fAccessGranted: boolean
infoTypeValid: boolean
defaultNC: DSName
object: DSName
enumerationContext: DWORD
baseIndex: DWORD
endIndex: DWORD
ncs: set of DSName
nc: DSName
i, j: DWORD
r: RepsFrom
q: RepsTo
pNeighbor: ADDRESS OF DS_REPL_NEIGHBORW
utd: sequence of ReplUpToDateVector
pCursor: ADDRESS OF DS_REPL_CURSOR
pCursor2: ADDRESS OF DS_REPL_CURSOR_2
pCursor3: ADDRESS OF DS_REPL_CURSOR_3W
a: ATTRTYP
attr: ATTRTYP
attrs: set of ATTRTYP
attrsSeq: sequence of ATTRTYP
s: AttributeStamp
stamp: LinkValueStamp
pObjMetaData: ADDRESS OF DS_REPL_OBJ_META_DATA
pObjMetaData2: ADDRESS OF DS_REPL_OBJ_META_DATA_2
values: set of attribute value
valuesSeq: sequence of attribute value
ls: LinkValueStamp
pAttrValueMetaData: ADDRESS OF DS_REPL_ATTR_VALUE_META_DATA
pAttrValueMetaData2: ADDRESS OF DS_REPL_ATTR_VALUE_META_DATA_2
pFailedConnection: ADDRESS OF DS_REPL_KCC_DSA_FAILUREW
pFailedLink: ADDRESS OF DS_REPL_KCC_DSA_FAILUREW
pPendingOp: ADDRESS OF DS_REPL_OPW
pClientContext: ADDRESS OF DS_REPL_CLIENT_CONTEXT
pOutgoingContext: ADDRESS OF DS_REPL_SERVER_OUTGOING_CALL
v: attribute value
ValidateDRSInput(hDrs, 19)
if dwInVersion = 1 then
293 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
infoType = pmsgIn^ V1.InfoType
else
infoType = pmsgIn^ V2.InfoType
endif
pdwOutVersion^ := infoType
if dwInVersion = 1 then
msgIn := pmsgIn^.V1
else
msgIn := pmsgIn^.V2
endif
294 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (infoType = DS_REPL_INFO_NEIGHBORS and object ≠ null) then
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(object, repsFrom, RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(object, DS-Replication-Manage-Topology) or
AccessCheckCAR(object, DS-Replication-Monitor-Topology)
endif
if (infoType = DS_REPL_INFO_NEIGHBORS and object = null) then
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(defaultNC, repsFrom, RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(defaultNC, DS-Replication-Manage-Topology) or
AccessCheckCAR(defaultNC, DS-Replication-Monitor-Topology)
endif
if (infoType = DS_REPL_INFO_REPSTO and object ≠ null) then
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(object, repsTo, RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(object, DS-Replication-Manage-Topology) or
AccessCheckCAR(object, DS-Replication-Monitor-Topology)
endif
if (infoType = DS_REPL_INFO_REPSTO and object = null) then
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(defaultNC, repsTo, RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(defaultNC, DS-Replication-Manage-Topology) or
AccessCheckCAR(defaultNC, DS-Replication-Monitor-Topology)
endif
if (infoType in {DS_REPL_INFO_CURSORS_FOR_NC,
DS_REPL_INFO_CURSORS_2_FOR_NC,
DS_REPL_INFO_CURSORS_3_FOR_NC,
DS_REPL_INFO_UPTODATE_VECTOR_V1} and
object ≠ null) then
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(
object, replUpToDateVector, RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(object, DS-Replication-Manage-Topology) or
AccessCheckCAR(object, DS-Replication-Monitor-Topology)
endif
if infoType in {DS_REPL_INFO_METADATA_FOR_OBJ,
DS_REPL_INFO_METADATA_2_FOR_OBJ,
DS_REPL_INFO_METADATA_FOR_ATTR_VALUE,
DS_REPL_INFO_METATDATA_2_FOR_ATTR_VALUE} then
if object = null then
return ERROR_INVALID_PARAMETER
endif
if not ObjExists(object) then
if object.dn = null then
return ERROR_DS_DRA_BAD_DN
else
return ERROR_DS_OBJ_NOT_FOUND
endif
endif
infoTypeValid := true
fAccessGranted :=
AccessCheckAttr(object,
replPropertyMetaData,
RIGHT_DS_READ_PROPERTY) or
AccessCheckCAR(object, DS-Replication-Manage-Topology) or
AccessCheckCAR(object, DS-Replication-Monitor-Topology)
endif
if infoType in {DS_REPL_INFO_PENDING_OPS,
DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES,
DS_REPL_INFO_KCC_DSA_LINK_FAILURES,
DS_REPL_INFO_CLIENT_CONTEXTS,
DS_REPL_INFO_SERVER_OUTGOING_CALLS} then
infoTypeValid := true
fAccessGranted :=
295 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
AccessCheckCAR(defaultNC, DS-Replication-Manage-Topology) or
AccessCheckCAR(defaultNC, DS-Replication-Monitor-Topology)
endif
/* DS_REPL_INFO_NEIGHBORS/DS_REPL_INFO_REPSTO */
if infoType in {DS_REPL_INFO_NEIGHBORS, DS_REPL_INFO_REPSTO}
/* If an object is specified, it must be an NC root. */
nc := object
if nc ≠ null then
ncs := {nc}
else
ncs := GetNCs()
endif
296 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
* are preserved in pNeighbor^.dwReplicaFlags.
* See section 5.169 repsFrom, RepsFrom for more info. */
pNeighbor^.dwReplicaFlags := {}
foreach flag in { DRS_WRIT_REP,
DRS_INIT_SYNC,
DRS_PER_SYNC,
DRS_MAIL_REP,
DRS_DISABLE_AUTO_SYNC,
DRS_DISABLE_PERIODIC_SYNC,
DRS_USE_COMPRESSION,
DRS_TWOWAY_SYNC,
DRS_NONGC_RO_REP,
DRS_FULL_SYNC_IN_PROGRESS,
DRS_FULL_SYNC_PACKET,
DRS_REF_GCSPN,
DRS_NEVER_SYNCED,
DRS_SPECIAL_SECRET_PROCESSING,
DRS_PREEMPTED,
DRS_NEVER_NOTIFY,
DRS_SYNC_PAS}
if flag in r.options then
pNeighbor^.dwReplicaFlags := pNeighbor^.dwReplicaFlags + flag
endif
endfor
j := j + 1
endif
i := i + 1
endif
endfor
endfor
pmsgOut^.pNeighbors^.cNumNeighbors := j
else
/* DS_REPL_INFO_REPSTO case. */
i := 0
j := 0
foreach nc in ncs
foreach q in nc!repsTo
/* The ordering of ncs hosted by the server and the values of
* repsTo for each nc is arbitrary but consistent from call
* to call on a server. */
if i >= baseIndex then
pNeighbor := ADR(pmsgOut^.pRepsTo^.rgNeighbor[j])
pNeighbor^.pszSourceDsaAddress := q.naDsa
pNeighbor^.ftimeLastSyncSuccess := q.timeLastSuccess
pNeighbor^.ftimeLastSyncAttempt := q.timeLastAttempt
pNeighbor^.dwLastSyncResult := q.ulResultLastAttempt
pNeighbor^.cNumConsecutiveSyncFailures :=
q.cConsecutiveFailures
pNeighbor^.uuidSourceDsaObjGuid := q.uuidDsa
pNeighbor^.pszSourceDsaDN := GetDNFromObjectGuid(q.uuidDsa)
pNeighbor^.pszNamingContext := nc!distinguishedName
/* If a naming context is specified in the request,
* the uuidNamingContextObjGuid field of the response
* is set to the NULL GUID. */
if object ≠ null then
pNeighbor^.uuidNamingContextObjGuid := NULLGUID
else
pNeighbor^.uuidNamingContextObjGuid := nc!objectGUID
endif
/* Only a subset of the possible DRS_OPTIONS in q.options
* are preserved in pNeighbor^.dwReplicaFlags.
* See section 5.170 repsTo, RepsTo for more info. */
pNeighbor^.dwReplicaFlags := {}
foreach flag in { DRS_WRIT_REP,
DRS_INIT_SYNC,
DRS_PER_SYNC,
DRS_MAIL_REP,
DRS_DISABLE_AUTO_SYNC,
DRS_DISABLE_PERIODIC_SYNC,
297 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_USE_COMPRESSION,
DRS_TWOWAY_SYNC,
DRS_NONGC_RO_REP,
DRS_FULL_SYNC_IN_PROGRESS,
DRS_FULL_SYNC_PACKET,
DRS_REF_GCSPN,
DRS_NEVER_SYNCED,
DRS_SPECIAL_SECRET_PROCESSING,
DRS_PREEMPTED,
DRS_NEVER_NOTIFY,
DRS_SYNC_PAS}
if flag in q.options then
pNeighbor^.dwReplicaFlags := pNeighbor^.dwReplicaFlags + flag
endif
endfor
j := j + 1
endif
i := i + 1
endfor
endfor
pmsgOut^.pRepsTo^.cNumNeighbors := j
endif
endif
/* DS_REPL_INFO_METADATA_FOR_OBJ/DS_REPL_INFO_METADATA_2_FOR_OBJ */
if infoType in {DS_REPL_INFO_METADATA_FOR_OBJ,
DS_REPL_INFO_METADATA_2_FOR_OBJ) then
if (IsForwardLinkAttribute(attr) and
dwInVersion = 2 and
DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS in msgIn.ulFlags)
then
ls := null
foreach v in GetAttrVals(object, attr, true)
stamp := LinkStamp(object, attr, v)
/* If v was last updated in win2k forest mode
* then it does not have LinkValueStamp associated with it.
* LinkStamp() returns null in that case. */
if stamp ≠ null and LinkValueStampCompare(stamp, ls) > 0 then
ls := stamp;
endif
endfor
if s = null then
s := 0 /* An AttributeStamp with 0 for all fields. */
endif
if s ≠ null then
if i >= baseIndex
if infoType = DS_REPL_INFO_METADATA_FOR_OBJ then
pObjMetaData := ADR(pmsgOut^.pObjMetaData^.rgMetaData[j])
pObjMetaData^.pszAttributeName := attr
pObjMetaData^.dwVersion := s.dwVersion
pObjMetaData^.ftimeLastOriginatingChange := s.timeChanged
pObjMetaData^.uuidLastOriginatingDsaInvocationID :=
298 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
s.uuidOriginating
pObjMetaData^.usnOriginatingChange := s.usnOriginating
pObjMetaData^.usnLocalChange :=
An implementation-specific value that the server
maintains for replicated attributes
else
pObjMetaData2 := ADR(pmsgOut^.pObjMetaData2^.rgMetaData[j])
pObjMetaData2^.pszAttributeName := attr
pObjMetaData2^.dwVersion := s.dwVersion
pObjMetaData2^.ftimeLastOriginatingChange := s.timeChanged
pObjMetaData2^.uuidLastOriginatingDsaInvocationID :=
s.uuidOriginating
pObjMetaData2^.usnOriginatingChange := s.usnOriginating
pObjMetaData2^.usnLocalChange :=
An implementation-specific value that the server
maintains for replicated attributes
pObjMetaData2^.pszLastOriginatingDsaDN :=
GetDNFromInvocationID(s.uuidOriginating)
endif
j := j + 1
endif
i := i + 1
endif
endwhile
if infoType = DS_REPL_INFO_METADATA_FOR_OBJ then
pmsgOut^.pObjMetaData^.cNumEntries = j
else
pmsgOut^.pObjMetaData2^.cNumEntries = j
endif
endif
/* DS_REPL_INFO_CURSORS_FOR_NC */
if infoType = DS_REPL_INFO_CURSORS_FOR_NC then
/* Parameter validation */
if nc = null then
return ERROR_INVALID_PARAMETER
endif
utd := GetUpToDatenessVector(nc)
i := baseIndex
j := 0
while i < utd.length
pCursor := ADR(pmsgOut^.pCursors^.rgCursor[j])
pCursor^.uuidSourceDsaInvocationID := utd[i].uuidDsa
pCursor^.usnAttributeFilter := utd[i].usnHighPropUpdate
i := i + 1
j := j + 1
endwhile
pmsgOut^.pCursors^.cNumCursors := j
endif
/* DS_REPL_INFO_CURSORS_2_FOR_NC/ DS_REPL_INFO_CURSORS_3_FOR_NC */
if infoType in {DS_REPL_INFO_CURSORS_2_FOR_NC,
DS_REPL_INFO_CURSORS_3_FOR_NC} then
/* Parameter validation. */
299 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (nc = null) then
return ERROR_INVALID_PARAMETER
endif
i := baseIndex
j := 0
utd := GetUpToDatenessVector(nc)
/* DS_REPL_INFO_UPTODATE_VECTOR_V1 */
if infoType = DS_REPL_INFO_UPTODATE_VECTOR_V1 then
/* Parameter validation. */
300 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (nc = null) then
return ERROR_INVALID_PARAMETER
endif
utd := GetUpToDatenessVector(nc)
for i := 0 to utd.length - 1
pCursor := ADR(pmsgOut^.pUpToDateVec^.rgCursors[i])
pCursor^.uuidSourceDsaInvocationID := utd[i].uuidDsa
pCursor^.usnAttributeFilter := utd[i].usnHighPropUpdate
endfor
pmsgOut^.pUpToDateVec^.cNumCursors := utd.length
endif
/* DS_REPL_INFO_METADATA_FOR_ATTR_VALUE/
* DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE */
if infoType in {DS_REPL_INFO_METADATA_FOR_ATTR_VALUE,
DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE} then
j := 0
while (i < valuesSeq.length and j < 1000)
ls := LinkStamp(object, attr, valuesSeq[i])
if infoType = DS_REPL_INFO_METADATA_FOR_ATTR_VALUE then
pAttrValueMetaData :=
ADR(pmsgOut^.pAttrValueMetaData^.rgMetadata[j])
pAttrValueMetaData^.pszAttributeName := attr
pAttrValueMetaData^.pszObjectDN := object!distinguishedName
if (Syntax(attr) = Object(DN-Binary) or
Syntax(attr) = Object(DN-String)) then
pAttrValueMetaData^.cbData :=
length of data associated with valuesSeq[i]
pAttrValueMetaData^.pbData := data associated with
valuesSeq[i]
endif
pAttrValueMetaData^.ftimeCreated := ls.timeCreated
pAttrValueMetaData^.ftimeDeleted := ls.timeDeleted
pAttrValueMetaData^.dwVersion := ls.dwVersion
301 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pAttrValueMetaData^.ftimeLastOriginatingChange :=
ls.timeChanged
pAttrValueMetaData^.uuidLastOriginatingDsaInvocationID :=
ls.uuidOriginating
pAttrValueMetaData^.usnOriginatingChange := ls.usnOriginating
pAttrValueMetaData^.usnLocalChange :=
implementation-specific value maintained for each link
attribute value
else
pAttrValueMetaData2 :=
ADR(pmsgOut^.pAttrValueMetaData2^.rgMetadata[j])
pAttrValueMetaData2^.pszAttributeName := attr
pAttrValueMetaData2^.pszObjectDN := object!distinguishedName
if (Syntax(attr) = Object(DN-Binary) or
Syntax(attr) = Object(DN-String)) then
pAttrValueMetaData2^.cbData :=
length of data associated with valuesSeq[i]
pAttrValueMetaData2^.pbData :=
data associated with valuesSeq[i]
endif
pAttrValueMetaData2^.ftimeCreated := ls.timeCreated
pAttrValueMetaData2^.ftimeDeleted := ls.timeDeleted
pAttrValueMetaData2^.dwVersion := ls.dwVersion
pAttrValueMetaData2^.ftimeLastOriginatingChange :=
ls.timeChanged
pAttrValueMetaData2^.uuidLastOriginatingDsaInvocationID :=
ls.uuidOriginating
pAttrValueMetaData2^.usnOriginatingChange :=
ls.usnOriginating
pAttrValueMetaData2^.usnLocalChange :=
implementation-specific value maintained for each
link attribute value
pAttrValueMetaData2^.pszLastOriginatingDsaDN :=
GetDNFromInvocationID(ls.uuidOriginating)
endif
i := i + 1
j := j + 1
endwhile
/* DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES */
if infoType = DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES then
i := 0
302 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
foreach t in dc.kccFailedConnections
pConnectionFailure :=
ADR(pmsgOut^.pConnectionFailures^.rgDsaFailure[i])
pConnectionFailure^.pszDsaDN := t.DsaDN
pConnectionFailure^.uuidDsaObjGuid := t.UUIDDsa
pConnectionFailure^.fTimeFirstFailure := t.TimeFirstFailure
pConnectionFailure^.cNumFailures := t.FailureCount
pConnectionFailure^.dwLastResult := t.LastResult
i := i + 1
endfor
pmsgOut^.pConnectionFailures^.cNumEntries := i
endif
/* DS_REPL_INFO_KCC_DSA_LINK_FAILURES */
if infoType = DS_REPL_INFO_KCC_DSA_LINK_FAILURES then
i := 0
foreach t in dc.kccFailedLinks
pConnectionLink := ADR(pmsgOut^.pLinkFailures^.rgDsaFailure[i])
pConnectionLink^.pszDsaDN := t.DsaDN
pConnectionLink^.uuidDsaObjGuid := t.UUIDDsa
pConnectionLink^.fTimeFirstFailure := t.TimeFirstFailure
pConnectionLink^.cNumFailures := t.FailureCount
pConnectionLink^.dwLastResult := t.LastResult
i := i + 1
endfor
pmsgOut^.pConnectionLinks^.cNumEntries := i
endif
/* DS_REPL_INFO_PENDING_OPS */
if infoType = DS_REPL_INFO_PENDING_OPS then
i := 0
foreach t in dc.replicationQueue
pPendingOp := ADR(pmsgOut^.pPendingOps^.rgPendingOp[i])
pPendingOp^.fTimeEnqueued := t.TimeEnqueued
pPendingOp^.ulSerailNumber := t.SerialNumber
pPendingOp^.ulPriority := t.Priority
pPendingOp^.OpType := t.OperationType
pPendingOp^.ulOptions := t.Options
pPendingOp^.pszNamingContext := t.NamingContext
pPendingOp^.pszDsaDN := t.DsaDN
pPendingOp^.pszDsaAddress := t.DsaAddress
pPendingOp^.uuidNamingContextObjGuid := t.UUIDNC
pPendingOp^.uuidDsaObjGuid := t.UUIDDsa
i := i + 1
endfor
pmsgOut^.pPendingOps^.cNumPendingOps := i
pmsgOut^.pPendingOps^.fTimeCurrentOpStarted := time when current
operation was started
endif
/* DS_REPL_INFO_CLIENT_CONTEXTS */
if infoType = DS_REPL_INFO_CLIENT_CONTEXTS then
i := 0
foreach t in dc.rpcClientContexts
pClientContext := ADR(pmsgOut^.pClientContexts^.rgContext[i])
pClientContext^.hCtx := t.BindingContext
pClientContext^.lReferenceCount := t.RefCount
pClientContext^.fIsBound := t.IsBound
pClientContext^.uuidClient := t.UUIDClient
pClientContext^.timeLastUsed := t.TimeLastUsed
pClientContext^.IPAddr := t.IPAddress
pClientContext^.pid := t.PID
i := i + 1
endfor
pmsgOut^.pClientContexts^.cNumContexts := i
endif
/* DS_REPL_INFO_SERVER_OUTGOING_CALLS */
if infoType = DS_REPL_INFO_SERVER_OUTGOING_CALLS then
303 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
i := 0
foreach t in dc.rpcOutgoingContexts
pOutgoingContext =
ADR(pmsgOut^.pServerOutgoingCalls^.rgCall[i])
pOutgoingContext^.pszServerName := t.ServerName
pOutgoingContext^.fIsHandleBound := t.IsBound
pOutgoingContext^.fIsHandleFromCache := t.HandleFromCache
pOutgoingContext^.fIsHandleInCache := t.HandleInCache
pOutgoingContext^.dwThreadId := t.ThreadId
pOutgoingContext^.dwBindingTimeoutMins := t.BindingTimeOut
pOutgoingContext^.dstimeCreated := t.CreateTime
pOutgoingContext^.dwCallType := t.CallType
i := i + 1
endfor
pmsgOut^.pServerOutgoingCalls^.cNumCalls := i
endif
return 0
In this example, the domain administrator wants to see which source DCs DC1 receives replication
updates from for the domain NC CONTOSO.COM. The domain administrator does so by issuing a
request to DC1 with pszObjectDN set to the DN of the domain NC.
Getting 1 entry:
Dn: DC=contoso,DC=com
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
304 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
InfoType = DS_REPL_INFO_NEIGHBORS
pszObjectDN = "DC=contoso,DC=com"
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_NEIGHBORS
pmsgOut = DS_REPL_NEIGHBORSW
cNumNeighbors = 1
dwReserved = 0
rgNeighbor = DS_REPL_NEIGHBORW[]
rgNeighbor[0]
pszNamingContext = DC=contoso,dc=com
pszSourceDsaAddress = 12626d52-1da7-4a40-a490-
987c0880c3fe._msdcs.contoso.com
pszAsyncIntersiteTransportDN = (null)
dwReplicaFlags = 0x0
dwReserved = 0
uuidNamingContextObjGuid = 00000000-0000-0000-0000-000000000000
uuidSourceDsaObjGuid = 12626d52-1da7-4a40-a490-987c0880c3fe
uidSourceDsaInvocationID = 44a2959c-bb0d-4b2e-b106-fd8235288ee4
uuidAsyncIntersiteTransportObjGuid = 00000000-0000-0000-0000-000000000000
usnLastObjChangeSynced = 20002
usnAttributeFilter = 20002
ftimeLastSyncSuccess.dwLowDateTime = 0x4aaeb00
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2ad2
ftimeLastSyncAttempt.dwLowDateTime = 0x4aaeb00
ftimeLastSyncAttempt.dwHighDateTime = 0x1cb2ad2
305 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwLastSyncResult = 0
cNumConsecutiveSyncFailures = 0
The final state is the same as the initial state; there is no change.
In this example, the domain administrator wants to see the NCs for which DCA1 receives replication
updates from DC1. The domain administrator does so by issuing a request to DCA1 with
pszObjectDN set to null and uuidSourceDsaObjGuid set to the DSA GUID of DC1.
ldap_search_s("CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com", baseObject, "(objectClass=*)",
[objectClass, objectGUID])
Getting 1 entry:
Getting 1 entry:
ldap_search_s("CN=Schema,CN=Configuration,DC=contoso,DC=com", baseObject,
"(objectClass=*)", [objectClass, repsFrom])
306 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Getting 1 entry:
Getting 1 entry:
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DCA1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_NEIGHBORS
pszObjectDN = (null)
uuidSourceDsaObjGuid = 2e235fab-353c-46fc-8afd-437e9d0188b3
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
307 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.13.4.2.3 Server Response
pdwOutVersion = DS_REPL_INFO_NEIGHBORS
pmsgOut = DS_REPL_NEIGHBORSW
cNumNeighbors = 3
dwReserved = 0
rgNeighbor = DS_REPL_NEIGHBORW[]
rgNeighbor[0]
pszNamingContext = CN=Configuration,DC=contoso,DC=com
pszSourceDsaAddress = 2e235fab-353c-46fc-8afd-437e9d0188b3._msdcs.contoso.com
pszAsyncIntersiteTransportDN = (null)
dwReplicaFlags = 0x0
dwReserved = 0
uuidNamingContextObjGuid = 64f4ed75-28b1-42f3-b7c9-6ac234db9a9e
uuidSourceDsaObjGuid = 2e235fab-353c-46fc-8afd-437e9d0188b3
uidSourceDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
uuidAsyncIntersiteTransportObjGuid = 00000000-0000-0000-0000-000000000000
usnLastObjChangeSynced = 24523
usnAttributeFilter = 24523
ftimeLastSyncSuccess.dwLowDateTime = 0xf7e80900
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2de9
ftimeLastSyncAttempt.dwLowDateTime = 0xf7e80900
ftimeLastSyncAttempt.dwHighDateTime = 0x1cb2de9
dwLastSyncResult = 0
cNumConsecutiveSyncFailures = 0
rgNeighbor[1]
pszNamingContext = CN=Schema,CN=Configuration,DC=contoso,DC=com
pszSourceDsaAddress = 2e235fab-353c-46fc-8afd-437e9d0188b3._msdcs.contoso.com
pszAsyncIntersiteTransportDN = (null)
308 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwReplicaFlags = 0x0
dwReserved = 0
uuidNamingContextObjGuid = f3ba2060-2d67-43e6-a334-54a8f1ecc78a
uuidSourceDsaObjGuid = 2e235fab-353c-46fc-8afd-437e9d0188b3
uidSourceDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
uuidAsyncIntersiteTransportObjGuid = 00000000-0000-0000-0000-000000000000
usnLastObjChangeSynced = 24523
usnAttributeFilter = 24523
ftimeLastSyncSuccess.dwLowDateTime = 0xf7e80900
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2de9
ftimeLastSyncAttempt.dwLowDateTime = 0xf7e80900
ftimeLastSyncAttempt.dwHighDateTime = 0x1cb2de9
dwLastSyncResult = 0
cNumConsecutiveSyncFailures = 0
rgNeighbor[2]
pszNamingContext = DC=ForestDnsZones,DC=contoso,DC=com
pszSourceDsaAddress = 2e235fab-353c-46fc-8afd-437e9d0188b3._msdcs.contoso.com
pszAsyncIntersiteTransportDN = (null)
dwReplicaFlags = 0x0
dwReserved = 0
uuidNamingContextObjGuid = 7fafd728-d866-4cf3-915f-78ff680603d4
uuidSourceDsaObjGuid = 2e235fab-353c-46fc-8afd-437e9d0188b3
uidSourceDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
uuidAsyncIntersiteTransportObjGuid = 00000000-0000-0000-0000-000000000000
usnLastObjChangeSynced = 24523
usnAttributeFilter = 24523
ftimeLastSyncSuccess.dwLowDateTime = 0xf7e80900
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2de9
ftimeLastSyncAttempt.dwLowDateTime = 0xf7e80900
ftimeLastSyncAttempt.dwHighDateTime = 0x1cb2de9
309 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwLastSyncResult = 0
cNumConsecutiveSyncFailures = 0
The final state is the same as the initial state; there is no change.
In this example, the domain administrator verifies which DCs DC1 sends replication updates to for
the domain NC CONTOSO.COM. The domain administrator does this by issuing a request to DC1 with
pszObjectDN set to the DN of the domain NC.
Getting 1 entry:
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_REPSTO
pszObjectDN = DC=contoso,DC=com
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
310 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_REPSTO
pmsgOut = DS_REPL_NEIGHBORSW
cNumNeighbors = 1
dwReserved = 0
rgNeighbor = DS_REPL_NEIGHBORW[]
rgNeighbor[0]
pszNamingContext = DC=contoso,DC=com
pszSourceDsaAddress = 12626d52-1da7-4a40-a490-
987c0880c3fe._msdcs.contoso.com
pszAsyncIntersiteTransportDN = (null)
dwReplicaFlags = 0x0
dwReserved = 0
uuidNamingContextObjGuid = 00000000-0000-0000-0000-000000000000
uuidSourceDsaObjGuid = 12626d52-1da7-4a40-a490-987c0880c3fe
uidSourceDsaInvocationID = 00000000-0000-0000-0000-000000000000
uuidAsyncIntersiteTransportObjGuid = 00000000-0000-0000-0000-000000000000
usnLastObjChangeSynced = 0
usnAttributeFilter = 0
ftimeLastSyncSuccess.dwLowDateTime = 0x6a6bee00
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2ea9
ftimeLastSyncAttempt.dwLowDateTime = 0x6a6bee00
ftimeLastSyncAttempt.dwHighDateTime = 0x1cb2ea9
dwLastSyncResult = 0
cNumConsecutiveSyncFailures = 0
The final state is the same as the initial state; there is no change.
311 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
In this example, the domain administrator wants to view the replication state on DC2 relative to the
config NC CN=Configuration,DC=contoso,DC=com. The domain administrator does this by issuing a
request to DC1 with pszObjectDN set to the DN of the config NC.
ldap_search_s("CN=Configuration,DC=contoso,DC=com", baseObject,
"(objectClass=configuration)", [objectClass, replUpToDateVector])
Getting 1 entry:
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC2 with the following
parameters (DRS_HANDLE to DC2 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_CURSORS_3_FOR_NC
pszObjectDN = CN=Configuration,DC=contoso,dc=com
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_CURSORS_3_FOR_NC
pmsgOut = DS_REPL_CURSORS_3W
cNumCursors = 3
dwEnumerationContext = 0xffffffff
rgCursor = DS_REPL_CURSOR_3W[]
rgCursor[0]
312 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
usnAttributeFilter = 22378
uuidSourceDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
ftimeLastSyncSuccess.dwLowDateTime = 0x517f0380
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2d16
rgCursor[1]
usnAttributeFilter = 43601
uuidSourceDsaInvocationID = 44a2959c-bb0d-4b2e-b106-fd8235288ee4
ftimeLastSyncSuccess.dwLowDateTime = 0xaf135000
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2d16
rgCursor[2]
usnAttributeFilter = 18177
uuidSourceDsaInvocationID = e4dfc4c0-381c-48c9-a563-cb27db448753
ftimeLastSyncSuccess.dwLowDateTime = 0xa0c53400
ftimeLastSyncSuccess.dwHighDateTime = 0x1cb2d16
The final state is the same as the initial state; there is no change.
In this example, the domain administrator wants to view the replication state of the organizational
unit OU1 on DC1.
Getting 1 entry:
313 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> instanceType: 0x4 = ( WRITE );
1> name:OU1;
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC2 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_METADATA_2_FOR_OBJ
pszObjectDN = OU=OU1,DC=contoso,dc=com
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_METADATA_2_FOR_OBJ
pmsgOut = DS_REPL_OBJ_META_DATA_2
cNumEntries = 7
dwReserved = 0
rgMetaData = DS_REPL_ATTR_META_DATA_2[]
rgMetaData[0]
pszAttributeName = objectClass
314 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
rgMetaData[1]
pszAttributeName = ou
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
rgMetaData[2]
pszAttributeName = instanceType
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
rgMetaData[3]
pszAttributeName = whenCreated
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
315 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
rgMetaData[4]
pszAttributeName = nTSecurityDescriptor
dwVersion = 2
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25426
usnLocalChange = 25426
rgMetaData[5]
pszAttributeName = name
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
rgMetaData[6]
pszAttributeName = objectCategory
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x94270580
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e14
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25424
usnLocalChange = 25424
316 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pszLastOriginatingDsaDN = CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-
First-Site-Name,CN=Sites,CN=Configuration,DC=contoso,DC=com
The final state is the same as the initial state; there is no change.
In this example, the domain administrator requires viewing the replication state of the link value
attribute member of the group GroupB on DC2.
Getting 1 entry:
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC2 with the following
parameters (DRS_HANDLE to DC2 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE
pszObjectDN = CN=GroupB,CN=Users,DC=contoso,dc=com
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = member
pszValueDN = (null)
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE
317 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut = DS_REPL_ATTR_VALUE_META_DATA_2
cNumEntries = 3
dwEnumerationContext = 0xffffffff
rgMetaData = DS_REPL_VALUE_META_DATA_2[]
rgMetaData[0]
pszAttributeName = member
cbData = 0
pbData = null
ftimeDeleted.dwLowDateTime = 0x0
ftimeDeleted.dwHighDateTime = 0x0
ftimeCreated.dwLowDateTime = 0xc3a4dd80
ftimeCreated.dwHighDateTime = 0x1cb2ab5
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0xc3a4dd80
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2ab5
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 15399
usnLocalChange = 19212
rgMetaData[1]
pszAttributeName = member
pszObjectDn = CN=GroupA,CN=Users,DC=contoso,DC=com
cbData = 0
pbData = null
ftimeDeleted.dwLowDateTime = 0x0
ftimeDeleted.dwHighDateTime = 0x0
ftimeCreated.dwLowDateTime = 0x2fb77680
ftimeCreated.dwHighDateTime = 0x1cb2e13
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x2fb77680
318 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e13
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25384
usnLocalChange = 46509
rgMetaData[2]
pszAttributeName = member
pszObjectDn = CN=GroupC,CN=Users,DC=contoso,DC=com
cbData = 0
pbData = null
ftimeDeleted.dwLowDateTime = 0x0
ftimeDeleted.dwHighDateTime = 0x0
ftimeCreated.dwLowDateTime = 0x2fb77680
ftimeCreated.dwHighDateTime = 0x1cb2e13
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0x2fb77680
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2e13
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 25385
usnLocalChange = 46508
The final state is the same as the initial state; there is no change.
In this example, the domain administrator wants to view the replication state of link value
attribute member of the group GroupB on DC2. Specifically, the domain administrator is interested
in the member value corresponding to Kim Akers' account. The domain administrator does so by
issuing a request to DC2 with pszObjectDN set to the DN of GroupB, pszAttributeName set to
member, and pszValueDN set to the DN of Kim Akers' user account.
319 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ldap_search_s("CN=GroupB,CN=Users,DC=contoso,DC=com", baseObject, "(objectClass=group)",
[objectClass, member])
Getting 1 entry:
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC2 with the following
parameters (DRS_HANDLE to DC2 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE
pszObjectDN = CN=GroupB,CN=Users,DC=contoso,dc=com
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = member
dwEnumerationContext = 0
pdwOutVersion = DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE
pmsgOut = DS_REPL_ATTR_VALUE_META_DATA_2
cNumEntries = 1
dwEnumerationContext = 0x1
rgMetaData = DS_REPL_VALUE_META_DATA_2[]
rgMetaData[0]
pszAttributeName = member
cbData = 0
pbData = null
ftimeDeleted.dwLowDateTime = 0x0
320 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ftimeDeleted.dwHighDateTime = 0x0
ftimeCreated.dwLowDateTime = 0xc3a4dd80
ftimeCreated.dwHighDateTime = 0x1cb2ab5
dwVersion = 1
ftimeLastOriginatingChange.dwLowDateTime = 0xc3a4dd80
ftimeLastOriginatingChange.dwHighDateTime = 0x1cb2ab5
uuidLastOriginatingDsaInvocationID = 2e235fab-353c-46fc-8afd-437e9d0188b3
usnOriginatingChange = 15399
usnLocalChange = 19212
The final state is the same as the initial state; there is no change.
In this example, the domain administrator verifies whether DC1 has any replication failures.
DC2 is a replication neighbor of DC1. DC2 is offline and DC1 is unable to contact DC2 to query its
replication state.
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES
pszObjectDN = (null)
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
321 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pdwOutVersion = DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES
pmsgOut = DS_REPL_KCC_DSA_FAILURESW
cNumEntries = 1
dwReserved = 0
rgDsaFailure = DS_REPL_KCC_DSA_FAILUREW[]
rgDsaFailure[0]
uuidDsaObjGuid = 12626d52-1da7-4a40-a490-987c0880c3fe
ftimeFirstFailure.dwLowDateTime = 0xcefc4100
ftimeFirstFailure.dwHighDateTime = 0x1cb2d21
cNumFailures = 2
dwLastResult = 1722
The final state is the same as the initial state (section 4.1.13.4.8.1); there is no change.
In this example, the domain administrator verifies whether DC1 has any pending operations in its
replication queue.
The client invokes the IDL_DRSGetReplInfo (section 4.1.13) method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 2
pmsgIn = DRS_MSG_GETREPLINFO_REQ_V2
InfoType = DS_REPL_INFO_PENDING_OPS
pszObjectDN = (null)
uuidSourceDsaObjGuid = 00000000-0000-0000-0000-000000000000
ulFlags = 0x0
pszAttributeName = (null)
pszValueDN = (null)
dwEnumerationContext = 0
322 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.13.4.9.3 Server Response
pdwOutVersion = DS_REPL_INFO_PENDING_OPS
pmsgOut = DS_REPL_PENDING_OPSW
ftimeCurrentOpStarted.dwLowDateTime = 0x2546bc80
ftimeCurrentOpStarted.dwHighDateTime = 0x1cb2ea7
cNumPendingOps = 1
rgPendingOp = DS_REPL_OPW[]
rgPendingOp[0]
ftimeEnqueued.dwLowDateTime = 0x2546bc80
ftimeEnqueued.dwHighDateTime = 0x2546bc80
ulSerialNumber = 2343
ulPriority = 250
OpType = DS_REPL_OP_TYPE_SYNC
ulOptions = 524291
pszNamingContext = DC=contoso,DC=com
pszDsaAddress = 12626d52-1da7-4a40-a490-987c0880c3fe._msdcs.contoso.com
uuidNamingContextObjGuid = 8f3cea57-61ff-46cb-aa17-6c1683c33020
uuidDsaObjGuid = 12626d52-1da7-4a40-a490-987c0880c3fe
The final state is the same as the initial state (section 4.1.13.4.9.1); there is no change.
The IDL_DRSInitDemotion method performs the first phase of the removal of a DC from an AD LDS
forest. This method is supported only by AD LDS.
ULONG IDL_DRSInitDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_INIT_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_INIT_DEMOTIONREPLY* pmsgOut
);
323 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwInVersion: The version of the request message.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.14.1.1 DRS_MSG_INIT_DEMOTIONREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_INIT_DEMOTIONREQ_V1 V1;
} DRS_MSG_INIT_DEMOTIONREQ;
4.1.14.1.2 DRS_MSG_INIT_DEMOTIONREQ_V1
typedef struct {
DWORD dwReserved;
} DRS_MSG_INIT_DEMOTIONREQ_V1;
4.1.14.1.3 DRS_MSG_INIT_DEMOTIONREPLY
The DRS_MSG_INIT_DEMOTIONREPLY union defines the response messages received from the
IDL_DRSInitDemotion method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_INIT_DEMOTIONREPLY_V1 V1;
} DRS_MSG_INIT_DEMOTIONREPLY;
324 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.14.1.4 DRS_MSG_INIT_DEMOTIONREPLY_V1
typedef struct {
DWORD dwOpError;
} DRS_MSG_INIT_DEMOTIONREPLY_V1;
Informative summary of behavior: Performs the first phase of the removal of a DC from an AD LDS
forest. This phase consists of disabling both originating and replicated updates to the AD LDS
DC.<33>
ULONG
IDL_DRSInitDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_INIT_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_INIT_DEMOTIONREPLY* pmsgOut
)
msgIn: DRS_MSG_INIT_DEMOTIONREQ_V1
ret: DWORD
ValidateDRSInput(hDrs, 25)
pmsgOut^.V1.dwOpError := 0
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
endif
if pmsgIn = null then
return ERROR_INVALID_PARAMETER
endif
if pmsgIn^.V1.dwReserved ≠ 0 then
return ERROR_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V1
if not IsMemberOfBuiltinAdminGroup() then
/* only BA is allowed to demote an AD LDS service */
return ERROR_DS_DRA_ACCESS_DENIED
endif
dc.fEnableUpdates := FALSE
pmsgOut^.V1.dwOpError := ERROR_SUCCESS
pdwOutVersion^ := 1
return ERROR_SUCCESS
The IDL_DRSInterDomainMove method is a helper method used in a cross-NC move LDAP operation.
ULONG IDL_DRSInterDomainMove(
325 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_MOVEREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_MOVEREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.15.1.1 DRS_MSG_MOVEREQ
The DRS_MSG_MOVEREQ union defines the request messages sent to the IDL_DRSInterDomainMove
method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_MOVEREQ_V1 V1;
[case(2)]
DRS_MSG_MOVEREQ_V2 V2;
} DRS_MSG_MOVEREQ;
4.1.15.1.2 DRS_MSG_MOVEREQ_V1
typedef struct {
char* pSourceDSA;
ENTINF* pObject;
UUID* pParentUUID;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG ulFlags;
} DRS_MSG_MOVEREQ_V1;
326 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pSourceDSA: The NetworkAddress of the client DC.
PrefixTable: The prefix table with which to translate the ATTRTYP values in pObject to OIDs.
4.1.15.1.3 DRS_MSG_MOVEREQ_V2
typedef struct {
DSNAME* pSrcDSA;
ENTINF* pSrcObject;
DSNAME* pDstName;
DSNAME* pExpectedTargetNC;
DRS_SecBufferDesc* pClientCreds;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG ulFlags;
} DRS_MSG_MOVEREQ_V2;
pDstName: The name the object will have in the destination domain.
PrefixTable: The prefix table with which to translate the ATTRTYP values in pSrcObject to OIDs.
4.1.15.1.4 DRS_MSG_MOVEREPLY
The DRS_MSG_MOVEREPLY union defines the response messages received from the
IDL_DRSInterDomainMove method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_MOVEREPLY_V1 V1;
[case(2)]
DRS_MSG_MOVEREPLY_V2 V2;
} DRS_MSG_MOVEREPLY;
4.1.15.1.5 DRS_MSG_MOVEREPLY_V1
327 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_MOVEREPLY_V1 structure defines a response message received from the
IDL_DRSInterDomainMove method. This response version is obsolete.<35>
typedef struct {
ENTINF** ppResult;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG* pError;
} DRS_MSG_MOVEREPLY_V1;
PrefixTable: The prefix table with which to translate the ATTRTYP values in ppResult to OIDs.
4.1.15.1.6 DRS_MSG_MOVEREPLY_V2
typedef struct {
ULONG win32Error;
[unique] DSNAME* pAddedName;
} DRS_MSG_MOVEREPLY_V2;
4.1.15.2.1 AttrIsBacklink
procedure AttrIsBacklink(attr: ATTRTYP): boolean
Returns true if the attribute attr is a back link, and returns false otherwise.
4.1.15.2.2 AttrIsConstructed
procedure AttrIsConstructed(attr: ATTRTYP): boolean
Returns true if the attribute attr is a constructed attribute, and returns false otherwise.
4.1.15.2.3 AttrIsNonReplicated
procedure AttrIsNonReplicated(attr: ATTRTYP): boolean
328 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Returns true if the attribute attr is a nonreplicated attribute, and returns false otherwise.
4.1.15.2.4 AuthorizationInfoFromClientCredentials
procedure AuthorizationInfoFromClientCredentials(
credBuffer: DRS_SecBufferDesc,
var token: ClientAuthorizationInfo): DWORD
4.1.15.2.5 ImpersonateAuthorizationInfo
procedure ImpersonateAuthorizationInfo(token: ClientAuthorizationInfo)
Impersonates a set of client credentials. This affects the outcome of all subsequent AccessCheckAttr,
AccessCheckCAR, AccessCheckObject, AccessCheckWriteToSpnAttribute, and related calls, until
RevertToSelf is called.
4.1.15.2.6 IsApplicationNC
procedure IsApplicationNC(nc: DSName): boolean
4.1.15.2.7 RevertToSelf
procedure RevertToSelf()
Undoes the effect of ImpersonateAuthorizationInfo. After the RevertToSelf procedure is called, the
security context is restored to what it was before ImpersonateAuthorizationInfo was called.
Note IDL_DRSInterDomainMove transfers data that is normally not readable by the end user (such
as password hashes and other secrets).
During the move, the ENTINF structure that contains the object data is constructed by the source DC
and passed to the target DC. The target DC enforces certain constraints, transforms the data
according to the processing rules, and then either creates the object in its NC replica or updates the
existing object. For more information on cross-NC move operations, see [MS-ADTS] section
3.1.1.5.4.2.
ULONG
329 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
IDL_DRSInterDomainMove(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_MOVEREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_MOVEREPLY *pmsgOut)
msgIn: DRS_MSG_MOVEREQ_V2
lastPrefixTableEntry: PrefixTableEntry
prefixTable: PrefixTable
dwErr: DWORD
clientCreds: ClientAuthorizationInfo
callerCreds: ClientAuthorizationInfo
O: ENTINF
existingObj: DSName
attribute: ATTRTYP
proxyEpoch: DWORD
ValidateDRSInput(hDrs, 10)
pdwOutVersion^ := 2
msgOut^.V2.win32error := ERROR_DS_GENERIC_ERROR
msgOut^.V2.pAddedName := null
if dwInVersion ≠ 2 then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V2
if msgIn.pExpectedTargetNC ≠ DefaultNC() then
return ERROR_DS_DST_NC_MISMATCH
endif
if msgIn.PrefixTable.PrefixCount < 1 then
return ERROR_SCHEMA_MISMATCH
endif
/* Remember last prefix table entry, and remove it from the prefix
* table.*/
lastPrefixTableEntry :=
msgIn.PrefixTable.pPrefixEntry[msgIn.PrefixTable.PrefixCount]
msgIn.PrefixTable.PrefixCount := msgIn.PrefixTable.PrefixCount-1
prefixTable := AbstractPTFromConcretePT(msgIn.PrefixTable)
if ADS_UF_SERVER_TRUST_ACCOUNT in
330 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ENTINF_GetValue(
O, userAccountControl, prefixTable) or
ADS_UF_INTERDOMAIN_TRUST_ACCOUNT in
ENTINF_GetValue(
O, userAccountControl, prefixTable) then
/* Disallowed to move DC accounts and trust objects. */
return ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION
endif
existingObj := select one obj from all where
(obj!distinguishedName = ENTINF_GetValue(O, distinguishedName,
prefixTable))
if existingObj ≠ null and
existingObj!objectGUID ≠
ENTINF_GetValue(O, objectGUID, prefixTable) then
/* There's already an object with the same DN but different GUID.*/
return ERROR_DS_SRC_GUID_MISMATCH
endif
if IsApplicationNC(GetObjectNC(O.pName^)) then
return ERROR_DS_INTERNAL_FAILURE
endif
/* Scan through the ENTINF and throw away any attributes that are not
* supposed to be moved. */
foreach attribute in ENTINF_EnumerateAttributes(O, prefixTable)
if AttrIsBacklink(attribute) or AttrIsNonReplicated(attribute) or
AttrIsConstructed(attribute) then
ENTINF_SetValue(O, attribute, null, prefixTable)
endif
if attribute in {
adminCount, badPasswordTime, badPwdCount, creationTime,
distinguishedName, domainReplica, instanceType,
isCriticalSystemObject, isDeleted, lastLogoff, lastLogon,
lastLogonTimestamp, lockoutTime, logonCount, modifiedCount,
modifiedCountAtLastProm, msDS-Cached-Membership,
msDS-Cached-Membership-Time-Stamp, msDS-Site-Affinity, nextRid,
nTSecurityDescriptor, objectCategory, operatorCount,
primaryGroupID, proxiedObjectName, replPropertyMetaData,
revision, rid, sAMAccountType, serverState, subRefs,
systemFlags, uASCompat, uSNChanged, uSNCreated,
uSNDSALastObjRemoved, uSNLastObjRem, whenChanged, whenCreated}
then
ENTINF_SetValue(O, attribute, null, prefixTable)
endif
endfor
331 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ENTINF_GetValue(O, sidHistory, prefixTable)
+ {ENTINF_GetValue(O, objectSid, prefixTable)})
ImpersonateAuthorizationInfo(clientCreds)
O.pName := msgIn.pDstName
dwErr :=
PerformAddOperation(
O,
msgOut^.V2.pAddedName^,
AbstractPTFromConcretePT(msgIn.PrefixTable),
TRUE)
RevertToSelf()
msgOut^.V2.win32error := dwErr
return dwErr
In this example, a user is moved from the domain NC ASIA.CONTOSO.COM to the domain NC
CONTOSO.COM.
Querying the user object for "Aaron Con" in the domain NC ASIA.CONTOSO.COM on DCA1, prior to
the move:
Getting 1 entries:
332 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> givenName: Aaron;
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> logonCount: 0;
Querying the user object for "Aaron Con" in the domain NC CONTOSO.COM on DC1 prior to the move
yields no results, as follows:
Getting 0 entries:
333 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.15.4.2 Client Request
dwInVersion = 2
pmsgIn = DRS_MSG_MOVEREQ_V2
pSrcObject: ENTINF
sn: Con
givenName: Aaron
instanceType: IT_WRITE
uSNCreated: 13798;
uSNChanged: 13803;
objectGUID: 45a6999f-31eb-40ab-a2e5-906ccd86d5eb;
badPwdCount: 0;
countryCode: 0;
supplementalCredentials: none
primaryGroupID: 513;
objectSid: S-1-5-21-1880045291-2375173688-894673254-1109;
logonCount: 0;
334 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
sAMAccountName: aaroncon;
sAMAccountType: SAM_NORMAL_USER_ACCOUNT;
userPrincipalName: aaroncon@asia.contoso.com;
replPropertyMetaData: omitted
pExpectedTargetNC: DC=contoso,DC=com
pClientCreds: DRS_SecBufferDesc
PrefixTable: SCHEMA_PREFIX_TABLE
ulFlags: None
pdwOutVersion = 2
pmsgOut = DRS_MSG_MOVEREPLY_V2
After the move, the user object for "Aaron Con" is not present on domain NC ASIA.CONTOSO.COM,
querying DCA1, as follows:
Getting 0 entries:
After the move, the user object for "Aaron Con" is now present on domain NC CONTOSO.COM,
querying DC1:
Matched DNs:
Getting 1 entries:
335 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> sn: Con;
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> logonCount: 0;
336 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.16 IDL_DRSQuerySitesByCost (Opnum 24)
The IDL_DRSQuerySitesByCost method determines the communication cost from a "from" site to one
or more "to" sites.
ULONG IDL_DRSQuerySitesByCost(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_QUERYSITESREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_QUERYSITESREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.16.1.1 DRS_MSG_QUERYSITESREQ
The DRS_MSG_QUERYSITESREQ union defines the request message versions sent to the
IDL_DRSQuerySitesByCost method. Only one version, identified by dwInVersion = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_QUERYSITESREQ_V1 V1;
} DRS_MSG_QUERYSITESREQ;
4.1.16.1.2 DRS_MSG_QUERYSITESREQ_V1
typedef struct {
[string] const WCHAR* pwszFromSite;
[range(1,10000)] DWORD cToSites;
[string, size_is(cToSites)] WCHAR** rgszToSites;
DWORD dwFlags;
337 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DRS_MSG_QUERYSITESREQ_V1;
cToSites: The number of items in the rgszToSites array (the count of "to" sites).
4.1.16.1.3 DRS_MSG_QUERYSITESREPLY
The DRS_MSG_QUERYSITESREPLY union defines the response messages received from the
IDL_DRSQuerySitesByCost method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_QUERYSITESREPLY_V1 V1;
} DRS_MSG_QUERYSITESREPLY;
4.1.16.1.4 DRS_MSG_QUERYSITESREPLY_V1
typedef struct {
[range(0,10000)] DWORD cToSites;
[size_is(cToSites)] DRS_MSG_QUERYSITESREPLYELEMENT_V1* rgCostInfo;
DWORD dwFlags;
} DRS_MSG_QUERYSITESREPLY_V1;
rgCostInfo: The sequence of computed site costs, in the same order as the rgszToSites field in the
request message.
4.1.16.1.5 DRS_MSG_QUERYSITESREPLYELEMENT_V1
typedef struct {
DWORD dwErrorCode;
DWORD dwCost;
} DRS_MSG_QUERYSITESREPLYELEMENT_V1;
338 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwCost: The communication cost between the "from" site and this "to" site, or 0xFFFFFFFF if the
sites are not connected.
4.1.16.2.1 ValidateSiteRDN
procedure ValidateSiteRDN(s: unicodestring): boolean
Informative summary of behavior: The ValidateSiteRDN procedure returns 0 if s is a valid RDN for a
site object, and returns an appropriate error otherwise. A valid RDN has the following characteristics:
Is not null.
4.1.16.2.3 MinWeightPath
procedure MinWeightPath(
vSet: set of DSName,
aSet: WeightedArcSet): WeightedArcSet
339 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.16.3 Server Behavior of the IDL_DRSQuerySitesByCost Method
Informative summary of behavior: Given a site fromSite and an array of sites toSites, the server
returns an array that contains the cost from fromSite to each element of toSite, where the cost is
defined as follows.
The server computes a weighted graph G = (V, A). Each vertex in V corresponds to a site object.
Each arc in A corresponds to a siteLink object that connects two vertices in V; the weight of an arc is
the value of attribute cost on the arc's siteLink object. The cost of a path in the graph is the sum of
the arc weights on the path. The cost from one site to another is the minimum-cost path between the
two sites.
The model just described corresponds to fully transitive communications between sites: If site a
communicates with site b and site b communicates with site c, then site a communicates with site c by
routing through b. Replication can be configured to restrict transitive communication to sites specified
in the same siteLinkBridge object. Suppose there is a siteLink object for site a and site b, and a
siteLink object for site b and site c, but no siteLink object for site a and site c. If both of the siteLink
objects are specified on the same siteLinkBridge object, site a can communicate with site c by routing
through b. If no such siteLinkBridge object exists, site a cannot communicate with site c.
To calculate the cost when siteLinkBridge objects are used, let nBridges be the number of
siteLinkBridge objects. For each k in the subrange [0 .. nBridges-1], construct a weighted graph G[k]
= (V, A[k]) using siteLinkBridge object b[k]. Graph G[k] has the same vertex set as G, but its arc set
A[k] is a subset of A, including only the arcs listed in attribute siteLinkList on siteLinkBridge object
b[k]. Then the cost from site a to site c is the minimum of the following costs:
2. For each k in the subrange [0 .. nBridges-1], the cost of the minimum cost path, if any, from a to
c in G[k].
Any authenticated user can perform this operation; no access checking is performed.<36>
ULONG
IDL_DRSQuerySitesByCost(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_QUERYSITESREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_QUERYSITESREPLY *pmsgOut)
msgIn: DRS_MSG_QUERYSITESREQ_V1
vSet, slSet, sbSet : set of DSName
aSet, aSetB, aSetC, aSetD: WeightedArcSet
siteContainer, ipObject, fromSite, toSite: DSName
u, v, sl, sb: DSName
i, c: integer
min: WeightedArc
ul : ULONG
ValidateDRSInput(hDrs, 24)
pdwOutVersion^ := 1
pmsgOut^.V1.cToSites := 0
pmsgOut^.V1. rgCostInfo := null
pmsgOut^.V1.dwFlags := 0
340 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgIn := pmsgIn^.V1
ul := ValidateSiteRDN(msgIn.pwszFromSite)
if 0 ≠ ul then
return ul
endif
if msgIn.cToSites > 0 and msgIn.rgszToSites = null then
return ERROR_INVALID_PARAMETER
endif
for i := 0 to msgIn.cToSites – 1
ul := ValidateSiteRDN(msgIn.rgszToSites[i])
if 0 ≠ ul then
return ul
endif
endfor
siteContainer := DescendantObject(ConfigNC(), "CN=Sites,")
ipObject := DescendantObject(ConfigNC(),
"CN=IP,CN=Inter-Site Transports,CN=Sites,")
fromSite := select one v from children siteContainer where
site in v!objectClass and v!name = msgIn.pwszFromSite
if fromSite = null then
return ERROR_DS_OBJ_NOT_FOUND
endif
341 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else if min.cost > c then
aSetC := aSetC - {[initial: u, final: v, cost: min.cost]}
+ {[initial: u, final: v, cost: c)}
endif
endfor
endfor
else
/* Fully transitive network, ignore siteLinkBridge objects. */
aSetC := MinWeightPath(vSet, aSet)
endif
return 0
Determines the nontransitive communication cost "from" site DC1 "to" sites DC2, DC3, and DC4. A
site graph is displayed in the following figure.
342 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Figure 2: Site graph for a nontransitive network
DC1 SL1 8
SL2 3
SLB0 (SL1, SL3) 13
DC2 SL1 8
SL3 5
DC3 SL2 3
SL4 7
DC4 SL3 7
SL4 13
SLB0 (SL1, SL3)
Querying the site object for domain NC CONTOSO.COM by performing an LDAP search with Base
DN "CN=Configuration,DC=contoso,DC=com".
343 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ldap_search_s(ld, "CN=Configuration,DC=contoso,DC=com", 2, "(objectclass=site)", attrList, 0,
&msg)
Matched DNs:
Getting 4 entries:
344 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> uSNChanged: 40991;
345 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> uSNChanged: 41002;
Querying the siteLink object for domain NC CONTOSO.COM by performing an LDAP search with Base
DN "CN=Configuration,DC=contoso,DC=com".
Matched DNs:
Getting 4 entries:
1> cost: 8;
1> cost: 3;
346 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> distinguishedName: CN=SL2, CN=IP, CN=Inter-Site Transports, CN=Sites,
CN=Configuration, DC=contoso, DC=com;
1> cost: 5;
347 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> whenChanged: 06/08/2010 19:05:51 Pacific Standard Time;
1> cost: 7;
Querying the siteLinkBridge object for domain NC CONTOSO.COM by performing an LDAP search with
Base DN "CN=Configuration,DC=contoso,DC=com".
Matched DNs:
Getting 1 entry:
348 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> instanceType: 0x4 = (WRITE);
A client invokes the IDL_DRSQuerySitesByCost method against Contoso with the following parameters
(DRS_HANDLE to DC1 is omitted):
dwInVersion =1
pmsgIn = DRS_MSG_QUERYSITESREQ_V1
pwszFromSite = "DC1"
cToSites =3
dwFlags =0
pdwOutVersion^ = 1
pmsgOut = DRS_MSG_QUERYSITESREPLY_V1
cToSites =3
rgCostInfo[0]: DRS_MSG_QUERYSITESREPLYELEMENT_V1
dwErrorCode =0
dwCost: =8
rgCostInfo[1]: DRS_MSG_QUERYSITESREPLYELEMENT_V
dwErrorCode =0
dwCost: =3
349 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
rgCostInfo[2]: DRS_MSG_QUERYSITESREPLYELEMENT_V1
dwErrorCode =0
dwCost: =13
dwFlags =0
The final state is the same as the initial state; there is no change.
Determines the transitive communication cost from site DC1 to sites DC2, DC3, and DC4. A site graph
is displayed in the following figure.
DC SL1 8
SL2 3
DC2 SL1 8
SL3 5
350 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
VERTEX ARC ARC WEIGHT
DC3 SL2 3
SL4 7
DC4 SL3 5
SL4 7
Querying the site object for domain NC CONTOSO.COM by performing an LDAP search with Base
DN "CN=Configuration,DC=contoso,DC=com".
Matched DNs;
Getting 4 entries;
351 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> instanceType: 0x4 = (WRITE);
352 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> instanceType: 0x4 = (WRITE);
Querying the siteLink object for domain NC CONTOSO.COM by performing an LDAP search with Base
DN "CN=Configuration,DC=contoso,DC=com".
Matched DNs;
Getting 4 entries:
1> cost: 8;
353 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> uSNChanged: 41010;
1> cost: 3;
1> cost: 5;
354 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
2> objectClass: top; siteLink;
1> cost: 7;
A client invokes the IDL_DRSQuerySitesByCost method against Contoso with the following parameters
(DRS_HANDLE to DC1 is omitted):
dwInVersion = 1
355 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgIn = DRS_MSG_QUERYSITESREQ_V1
pwszFromSite = "DC1"
cToSites =3
dwFlags =0
pdwOutVersion^ = 1
pmsgOut = DRS_MSG_QUERYSITESREPLY_V1
cToSites =3
rgCostInfo[0]: DRS_MSG_QUERYSITESREPLYELEMENT_V1
dwErrorCode = 0
dwCost: = 8
rgCostInfo[1]: DRS_MSG_QUERYSITESREPLYELEMENT_V1
dwErrorCode = 0
dwCost: = 3
rgCostInfo[2]: DRS_MSG_QUERYSITESREPLYELEMENT_V1
dwErrorCode = 0
dwCost: = 10
dwFlags = 0
The final state is the same as the initial state; there is no change.
ULONG IDL_DRSRemoveDsDomain(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_RMDMNREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMDMNREPLY* pmsgOut
);
dwInVersion: The version of the request message. This must be set to 1, because this is the only
version supported.
356 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgIn: A pointer to the request message.
pdwOutVersion: A pointer to the version of the response message. The value must be 1 because
that is the only version supported.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.17.1.1 DRS_MSG_RMDMNREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_RMDMNREQ_V1 V1;
} DRS_MSG_RMDMNREQ;
4.1.17.1.2 DRS_MSG_RMDMNREQ_V1
typedef struct {
[string] LPWSTR DomainDN;
} DRS_MSG_RMDMNREQ_V1;
4.1.17.1.3 DRS_MSG_RMDMNREPLY
The DRS_MSG_RMDMNREPLY union defines the response messages received from the
IDL_DRSRemoveDsDomain method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_RMDMNREPLY_V1 V1;
} DRS_MSG_RMDMNREPLY;
357 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.17.1.4 DRS_MSG_RMDMNREPLY_V1
typedef struct {
DWORD Reserved;
} DRS_MSG_RMDMNREPLY_V1;
4.1.17.2.1 HasNCReplicated
procedure HasNCReplicated(nc: DSName): boolean
Returns true if the DC's NC replica of the NC specified by nc has replicated at least once with
another DC that hosts that NC since the DC was booted; otherwise, returns false.
Informative summary of behavior: Removes the crossRef object that defines a domain NC. Fails if
any DC is currently hosting this domain as its default NC, as indicated by the state of that DC's
nTDSDSA object. Fails if the server is not the Domain Naming FSMO role owner for the forest.
The removal of the crossRef object signals any DC currently hosting a partial replica of the removed
domain NC to remove that replica from its state.
This method undoes the effects of the IDL_DRSAddEntry method when IDL_DRSAddEntry is used to
create a crossRef object.
The IDL_DRSRemoveDsServer method removes the state within a forest, including the state on a DC's
nTDSDSA object, associated with hosting a domain as a default NC on some DC. Therefore,
IDL_DRSRemoveDsServer can be used to establish a precondition for the success of
IDL_DRSRemoveDsDomain.
ULONG
IDL_DRSRemoveDsDomain(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_RMDMNREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMDMNREPLY *pmsgOut);
domainDN: unicodestring
otherNtdsdsa: DSName
cr: DSName
rt: ULONG
ValidateDRSInput(hDrs, 15)
pdwOutVersion^ := 1
pmsgOut^.V1.Reserved := 0
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
358 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
domainDN := pmsgIn^.V1.DomainDN
if cr = null then
return ERROR_DS_NO_CROSSREF_FOR_NC
endif
rt:= RemoveObj(cr,false)
if rt ≠ 0 then
return rt
endif
DelSubRef(cr!ncName)
return 0
ULONG IDL_DRSRemoveDsServer(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
359 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[in, ref, switch_is(dwInVersion)]
DRS_MSG_RMSVRREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMSVRREPLY* pmsgOut
);
dwInVersion: The version of the request message. Must be set to 1 because that is the only version
supported.
pdwOutVersion: A pointer to the version of the response message. The value must be 1 because
that is the only version supported.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.18.1.1 DRS_MSG_RMSVRREQ
The DRS_MSG_RMSVRREQ union defines the request messages sent to the IDL_DRSRemoveDsServer
method. Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_RMSVRREQ_V1 V1;
} DRS_MSG_RMSVRREQ;
4.1.18.1.2 DRS_MSG_RMSVRREQ_V1
typedef struct {
[string] LPWSTR ServerDN;
[string] LPWSTR DomainDN;
BOOL fCommit;
} DRS_MSG_RMSVRREQ_V1;
360 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DomainDN: The DN of the NC root of the domain that the DC to be removed belongs to. Can be set
to null if the client does not want the server to compute the value of
pmsgOut^.V1.fLastDCInDomain.
fCommit: True if the DC's metadata should actually be removed from the directory. False if the
metadata should not be removed. (This is used by a client that wants to determine the value of
pmsgOut^.V1.fLastDcInDomain without altering the directory.)
4.1.18.1.3 DRS_MSG_RMSVRREPLY
The DRS_MSG_RMSVRREPLY union defines the response messages received from the
IDL_DRSRemoveDsServer method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_RMSVRREPLY_V1 V1;
} DRS_MSG_RMSVRREPLY;
4.1.18.1.4 DRS_MSG_RMSVRREPLY_V1
typedef struct {
BOOL fLastDcInDomain;
} DRS_MSG_RMSVRREPLY_V1;
fLastDcInDomain: True if the DC is the last DC in its domain, and pmsgIn^.V1.DomainDN was set
to the DN of the NC root of the domain to which the DC belongs. Otherwise, false.
Informative summary of behavior: Removes the metadata defining a DC, which consists of the tree of
objects rooted at the DC's nTDSDSA object as well as the rIDSet objects and DRS SPNs associated
with the DC's computer object. This method is typically used when a DC is demoted. As part of the
demotion process, the DC being demoted calls this method on another DC (either in the same
domain, if such a DC exists, or in the parent domain, if there are no other DCs in the same domain
but there is a parent domain) to remove the metadata of the DC being demoted from the forest.
Alternatively, if a DC is removed from the domain without being properly demoted (for example, if the
DC suffers a fatal hardware failure), a client can make this call to remove the metadata of the now-
nonexistent DC. When pmsgIn^.V1.DomainDN is specified, this method also computes whether the
DC is the last replica of its default domain NC.
The behavior of this method has two variants. If pmsgIn^.V1.fCommit is false, the method is read-
only with regard to abstract state; that is, it does not make any changes to the directory contents. In
this mode, the main purpose of the method is to compute pmsgOut^.V1.fLastDcInDomain (and so
there is little point to calling the method in this mode without setting pmsgIn^.V1.DomainDN). For
example, prior to removing the DC's metadata, a client application might try to determine whether
any DCs would be left in the domain, so that it can warn the user if the user is removing the last DC in
the domain.
361 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
When pmsgIn^.V1.fCommit is true, the second variant of the behavior is performed. In this mode, the
method actually removes the DC metadata. The pmsgOut^.V1.fLastDcInDomain value is also
computed in this mode (provided that pmsgIn^.V1.DomainDN was passed in). This method undoes
the effects of the IDL_DRSAddEntry method when IDL_DRSAddEntry is used to create an nTDSDSA
object. The removal of the DC's metadata signals other DCs in the forest that this particular DC no
longer exists.
ULONG
IDL_DRSRemoveDsServer(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_RMSVRREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMSVRREPLY *pmsgOut);
serverDn: unicodestring
domainDn: unicodestring
server: DSName
ntdsdsa: DSName
otherNtdsdsa: DSName
spnsToRemove: set of unicodestring
computerDn: unicodestring
computer: DSName
objectsToDelete: set of DSName
rt: ULONG
RODCKrbtgtAcct: DSName
accountList: set of DSName
ValidateDRSInput(hDrs, 14)
serverDn := pmsgIn^.V1.ServerDN
domainDn := pmsgIn^.V1.DomainDN
pdwOutVersion^ := 1
pmsgOut^.V1.fLastDcInDomain = false
362 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
return 0
endif
rt := RemoveObj(ntdsdsa,true)
if rt ≠ 0 then
return rt
endif
RemoveObj(r, false)
endfor
363 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Delete msDS-AuthenticatedToAccountList links */
accountList := { computer!msDS-AuthenticatedToAccountList }
computer!servicePrincipalName :=
computer!servicePrincipalName - spnsToRemove
endif
return 0
The IDL_DRSReplicaAdd method adds a replication source reference for the specified NC.
ULONG IDL_DRSReplicaAdd(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPADD* pmsgAdd
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.19.1.1 DRS_MSG_REPADD
The DRS_MSG_REPADD union defines request messages that are sent to the IDL_DRSReplicaAdd
method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPADD_V1 V1;
[case(2)]
DRS_MSG_REPADD_V2 V2;
[case(3)]
DRS_MSG_REPADD_V3 V3;
364 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DRS_MSG_REPADD;
4.1.19.1.2 DRS_MSG_REPADD_V1
typedef struct {
[ref] DSNAME* pNC;
[ref] [string] char* pszDsaSrc;
REPLTIMES rtSchedule;
ULONG ulOptions;
} DRS_MSG_REPADD_V1;
4.1.19.1.3 DRS_MSG_REPADD_V2
typedef struct {
[ref] DSNAME* pNC;
[unique] DSNAME* pSourceDsaDN;
[unique] DSNAME* pTransportDN;
[ref] [string] char* pszSourceDsaAddress;
REPLTIMES rtSchedule;
ULONG ulOptions;
} DRS_MSG_REPADD_V2;
pSourceDsaDN: The nTDSDSA object for the DC from which to replicate changes.
pTransportDN: The interSiteTransport object that identifies the network transport over which
replication is to be performed.
4.1.19.1.4 DRS_MSG_REPADD_V3
365 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_REPADD_V3 structure defines a request message sent to the IDL_DRSReplicaAdd
method. This request version is a superset of V2.
typedef struct {
[ref] DSNAME* pNC;
[unique] DSNAME* pSourceDsaDN;
[unique] DSNAME* pTransportDN;
[ref] [string] char* pszSourceDsaAddress;
REPLTIMES rtSchedule;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_REPADD_V3;
pSourceDsaDN: The nTDSDSA object for the DC from which to replicate changes.
pTransportDN: The interSiteTransport object that identifies the network transport over which
replication is to be performed.
correlationID: An identifier for the operation that the DC can use for implementation-defined
troubleshooting. There are no normative constraints on this value, nor does the value figure in any
normative processing rules.
Informative summary of behavior: The server adds a value to the repsFrom of the specified NC
replica. If ulOptions contains DRS_ASYNC_OP, the server processes the request asynchronously. The
client can be an administrative client or another DC. The client includes DRS_WRIT_REP in ulOptions if
the specified NC replica is writable at the server. The client includes DRS_NONGC_RO_REP and
DRS_SPECIAL_SECRET_PROCESSING in ulOptions if the specified NC replica is a read-only full replica
on a read-only DC. The server adds a value to repsFrom, and the value has replicaFlags derived from
ulOptions (see below), serverAddress equal to pszSourceDsaAddress (pszDsaSrc if V1), and schedule
equal to rtSchedule. If ulOptions contains DRS_ASYNC_REP but not DRS_MAIL_REP or
DRS_NEVER_NOTIFY, the server sends a request to the DC specified by pszSourceDsaAddress to add
a value to the repsTo of the specified NC replica by calling IDL_DRSUpdateRefs. Finally, the server
begins a replication cycle by sending an IDL_DRSGetNCChanges request.
ULONG
IDL_DRSReplicaAdd(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPADD *pmsgAdd);
options: DRS_OPTIONS
nc: DSName
partitionsObj: DSName
cr: DSName
rf: RepsFrom
msgIn: DRS_MSG_REPADD_V2
366 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
updRefs: DRS_MSG_UPDREFS /* See IDL_DRSUpdateRefs structures. */
hDrsSrc: DRS_HANDLE
msgRequest: DRS_MSG_GETCHGREQ
msgOut: DRS_MSG_GETCHGREPLY
outVersion: DWORD
cMaxObjects: ULONG
cMaxBytes: ULONG
versionRequestMsg: DWORD
err: ULONG
ValidateDRSInput(hDrs, 5)
if msgIn.pNC = null
or msgIn.pszSourceDsaAddress = null
or msgIn.pszSourceDsaAddress = "" then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
options := msgIn.ulOptions
nc := msgIn.pNC^
partitionsObj :=
select one o from children ConfigNC() where o!name = "Partitions"
cr := select o from children partitionsObj where o!nCName = nc
if cr = null then
return ERROR_DS_DRA_BAD_NC
endif
if ObjExists(nc) then
if not AccessCheckCAR(nc, DS-Replication-Manage-Topology) then
return ERROR_DS_DRA_ACCESS_DENIED
endif
else
if not AccessCheckCAR(DefaultNC(), DS-Replication-Manage-Topology)
then
return ERROR_DS_DRA_ACCESS_DENIED
endif
endif
367 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if DRS_ASYNC_OP in options then
Asynchronous Processing: Initiate a logical thread of control
to process the remainder of this request asynchronously
return 0
endif
if ObjExists(nc) then
if (IT_WRITE in nc!instanceType) ≠ (DRS_WRIT_REP in options) then
return ERROR_DS_DRA_BAD_INSTANCE_TYPE
endif
/* Disallow addition if server already replicates from this
* source */
if (select one v from nc!repsFrom
where v.serverAddress = msgIn.pszSourceDsaAddress) ≠ null
then
return ERROR_DS_DRA_DN_EXISTS
endif
endif
hDrsSrc := BindToDSA(msgIn.pSourceDsaDN)
if hDrsSrc ≠ null then
ret := IDL_DRSUpdateRefs(hDrsSrc, 1, ADR(updRefs))
UnbindFromDSA(hDrsSrc)
368 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
endif
err := IDL_DRSGetNCChanges(
hDrsSrc,
versionRequestMsg,
msgRequest,
ADDR(outVersion),
ADDR(msgOut))
if err = 0
and not DRS_MAIL_REP in msgIn.ulOptions
then
Wait for the response, process it (section 4.1.10.6), send the next request, etc.
until the replication cycle is complete.
If there are any failures from this replication attempt, err is assigned an
appropriate error value.
endif
return err
The IDL_DRSReplicaDel method deletes a replication source reference for the specified NC.
ULONG IDL_DRSReplicaDel(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPDEL* pmsgDel
);
369 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.20.1.1 DRS_MSG_REPDEL
The DRS_MSG_REPDEL union defines the request messages sent to the IDL_DRSReplicaDel method.
Only one version, identified by dwVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPDEL_V1 V1;
} DRS_MSG_REPDEL;
4.1.20.1.2 DRS_MSG_REPDEL_V1
typedef struct {
[ref] DSNAME* pNC;
[string] char* pszDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPDEL_V1;
Informative summary of behavior: When DRS_NO_SOURCE is not specified, the server removes a
value from the repsFrom of the specified NC replica. If ulOptions contains DRS_ASYNC_OP, the
server processes the request asynchronously. The client has to include DRS_WRIT_REP in ulOptions if
the specified NC replica is a writable replica. The server removes the value from repsFrom whose
serverAddress matches pszDsaSrc. If ulOptions does not contain DRS_LOCAL_ONLY, the server sends
a request to the DC specified by pszDsaSrc to remove this DC from the values in repsTo of the
specified NC replica by calling IDL_DRSUpdateRefs.
When DRS_NO_SOURCE is specified, the server expunges the NC replica and all its children. This
operation returns an error and the expunge does not occur if the repsFrom or repsTo attributes are
present on the NC replica. However, if ulOptions contains DRS_REF_OK, it is permitted for repsTo to
be present. If ulOptions contains DRS_ASYNC_OP, the server processes the request asynchronously.
The client has to include DRS_WRIT_REP in ulOptions if the specified NC replica is writable. If
ulOptions contains DRS_ASYNC_REP, the server expunges the objects asynchronously.
ULONG
370 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
IDL_DRSReplicaDel(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPDEL *pmsgDel);
options: DRS_OPTIONS
nc: DSName
cr: DSName
srcDSA: DSName
hDrsSrc: DRS_HANDLE
rf: RepsFrom
msgIn: DRS_MSG_REPDEL_V1
updRefs: DRS_MSG_UPDREFS /* See IDL_DRSUpdateRefs structures. */
rt: ULONG
ValidateDRSInput(hDrs, 6)
msgIn := pmsgDel^.V1
/* Validate the NC */
if msgIn.pNC = null then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
nc := msgIn.pNC^
options := msgIn.ulOptions
371 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if DRS_ASYNC_REP in options then
Asynchronous Processing: Initiate a logical thread of control
to process the remainder of this request asynchronously
return 0
endif
/* Check whether there is stil a crossref object for the given nc. */
cr := select one v from subtree ConfigNC()
where v!ncName = nc and crossRef in v!objectClass
if(cr == NULL)
if(IT_NC_ABOVE in nc!instanceType) then
nc!instanceType = {IT_NC_ABOVE, IT_UNINSTANT,IT_NC_HEAD}
endif
rt := RemoveObj(nc,false)
if rt ≠ 0 then
return rt
endif
else
if(IT_NC_ABOVE in nc!instanceType) then
nc!instanceType = {IT_NC_ABOVE, IT_UNINSTANT,IT_NC_HEAD}
else
Expunge(nc)
endif
endif
return 0
if msgIn.pszDsaSrc = null or
msgIn.pszDsaSrc^ = "" or
(IsAdlds() and
GetDSNameFromNetworkAddress(msgIn.pszDsaSrc^) = null) then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
372 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
nc!repsFrom := nc!repsFrom - {rf}
endif
return 0
endif
The IDL_DRSReplicaDemotion method replicates off all changes to the specified NC and moves any
FSMOs held to another server.
ULONG IDL_DRSReplicaDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_REPLICA_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REPLICA_DEMOTIONREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
373 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.21.1 Method-Specific Concrete Types
4.1.21.1.1 DRS_MSG_REPLICA_DEMOTIONREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPLICA_DEMOTIONREQ_V1 V1;
} DRS_MSG_REPLICA_DEMOTIONREQ;
4.1.21.1.2 DRS_MSG_REPLICA_DEMOTIONREQ_V1
typedef struct {
DWORD dwFlags;
UUID uuidHelperDest;
[ref] DSNAME* pNC;
} DRS_MSG_REPLICA_DEMOTIONREQ_V1;
dwFlags: Zero or more of the following bit flags, which are presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X X T X X X X X X X X X X X X X X X X X X X X X X X X
4.1.21.1.3 DRS_MSG_REPLICA_DEMOTIONREPLY
The DRS_MSG_REPLICA_DEMOTIONREPLY union defines the response messages received from the
IDL_DRSReplicaDemotion method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPLICA_DEMOTIONREPLY_V1 V1;
} DRS_MSG_REPLICA_DEMOTIONREPLY;
374 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1: The version 1 reply.
4.1.21.1.4 DRS_MSG_REPLICA_DEMOTIONREPLY_V1
typedef struct {
DWORD dwOpError;
} DRS_MSG_REPLICA_DEMOTIONREPLY_V1;
4.1.21.2.1 ReplicationPartners()
procedure ReplicationPartners(nc: DSNAME): sequence of DSNAME
The DC D executing this procedure hosts a portion of forest F. This procedure computes the set of all
DCs in F that host the specified NC, excluding D. It returns this set as a sequence in an arbitrary
order.
4.1.21.2.2 AbandonAllFSMORoles()
procedure AbandonAllFSMORoles(nc: DSNAME): DWORD
The AbandonAllFSMORoles procedure abandons any FSMO roles represented in the supplied NC that
are held by this DC. The new holder of the FSMO roles is arbitrary. AbandonAllFSMORoles returns a
Win32 error value.
msgReq: DRS_MSG_GETCHGREQ_V10
msgUpd: DRS_MSG_GETCHGREPLY_NATIVE
if nc = ConfigNC() then
/* check domain naming FSMO role */
fsmoContainer := DescendantObject(ConfigNC(), "CN=Partitions,")
else if nc = SchemaNC() then
/* check schema master FSMO role */
fsmoContainer := SchemaNC()
else
/* application NCs don't hold FSMOs */
return ERROR_SUCCESS
endif
375 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
i := 0
while not bGivenAway
if i ≥ targetDSAs.length then
/* no more replication partners that would take our FSMO! */
return ERROR_DS_UNABLE_TO_SURRENDER_ROLES
endif
hDRS := BindToDSA(targetDSAs[i])
if hDRS ≠ null then
/* the targetDSA appears to be up. Let's try to transfer the
* role */
/* Perform an IDL_DRSGetNCChanges(EXOP_FSMO_ABANDON_ROLE) call */
msgReq.uuidDsaObjDest := dc.serverGuid
msgReq.pNC := ADDR(fsmoContainer)
msgReq.ulFlags := DRS_WRIT_REP
msgReq.ulExtendedOp := EXOP_FSMO_ABANDON_ROLE
ret :=
IDL_DRSGetNCChanges(hDRS, 8, ADDR(msgReq), 6, ADDR(msgUpd))
if ret = ERROR_SUCCESS then
/* successfully given away */
bGivenAway := true
endif
UnbindFromDSA(hDRS)
endif
i := i + 1
endwhile
/* if execution got here, the role was given away */
return ERROR_SUCCESS
4.1.21.2.3 ReplicateOffChanges()
procedure ReplicateOffChanges(nc: DSNAME): DWORD
The ReplicateOffChanges procedure replicates all local changes in the NC to a randomly selected
replication partner.
bReplicated := false
targetDSAs := ReplicationPartners(nc)
i := 0
while not bReplicated
if i ≥ targetDSAs.length then
/* no more replication partners that host the NC! */
return ERROR_DS_CANT_FIND_DSA_OBJ
endif
hDRS := BindToDSA(targetDSAs[i])
if hDRS ≠ null then
/* the targetDSA appears to be up. Let's try to replicate to
* it */
/* Invoke IDL_DRSReplicaSync to get changes from us */
msgSyncReq.pszDsaSrc := NetworkAddress of targetDSA
msgSyncReq.uuidDsaSrc := dc.serverGuid
msgSyncReq.pNC := ADDR(nc)
msgSyncReq.ulOptions := DRS_WRIT_REP
ret := IDL_DRSReplicaSync(hDRS, 1,ADR(msgSyncReq))
if ret = ERROR_DS_DRA_NO_REPLICA then
/* the targetDSA does not currently have replication agreement
(repsFrom) with this DC. Tell it to add one */
376 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgAddReq.pNC := ADDR(nc)
msgAddReq.pszSourceDsaAddress := NetworkAddress of this DC
msgAddReq.ulOptions := DRS_WRIT_REP
msgAddReq.pSourceDsaDN := null
msgAddReq.pTransportDN := null
ret := IDL_DRSReplicaAdd(hDRS, 2,ADR(msgAddReq))
endif
UnbindFromDSA(hDRS)
if ret = ERROR_SUCCESS then
/* success! */
bReplicated := true
endif
endif
i := i + 1
endwhile
/* if execution got here, then the changes were successfully replicated off */
return ERROR_SUCCESS
Informative summary of behavior: For a given NC, the IDL_DRSReplicaDemotion method replicates
out any changes that had not previously been replicated out. It also abandons any NC-specific FSMO
roles that are owned by this DC. This function accomplishes nothing when the DC being demoted is
the last DC in the forest.
ULONG
IDL_DRSReplicaDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_REPLICA_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REPLICA_DEMOTIONREPLY* pmsgOut
)
msgIn: DRS_MSG_REPLICA_DEMOTIONREQ_V1
ret: DWORD
nc: DSNAME
ValidateDRSInput(hDrs, 26)
pdwOutVersion^ := 1
pmsgOut^.V1.dwOpError := ERROR_DS_CODE_INCONSISTENCY
if dwInVersion ≠ 1 then
return ERROR_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V1
if msgIn.pNC = null or
msgIn.dwFlags ≠ DS_REPLICA_DEMOTE_TRY_ALL_SRCS then
return ERROR_INVALID_PARAMETER
endif
nc := msgIn.pNC^
ret := AbandonAllFSMORoles(nc)
if ret = ERROR_SUCCESS then
ret := ReplicateOffChanges(nc)
endif
377 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if ret = ERROR_SUCCESS then
/* mark instanceType as going and not coming */
nc!instanceType := nc!instanceType + {IT_NC_GOING} - {IT_NC_COMING}
/* remove any repsFrom */
nc!repsFrom := null
endif
pmsgOut^.V1.dwOpError := ret
pdwMsgOut^ := 1
return ERROR_SUCCESS
The IDL_DRSReplicaModify method updates the value for repsFrom for the NC replica.
ULONG IDL_DRSReplicaModify(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPMOD* pmsgMod
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.22.1.1 DRS_MSG_REPMOD
The DRS_MSG_REPMOD union defines the request messages for the IDL_DRSReplicaModify method.
Only one version, identified by dwVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPMOD_V1 V1;
} DRS_MSG_REPMOD;
4.1.22.1.2 DRS_MSG_REPMOD_V1
378 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
[ref] DSNAME* pNC;
UUID uuidSourceDRA;
[unique, string] char* pszSourceDRA;
REPLTIMES rtSchedule;
ULONG ulReplicaFlags;
ULONG ulModifyFields;
ULONG ulOptions;
} DRS_MSG_REPMOD_V1;
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X U U U X X X X X X X X X X X X X X X X X X X X X X X X
S A F
Informative summary of behavior: The server replaces fields in the repsFrom of the specified NC
replica. If ulOptions contains DRS_ASYNC_OP, the server processes the request asynchronously. The
client has to include DRS_WRIT_REP in ulOptions if the specified NC replica is a full replica. The
server optionally replaces (as specified by ulModifyFields) serverAddress, schedule, and replicaFlags in
repsFrom with the corresponding value from pszSourceDRA, rtSchedule, and ulReplicaFlags.
ULONG
IDL_DRSReplicaModify(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPMOD *pmsgMod);
options: DRS_OPTIONS
nc: DSName
rf: RepsFrom
msgIn: DRS_MSG_REPMOD_V1
379 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ValidateDRSInput(hDrs, 7)
msgIn := pmsgMod^.V1
if rf = null then
return ERROR_DS_DRA_NO_REPLICA
endif
return 0
380 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.23 IDL_DRSReplicaSync (Opnum 2)
ULONG IDL_DRSReplicaSync(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPSYNC* pmsgSync
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.23.1.1 DRS_MSG_REPSYNC
The DRS_MSG_REPSYNC union defines the request messages sent to the IDL_DRSReplicaSync
method. Only one version, identified by dwVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPSYNC_V1 V1;
[case(2)]
DRS_MSG_REPSYNC_V2 V2;
} DRS_MSG_REPSYNC;
4.1.23.1.2 DRS_MSG_REPSYNC_V1
typedef struct {
[ref] DSNAME* pNC;
UUID uuidDsaSrc;
[unique] [string] char* pszDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPSYNC_V1;
381 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
uuidDsaSrc: The DSA GUID.
4.1.23.1.3 DRS_MSG_REPSYNC_V2
typedef struct {
[ref] DSNAME* pNC;
UUID uuidDsaSrc;
[unique] [string] char* pszDsaSrc;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_REPSYNC_V2;
correlationID: An identifier for the operation that the DC can use for implementation-defined
troubleshooting. There are no normative constraints on this value, nor does the value figure in any
normative processing rules.
Informative summary of behavior: The server starts or resumes a replication cycle by sending an
IDL_DRSGetNCChanges request to the specified DC. If ulOptions contains DRS_ASYNC_OP, the server
performs this operation asynchronously.
ULONG
IDL_DRSReplicaSync(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPSYNC *pmsgSync);
options: DRS_OPTIONS
nc: DSName
rf: sequence of RepsFrom
msgIn: DRS_MSG_REPSYNC_V1
err: ULONG
ValidateDRSInput(hDrs, 2)
382 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Validate input params */
options := msgIn.ulOptions
if msgIn.pNC = null
or (not DRS_SYNC_ALL in options /* See product behavior note below.*/
and msgIn.uuidDsaSrc = null
and msgIn.pszDsaSrc = null) then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
foreach r in rf
msgRequest: DRS_MSG_GETCHGREQ
cMaxObjects: ULONG
cMaxBytes: ULONG
versionRequestMsg: DWORD
outVersion: DWORD
msgOut: DRS_MSG_GETCHGREPLY
versionRequestMsg := The version number of the input message negotiated between the
client and server (section 4.1.10.4.1).
cMaxObjects := Implementation-specific value.
cMaxBytes := Implementation-specific value.
if DRS_UPDATE_NOTIFICATION in options
and not DRS_TWOWAY_SYNC in options
and DRS_NEVER_NOTIFY in r.V2.ulReplicaFlags then
return ERROR_DS_DRA_NO_REPLICA
endif
ReplicateNCRequestMsg(
hDrs,
versionRequestMsg,
nc,
r,
options,
cMaxObjects,
383 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cMaxBytes,
ADDR(msgRequest))
err := IDL_DRSGetNCChanges(
hDrsSrc,
versionRequestMsg,
msgRequest,
ADDR(outVersion),
ADDR(msgOut))
if err = 0
and not DRS_MAIL_REP in msgIn.ulOptions
then
Wait for the response, process it (section 4.1.10.6), send the next request,
etc., until the replication cycle is complete.
endif
endfor
return err
For information about Windows support for the DRS_SYNC_ALL flag, see the product behavior note in
section 5.41.
ULONG IDL_DRSReplicaVerifyObjects(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPVERIFYOBJ* pmsgVerify
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.24.1.1 DRS_MSG_REPVERIFYOBJ
384 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_REPVERIFYOBJ_V1 V1;
} DRS_MSG_REPVERIFYOBJ;
4.1.24.1.2 DRS_MSG_REPVERIFYOBJ_V1
typedef struct {
[ref] DSNAME* pNC;
UUID uuidDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPVERIFYOBJ_V1;
uuidDsaSrc: The objectGUID of the nTDSDSA object for the reference DC.
ulOptions: 0 to expunge each object that is not verified, or 1 to log an event that identifies each
such object.
4.1.24.2.1 GetRemoteUTD
procedure GetRemoteUTD(
dsa: DSName,
nc: DSName,
var uTDVec: UPTODATE_VECTOR_V1_EXT
): ULONG
The GetRemoteUTD procedure uses the IDL_DRSGetReplInfo method to remotely retrieve the
UPTODATE_VECTOR_V1_EXT for the NC with the DSName nc from the DC whose nTDSDSA object
has the DSName dsa. The procedure returns either an implementation-specific value from the client
implementation of the IDL_DRSGetReplInfo method, or the value returned by the remote server's
IDL_DRSGetReplInfo method.
4.1.24.2.2 ObjectExistsAtDC
procedure ObjectExistsAtDC(o: DSName, dsa: DSName): boolean
The ObjectExistsAtDC procedure checks that the object o exists on the DC whose nTDSDSA object
has the DSName dsa by verifying that the DC holds an object o' whose objectGUID value is equal to
that of object o. If the object exists, the procedure returns true; otherwise, the procedure returns
false.
385 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.24.3 Server Behavior of the IDL_DRSReplicaVerifyObjects Method
Informative summary of behavior: Let N be the NC pNC^, and let the reference DC be the DC
corresponding to the nTDSDSA object uuidDsaSrc.
For the purposes of this method, an object exists within an NC replica if it is either an object or a
tombstone.
Let S be the set of objects that exists in N at the server running IDL_DRSReplicaVerifyObjects at the
time IDL_DRSReplicaVerifyObjects begins processing. Let the set S' be S minus the members of S that
have never existed in N at the reference DC when IDL_DRSReplicaVerifyObjects begins processing.
The members of (S - S') are objects recently added to N on the server, since otherwise they would
have replicated to the reference DC. The set S' is computable using the replUpToDateVector for N at
the server and at the reference DC.
For each object o in S' that does not exist in N at the reference DC while IDL_DRSReplicaVerifyObjects
is processing, either expunge o at the server (if ulOptions = 0) or log an administrator-visible event at
the server (if ulOptions = 1).
ULONG IDL_DRSReplicaVerifyObjects(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_REPVERIFYOBJ *pmsgVerify)
err: ULONG
msgIn: DRS_MSG_REPVERIFYOBJ_V1
nc, refDsa, o: DSName
uTDServer, uTDRef, uTDMerge: UPTODATE_VECTOR_V1_EXT
sPrime: set of DSName
ValidateDRSInput(hDrs, 22)
386 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
uTDMerge := MergeUTD(uTDServer, uTDRef)
return 0
Windows behavior about the for loop is specified in the following citation:<37>
A client that has bound to DC1 is removing all lingering objects on this directory server with
respect to DC2.
A client has bound to DC1.CONTOSO.COM using the IDL_DRSBind method and received a
DRS_HANDLE to DC1.
387 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Users at DC1 Users at DC2 Notes
to DC2 yet.
Relevant entries of the DS_REPL_ATTR_META_DATA structure for each object listed above are also
captured below to further demonstrate the differences between DC1 and DC2.
388 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
usnLocalC uuidLastOriginatingDsaI usnOriginating ftimeLastOriginati dwVer pszAttribut
hange nvocationID Change ngChange sion eName
The UPTODATE_VECTOR_V1_EXT structures on DC1 and DC2 are also needed for the
IDL_DRSReplicaVerifyObjects method:
On DC1:
dwVersion: 1
dwReserved1: 0
cNumCursors: 2
dwReserved2: 0
First entry:
uuidDsa: 4875e25f-11a9-4c70-abf4-5fb39529f84b
usnHighPropUpdate: 14621
Second entry:
uuidDsa: 7526f625-51db-4022-8150-59c0286efd82
usnHighPropUpdate: 12448
On DC2:
dwVersion: 1
389 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwReserved1: 0
cNumCursors: 2
dwReserved2: 0
First entry:
uuidDsa: 4875e25f-11a9-4c70-abf4-5fb39529f84b
usnHighPropUpdate: 14107
Second entry:
uuidDsa: 7526f625-51db-4022-8150-59c0286efd82
usnHighPropUpdate: 12992
Finally, also relevant to IDL_DRSReplicaVerifyObjects is the nTDSDSA object for DC2 as seen
on DC1:
A client invokes the IDL_DRSReplicaVerifyObjects method on DC1 with the following parameters
(DRS_HANDLE to DC1 omitted):
dwVersion: 1
pmsgVerify:
uuidDsaSrc: e845e047-3850-4a82-8811-a0b9250863c6
ulOptions: 0
The IDL_DRSReplicaVerifyObjects method has removed all lingering objects on DC1 (but not on
DC2). The following table compares the Users container on DC1 and DC2 after the
IDL_DRSReplicaVerifyObjects method has been successfully returned.
390 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Users at DC1 Users at DC2 Notes
"Eva Corets"
was a lingering
object on DC1
and has been
expunged.
The IDL_DRSUnbind method destroys a context handle previously created by the IDL_DRSBind
method.
ULONG IDL_DRSUnbind(
[in, out, ref] DRS_HANDLE* phDrs
);
phDrs: A pointer to the RPC context handle returned by the IDL_DRSBind method. The value is set to
null on return.
391 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Exceptions Thrown: This method might throw the following exception beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE.
Informative summary of behavior: The server releases any resources associated with the context
handle, making the context handle unusable by the client. The server sets phDrs to null.
ULONG
IDL_DRSUnbind(
[in, out, ref] DRS_HANDLE *phDrs)
ValidateDRSInput(hDrs, 1)
phDrs^ := null
return 0
The IDL_DRSUpdateRefs method adds or deletes a value from the repsTo of a specified NC replica.
ULONG IDL_DRSUpdateRefs(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)]
DRS_MSG_UPDREFS* pmsgUpdRefs
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.26.1.1 DRS_MSG_UPDREFS
The DRS_MSG_UPDREFS union defines the request message versions sent to the IDL_DRSUpdateRefs
method. Only one version, identified by dwVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_UPDREFS_V1 V1;
[case(2)]
DRS_MSG_UPDREFS_V2 V2;
} DRS_MSG_UPDREFS;
392 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1: The version 1 request.
4.1.26.1.2 DRS_MSG_UPDREFS_V1
typedef struct {
[ref] DSNAME* pNC;
[ref] [string] char* pszDsaDest;
UUID uuidDsaObjDest;
ULONG ulOptions;
} DRS_MSG_UPDREFS_V1;
4.1.26.1.3 DRS_MSG_UPDREFS_V2
typedef struct {
[ref] DSNAME* pNC;
[ref] [string] char* pszDsaDest;
UUID uuidDsaObjDest;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_UPDREFS_V2;
correlationID: An identifier for the operation that the DC can use for implementation-defined
troubleshooting. There are no normative constraints on this value, nor does the value figure in any
normative processing rules.
Informative summary of behavior: If ulOptions contains DRS_ADD_REF, the server adds a value to the
repsTo of the specified NC replica; if ulOptions contains DRS_DEL_REF, the server deletes a value. If
these options are combined, the Delete operation is done before the Add operation; if a corresponding
value does not already exist, this is the same as if ulOptions contained DRS_ADD_REF but not
393 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_DEL_REF. The client includes DRS_WRIT_REP in ulOptions if the specified NC replica is writable.
The client specifies both pszDsaDest and uuidDsaObjDest to identify the value to be added or
removed. If ulOptions contains DRS_ASYNC_OP, the server processes the request asynchronously. If
the server adds a value to repsTo, the value has ulReplicaFlags equal to ulOptions ∩
{DRS_WRIT_REP}.
ULONG IDL_DRSUpdateRefs(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_UPDREFS *pmsgUpdRefs);
msgIn: DRS_MSG_UPDREFS_V1
options: DRS_OPTIONS
err: DWORD
nc: DSName
ValidateDRSInput(hDrs, 4)
if dwVersion ≠ 1 then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
msgIn := pmsgUpdRefs^.V1
options := msgIn.ulOptions
if msgIn.pNC = null or
(msgIn.pszDsaDest = null) or
(msgIn.uuidDsaObjDest = null) or
(options ∩ {DRS_ADD_REF, DRS_DEL_REF} = null)
return ERROR_DS_DRA_INVALID_PARAMETER
endif
nc := msgIn.pNC^
return err
394 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
This example shows how to add a new repsTo entry by calling IDL_DRSUpdateRefs (section 4.1.26)
with the DRS_ADD_REF parameter.
The repsTo attribute on the NC root object for domain NC CONTOSO.COM on DC1 does not contain
a value:
Matched DNs:
Getting 1 entry:
DC2 invokes the IDL_DRSUpdateRefs method against DC1, with the following parameters
(DRS_HANDLE to DC1 omitted):
dwVersion = 1
pszDsaDest: "5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM"
uuidDsaObjDest: 5fe84f18-3765-4ca3-b895-47802a7ab74f
Return code of 0.
The repsTo attribute on the NC root object for domain NC CONTOSO.COM on DC1 contains one
value:
Matched DNs:
Getting 1 entry:
V2.timeLastAttempt: 0, V2.ulResultLastAttempt: 0,
V2.cbOtherDraOffset: 216,
395 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V2.cbOtherDra: 376, V2.ulReplicaFlags: 16, V2.rtSchedule: <ldp:skipped>,
V2.usnvec.usnHighObjUpdate: 0, V2.usnvec.usnHighPropUpdate: 0,
V2.uuidDsaObj: 5fe84f18-3765-4ca3-b895-47802a7ab74f
V2.uuidInvocId: 00000000-0000-0000-0000-000000000000
V2.uuidTransportObj: 00000000-0000-0000-0000-000000000000
V2.cbPASDataOffset: 0
V2~PasData: (none)
v2~pdsa_rpc_inst
v2.pszDSIServer 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
v2.pszDSIAnnotation (null)
v2.pszDSIInstance 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
v2.pguidDSIInstance (null);
This example shows how to semantically update an existing repsTo entry by calling
IDL_DRSUpdateRefs with the DRS_ADD_REF and DRS_DEL_REF parameters.
returns
Getting 1 entry:
V2.cbOtherDraOffset: 216,
V2.usnvec.usnHighObjUpdate: 0, v2.usnvec.usnHighPropUpdate:0
V2.pszUuidDsaObj: 5fe84f18-3765-4ca3-b895-47802a7ab74f
V2.pszUuidInvocId: 00000000-0000-0000-0000-000000000000
V2.pszUuidTransportObj: 00000000-0000-0000-0000-000000000000
V2~pdsa_rpc_inst
396 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V2.pszDSIServer 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
V2.pszDSIAnnotation (null)
V2.pszDSIInstance 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
V2.pguidDSIInstance (null)
A client invokes the IDL_DRSUpdateRefs (section 4.1.26) method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted).
dwVersion = 1
pszDsaDest : "5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.contoso.com"
Return code of 0.
returns
Getting 1 entry:
V2.timeLastAttempt: 0, V2.ulResultLastAttempt: 0,
V2.cbOtherDraOffset: 216,
V2.usnvec.usnHighObjUpdate: 0, v2.usnvec.usnHighPropUpdate:0
V2.pszUuidDsaObj: 5fe84f18-3765-4ca3-b895-47802a7ab74f
V2.pszUuidInvocId: 00000000-0000-0000-0000-000000000000
V2.pszUuidTransportObj: 00000000-0000-0000-0000-000000000000
v2~pdsa_rpc_inst
397 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
v2.pszDSIServer 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
v2.pszDSIAnnotation (null)
v2.pszDSIInstance 5fe84f18-3765-4ca3-b895-47802a7ab74f._msdcs.CONTOSO.COM
v2.pguidDSIInstance (null);
ULONG IDL_DRSVerifyNames(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_VERIFYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_VERIFYREPLY* pmsgOut
);
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.27.1.1 DRS_MSG_VERIFYREQ
The DRS_MSG_VERIFYREQ union defines the request messages sent to the IDL_DRSVerifyNames
method. Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_VERIFYREQ_V1 V1;
} DRS_MSG_VERIFYREQ;
4.1.27.1.2 DRS_MSG_VERIFYREQ_V1
398 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_VERIFYREQ_V1 structure defines a request message sent to the IDL_DRSVerifyNames
method.
typedef struct {
DWORD dwFlags;
[range(1,10000)] DWORD cNames;
[size_is(cNames)] DSNAME** rpNames;
ATTRBLOCK RequiredAttrs;
SCHEMA_PREFIX_TABLE PrefixTable;
} DRS_MSG_VERIFYREQ_V1;
dwFlags: The type of name to be verified; MUST have one of the following values:
Value Meaning
RequiredAttrs: The list of attributes to be retrieved for each name that is verified.
PrefixTable: The prefix table used to translate ATTRTYP values in RequiredAttrs to OID values.
4.1.27.1.3 DRS_MSG_VERIFYREPLY
The DRS_MSG_VERIFYREPLY union defines the response messages received from the
IDL_DRSVerifyNames method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_VERIFYREPLY_V1 V1;
} DRS_MSG_VERIFYREPLY;
4.1.27.1.4 DRS_MSG_VERIFYREPLY_V1
typedef struct {
DWORD error;
[range(0,10000)] DWORD cNames;
399 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[size_is(cNames)] ENTINF* rpEntInf;
SCHEMA_PREFIX_TABLE PrefixTable;
} DRS_MSG_VERIFYREPLY_V1;
rpEntInf: An array of ENTINF structures that contain the attributes requested in the
RequiredAttrs field of the input DRS_MSG_VERIFYREQ_V1 structure if the corresponding name is
verified.
PrefixTable: The prefix table used to translate ATTRTYP values in the response to OIDs.
Informative summary of behavior: The server resolves each of a sequence of object names and
returns its DSName and the values of zero or more of its attributes. The type of the input object
name is indicated by the dwFlags field in the request. The IDL_DRSVerifyNames method verifies the
names of both deleted and normal objects.
ULONG
IDL_DRSVerifyNames(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_VERIFYREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_VERIFYREPLY *pmsgOut);
msgIn: DRS_MSG_VERIFYREQ_V1
msgOut: DRS_MSG_VERIFYREPLY_V1
nc, d: DSName
o: sequence of DSName
i, j, k: int
domainName, username: unicodestring
done: boolean
attribute: ATTRTYP
FilterPAS: PARTIAL_ATTR_VECTOR_V1_EXT
GCPas: PARTIAL_ATTR_VECTOR_V1_EXT
referredDomain: unicodestring
ValidateDRSInput(hDrs, 8)
pdwOutVersion^ := 1
pmsgOut^.V1.error := 0
pmsgOut^.V1.cNames := 0
pmsgOut^.V1.rpEntInf := null
pmsgOut^.V1.PrefixTable.PrefixCount := 0
pmsgOut^.V1.PrefixTable.pPrefixEntry := null
400 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if msgIn.cNames > 0 and msgIn.rpNames = null then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
if (msgIn.dwFlags = DRS_VERIFY_SIDS or
msgIn.dwFlags = DRS_VERIFY_SAM_ACCOUNT_NAMES or
msgIn.dwFlags = DRS_VERIFY_FPOS) and
not IsGC() then
return ERROR_DS_GC_REQUIRED
endif
if msgIn.dwFlags = DRS_VERIFY_DSNAMES and not IsGC() then
for i := 0 to msgIn.cNames-1
if DefaultNC() ≠ GetObjectNC(msgIn.rpNames[i]^) then
return ERROR_DS_GC_REQUIRED
endif
endfor
endif
/* Compute output */
msgOut.PrefixTable := dc.prefixTable
for i := 0 to msgIn.cNames - 1
d := msgIn.rpNames[i]
o := null
done := false
if not done
/* locate object or objects in question */
if msgIn.dwFlags = DRS_VERIFY_DSNAMES then
if ObjExists(d) then
o := {d}
endif
else if msgIn.dwFlags = DRS_VERIFY_SIDS then
o := select all v from all-ts-included
where v!objectSid = d.sid and
foreignSecurityPrincipal not in v!objectClass
else if msgIn.dwFlags = DRS_VERIFY_SAM_ACCOUNT_NAMES then
if domainName ≠ null and username ≠ null then
nc := select one v from all
where v!nETBIOSName = domainName and GetObjectNC(v)= v
/* The following query returns both normal objects
and tombstones */
o := select all v from subtree-ts-included nc where
v!sAMAccountName = username
else
o := select all v from all-ts-included
where v!userPrincipalName =
d.dn
401 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
else if msgIn.dwFlags = DRS_VERIFY_FPOS then
o := select all v from all-ts-included
where v!objectSid = d.sid
and foreignSecurityPrincipal in v!objectClass
endif
FilterPas := FilteredPAS()
GCPas := GCPAS()
for j := 0 to msgIn.RequiredAttrs.AttrCount - 1
if AmILHServer() then
if (not (msgIn.RequiredAttrs.pAttr[j].AttrType in FilterPas
&&
msgIn.RequiredAttrs.pAttr[j].AttrType in GCPas))
then
/* skip requested attributes not part of both FilterPAS
and GCPas */
msgOut.rpEntInf[i] := null
continue;
endif
else
/* pre-LH server */
if (not (msgIn.RequiredAttrs.pAttr[j].AttrType in GCPas))
then
/* skip requested attributes not part of GCPas */
msgOut.rpEntInf[i] := null
continue;
endif
endif
attribute := LocalAttidFromRemoteAttid(
msgIn.PrefixTable,
msgIn.RequiredAttrs.pAttr[j].attrTyp)
msgOut.rpEntInf[i].AttrBlock.pAttr[j].attrTyp := attribute
k := 0
foreach val in GetAttrVals(o, attribute, false)
msgOut.rpEntInf[i].AttrBlock.pAttr[j].AttrVal.pAVal :=
ADR(ATTRVALFromValue(val,
Syntax(attribute),
dc.prefixTable))
msgOut.rpEntInf[i].AttrBlock.pAttr[j].AttrVal.valCount :=
k + 1
endfor
endfor
else
msgOut.rpEntInf[i] := null
endif
endif
endfor /* i := */
pmsgOut^.V1 := msgOut
return 0
402 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.27.3 Examples of the IDL_DRSVerifyNames Method
Getting 1 entries:
To get a user's SID, DC2 invokes the IDL_DRSVerifyNames method against DC1 with the following
parameters (DRS_HANDLE to DC1 omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_VERIFYREQ_V1
dwFlags: 2
cNames: 1
rpNames: DSNAME
RequiredAttrs: ATTRBLOCK
attrCount: 3
pAttr: ATTR
sAMAccountType
objectSid
sAMAccountName
The server responds with a return code of 0 and the following values:
pMsgOut = DRS_MSG_VERIFYREPLY_V1
cNames: 1
rpEntInf: ENTINF
pName: DSNAME
403 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Guid: GUID {772cf177-00f8-45ed-9c72-5e5206bead02}
SID: S-1-5-21-3263199975-614030967-162443871-1603
ulFlags: ENTINF_FROM_MASTER
AttrBlock: ATTRBLOCK
sAMAccountType: 0x30000000
objectSid: S-1-5-21-3263199975-614030967-162443871-1603
sAMAccountName: JaneDow
PrefixTable: SCHEMA_PREFIX_TABLE
No change in state.
ULONG IDL_DRSWriteSPN(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_SPNREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_SPNREPLY* pmsgOut
);
dwInVersion: The version of the request message. Must be set to 1, because that is the only version
supported.
pdwOutVersion: A pointer to the version of the response message. The value must be 1 because
that is the only version supported.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, ERROR_DS_DIFFERENT_REPL_EPOCHS, and
ERROR_INVALID_PARAMETER.
4.1.28.1.1 DRS_MSG_SPNREQ
404 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DRS_MSG_SPNREQ union defines the request messages sent to the IDL_DRSWriteSPN method.
Only one version, identified by dwInVersion = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_SPNREQ_V1 V1;
} DRS_MSG_SPNREQ;
4.1.28.1.2 DRS_MSG_SPNREQ_V1
typedef struct {
DWORD operation;
DWORD flags;
[string] const WCHAR* pwszAccount;
[range(0,10000)] DWORD cSPN;
[string, size_is(cSPN)] const WCHAR** rpwszSPN;
} DRS_MSG_SPNREQ_V1;
operation: The SPN operation to perform. MUST be one of the DS_SPN_OPERATION values.
4.1.28.1.3 DRS_MSG_SPNREPLY
The DRS_MSG_SPNREPLY union defines the response messages received from the IDL_DRSWriteSPN
method. Only one version, identified by pdwOutVersion^ = 1, is currently defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_SPNREPLY_V1 V1;
} DRS_MSG_SPNREPLY;
4.1.28.1.4 DRS_MSG_SPNREPLY_V1
typedef struct {
DWORD retVal;
} DRS_MSG_SPNREPLY_V1;
405 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
retVal: 0, or a Windows error code.
4.1.28.1.5 DS_SPN_OPERATION
Value Meaning
DS_SPN_REPLACE_SPN_OP Removes all the existing SPNs, then adds the specified values. If the set of
(0x00000001) specified values is empty (cSPN is zero), no values are added.
4.1.28.2.1 ExecuteWriteSPNRemotely
procedure ExecuteWriteSPNRemotely(
DWORD dwInVersion,
DRS_MSG_SPNREQ *pmsgIn,
DWORD *pdwOutVersion,
DRS_MSG_SPNREPLY *pmsgOut): ULONG
This procedure is executed only on an RODC. It finds a DC that holds a full NC replica of the
domain NC of the RODC, performs the IDL_DRSWriteSPN RPC method call with the given parameters
against the DC in the client's security context, and returns the value returned by that RPC call.
Adds a non-empty set of SPNs to the object's servicePrincipalName. If a member of the set is
already present on the object's servicePrincipalName, it is ignored.
Removes all current values from the object's servicePrincipalName, then adds a (possibly empty)
set of SPNs to the object's servicePrincipalName.
Removes a non-empty set of SPNs from the object's servicePrincipalName. If a member of the set
is not present on the object's servicePrincipalName, it is ignored.
The effect of this method can be achieved by an LDAP Modify operation to the servicePrincipalName
attribute of an object. Some manipulations of the servicePrincipalName attribute that cannot be
406 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
performed using this method can be performed using LDAP Modify. For example, an LDAP Modify can
remove one specific SPN from the servicePrincipalName attribute while adding another SPN to the
servicePrincipalName attribute in the same transaction; IDL_DRSWriteSPN cannot do this.
ULONG
IDL_DRSWriteSPN(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_SPNREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_SPNREPLY *pmsgOut);
accountDN: unicodestring
account: DSName
err: DWORD
operation: DS_SPN_OPERATION
cSPN: integer
spnSet: set of unicodestring
instanceName: unicodestring
ValidateDRSInput(hDrs, 13)
pdwOutVersion^ := 1
pmsgOut^.V1.retVal := 0
accountDN := pmsgIn^.V1.pwszAccount
operation := pmsgIn^.V1.operation
cSPN := pmsgIn^.V1.cSPN
spnSet := pmsgIn^.V1.rpwszSPN
407 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* The empty string is an invalid SPN. */
foreach spn in spnSet
if spn = null or spn = "" then
pmsgOut^.V1.retVal := ERROR_INVALID_PARAMETER
return ERROR_INVALID_PARAMETER
endif
endfor
account := GetDSNameFromDN(accountDN);
if not ObjExists(account) then
pmsgOut^.V1.retVal := ERROR_DS_OBJ_NOT_FOUND
return ERROR_DS_OBJ_NOT_FOUND
endif
/* Must be DS_SPN_REPLACE_SPN_OP.
* Remove all existing SPNs, then add in the specified SPNs. */
account!servicePrincipalName := {null}
foreach spn in spnSet
account!servicePrincipalName :=
account!servicePrincipalName + {spn}
endfor
return 0
The IDL_DRSAddCloneDC method is used to create a new DC object by copying attributes from an
existing DC object.
ULONG IDL_DRSAddCloneDC(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ ADDCLONEDCREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ ADDCLONEDCREPLY* pmsgOut
);
408 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
hDrs: The RPC context handle returned by the IDL_DRSBind method.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, and ERROR_INVALID_PARAMETER.
4.1.29.1.1 DRS_MSG_ADDCLONEDCREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_ADDCLONEDCREQ_V1 V1;
} DRS_MSG_ADDCLONEDCREQ;
4.1.29.1.2 DRS_MSG_ADDCLONEDCREQ_V1
typedef struct {
[string] const WCHAR* pwszCloneDCName;
[string] const WCHAR* pwszSite;
} DRS_MSG_ADDCLONEDCREQ_V1;
pwszSite: The RDN of the site the new DC will be placed into.
4.1.29.1.3 DRS_MSG_ADDCLONEDCREPLY
The DRS_MSG_ADDCLONEDCREPLY union defines the response messages received from the
IDL_DRSAddCloneDC method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_ADDCLONEDCREPLY_V1 V1;
} DRS_MSG_ADDCLONEDCREPLY;
409 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
V1: The version 1 response.
4.1.29.1.4 DRS_MSG_ADDCLONEDCREPLY_V1
typedef struct {
[string] WCHAR* pwszCloneDCName;
[string] WCHAR* pwszSite;
[range(0,1024)] DWORD cPasswordLength;
[size_is(cPasswordLength)] WCHAR* pwsNewDCAccountPassword;
} DRS_MSG_ADDCLONEDCREPLY_V1;
4.1.29.2.1 GetKeyLength
procedure GetKeyLength(hDrs: DRS_HANDLE): integer
Returns the key length, in bits, of the encryption used on the hDrs connection. Returns 0 if no
encryption is in use on the connection.
4.1.29.2.2 DNMap
type DNMap : Map {originalObj : DSName} to {newObj : DSName}
4.1.29.2.3 DCInfo
typedef struct {
string Name;
string dnsHostName;
SID Sid;
} DCInfo;
4.1.29.2.4 TranslationInfo
Represents translation from the original domain controller to the new domain controller.
410 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
DCInfo OriginalDC;
DCInfo NewDC;
DNMap objMap;
} TranslationInfo;
objMap: The map of the original DC-related DNs to the new DC-related DN.
4.1.29.2.5 ReplaceName
ReplaceName(stringValue : string, originalName : string, newName : string) : string
Replaces all occurrences of originalName in stringValue with newName, and returns the resulting
string.
4.1.29.2.6 ReplaceSIDInSecurityDescriptor
ReplaceSIDInSecurityDescriptor(sd : SECURITY_DESCRIPTOR, originalSid : SID, newSid : SID)
: SECURITY_DESCRIPTOR
Creates a copy of security descriptor sd, replaces all occurrences of originalSid with newSid in the
security descriptor, and returns the new security descriptor.
4.1.29.2.7 GetPrincipalSid
GetPrincipalSid(clientCreds : ClientAuthorizationInfo) : SID
4.1.29.2.8 GenerateNewKrbTgtAcct
GenerateNewKrbTgtAcct() : DSName
Generates a Kerb Tgt user account in the local domain controller (local DC) using the same steps
as [MS-ADTS] section 3.1.1.3.4.1.23. The following steps are performed by this abstract procedure:
Selects a value in the range [1 .. 65535] that is not currently present as a value of the msDS-
SecondaryKrbTgtNumber attribute on any object in this domain, and assigns the value to the
msDS-SecondaryKrbTgtNumber attribute of the created object. If no such value exists, the result
is the error other / ERROR_NO_SYSTEM_RESOURCES.
The selected value for msDS-SecondaryKrbTgtNumber is appended (in decimal form) to the string
"krbtgt", and the resulting string is assigned to the sAMAccountName attribute on the created
object.
411 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The object's account password is set to a randomly generated value that satisfies all criteria in
[MS-SAMR] section 3.1.1.7.2 and is processed as described in [MS-SAMR] section 3.1.1.8.5.
4.1.29.2.9 DuplicateObject
Procedure DuplicateObject (
originalObj : DSName,
newObjParent : DSName,
newObjRdn : string,
tlInfo : TranslationInfo) : DSName
Informative summary of behavior: This procedure creates a new object by copying data from an
existing object. When copying data, it replaces any reference to the original DC in the object data with
a reference to the new DC. The new object is created under newObjectParent and its RDN is set to
newObjRdn.
Procedure DuplicateObject (
originalObj : DSName,
newObjParent : DSName,
newObjRdn : string,
tlInfo : TranslationInfo) : DSName
newObj : DSName
forwardLinkAttribute : string
referenceObj : DSName
412 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
tlInfo.OriginalDC.dnsHostName,
tlInfo.newDC.dnsHostName)
newObj!servicePricipalName :=
newObj!servicePricipalName +
{newServicePrincipalName}
endif
endfor
else if attribute = invocationId then
newObj!invocationId := a random guid
else if attribute = nTSecurityDescriptor then
if tlInfo.newDC.Sid ≠ null then
newObj!nTSecurityDescriptor := ReplaceSIDInSecurityDescriptor (
originalDC!nTSecurityDescriptor, tlInfo.originalDC.Sid,
tlInfo.newDC.Sid)
endif
endif
endfor
Informative summary of behavior: The IDL_DRSAddCloneDC method is used to create a new domain
controller (DC) by duplicating the states of the original DC. The states of a DC are composed of
computer, server, NTDS settings, FRS, DFSR, and connection objects that are maintained for each
DC. When duplicating an object, this RPC method replaces all references to the original DC with
corresponding objects of the new DC. The caller has to have the control access right DS-Clone-
Domain-Controller on the default NC. When called, this RPC method:
2. Creates new account and other objects for the new domain controller account by copying
information from the existing domain controller.
3. Returns the name, site, and password for the new domain controller to the client.
ULONG
IDL_DRSAddCloneDC(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ADDCLONEDCREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDCLONEDCREPLY *pmsgOut)
413 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
msgIn: DRS_MSG_ADDCLONEDCREQ_V1
clientCreds: ClientAuthorizationInfo
tlInfo: TranslationInfo
callerSid: SID
isRodc: boolean
computerObj: DSName
originalDCSrvObj: DSName
originalDCSiteObj: DSName
originalDCServersObj: DSName
originalDSAObj: DSName
newDCComputerObj: DSName
newDCSiteObj: DSName
newDCServersObj: DSName
newDCServerObj: DSName
newDSAObj: DSName
ValidateDRSInput(hDrs, 28)
pdwOutVersion^ := 1
pmsgOut^.V1.pwszCloneDCName := null
pmsgOut^.V1.pwszSite := null
pmsgOut^.V1.cPasswordLength := 0
pmsgOut^.V1.pwsNewDCAccountPassword := null
if dwInVersion ≠ 1 then
return ERROR_DS_DRA_INVALID_PARAMETER
endif
msgIn := pmsgIn^.V1
callerSid := GetPrincipalSid(clientCreds)
tlInfo.OriginalDC.Name := computerObj!sAMAccountName.Remove('$')
414 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
newDCName : string
if not exists(
select o from all where o!sAMAccountName = (newDCName + '$')
) then
found := true
break
endif
endfor
if not found then
return ERROR_DS_UNWILLING_TO_PERFORM
endif
tlInfo.newDC.Name := newDCName
else
tlInfo.newDC.Name := msgIn.pwszCloneDCName
endIf
tlInfo.OriginalDC.Sid := computerObj!objectSid
tlInfo.OriginalDC.dnsHostName := computerObj!dNSHostName
if isRodc then
newKrbTgtAcct : DSName
newKrbTgtAcct := GenerateNewKrbTgtAcct()
tlInfo.objMap[computerObj!msDS-KrbTgtLink] := newKrbTgtAcct
endif
415 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Duplicate the server object */
newDCServerObj := DescendantObject(newDCServersObj,
"CN=" + tlInfo.newDC.Name)
if isRodc then
newConnObj: DSName
topologyObj: DSName
originalDFSRObj: DSName
newDFSRObj: DSName
frsSysvolObj: DSName
originalFRSObj: DSName
newfrsObj : DSName
pmsgOut^.V1.pwszCloneDCname := tlInfo.newDC.Name
pmsgOut^.V1.cPasswordLength := 120
pmsgOut^.V1.pwsNewDCAccountPassword:= a 120-byte sequence of randomly
generated characters between ASCII 32 (space) and ASCII 122 ('z')
pmsgOut^.V1.pwszSite := newDCSiteObj!name
return 0
416 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.1.29.4 Examples of the IDL_DRSAddCloneDC Method
DC1 invokes the IDL_DRSAddCloneDC method on the PDC to create a cloned domain controller
account "DC1Clone1" in the CONTOSO.COM domain NC.
Querying the DC1 computer object in domain NC DC=CONTOSO, DC=COM by performing an LDAP
search with base scope on the DN "CN=DC1,OU=Domain Controllers,DC=contoso,DC=com":
Matched DNs:
Getting 1 entries:
1> badPwdCount: 0;
1> codePage: 0;
1> countryCode: 0;
1> localPolicyFlags: 0;
417 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> logonCount: 17;
ldap_search_s(ld, "CN=ALPHA10,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com", 2, "(objectClass=*)", attrList, 0,
&msg)
Getting 5 entries:
>>Dn: CN=DC1,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=contoso,DC=com
418 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> name: DC1;
1> msDS-Behavior-Version: 5;
3> msDS-HasInstantiatedNCs:
B:8:0000000D:CN=Schema,CN=Configuration,DC=contoso,DC=com;
B:8:0000000D:CN=Configuration,DC=contoso,DC=com;
B:8:00000005:DC=contoso,DC=com;
419 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> serverReferenceBL: CN=DC1,CN=Domain System Volume (SYSVOL share),CN=File
Replication Service,CN=System,DC=contoso,DC=com;
3> mS-DS-ReplicatesNCReason:
B:8:00000008:CN=Schema,CN=Configuration,DC=contoso,DC=com;
B:8:00000008:DC=contoso,DC=com;
B:8:00000008:CN=Configuration,DC=contoso,DC=com;
420 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> whenChanged: 7/22/2011 3:25:14 PM Pacific Daylight Time;
DC1 invokes the IDL_DRSAddCloneDC method against the PDC with the following parameters
(DRS_HANDLE is omitted):
dwInVersion = 1
pmsgIn = DRS_MSG_ADDCLONEDCREQ_V1
pwszCloneDCName = "DC1Clone1"
pwszSite = Site1
pdwOutVersion^ = 1
pmsgOut = DRS_MSG_ADDCLONEDCREPLY_V1
pwszCloneDCname: DC1Clone1
pwszSite: Site1
cPasswordLength: 120
pwsNewDCAccountPassword: "a;adoba01>...4ei1283-0"
After the clone operation, objects for a new domain controller "DC1Clone1" are present in the
CONTOSO.COM domain, querying the PDC as follows:
Matched DNs:
Getting 1 entries:
421 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1> uSNCreated: 12291;
1> codePage: 0;
1> countryCode: 0;
1> localPolicyFlags: 0;
ldap_search_s(ld,
"CN=ALPHA10,CN=Servers,CN=Site1,CN=Sites,CN=Configuration,DC=contoso,DC=com", 2,
"(objectClass=*)", attrList, 0, &msg)
Getting 5 entries:
422 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
>>Dn: CN=DC1CLONE1,CN=Servers,CN=Site1,CN=Sites,CN=Configuration,DC=contoso,DC=com
1> distinguishedName:
CN=DC1CLONE1,CN=Servers,CN=Site1,CN=Sites,CN=Configuration,DC=contoso,DC=com;
1> msDS-Behavior-Version: 5;
3> msDS-HasInstantiatedNCs:
B:8:0000000D:CN=Schema,CN=Configuration,DC=contoso,DC=com;
423 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
B:8:0000000D:CN=Configuration,DC=contoso,DC=com;
B:8:00000005:DC=contoso,DC=com;
ULONG IDL_DRSWriteNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_WRITENGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_WRITENGCKEYREPLY* pmsgOut
);
dwInVersion: The version of the request message. Must be set to 1, because that is the only version
supported.
pdwOutVersion: A pointer to the version of the response message. The value must be 1 because
that is the only version supported.
424 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, and ERROR_INVALID_PARAMETER.
4.1.30.1.1 DRS_MSG_WRITENGCKEYREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_WRITENGCKEYREQ_V1 V1;
} DRS_MSG_WRITENGCKEYREQ;
4.1.30.1.2 DRS_MSG_WRITENGCKEYREQ_V1
4.1.30.1.3 DRS_MSG_WRITENGCKEYREPLY
The DRS_MSG_WRITENGCKEYREPLY union defines the response messages received from the
IDL_DRSWriteNgcKey method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_WRITENGCKEYREPLY_V1 V1;
} DRS_MSG_WRITENGCKEYREPLY;
4.1.30.1.4 DRS_MSG_WRITENGCKEYREPLY_V1
425 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct _DRS_MSG_WRITENGCKEYREPLY_V1{
DWORD retVal;
} DRS_MSG_WRITENGCKEYREPLY_V1;
4.1.30.2.1 AccessCheckWriteToKeyCredentialLinkAttribute
procedure AccessCheckWriteToKeyCredentialLinkAttribute (
obj: DSName,
newValue: boolean) : ULONG
if AccessCheckAttr(obj,
msDS-KeyCredentialLink,
RIGHT_DS_WRITE_PROPERTY) then
return ERROR_SUCCESS
else
if AccessCheckAttr(obj,
msDS-KeyCredentialLink,
RIGHT_DS_WRITE_PROPERTY_EXTENDED) then
/* Extended write access permits the attribute to be written */
* provided certain constraints are met. */
isSelf: boolean
existingValue: boolean
if (!(computer in obj!objectClass))
return ERROR_DS_INSUFF_ACCESS_RIGHTS
endif
if (obj!ObjectSid = ClientAuthorizationInfo!UserSid)
isSelf := true
else
isSelf := false
endif
if (obj!msDS-KeyCredentialLink = NULL)
existingValue := false
else
existingValue := true
endif
4.1.30.2.2 ComposeKeyCredentialLinkForComputer
426 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure ComposeKeyCredentialLinkForComputer (
obj: DSName,
keyValue: array of UCHAR) : DNBinary
keyDNBinary : DNBinary
keyBinary: array of UCHAR
keyBlob: KEYCREDENTIALLINK_BLOB
keyEntry: KEYCREDENTIALLINK_ENTRY
hashOffset: DWORD
hashValueOffset: DWORD
now: FILETIME
keyBlob!Version := KEY_CREDENTIAL_LINK_VERSION_2
// Add KeyID
keyEntry!Length := 32
keyEntry!Identifier := KeyID
keyEntry!Value := SHA256(keyValue)
// Add KeyHash
keyEntry!Length := 32
keyEntry!Identifier := KeyHash
keyEntry!Value := 32-byte array of UCHAR
// Add KeyMaterial
keyEntry!Length = length(keyValue)
keyEntry!Identifier = KeyMaterial
keyEntry!Value = keyValue
// Add KeyUsage
keyEntry!Length := 1
keyEntry!Identifier := KeyUsage
keyEntry!Value := 1
// Add KeySource
keyEntry!Length := 1
keyEntry!Identifier := KeySource
keyEntry!Value := 0
// Add KeyApproximateLastLogonTimeStamp
keyEntry!Length := sizeof(FILETIME)
427 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
keyEntry!Identifier := KeyApproximateLastLogonTimeStamp
keyEntry!Value := now
// Add KeyCreationTime
keyEntry!Length := sizeof(FILETIME)
keyEntry!Identifier := KeyCreationTime
keyEntry!Value := now
// Compute and store the KeyHash value now that all subsequent fields are present
keyEntry := keyBinary + hashOffset
keyEntry!Value := SHA256(keyBinary[hashValueOffset .. (length(keyBinary)-1)])
keyDNBinary!DN := obj
keyDNBinary!Binary := keyBinary
return keyDNBinary
The effect of this method can be achieved by an LDAP Modify operation to the msDS-
KeyCredentialLink attribute of an object.
ULONG IDL_DRSWriteNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_WRITENGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_WRITENGCKEYREPLY* pmsgOut);
accountDN: unicodestring
account: DSName
keyValue : array of UCHAR
err: DWORD
key: DNBinary
ValidateDRSInput(hDrs, 29)
pdwOutVersion^ := 1
428 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut^.V1.retVal := 0
accountDN := pmsgIn^.V1.pwszAccount
keyValue := pmsgIn^.V1.pNgcKey
account := GetDSNameFromDN(accountDN);
if not ObjExists(account) then
pmsgOut^.V1.retVal := ERROR_DS_OBJ_NOT_FOUND
return ERROR_DS_OBJ_NOT_FOUND
endif
return 0
The IDL_DRSReadNgcKey method reads and parses the msDS-KeyCredentialLink value on an object.
ULONG IDL_DRSReadNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_READNGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_READNGCKEYREPLY* pmsgOut
);
dwInVersion: The version of the request message. Must be set to 1, because that is the only version
supported.
pdwOutVersion: A pointer to the version of the response message. The value must be 1 because
that is the only version supported.
429 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgOut: A pointer to the response message.
Exceptions Thrown: This method might throw the following exceptions beyond those thrown by the
underlying RPC protocol (as specified in [MS-RPCE]): ERROR_INVALID_HANDLE,
ERROR_DS_DRS_EXTENSIONS_CHANGED, and ERROR_INVALID_PARAMETER.
4.1.31.1.1 DRS_MSG_READNGCKEYREQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_READNGCKEYREQ_V1 V1;
} DRS_MSG_READNGCKEYREQ;
4.1.31.1.2 DRS_MSG_READNGCKEYREQ_V1
4.1.31.1.3 DRS_MSG_READNGCKEYREPLY
The DRS_MSG_READNGCKEYREPLY union defines the response messages received from the
IDL_DRSReadNgcKey method. Only one version, identified by pdwOutVersion^ = 1, is currently
defined.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_READNGCKEYREPLY_V1 V1;
} DRS_MSG_READNGCKEYREPLY;
4.1.31.1.4 DRS_MSG_READNGCKEYREPLY_V1
430 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DWORD retVal;
[range(0,0xFFFF)] DWORD cNgcKey;
[size_is(cNgcKey)] UCHAR * pNgcKey;
} DRS_MSG_READNGCKEYREPLY_V1;
ULONG IDL_DRSReadNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_READNGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_READNGCKEYREPLY* pmsgOut);
accountDN: unicodestring
account: DSName
keyValue : array of UCHAR
err: DWORD
key: DNBinary
keyBinary: array of BYTE
keyBlob: KEYCREDENTIALLINK_BLOB
keyEntry: KEYCREDENTIALLINK_ENTRY
offset: DWORD
ValidateDRSInput(hDrs, 30)
pdwOutVersion^ := 1
pmsgOut^.V1.retVal := 0
accountDN := pmsgIn^.V1.pwszAccount
account := GetDSNameFromDN(accountDN);
431 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if not ObjExists(account) then
pmsgOut^.V1.retVal := ERROR_DS_OBJ_NOT_FOUND
return ERROR_DS_OBJ_NOT_FOUND
endif
if (keyBlob!Version != KEY_CREDENTIAL_LINK_VERSION_2)
continue
endif
if (keyEntry!Identifer = KeyMaterial)
keyValue := keyEntry!Value
break
endif
endwhile
if (keyValue != NULL)
break
endif
endfor
if (keyValue == NULL)
return ERROR_DS_OBJ_NOT_FOUND
endif
pmsgOut^.V1.pNgcKey := keyValue
pmsgOut^.V1.cNgcKey := length(keyValue)
return 0
This section specifies the methods for the dsaop RPC interface of the DRS Remote Protocol, in
addition to the processing rules. This interface is available only when msDS-UpdateScript contains a
valid value, where the validation criterion is implementation-specific.
Method Description
432 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
For information on the order of method calls, see section 1.3.2.
ULONG IDL_DSAPrepareScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_PREPARE_SCRIPT_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_PREPARE_SCRIPT_REPLY* pmsgOut
);
4.2.1.1.1 DSA_MSG_PREPARE_SCRIPT_REQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DSA_MSG_PREPARE_SCRIPT_REQ_V1 V1;
} DSA_MSG_PREPARE_SCRIPT_REQ;
4.2.1.1.2 DSA_MSG_PREPARE_SCRIPT_REQ_V1
typedef struct {
DWORD Reserved;
} DSA_MSG_PREPARE_SCRIPT_REQ_V1;
433 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
4.2.1.1.3 DSA_MSG_PREPARE_SCRIPT_REPLY
The DSA_MSG_PREPARE_SCRIPT_REPLY union defines the response messages received from the
IDL_DSAPrepareScript method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DSA_MSG_PREPARE_SCRIPT_REPLY_V1 V1;
} DSA_MSG_PREPARE_SCRIPT_REPLY;
4.2.1.1.4 DSA_MSG_PREPARE_SCRIPT_REPLY_V1
typedef struct {
DWORD dwOperationStatus;
[string] LPWSTR pwErrMessage;
[range(0,1024)] DWORD cbPassword;
[size_is(cbPassword)] BYTE* pbPassword;
[range(0,10485760)] DWORD cbHashBody;
[size_is(cbHashBody)] BYTE* pbHashBody;
[range(0,10485760)] DWORD cbHashSignature;
[size_is(cbHashSignature)] BYTE* pbHashSignature;
} DSA_MSG_PREPARE_SCRIPT_REPLY_V1;
4.2.1.2.1 GetKeyLengthHandleT
procedure GetKeyLengthHandleT(hRpc: handle_t): integer
Returns the key length, in bits, of the encryption used on the hRpc connection. Returns 0 if no
encryption is in use on the connection.
4.2.1.2.2 PrepareScriptInProgress
434 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure PrepareScriptInProgress(): boolean
Returns true if an instance of the IDL_DSAPrepareScript() method is already executing, and false
otherwise.
4.2.1.2.3 PrepareScriptVerifyScript
procedure PrepareScriptVerifyScript(pc: DSName): boolean
4.2.1.2.4 PrepareScriptHashBody
procedure PrepareScriptHashBody(pc: DSName): sequence of BYTE
4.2.1.2.5 PrepareScriptHashSignature
procedure PrepareScriptHashSignature(pc: DSName): sequence of BYTE
Returns a SHA1 hash of the value formed by appending the GUID {0916C8E3-3431-4586-AF77-
44BD3B16F961} to the value of pc!msDS-UpdateScript.
4.2.1.2.6 PrepareScriptGeneratePassword
procedure PrepareScriptGeneratePassword(): sequence of BYTE
Informative summary of behavior: The IDL_DSAPrepareScript method prepares for a subsequent call
to IDL_DSAExecuteScript. The partitions container that is a child object of the root of the
configuration NC is altered as follows:
The password, a hash of the value stored in msDS-UpdateScript, and a hash of that same value with
the GUID {0916C8E3-3431-4586-AF77-44BD3B16F961} appended are returned to the client. The
returned password value is later passed back by the client in a call to IDL_DSAExecuteScript as a form
of authorization.
ULONG
IDL_DSAPrepareScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_PREPARE_SCRIPT_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_PREPARE_SCRIPT_REPLY *pmsgOut);
435 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pc: DSName
msgIn: DSA_MSG_PREPARE_SCRIPT_REQ_V1
byteseq: sequence of BYTE
/* Security checks */
if not AccessCheckAttr(
pc, msDS-UpdateScript, RIGHT_DS_WRITE_PROPERTY) then
pmsgOut^.V1.dwOperationStatus := ERROR_DS_AUTHORIZATION_FAILED
pmsgOut^.V1.pwErrMessage := human-readable description of the error
return 0
endif
436 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
byteseq := PrepareScriptHashBody(pc)
pmsgOut^.V1.pbHashBody := byteseq
pmsgOut^.V1.cbHashBody := byteseq.length
byteseq := PrepareScriptHashSignature(pc)
pmsgOut^.V1.pbHashSignature := byteseq
pmsgOut^.V1.cbHashSignature := byteseq.length
pmsgOut^.V1.dwOperationStatus := 0
return 0
ULONG IDL_DSAExecuteScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_EXECUTE_SCRIPT_REQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_EXECUTE_SCRIPT_REPLY* pmsgOut
);
4.2.2.1.1 DSA_MSG_EXECUTE_SCRIPT_REQ
typedef
[switch_type(DWORD)]
union {
[case(1)]
DSA_MSG_EXECUTE_SCRIPT_REQ_V1 V1;
437 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} DSA_MSG_EXECUTE_SCRIPT_REQ;
4.2.2.1.2 DSA_MSG_EXECUTE_SCRIPT_REQ_V1
typedef struct {
DWORD Flags;
[range(1,1024)] DWORD cbPassword;
[size_is(cbPassword)] BYTE* pbPassword;
} DSA_MSG_EXECUTE_SCRIPT_REQ_V1;
4.2.2.1.3 DSA_MSG_EXECUTE_SCRIPT_REPLY
The DSA_MSG_EXECUTE_SCRIPT_REPLY union defines the response messages received from the
IDL_DSAExecuteScript method.
typedef
[switch_type(DWORD)]
union {
[case(1)]
DSA_MSG_EXECUTE_SCRIPT_REPLY_V1 V1;
} DSA_MSG_EXECUTE_SCRIPT_REPLY;
4.2.2.1.4 DSA_MSG_EXECUTE_SCRIPT_REPLY_V1
typedef struct {
DWORD dwOperationStatus;
[string] LPWSTR pwErrMessage;
} DSA_MSG_EXECUTE_SCRIPT_REPLY_V1;
4.2.2.2.1 ExecuteScriptInProgress
procedure ExecuteScriptInProgress(): boolean
438 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Returns true if an instance of the IDL_DSAExecuteScript method is already executing, and false
otherwise.
4.2.2.2.2 ExecuteScript
procedure ExecuteScript(pc: DSName): ULONG
ULONG
IDL_DSAExecuteScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_EXECUTE_SCRIPT_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_EXECUTE_SCRIPT_REPLY *pmsgOut);
pc: DSName
msgIn: DSA_MSG_EXECUTE_SCRIPT_REQ_V1
pmsgOut^.V1.dwOperationStatus := ERROR_DS_INTERNAL_FAILURE
pmsgOut^.V1.pwErrMessage := null
pc := DescendantObject(ConfigNC(), "CN=Partitions,")
/* Passwords match? */
if pc!msDS-ExecuteScriptPassword ≠ msgIn.pbPassword then
pmsgOut^.V1.dwOperationStatus := ERROR_DS_AUTHORIZATION_FAILED
pmsgOut^.V1.pwErrMessage := human-readable description of the error
return 0
endif
439 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Execute and delete the script. */
pmsgOut^.V1.dwOperationStatus := ExecuteScript(pc)
if pmsgOut^.V1.dwOperationStatus = 0 then
/* Script executed successfully. Remove the script value */
pc!msDS-UpdateScript := null
else
pmsgOut^.V1.pwErrMessage := human-readable description of the error
endif
return 0
440 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5 Common Data Types, Variables, and Procedures
This section contains types that are used by two or more drsuapi or dsaop methods, or types that are
used in this specification but normatively specified in other specifications. It also contains types and
procedures used only within the specification. This section is arranged in order by type or procedure
name.
The specification of message syntax in this section is normative for syntax only. The behavior
descriptions for types representing messages are informative. Consult the behavior description for
each method that uses a type for the normative specification of behavior related to that type.
"Hand-marshaled" types are types passed as BLOBs through RPC and types stored as BLOBs in the
directory. Any type that is "hand-marshaled" is specified pictorially in this section to emphasize the
layout of any multibyte quantities it contains. The layout is always little-endian. If a type is both
"hand-marshaled" and marshaled by RPC, then an IDL specification of the type is given in addition to
the pictorial specification.
This specification uses the definitions of RPC base types. Additional data types used in this protocol
are specified in this section.
Note that values of some types are marshaled by RPC as structures in some cases and as little-endian
byte arrays in other cases. An example is DSName, which can be marshaled as a DSName *pObject
field of an ENTINF, or as a UCHAR *pVal field of an ATTRVAL. Where such cases exist, the structure is
defined both in MIDL syntax and in a byte diagram, and the byte array cases are clearly identified so
that big-endian architectures can perform the necessary byte swapping. (For example, see ATTRVAL
conversions.)
5.1 AbstractPTFromConcretePT
procedure AbstractPTFromConcretePT(
concretePrefixTable: SCHEMA_PREFIX_TABLE): PrefixTable
prefixTable: PrefixTable
i: DWORD
for i := 0 to (concretePrefixTable.PrefixCount - 1)
prefixTable[i].prefixString :=
concretePrefixTable. pPrefixTableEntry[i].prefix
prefixTable[i].prefixIndex :=
concretePrefixTable.pPrefixTableEntry[i].ndx
endfor
return concretePrefixTable
5.2 AccessCheckAttr
procedure AccessCheckAttr(
dsName: DSName, attr: ATTRTYP, right: Right): boolean
The AccessCheckAttr procedure returns true if dsName identifies an object within an NC replica
hosted by the server, and if the client's security context, which MUST be retrieved using the method
described in [MS-RPCE] section 3.3.3.4.3, has the access indicated by the access right right to the
441 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attribute attr on that object according to the algorithm specified in [MS-DTYP] section 2.5.3.2. The
procedure returns false otherwise.
See [MS-ADTS] section 5.1.3.2 for the list of symbolic names for access rights (for example,
RIGHT_DS_WRITE_PROPERTY) and the numeric value of each.
5.3 AccessCheckCAR
procedure AccessCheckCAR(dsName: DSName; right: Right): boolean
The AccessCheckCAR procedure returns true if dsName identifies an object within an NC replica
hosted by the server, and if the client's security context, which MUST be retrieved using the method
described in [MS-RPCE] section 3.3.3.4.3, has the access indicated by the control access right right
on that object according to the algorithm specified in [MS-DTYP] section 2.5.3.2. It returns false
otherwise.
See [MS-ADTS] section 5.1.3.2.1 for the list of symbolic names for control access rights (for example,
DS-Replication-Manage-Topology) and the numeric value of each.
5.4 AccessCheckObject
procedure AccessCheckObject(dsName: DSName, right: Right): boolean
The AccessCheckObject procedure returns true if dsName identifies an object within an NC replica
hosted by the server, and if the client's security context, which MUST be retrieved using the method
described in [MS-RPCE] section 3.3.3.4.3, has the access indicated by the access right right on that
object according to the algorithm specified in [MS-DTYP] section 2.5.3.2. The procedure returns false
otherwise.
See [MS-ADTS] section 5.1.3.2 for the list of symbolic names for access rights (for example,
RIGHT_DS_DELETE_CHILD) and the numeric value of each.
5.5 AccessCheckWriteToSpnAttribute
procedure AccessCheckWriteToSpnAttribute(
obj: DSName, spnSet: set of unicodestring) : boolean
if AccessCheckAttr(obj,
servicePrincipalName,
RIGHT_DS_WRITE_PROPERTY) then
return ERROR_SUCCESS
else
if AccessCheckAttr(obj,
servicePrincipalName,
RIGHT_DS_WRITE_PROPERTY_EXTENDED) then
442 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Extended write access permits the attribute to be written */
* provided the proposed SPNs meet certain constraints. */
serviceName := GetServiceNameFromSPN(spn)
if not IsValidServiceName(obj, serviceName)
return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
endif
else
return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
endif
endif
instanceName := GetInstanceNameFromSPN(spn)
if (instanceName ≠ obj!dNSHostName) and
(not instanceName + "$" = obj!sAMAccountName) and
(not instanceName in obj!msDS-AdditionalDnsHostName) and
(not instanceName + "$" in
obj!msDS-AdditionalSamAccountName) then
/* If this is a DC computer account */
/* the instance name might be a GUID based dns host name */
if IsDCAccount(obj) then
if not IsGUIDBasedDNSName(obj, instanceName)then
return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
endif
else
return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
endif
endif
endfor
return ERROR_SUCCESS
endif
return ERROR_DS_INSUFF_ACCESS_RIGHTS
endif
5.6 AddSubRef
procedure AddSubRef(childNC: DSName): DWORD
Informative summary of behavior: This procedure creates a sub-ref object to the NC named by
childNC, if appropriate.
err:= 0
443 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if !ObjExists(childNC) then
/* Create a subordinate reference object */
ENTINF_SetValue(srAtt, instanceType,
{IT_NC_HEAD | IT_UNINSTANT | IT_NC_ABOVE}, dc.prefixTable)
ENTINF_SetValue(srAtt, objectClass, top,prefixTable)
ENTINF_SetValue(srAtt, objectCategory,SchemaObj(top), dc.prefixTable)
ENTINF_SetValue(srAtt, distinguishedName, childNC,prefixTable)
err := PerformAddOperation(srAtt,childNC, dc.prefixTable, TRUE)
if(err != 0)
return err
endif
else
if (childNC!isDeleted)
/*The cross-ref is being undeleted. Undelete the sub-ref object also.*/
UndeleteObject(childNC)
endif
endif
5.7 AmIRODC
procedure AmIRODC() : boolean
5.8 AmILHServer
procedure AmILHServer() : boolean
The AmILHServer procedure returns true if the local machine is Windows Server 2008 operating
system or later.
5.9 ATTR
The ATTR structure defines a concrete type for the identity and values of an attribute.
typedef struct {
ATTRTYP attrTyp;
ATTRVALBLOCK AttrVal;
} ATTR;
444 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attrTyp: An attribute.
5.10 ATTRBLOCK
The ATTRBLOCK structure defines a concrete type for a set of attributes and their values.
typedef struct {
[range(0,1048576)] ULONG attrCount;
[size_is(attrCount)] ATTR* pAttr;
} ATTRBLOCK;
5.11 AttributeStamp
AttributeStamp is an abstract type that contains information about the last originating update to
an attribute. It is a tuple of the following:
dwVersion: A 32-bit integer. Set to 1 when a value for the attribute is set for the first time. On
each subsequent originating update, if the current value of dwVersion is less than 0xFFFFFFFF,
then increment it by 1; otherwise set it to 0.
timeChanged: The date and time at which the last originating update was made.
uuidOriginating: The invocation ID of the DC that performed the last originating update.
usnOriginating: The USN assigned to the last originating update by the DC that performed it.
Comparisons
Version Comparison: The following procedure is used for comparing the dwVersion fields of two
AttributeStamps:
Informative summary of behavior: This procedure compares two dwVersions and returns an integer
that is used in AttributeStamp following comparisons.
if x = y then
return 0
elseif x > 0x7FFFFFFF then
if y = (x – 0x80000000) then
return 1
elseif (y < (x – 0x7FFFFFFF)) or (x < y) then
return -1
else
return 1
endif
elseif x < 0x7FFFFFFF then
if y = (x + 0x80000000) then
return -1
elseif (x < y) and (y < (x – 0x7FFFFFFF)) then
return -1
else
return 1
445 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
else
if y = 0xFFFFFFFF then
return -1
elseif x < y then
return -1
else
return 1
endif
endif
AttributeStamp Comparison: Given two AttributeStamps x and y, let d be the result of the procedure
CompareVersions(x.dwVersion, y.dwVersion).
d>0
d<0
Conversions
A value x of type AttributeStamp can be converted to and from its wire format y of type
PROPERTY_META_DATA_EXT by associating the values of fields in x with the values of the like-named
fields in y.
5.12 AttributeSyntax
AttributeSyntax is an abstract type that represents an LDAP attribute syntax. The valid values are
the names from the LDAP Syntax Name column of the table in section 5.16.2, for example,
"Object(DS-DN)" and "Object(DN-Binary)".
5.13 AttrStamp
procedure AttrStamp(o: DSName, attr: ATTRTYP) : AttributeStamp
The AttrStamp procedure returns the AttributeStamp for the attribute whose ATTRTYP is attr on the
object whose DSName is o.
446 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.14 ATTRTYP
Section 5.16.4 specifies the procedures that map between ATTRTYP and OID with the aid of a
SCHEMA_PREFIX_TABLE.
5.15 AttrtypFromSchemaObj
procedure AttrtypFromSchemaObj(o: DSName): ATTRTYP
5.16 ATTRVAL
The ATTRVAL structure defines a concrete type for the value of a single attribute.
typedef struct {
[range(0,26214400)] ULONG valLen;
[size_is(valLen)] UCHAR* pVal;
} ATTRVAL;
pVal: The value of the attribute. The encoding of the attribute varies by syntax, as described in the
following sections.
This section defines types used for concrete value representations. In addition to the types described
here, the following types are also used for concrete value representations:
447 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.1.1 INT32
The INT32 type is a 4-byte integer in little-endian form. See [MS-DTYP] section 2.2.22 for its
definition.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
intValue
5.16.1.2 INT64
The INT64 type is an 8-byte integer in little-endian form. See [MS-DTYP] section 2.2.23 for its
definition.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
int64Value
...
5.16.1.3 OctetString
The OctetString represents an array of bytes. The number of bytes in the array equals the valLen field
of the ATTRVAL structure.
5.16.1.4 String8
The String8 type is an array of ASCII characters. Each character is encoded as a single byte. The
number of bytes in the array equals the valLen field of the ATTRVAL structure.
5.16.1.5 String16
The String16 type is an array of Unicode characters. Each Unicode character is encoded as 2 bytes.
The number of bytes in the array equals the valLen field of the ATTRVAL structure.
5.16.1.6 SECURITY_DESCRIPTOR
5.16.1.7 SID
The SID type is an NT security identifier (SID) structure, as specified in [MS-DTYP] section 2.4.2.
448 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.2 Abstract Value Representations
The abstract data model utilizes a representation of data values that is used by LDAP, minus the BER
encoding. Several of these syntaxes are adopted from [RFC2252].
The following table lists all the supported syntaxes and how they are represented in the model. Some
syntaxes share an OID, so the syntaxes in the table are identified by name, not OID.
The LDAP syntaxes that are not defined in [RFC2252] are described in the following sections.
5.16.2.1 Object(DS-DN)
A value with the Object(DS-DN) syntax is a UTF-8 string in the following format:
<GUID=guid_value>;<SID=sid_value>;dn
449 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
where:
sid_value is the value of the object's objectSid attribute in its binary format (as specified in [MS-
DTYP] section 2.4.2).
dn is the string representation of a DN (as specified by [RFC2252] section 6.9, and further
specified by [RFC2253]).
For reference to objects that do not have an objectSid, the format is as follows:
<GUID=guid_value>;dn
where guid_value and dn have the same meaning as in the previous case.
5.16.2.2 Object(DN-String)
A value with the Object(DN-String) syntax is a UTF-8 string in the following format:
S:char_count:string_value:object_DN
where:
5.16.2.3 Object(DN-Binary)
A value with the Object(DN-Binary) syntax is a UTF-8 string in the following format:
B:char_count:binary_value:object_DN
where:
5.16.2.4 Object(Access-Point)
A value with the Object(Access-Point) syntax is a UTF-8 string in the following format:
presentation_address#X500:object_DN
where:
450 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
presentation_address is a value encoded in the Object(Presentation-Address) syntax.
5.16.2.5 Object(OR-Name)
A value with the Object(OR-Name) syntax is a UTF-8 string in the following format:
object_DN
5.16.2.6 String(NT-Sec-Desc)
A value with the String(NT-Sec-Desc) syntax contains a Windows security descriptor in self-relative
binary form. The binary form is that of a SECURITY_DESCRIPTOR structure and is documented in [MS-
DTYP] section 2.4.6.
5.16.2.7 String(Sid)
A value with the String(Sid) syntax is a Windows SID in binary form. The binary form is that of a SID
structure and is specified in [MS-DTYP] section 2.4.2.
5.16.2.8 String(Teletex)
A value with the String(Teletex) syntax is a UTF-8 string restricted to characters with values between
0x20 and 0x7e, inclusive.
The type ATTRVAL is an encoding that several methods use to send individual directory attribute
values across the network. When an attribute has multiple values, and all those values need to be
sent, this is performed by sending multiple ATTRVALs.
An ATTRVAL that encodes an OID requires a prefix table for decoding. In some cases, the prefix
table accompanies the ATTRVAL in the same RPC request or response. In other cases, a predefined
prefix table is sufficient. The process of creating the ATTRVAL for an OID can add an entry to the
prefix table that will accompany the ATTRVAL.
The abstract directory model specified in [MS-ADTS] section 3.1.1 represents individual attribute
values in the form used by LDAP (see [RFC2252]), minus the BER encoding. In short, values are
represented as strings in a variety of formats. The abstract type Value is used to represent an
attribute value in the model. Section 5.16.2 specifies the abstract representation for each LDAP
syntax.
Therefore, this specification requires procedures that convert between the concrete ATTRVAL encoding
and the abstract Value encoding, creating a prefix table while creating the ATTRVAL, and reading a
prefix table while decoding the ATTRVAL. These procedures have the following signatures:
procedure ATTRVALFromValue(
v: Value, s: AttributeSyntax, var t: PrefixTable) : ATTRVAL
procedure ValueFromATTRVAL(
a: ATTRVAL, s: AttributeSyntax, t: PrefixTable) : Value
where:
451 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
s is an LDAP attribute syntax from the table in section 5.16.2.
Apart from the prefix table complication, these two procedures are straightforward given the two value
representations. These procedures obey the mappings shown in the following table for converting
between abstract and concrete value representations.
Since the preceding procedures require a prefix table, a procedure to produce a prefix table is also
required, as follows:
452 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The special case value conversion between ATTRTYP and OID is provided by the following two
procedures:
These three procedures, specified in section 5.16.4, describe the algorithm for converting values of
type OID to and from their ATTRVAL payload representation using a PrefixTable.
The conversion between an abstract Value representation and a concrete ATTRVAL representation is
specified in the following sections, which are organized by abstract value type. In the examples
shown:
valLen represents the value in the valLen field of the ATTRVAL structure.
payload represents the data in the payload (the referent of pVal in the ATTRVAL structure).
Because prefix tables are communicated over the wire, the ConcretePTFromAbstractPT and
AbstractPTFromConcretePT procedures are defined to convert between the abstract PrefixTable and
the concrete SCHEMA_PREFIX_TABLE.
5.16.3.1 Boolean
The Boolean LDAP attribute value FALSE corresponds to an INT32 with value 0. The Boolean LDAP
attribute value TRUE corresponds to an INT32 with a nonzero value. INT32 is in little-endian format.
The valLen field of ATTRVAL equals 4.
Example:
valLen: 4.
payload:
01 00 00 00 ....
The Enumeration and the Integer LDAP syntax types are represented in the same manner. The LDAP
representation of the integer as a string expressed in base-10 notation corresponds to an INT32,
which is in little-endian format. The valLen field of ATTRVAL equals 4.
Example:
LDAP value: 5
INT32 value: 0x5
valLen: 4,
payload:
05 00 00 00 ....
453 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.3.3 LargeInteger
The LDAP representation of the integer as a string expressed in base-10 notation corresponds to an
INT64, which is in little-endian format. The valLen field of ATTRVAL equals 8.
Example:
valLen: 8,
payload:
3d 31 00 00 00 00 00 00 =1......
5.16.3.4 Object(Presentation-Address)
To convert from the LDAP representation to the SYNTAX_ADDRESS representation, the UTF-8
encoded string is converted to a UCS-16 encoded Unicode string. The resulting string is not null-
terminated. The dataLen field of SYNTAX_ADDRESS equals the length of the Unicode string in bytes,
plus 4. The valLen field of ATTRVAL equals the dataLen field of SYNTAX_ADDRESS.
Example:
valLen: 14
payload:
0e 00 00 00 31 00 32 00 33 00 34 00 35 00 ....1.2.3.4.5.
The representation used in LDAP syntax and encoding of the ATTRVAL payload is the same.
Therefore, the payload is set to the same value. The valLen field of ATTRVAL equals the length of the
byte array.
The representation used in LDAP syntax and encoding of the ATTRVAL payload is the same.
Therefore, the payload is set to the same value. The string is not null-terminated. The valLen field of
ATTRVAL equals the number of bytes in the string.
Example:
valLen: 9
454 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
payload:
31 32 33 34 35 36 37 38 39 123456789
5.16.3.7 String(Unicode)
To convert from the LDAP representation to the Unicode syntax representation, the UTF-8 encoded
string is converted to a UCS-16 encoded String16. Each Unicode character is in little-endian format.
The resulting string is not null-terminated. The valLength field of ATTRVAL equals the total number of
bytes in the Unicode string.
Example:
payload:
41 00 64 00 6d 00 69 00 6e 00 69 00 73 00 74 00 A.d.m.i.n.i.s.t.
72 00 61 00 74 00 6f 00 72 00 r.a.t.o.r.
5.16.3.8 String(Object-Identifier)
Conversion from the LDAP representation to ATTRTYP is performed via the MakeAttid function. The
length of the valLen field in ATTRVAL equals 4.
Example:
valLen: 4
payload:
05 00 01 00 ....
For both the String(UTC-Time) and String(Generalized-Time) LDAP syntaxes, the time expressed in
the LDAP value corresponds to DSTIME. It is in little-endian format. The valLen field of ATTRVAL
equals 8.
payload:
ea 74 9a fa 02 00 00 00 .t......
455 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.3.10 Object(DS-DN)
The dn part of the LDAP representation is converted to a UCS-16 encoded Unicode string. Then, the
attributeValue component (defined in [RFC2253]) of each RDN in the DN is canonicalized according to
the following rules:
The first leading space, if any, is escaped as a backslash (\) followed by a space.
Any carriage return or line-feed characters are escaped as a backslash followed by the 2-digit
hexadecimal value of that character, as specified in [RFC2253] section 2.4.
Any of the following characters—number sign (#), plus sign (+), comma (,), semicolon (;),
quotation mark ("), left angle bracket (<), equal sign (=), right angle bracket (>), and backslash
(\)—are escaped as a backslash followed by the character.
The resulting string (including a terminating null character) is inserted into the StringName field of the
DSNAME. The length of the string, in Unicode characters, is inserted into the NameLen field. The
length of the string in the NameLen field does not include the terminating null character. The value of
guid_value in LDAP representation is expressed as a GUID and inserted into the Guid field of the
DSNAME structure. If the sid_value is present, it is copied into the Sid field of the DSNAME and the
SidLen field is set to the length, in bytes, of the SID. If the sid_value part is not present, then the
SidLen field is set to 0. The valLen field of ATTRVAL equals the length of the DSNAME structure. All the
multibyte quantities in the DSNAME are stored in little-endian format.
Example:
valLen: 138,
payload:
8a 00 00 00 1c 00 00 00 a1 b4 ea 3c 47 fc 71 4a ...........<G.qJ
81 95 45 4f aa 64 23 a3 01 05 00 00 00 00 00 05 ..EO.d#.........
15 00 00 00 89 59 8d 33 d3 c5 6b 68 94 e1 f2 e6 .....Y.3..kh....
f4 01 00 00 28 00 00 00 43 00 4e 00 3d 00 41 00 ....(...C.N.=.A.
64 00 6d 00 69 00 6e 00 69 00 73 00 74 00 72 00 d.m.i.n.i.s.t.r.
61 00 74 00 6f 00 72 00 2c 00 4f 00 55 00 3d 00 a.t.o.r.,.O.U.=.
55 00 73 00 65 00 72 00 73 00 2c 00 44 00 43 00 U.s.e.r.s.,.D.C.
3d 00 74 00 65 00 73 00 74 00 2c 00 44 00 43 00 =.t.e.s.t.,.D.C.
3d 00 63 00 6f 00 6d 00 00 00 =.c.o.m...
456 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.3.11 Object(DN-Binary)
Padding is added between the DSNAME and SYNTAX_ADDRESS structures so that the length of
DSNAME plus padding modulo 4 equals 0. The padding is an array of bytes, each byte of value 0. The
valLen field of ATTRVAL equals the length of the DSNAME structure, plus the number of bytes added
for padding, plus the length of the SYNTAX_ADDRESS structure.
All the multibyte quantities in the DSNAME and SYNTAX_ADDRESS structures are stored in little-
endian format.
LDAP value:
B:8:00000005:<GUID=2d8b0ce6-aa32-4f31-a6e8-
88343e6244a5>;<SID=010100001cd509a018459359>;DC=test,DC=com
valLength: 96
payload:
56 00 00 00 0c 00 00 00 e6 0c 8b 2d 32 aa 31 4f V..........-2.1O
a6 e8 88 34 3e 62 44 a5 01 01 00 00 1c d5 09 a0 ...4>bD.........
18 45 93 59 00 00 00 00 00 00 00 00 00 00 00 00 .E.Y............
00 00 00 00 0e 00 00 00 44 00 43 00 3d 00 74 00 ........D.C.=.t.
65 00 73 00 74 00 2c 00 44 00 43 00 3d 00 63 00 e.s.t.,.D.C.=.c.
6f 00 6d 00 00 00 00 00 08 00 00 00 00 00 00 05 o.m.............
LDAP value:
B:8:0000000D:<GUID= ff432fe0-8c94-43cf-915c-
286b197b0164>;<SID=010100001a180dba5ec27614>;DC=test1,DC=test,DC=com.
457 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
+0x000 dataLen : 0x74003d
+0x004 byteVal : 00 00 00 0d
68 00 00 00 0c 00 00 00 e0 2f 43 ff 94 8c cf 43 h......../C....C
91 5c 28 6b 19 7b 01 64 01 01 00 00 1a 18 0d ba .\(k.{.d........
5e c2 76 14 00 00 00 00 00 00 00 00 00 00 00 00 ^.v.............
00 00 00 00 17 00 00 00 44 00 43 00 3d 00 74 00 ........D.C.=.t.
65 00 73 00 74 00 31 00 2c 00 44 00 43 00 3d 00 e.s.t.1.,.D.C.=.
74 00 65 00 73 00 74 00 2c 00 44 00 43 00 3d 00 t.e.s.t.,.D.C.=.
63 00 6f 00 6d 00 00 00 08 00 00 00 00 00 00 0d c.o.m...........
5.16.3.12 Object(DN-String)
Example:
LDAP value:
S:7:Unicode:<GUID=2d8b0ce6-aa32-4f31-a6e8-
88343e6244a5>;<SID=010100001cd509a018459359>;DC=test,DC=com
valLength: 106
payload:
56 00 00 00 0c 00 00 00 e6 0c 8b 2d 32 aa 31 4f V..........-2.1O
a6 e8 88 34 3e 62 44 a5 01 01 00 00 1c d5 09 a0 ...4>bD.........
18 45 93 59 00 00 00 00 00 00 00 00 00 00 00 00 .E.Y............
00 00 00 00 0e 00 00 00 44 00 43 00 3d 00 74 00 ........D.C.=.t.
65 00 73 00 74 00 2c 00 44 00 43 00 3d 00 63 00 e.s.t.,.D.C.=.c.
6f 00 6d 00 00 00 00 00 12 00 00 00 55 00 6e 00 o.m.........U.n.
69 00 63 00 6f 00 64 00 65 00 i.c.o.d.e.
458 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.16.3.13 Object(OR-Name)
5.16.3.14 Object(Access-Point)
5.16.3.15 String(Sid)
The representation used in LDAP syntax and encoding of ATTRVAL payload is the same. Therefore the
payload is set to the same value. The valLen field of ATTRVAL equals the number of bytes in the
payload. It is always 28. All the multibyte quantities in the SID structure are stored in little-endian
format.
Example:
valLen: 28
payLoad:
01 05 00 00 00 00 00 05 15 00 00 00 89 59 8d 33 .............Y.3
d3 c5 6b 68 94 e1 f2 e6 f4 01 00 00 ..kh........
5.16.3.16 String(NT-Sec-Desc)
The representation used in LDAP syntax and encoding of ATTRVAL payload is the same. Therefore the
payload is set to the same value. The valLen field of ATTRVAL equals the number of bytes in the
payload. All the multibyte quantities in the security descriptor structure are stored in little-endian
format.
SD Revision: 1
SD Control: 0x8c04
SE_DACL_PRESENT
SE_DACL_AUTO_INHERITED
SE_SACL_AUTO_INHERITED
SE_SELF_RELATIVE
Owner: S-1-483723680-1502823704-512
Group: S-1-483723680-1502823704-512
DACL:
Revision 4
459 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Size: 92 bytes
# Aces: 3
Ace[0]
Ace Type: 0x5 - ACCESS_ALLOWED_OBJECT_ACE_TYPE
Ace Size: 40 bytes
Ace Flags: 0x0
Object Ace Mask: 0x00000100
ACTRL_DS_CONTROL_ACCESS
Object Ace Flags: 0x1
ACE_OBJECT_TYPE_PRESENT
Object Ace Type:
Change Password-ab721a53-1e2f-11d0-9819-00aa0040529b
Object Ace Sid: NT AUTHORITY\SELF [S-1-5-10]
Ace[1]
Ace Type: 0x0 - ACCESS_ALLOWED_ACE_TYPE
Ace Size: 24 bytes
Ace Flags: 0x12
CONTAINER_INHERIT_ACE
INHERITED_ACE
Ace Mask: 0x000f01ff
DELETE
READ_CONTROL
WRITE_DAC
WRITE_OWNER
ACTRL_DS_CREATE_CHILD
ACTRL_DS_DELETE_CHILD
ACTRL_DS_LIST
ACTRL_DS_SELF
ACTRL_DS_READ_PROP
ACTRL_DS_WRITE_PROP
ACTRL_DS_DELETE_TREE
ACTRL_DS_LIST_OBJECT
ACTRL_DS_CONTROL_ACCESS
Ace Sid: BUILTIN\Administrators [S-1-5-32-544]
Ace[2]
Ace Type: 0x0 - ACCESS_ALLOWED_ACE_TYPE
Ace Size: 20 bytes
Ace Flags: 0x12
CONTAINER_INHERIT_ACE
INHERITED_ACE
Ace Mask: 0x00020094
READ_CONTROL
ACTRL_DS_LIST
ACTRL_DS_READ_PROP
ACTRL_DS_LIST_OBJECT
Ace Sid: NT AUTHORITY\Authenticated Users [S-1-5-11]
valLen: 144
paylaod:
01 00 04 8c 70 00 00 00 80 00 00 00 00 00 00 00 ....p...........
14 00 00 00 04 00 5c 00 03 00 00 00 05 00 28 00 ......\.......(.
00 01 00 00 01 00 00 00 53 1a 72 ab 2f 1e d0 11 ........S.r./...
98 19 00 aa 00 40 52 9b 01 01 00 00 00 00 00 05 .....@R.........
0a 00 00 00 00 12 18 00 ff 01 0f 00 01 02 00 00 ................
00 00 00 05 20 00 00 00 20 02 00 00 00 12 14 00 .... ... .......
94 00 02 00 01 01 00 00 00 00 00 05 0b 00 00 00 ................
01 02 00 00 1c d5 09 a0 18 45 93 59 00 02 00 00 .........E.Y....
01 02 00 00 1c d5 09 a0 18 45 93 59 00 02 00 00 .........E.Y....
This section describes the prefix mapping mechanism that allows the one-to-one mapping between
OIDs and a 32-bit integer (ATTRTYP).
460 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
An OID can be represented in the binary form, with a BER encoding scheme. The standard BER
encoding of an object identifier consists of three components, because the end-of-contents component
is not present. Only the third component (contents octets) is used here; other components are
omitted.
Note The BER encoding of an OID is described in [ITUX690] section 8.19. To avoid ambiguity, the
non-encoded form of the OID is referred to as the original form in this section.
The prefix of an OID is the binary OID, excluding the last one or two bytes. If the number following
the final period (.) in the original form of the OID is less than 128, only the last byte is excluded;
otherwise, the last two bytes are excluded.
where:
The integer prefixIndex is called the prefix index of prefixString. To allow one-to-one mappings
between the prefix strings and the prefix indexes in the table, each prefixString MUST occur at most
once in the table, and each prefixIndex MUST occur at most once in the table.
An ATTRTYP is a 32-bit, unsigned integer. If attr is an ATTRTYP, define attr.upperWord to be the most
significant 16 bits, and attr.lowerWord to be the least significant 16 bits.
The following types and helper procedures are used for mapping between OIDs and ATTRTYP.
Converts a string to a binary OID representation. For example, "\x55\x06" is the binary OID \x55\x06.
Concatenates a byte onto a binary OID. For example, \x02 concatenated onto \x55\x06 is
\x55\x06\x02.
Converts a binary OID to its string representation, as described in [ITUX690] section 8.19; returns
null if the conversion fails. For example, the binary OID \x55\x06\x02 is converted to the OID string
"2.5.6.2".
461 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Converts an OID string representation to a binary OID, as described in [ITUX690] section 8.19;
returns null if the conversion fails. For example, the OID string "2.5.6.2" is converted to the binary
form \x55\x06\x02.
Converts an integer into a byte representation, truncating to the least significant digits, if needed. For
example, 2 converts to \x02.
Sets t[t.length].prefixString to o. Generates a random number between 0 and 65535 that is unique in
the values of prefixIndex in t, and sets t[t.length].prefixIndex to the generated random number.
Increases t.length by one.
Converts a string to its integer representation. For example, "127" is 127. Strings with non-numeric
characters are not defined for this procedure.
The following procedures are used for mapping between object identifiers and ATTRTYP
representations.
lastValueString: unicodestring
lastValue, lowerWord: integer
binaryOID, oidPrefix: sequence of BYTE
attr: ATTRTYP
pos: integer
462 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* get the prefix of the OID*/
if lastValue < 128 then
oidPrefix := SubBinary(binaryOID, 0, binaryOID.length - 2)
else
oidPrefix := SubBinary(binaryOID, 0, binaryOID.length - 3)
endif
if fToAdd then
pos := t.length
AddPrefixTableEntry(t, oidPrefix)
endif
return attr
binaryOID = null
463 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if binaryOID = null then
return null
else
return ToStringOID(binaryOID)
endif
This procedure creates a new PrefixTable, inserts the following tuples into the table, and returns the
table as the result.
"\x55\x4" 2 0
"\x55\x6" 2 1
"\x2A\x86\x48\x86\xF7\x14\x01\x02" 8 2
"\x2A\x86\x48\x86\xF7\x14\x01\x03" 8 3
"\x60\x86\x48\x01\x65\x02\x02\x01" 8 4
"\x60\x86\x48\x01\x65\x02\x02\x03" 8 5
"\x60\x86\x48\x01\x65\x02\x01\x05" 8 6
"\x60\x86\x48\x01\x65\x02\x01\x04" 8 7
"\x55\x5" 2 8
"\x2A\x86\x48\x86\xF7\x14\x01\x04" 8 9
"\x2A\x86\x48\x86\xF7\x14\x01\x05" 8 10
"\x09\x92\x26\x89\x93\xF2\x2C\x64" 8 19
"\x60\x86\x48\x01\x86\xF8\x42\x03" 8 20
"\x09\x92\x26\x89\x93\xF2\x2C\x64\x01" 9 21
"\x60\x86\x48\x01\x86\xF8\x42\x03\x01" 9 22
"\x2A\x86\x48\x86\xF7\x14\x01\x05\xB6\x58" 10 23
"\x55\x15" 2 24
"\x55\x12" 2 25
"\x55\x14" 2 26
The following examples show the correspondence between OID and ATTRTYP by using the
PrefixTable returned by the procedure NewPrefixTable.
464 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Prefix string: "\x55\x06"
Prefix index: 1
ATTRTYP: 0x00010002
465 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ATTRTYP: 0x001a0001
5.17 ATTRVALBLOCK
The ATTRVALBLOCK structure defines a concrete type for a sequence of attribute values.
typedef struct {
[range(0,10485760)] ULONG valCount;
[size_is(valCount)] ATTRVAL* pAVal;
} ATTRVALBLOCK;
5.18 ATTRVALFromValue
procedure ATTRVALFromValue(v: Value,
s: Syntax,
var t: PrefixTable) : ATTRVAL
The ATTRVALFromValue procedure converts a value in the abstract Value encoding v of syntax s into a
concrete ATTRVAL, using the prefix table represented by t. This procedure can mutate the supplied
prefix table.
5.19 BindToDSA()
procedure BindToDSA(dsa: DSNAME): DRS_HANDLE
The BindToDSA procedure establishes an RPC connection to the target DC represented by its DSA
object. It also performs the IDL_DRSBind call. It returns the RPC handle on success or null on failure.
5.20 BOOL
5.21 BYTE
5.22 CHANGE_LOG_ENTRIES
466 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
SequenceNumber: The sequence number for the buffer. MUST be set to 0x00000001 in a response
to an IDL_DRSGetNT4ChangeLog request with pmsgIn.V1.pRestart = null. The value of
pmsgOut.V1.pRestart in any IDL_DRSGetNT4ChangeLog response MUST encapsulate
SequenceNumber. In a response to an IDL_DRSGetNT4ChangeLog request with
pmsgIn.V1.pRestart ≠ null, SequenceNumber is the value encapsulated in pmsgIn.V1.pRestart,
plus one.
5.23 CHANGELOG_ENTRY
CHANGELOG_ENTRY is a concrete type that is defined in [MS-NRPC] section 3.5.4.6.4, with more
information in [MS-ADTS] section 3.1.1.7.1.2. The abstract variable dc.pdcChangeLog is a sequence of
CHANGELOG_ENTRY. The following two fields within this type are used in specifying
IDL_DRSGetNT4ChangeLog server behavior:
SerialNumber: A LARGE_INTEGER containing the serial number of the update represented in this
CHANGELOG_ENTRY.
5.24 CheckGroupMembership
procedure CheckGroupMembership(
token: ClientAuthorizationInfo,
groupSid: SID): boolean
The CheckGroupMembership procedure returns true only if the user represented by token is a member
of the group whose SID is groupSid. For more details, see [MS-DTYP] section 2.5.3.
5.25 ClientAuthorizationInfo
ClientAuthorizationInfo is an abstract type that represents a client's security context that contains
authorization information for a client.
5.26 ClientExtensions
procedure ClientExtensions(hDrs: DRS_HANDLE): DRS_EXTENSIONS_INT
The ClientExtensions server procedure gets the client extensions presented in the IDL_DRSBind call
that created hDrs. Any fields not specified by the client in the pextClient parameter to IDL_DRSBind
(such that pextClient^.cb is less than the offset of the end of the field of DRS_EXTENSIONS_INT) are
set to 0.
5.27 ClientUUID
procedure ClientUUID(hDrs: DRS_HANDLE): UUID
The ClientUUID procedure returns the GUID that identifies the caller presented in the IDL_DRSBind
call that created hDrs.
467 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.28 ConcretePTFromAbstractPT
procedure ConcretePTFromAbstractPT(
prefixTable: PrefixTable): SCHEMA_PREFIX_TABLE
prefixCount: ULONG
concretePrefixTable: SCHEMA_PREFIX_TABLE
prefixCount := prefixTable.length
concretePrefixTable.PrefixCount := prefixCount
for i := 0 to (prefixTable.length - 1)
concretePrefixTable.pPrefixTableEntry[i].prefix :=
prefixTable[i].prefixString
concretePrefixTable.pPrefixTableEntry[i].ndx :=
prefixTable[i].prefixIndex
endfor
return concretePrefixTable
5.29 ConfigNC
procedure ConfigNC(): DSName
5.30 dc, DC
A global variable that represents the state of a DC, as defined in [MS-ADTS] section 3.1.1.1.9, and the
type of that variable. That definition is repeated here for convenience:
type DC = [
serverGuid: GUID,
invocationId: GUID,
prefixTable: PrefixTable,
pdcChangeLog: PdcChangeLog,
nt4ReplicationState: NT4ReplicationState,
ldapConnections: LDAPConnections,
468 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
replicationQueue: ReplicationQueue,
kccFailedConnections: KCCFailedConnections,
kccFailedLinks: KCCFailedLinks,
rpcClientContexts: RPCClientContexts,
rpcOutgoingContexts: RPCOutgoingContexts,
fLinkValueStampEnabled: boolean,
nt4EmulatorEnabled: boolean,
fEnableUpdates: boolean,
minimumGetChangesReplyVersion: integer,
minimumGetChangesRequestVersion: integer
The variable dc is the only global variable in this specification. It contains the state of the server:
dc: DC
5.31 DefaultNC
procedure DefaultNC(): DSName
5.32 DelSubRef
procedure DelSubRef(childNC: DSName)
Informative summary of behavior: This procedure deletes a sub-ref object for the NC childNC, if it
exists.
parentNC: DSName
rt: ULONG
else
/* Otherwise, just prevent continuation referrals from being
* generated by removing childNC from the parent's subRefs list.
*/
parentNC := GetObjectNC(ChildNC)
469 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
parentNC!subRefs := parentNC!subRefs – {childNC}
endif
5.33 DescendantObject
procedure DescendantObject(
ancestor: DSName, rdns: unicodestring): DSName
The DescendantObject procedure constructs a DN string by concatenating rdns and ancestor.dn, and
then verifies the existence of the descendant object. It returns the DSName if the descendant exists,
and null otherwise.
5.34 DomainNameFromDN
procedure DomainNameFromDN(
dn: unicodestring): unicodestring
The DomainNameFromDN procedure returns the fully qualified domain name (FQDN) (1) of the
crossRef object identified by dn, or null if no matching crossRef object exists.
5.35 DN
DN is an abstract type that is a unicodestring (section 3.4.3) that contains a DN of the form
specified in [RFC2253].
5.36 DNBinary
5.37 DomainNameFromNT4AccountName
procedure DomainNameFromNT4AccountName(
nt4AccountName: unicodestring): unicodestring
If nt4AccountName is a name in Windows NT 4.0 operating system account name format, that is, two
components separated by a backslash (for example, "DOMAIN\username"), the
DomainNameFromNT4AccountName procedure returns the first component (the domain name, or
"DOMAIN" in this example). If the nt4AccountName is not in this format, null is returned.
5.38 DRS_EXTENSIONS
The DRS_EXTENSIONS structure defines a concrete type for capabilities information used in version
negotiation.
typedef struct {
[range(1,10000)] DWORD cb;
[size_is(cb)] BYTE rgb[];
} DRS_EXTENSIONS;
470 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cb: The size, in bytes, of the rgb array.
rgb: To RPC, this field is a string of cb bytes. It is interpreted by the client and the server as the first
cb bytes of a DRS_EXTENSIONS_INT structure that follow the cb field of that structure. The fields
of the DRS_EXTENSIONS_INT structure are in little-endian byte order. Since both
DRS_EXTENSIONS and DRS_EXTENSIONS_INT begin with a DWORD cb, a field in
DRS_EXTENSIONS_INT is at the same offset in DRS_EXTENSIONS as it is in
DRS_EXTENSIONS_INT.
5.39 DRS_EXTENSIONS_INT
The DRS_EXTENSIONS_INT structure is a concrete type for structured capabilities information used
in version negotiation.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
cb
dwFlags
...
...
Pid
dwReplEpoch
dwFlagsExt
...
...
dwExtCaps
dwFlags (4 bytes): The dwFlags field contains individual bit flags that describe the capabilities of
the DC that produced the DRS_EXTENSIONS_INT structure.<41>
The following table lists the bit flags, which are presented in little-endian byte order.
471 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
B G I D L A A G G G P D G D W G G G
A U D D M R A S C K S T R R
A R N C V E N C M C B C C F B R R C
E O C F V M S E B E H M 3 2
S I R 2 R 2 C 6 2 5 3 F 10 2 3 6 5 8
472 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
TM (DRS_EXT_TRANSITIVE_MEMBERSHIP, 0x00020000): If present, signifies that the DC
supports IDL_DRSGetMemberships.
GC6 (DRS_EXT_GETCHGREQ_V6, 0x00400000): Unused. This bit was used for a pre-release
version of Windows. No released version of Windows references it. This bit can be set or unset
with no change in behavior.
SiteObjGuid (16 bytes): A GUID. The objectGUID of the site object of which the DC's DSA
object is a descendant. For non-DC client callers, this field SHOULD be set to zero.
Pid (4 bytes): A 32-bit, signed integer value that specifies a process identifier. The client sets the
Pid field to the current client process, or the server sets the Pid to the current server process.
This is for informational and debugging purposes only. The assignment of this field is
implementation-specific.<42>
dwReplEpoch (4 bytes): A 32-bit, unsigned integer value that specifies the replication epoch. This
value is set to zero by all client callers. The server sets this value by assigning the value of msDS-
ReplicationEpoch from its nTDSDSA object. If dwReplEpoch is not included in
DRS_EXTENSIONS_INT, the value is considered to be zero.<43>
dwFlagsExt (4 bytes): An extension of the dwFlags field that contains individual bit flags. These bit
flags determine which extended capabilities are enabled in the DC that produced the
473 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_EXTENSIONS_INT structure. For non-DC client callers, no bits SHOULD be set. If
dwFlagsExt is not included in DRS_EXTENSIONS_INT, all bit flags are considered unset.
The following table lists the bit flags, which are presented in little-endian byte order.<44>
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X R L D X X X X X CI X G X X X X X X X X X X X X X X X X
B H A D R
9
ConfigObjGUID (16 bytes): A GUID. This field is set to zero by all client callers. The server sets this
field by assigning it the value of the objectGUID of the config NC object. If ConfigObjGUID is
not included in DRS_EXTENSIONS_INT, the value is considered to be the NULL GUID value.<45>
dwExtCaps (4 bytes): A mask for the dwFlagsExt field that contains individual bit flags. These bit
flags describe the potential extended capabilities of the DC that produced the
DRS_EXTENSIONS_INT structure. For non-DC client callers, no bits SHOULD be set. If neither
dwFlagsExt nor dwExtCaps is included in DRS_EXTENSIONS_INT, all bits in dwExtCaps are
considered unset. If dwFlagsExt is included in DRS_EXTENSIONS_INT but dwExtCaps is not, all
relevant bits in dwExtCaps (as explained below) are implicitly set.<46>
Each bit in dwExtCaps corresponds exactly to each bit in dwFlagsExt. If the DC that produced
the DRS_EXTENSIONS_INT structure supports a capability described by a bit in the dwFlagsExt
field (that is, the bit either is or could potentially be set), then the corresponding bit in
dwExtCaps MUST be set. If a bit in dwExtCaps is not set, it is assumed that the corresponding
bit in dwFlagsExt will not and cannot be set.
Note The dwExtCaps field is relevant only for capabilities that are labeled as "optional features"
in the bit descriptions of dwFlagsExt. The bits in dwExtCaps that correspond to capabilities in
dwFlagsExt that are not labeled as "optional features" MUST NOT be different from the setting of
the dwFlagsExt bits. Currently, the capabilities represented by the DA and LH bits fit into this
category.
5.40 DRS_HANDLE
DRS_HANDLE is a concrete type for an RPC context handle (as specified in [C706]) for use in calls to
methods in the drsuapi RPC interface.
474 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
This type is declared as follows:
5.41 DRS_OPTIONS
DRS_OPTIONS is a concrete type for a set of options sent to and received from various drsuapi
methods.
It is a bit field, presented in little-endian byte order, that contains the following values.
Seven elements of the set are interpreted differently by different methods; such elements have
multiple symbolic names.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
M P IS W A A G A F S N G G C T A IS S N R S S F F G S N U D D S P
R S R LL R C/ S S/ N R S/ A O S S N S S G U Q S SI P P N C P A F E
/ U N /R R L R/ Y / P S S
D N S F O IE N
R D
475 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
MR (DRS_MAIL_REP, 0x00000080): Perform replication using SMTP as a transport.
TS (DRS_TWOWAY_SYNC, 0x00000200): Inform the server DC to replicate from the client DC.
LO (DRS_LOCAL_ONLY, 0x00001000): Perform the operation locally without contacting any other
DC.
RF (DRS_REF_OK, 0x00004000): Allow the NC replica to be removed even if other DCs use this DC
as a replication server DC.
RG (DRS_REF_GCSPN, 0x00100000): Requests that the server add an entry to repsTo for the
client on the root object of the NC replica that is being replicated. When repsTo is set using this
flag, the notifying client DC contacts the server DC using the service principal name that begins
with "GC" (section 2.2.3.2).
476 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
SS (DRS_SPECIAL_SECRET_PROCESSING, 0x00400000): Do not replicate attribute values of
attributes that contain secret data.
SP (DRS_SYNC_PAS, 0x40000000): Expand the partial attribute set of the partial replica.
For information about the Windows versions in which these flags were introduced, supported, or
deprecated, see the following behavior note.<47>
5.42 DRS_MORE_GETCHGREQ_OPTIONS
It is a bit field, presented in little-endian byte order, which contains the following values.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X X T X X X X X X X X X X X X X X X X X X X X X X X X
G
T
TGT (DRS_GET_TGT, 0x00000001): Include updates to the target object of a link value before
updates to the link value.
5.43 DRS_SecBuffer
typedef struct {
[range(0,10000)] unsigned long cbBuffer;
477 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
unsigned long BufferType;
[size_is(cbBuffer)] BYTE* pvBuffer;
} DRS_SecBuffer;
BufferType: A bit field, presented in little-endian byte order, that contains the following values:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X T X X X X X X X X X X X X X X X X X X R X X X X X X X
Y O
P
Value Meaning
SECBUFFER_EMPTY A placeholder in the buffer array. The caller can supply several such
0x00000000 entries in the array, and the security package can return data in them.
SECBUFFER_DATA Used for common data. The security package can read this data and
0x00000001 write it, for example, to encrypt some or all of it.
SECBUFFER_TOKEN This buffer is used to indicate the security token portion of the
0x00000002 message. This is read-only for input parameters or read/write for output
parameters.
SECBUFFER_MISSING The security package uses this value to indicate the number of missing
0x00000004 bytes in a particular message. The pvBuffer member is ignored in this
type.
SECBUFFER_EXTRA The security package uses this value to indicate the number of extra or
0x00000005 unprocessed bytes in a message.
478 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.44 DRS_SecBufferDesc
typedef struct {
unsigned long ulVersion;
[range(0,10000)] unsigned long cBuffers;
[size_is(cBuffers)] DRS_SecBuffer* Buffers;
} DRS_SecBufferDesc;
ulVersion: MUST be 0.
5.45 DRS_SPN_CLASS
A unicodestring constant (section 3.4.3) that is used as the service class in the SPN for a DC. It has
the value "E3514235-4B06-11D1-AB04-00C04FC2DCD2".
5.46 DS_REPL_OP_TYPE
typedef enum
{
DS_REPL_OP_TYPE_SYNC = 0,
DS_REPL_OP_TYPE_ADD,
DS_REPL_OP_TYPE_DELETE,
DS_REPL_OP_TYPE_MODIFY,
DS_REPL_OP_TYPE_UPDATE_REFS
} DS_REPL_OP_TYPE;
5.47 DSAObj
procedure DSAObj(): DSName
The DSAObj procedure returns the dsname of the DC's nTDSDSA object.
479 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.48 DSA_RPC_INST
cbpszServerOffset: The offset from the start of the DSA_RPC_INST structure to a location that
specifies the start of the server name of this instance.
cbpszAnnotationOffset: The offset from the start of the DSA_RPC_INST structure to a location that
specifies the start of the annotation of this instance.
cbpszInstanceOffset: The offset from the start of the DSA_RPC_INST structure to a location that
specifies the start of the NetworkAddress (section 5.134) of this instance.
cbpguidInstanceOffset: The offset from the start of the DSA_RPC_INST structure to a location that
specifies the start of the GUID for the instance.
5.49 DSName
The dn field corresponds to the StringName field of the DSNAME structure and contains the DN of
the object.
The guid field corresponds to the Guid field of the DSNAME structure and contains the value of the
object's objectGUID attribute.
The sid field corresponds to the Sid field of the DSNAME structure. If the object possesses an
objectSid attribute, it contains the value of the object's objectSid attribute. If the object does not
possess an objectSid attribute, the field is null.
5.50 DSNAME
DSNAME is a concrete type for representing a DSName, identifying a directory object using the
values of one or more of its LDAP attributes: objectGUID, objectSid, or distinguishedName.
typedef struct {
unsigned long structLen;
unsigned long SidLen;
GUID Guid;
NT4SID Sid;
unsigned long NameLen;
[range(0, 10485761)] [size_is(NameLen + 1)]
480 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
WCHAR StringName[];
} DSNAME;
SidLen: The number of bytes in the Sid field used to represent the object's objectSid attribute
value. Zero indicates that the DSNAME does not identify the objectSid value of the directory
object.
Guid: The value of the object's objectGUID attribute specified as a GUID structure, which is defined
in [MS-DTYP] section 2.3.4. If the values for all fields in the GUID structure are zero, this indicates
that the DSNAME does not identify the objectGUID value of the directory object.
Sid: The value of the object's objectSid attribute, its security identifier, specified as a SID
structure, which is defined in [MS-DTYP] section 2.4.2. The size of this field is exactly 28 bytes,
regardless of the value of SidLen, which specifies how many bytes in this field are used. Note that
this is smaller than the theoretical size limit of a SID, which is 68 bytes. While Windows publishes
a general SID format, Windows never uses that format in its full generality. 28 bytes is sufficient
for a Windows SID.
NameLen: The number of characters in the StringName field, not including the terminating null
character, used to represent the object's distinguishedName attribute value. Zero indicates that
the DSNAME does not identify the distinguishedName value of the directory object.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
structLen
SidLen
Guid.Data1
Guid.Data2 Guid.Data3
Guid.Data4...
...Guid.Data4
Sid...
...Sid...
...Sid...
...Sid...
481 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
...Sid...
...Sid...
...Sid
NameLen
When comparing DSNAME elements for equality, an implementation must be aware that multiple
attributes can be specified. DSNAME values x and y are equal only if one of the following conditions
holds:
x.Guid is not zeros and y.Guid is not zeros and x.Guid = y.Guid
x.StringLen ≠ 0.
x.Guid is zeros.
y.Guid is zeros.
x.StringLen = 0.
y.StringLen = 0.
x.SidLen ≠ 0.
x.SidLen = y.SidLen.
x.Sid and y.Sid contain identical values in the first x.SidLen array items.
5.51 DSTIME
DSTIME is a concrete type for time expressed as the number of seconds since January 1, 1601,
12:00:00 A.M.
482 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef LONGLONG DSTIME;
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
cSeconds...
...cSeconds
5.52 DWORD
A concrete type for a 32-bit, unsigned integer, as specified in [MS-DTYP] section 2.2.9.
5.53 ENTINF
ENTINF is a concrete type for the identity and attributes (some or all) of a given object.
typedef struct {
DSNAME* pName;
unsigned long ulFlags;
ATTRBLOCK AttrBlock;
} ENTINF;
ulFlags: A flags field that supports the following flags, which are presented in little-endian byte
order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X X D M X X X X X X X X X X X X X X X R X X X X X X X X
O M
AttrBlock: Some of all of the attributes for this object, as determined by the particular method. See
section 1.3.3 for an overview of methods using type ENTINF.
5.54 ENTINF_GetValue
procedure ENTINF_GetValue (
entInf: ENTINF,
483 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attribute: ATTRTYP,
prefixTable: PrefixTable): ATTRVAL
Informative summary of behavior: The ENTINF_GetValue procedure scans an ENTINF structure and
returns the first ATTRVAL structure for the requested attribute. The attribute parameter is based on
dc.prefixTable, while the attributes within entInf are based on the prefixTable parameter.
attrType: ATTRTYP
oid : OID
5.55 ENTINF_SetValue
procedure ENTINF_SetValue (
var entInf: ENTINF,
attribute: ATTRTYP,
attrVal: ATTRVAL,
prefixTable: PrefixTable)
The ENTINF_SetValue procedure updates an attribute value within the ENTINF. If attrVal is null,
then the attribute is removed from the list (if it exists). If the value is non-null, then the attribute
value is updated or added to the list (when a value is not already present). The attribute and attrVal
parameters are based on dc.prefixTable, while the attributes within entInf are based on the
prefixTable parameter.
5.56 ENTINF_EnumerateAttributes
procedure ENTINF_EnumerateAttributes(
e: ENTINF,
prefixTable: PrefixTable): set of ATTRTYP
5.57 ENTINFLIST
484 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.58 Expunge
procedure Expunge(obj: DSName)
The Expunge procedure physically removes an object whose DSName is obj from the directory,
without enforcing referential integrity constraints. The object is immediately removed without
undergoing conversion to a tombstone.
5.59 FILETIME
5.60 FilteredGCPAS
procedure FilteredGCPAS() : PARTIAL_ATTR_VECTOR_V1_EXT^
filteredAttributeSet := GetFilteredAttributeSet()
return pPartialAttrVector^
5.61 FilteredPAS
procedure FilteredPAS() : PARTIAL_ATTR_VECTOR_V1_EXT
485 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attrSetSeq: sequence of DSName
filteredAttributeSet: sequence of ATTRTYP
pPartialAttrVector: PARTIAL_ATTR_VECTOR_V1_EXT^
attrId: ATTRTYP
i, j: int
filteredAttributeSet := GetFilteredAttributeSet()
return pPartialAttrVector^
5.62 FindChar
procedure FindChar(
s: unicodestring, start: integer, c: UCHAR): integer
Informative summary of behavior: The FindChar procedure returns the zero-based index of the first
occurrence of c in the portion of s between the start and the end of s.
If s = null, start < 0 or start > s.length-1, this procedure returns -1. Otherwise, let s be represented
as the sequence of characters {s[0], ... s[s.length - 1]}. Let i be such that i >= start, i <= s.length -
1, s[i] = c, and s[start] ≠ c, ..., s[i-1] ≠ c. If such an i exists, this procedure returns i. Otherwise, this
procedure returns -1.
5.63 FindCharRev
procedure FindCharRev(
s: unicodestring,
start: integer,
c: UCHAR): integer
Informative summary of behavior: The FindCharRev procedure returns the zero-based index of the
last occurrence of c in the portion of s between the start and the end of s.
If s = null, start < 0 or start > s.length-1, this procedure returns -1. Otherwise, let s be represented
as the sequence of characters {s[0], ... s[s.length - 1]}. Let i be such that i >= start, i <= s.length -
1, s[i] = c, and s[i+1] ≠ c, ..., s[s.length - 1] ≠ c. If such an i exists, this procedure returns i.
Otherwise, this procedure returns -1.
486 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.64 FOREST_TRUST_INFORMATION
FOREST_TRUST_INFORMATION is a concrete type for state information about trust relationships with
other forests. This data is stored in objects of class trustedDomain in the domain NC replica of
the forest root domain. Specifically, the msDS-TrustForestTrustInfo attribute on such objects
contains information about the trusted forest or realm. The structure of the information contained in
this attribute is represented in the following manner.
1 2 3
0
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Version
RecordCount
Records (variable)
...
Version (4 bytes): The version of the data structure. The only supported version of the data
structure is 1.
Records (variable): Variable-length records that each contain a specific type of data about the forest
trust relationship.
Note Records are not necessarily aligned to 32-bit boundaries. Each record starts at the next
byte after the previous record ends.
5.64.1 Record
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
RecordLen
Flags
Timestamp
...
...
487 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Flags (4 bytes): Individual bit flags that control how the forest trust information in this record can
be used.
If RecordType = 0 or 1, the Flags field can have one or more of the following bits, which are
presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X T T T X X X X X X X X X X X X X X X X X X X X X X X X
D D D
C A N
If RecordType = 2, the Flags field can have one or more of the following bits, which are
presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X N N S S X X X X X X X X X X X X X X X X X X X X X X X X
D D D D
C A C A
Timestamp (8 bytes): A FILETIME (section 5.59) that contains the time when this entry was
created.
RecordType (1 byte): An 8-bit value that specifies the type of record contained in this specific entry.
The allowed values are specified in section 5.65.
488 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ForestTrustData (variable): A variable length, type-specific record, depending on the RecordType
value, that contains the specific type of data about the forest trust relationship.
There are three different type-specific records. Depending on the value of the RecordType field,
the structure of the type-specific record differs as described below.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
NameLen
If RecordType = 2, then the type-specific record is represented in the following manner. Note
that the record contains the following structures one after another. It is important to note that
none of the data shown below is necessarily aligned to 32-bit boundaries.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
SidLen
DnsNameLen
NetbiosNameLen
Sid: The SID of a domain in the trusted forest, specified as a SID structure, which is defined
in [MS-DTYP] section 2.4.2.
DnsName: The FQDN (1) of a domain in the trusted forest, in UTF-8 format.
NetbiosName: The NetBIOS name of a domain in the trusted forest, in UTF-8 format.
489 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
If RecordType is not one of the preceding values, then the type-specific record is represented in
the following manner.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
BinaryDataLen
This section describes procedures that use the forest trust information contained in the msDS-
TrustForestTrustInfo attribute to determine if a given domain is in a trusted forest.
The procedures described in this section use the following data structures.
struct {
ULONG RecordCount;
PX_FOREST_TRUST_RECORD *Entries;
} X_FOREST_TRUST_INFORMATION;
struct {
ULONG Flags;
FOREST_TRUST_RECORD_TYPE ForestTrustType;
LARGE_INTEGER Time;
union {
LPWSTR TopLevelName;
X_FOREST_TRUST_DOMAIN_INFO DomainInfo;
X_FOREST_TRUST_BINARY_DATA Data;
} ForestTrustData;
} X_FOREST_TRUST_RECORD, *PX_FOREST_TRUST_RECORD;
struct {
SID *Sid;
LPWSTR DnsName;
LPWSTR NetbiosName;
} X_FOREST_TRUST_DOMAIN_INFO;
struct {
ULONG Length;
BYTE *Buffer;
} X_FOREST_TRUST_BINARY_DATA;
procedure ExtractString(
buffer: sequence of BYTE,
index: DWORD, size: DWORD): unicodestring;
490 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The sequence [index .. index + size] of bytes in buffer is interpreted as a UTF-8 string, and a
corresponding unicodestring (section 3.4.3) is returned.
procedure ExtractSid(
buffer: sequence of BYTE,
index: DWORD, size: DWORD): SID;
The sequence [index .. index + size] of bytes in buffer is converted into a SID structure and returned.
procedure ExtractBinary(
buffer: sequence of BYTE,
index: DWORD, size: DWORD): sequence of BYTE;
procedure UnmarshalForestTrustInfo
(inputBuffer: sequence of BYTE,
var forestTrustInfo: X_FOREST_TRUST_INFORMATION): boolean
index: DWORD
pdwVersion: ADDRESS OF DWORD
pdwRecordCount: ADDRESS OF DWORD
i: DWORD
pwdRecordLength: ADDRESS OF DWORD
pTrustRecord: ADDRESS OF X_FOREST_TRUST_RECORD
pulTime: ADDRESS OF ULONGLONG
pType: ADDRESS OF BYTE
pSid: ADDRESS OF SID
pString: ADDRESS OF unicodestring
pdwSize: ADDRESS OF DWORD
index := 0
pdwVersion := ADR(inputBuffer[index])
if pdwVersion^ ≠ 1 then
return false
endif
index := index + 4
pdwRecordCount := ADR(inputBuffer[index])
forestTrustInfo.RecordCount := pdwRecordCount^
index := index + 4
pTrustRecord := forestTrustInfo.Entries[i]
491 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
/* Next 4 bytes of the record are the flags */
pdwFlags := ADR(inputBuffer[index])
pTrustRecord^.Flags := pdwFlags^
index := index + 4
if (pTrustRecord^.ForestTrustType = ForestTrustTopLevelName or
pTrustRecord^.ForestTrustType = ForestTrustTopLevelNameEx)
then
492 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
endif
endif
return true
The following procedures are used to determine if a given domain name, SID, or UPN is in a trusted
forest. Since they make use of forest trust information data stored in objects in the NC replica of the
forest root domain (see FOREST_TRUST_INFORMATION), these functions only work on GC servers or
DCs in the forest root domain.
return false
foreach o in tdos
if not UnmarshalForestTrustInfo(o!msDS-TrustForestTrustInfo, f)
then
return false
else
foreach e in f.Entries
if (e.ForestTrustType = ForestTrustDomainInfo and
e.DomainInfo.Sid = sid and
LSA_FTRECORD_DISABLED_REASONS not in e.Flags) then
b := true
foreach g in f.Entries
if (g.ForestTrustType = ForestTrustTopLevelNameEx and
493 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
LSA_FTRECORD_DISABLED_REASONS not in g.Flags and
(g.TopLevelName = e.DomainInfo.DnsName or
IsSubdomainOf(e.DomainInfo.DnsName, g.TopLevelName))) then
b := false
break
endif
endfor
if b then
return true
endif
endif
endfor
endif
endfor
return false
The IsSubdomainOf procedure takes a pair of domain names and returns true if subdomainName is a
subdomain of superiordomainName as described in [RFC1034] section 3.1, and false otherwise.
return false
494 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure IsDomainDnsNameInTrustedForest(name: unicodestring,
var referredDomain: unicodestring) : boolean
foreach o in tdos
if not UnmarshalForestTrustInfo(o!msDS-TrustForestTrustInfo, f)
then
return false
else
foreach e in f.Entries
if (e.ForestTrustType = ForestTrustDomainInfo and
e.DomainInfo.DnsName = name and
LSA_SID_DISABLED_ADMIN not in e.Flags and
LSA_SID_DISABLED_CONFLICT not in e.Flags and
ForestTrustOwnsName(f, e.DomainInfo.DnsName) then
referredDomain := o!trustPartner
return true
endif
endfor
endif
endfor
return false
procedure IsDomainNetbiosNameInTrustedForest
(name: unicodestring, var referredDomain: unicodestring): boolean
foreach o in tdos
if not UnmarshalForestTrustInfo(o!msDS-TrustForestTrustInfo, f)
then
return false
else
foreach e in f.Entries
if (e.ForestTrustType = ForestTrustDomainInfo and
e.DomainInfo.NetbiosName = name and
NETBIOS_DISABLED_MASK not in e.Flags and
ForestTrustOwnsName(f, e.DomainInfo.DnsName) then
referredDomain := o!trustPartner
return true
endif
endfor
endif
endfor
return false
The IsUPNInTrustedForest procedure uses the following helper procedure to determine if a UPN is in a
trusted forest.
495 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
procedure IsNamespaceInTrustedDomain
(name: unicodestring, var trustedForestName: unicodestring): boolean
foreach o in tdos
if not UnmarshalForestTrustInfo(o!msDS-TrustForestTrustInfo, f)
then
return false
else
foreach e in f.Entries
if (e.ForestTrustType = ForestTrustTopLevelName and
e.TopLevelName = dnsParent and
LSA_FTRECORD_DISABLED_REASONS not in e.Flags) then
b := true
foreach g in f.Entries
if (g.ForestTrustType = ForestTrustTopLevelNameEx and
LSA_FTRECORD_DISABLED_REASONS not in g.Flags and
(g.TopLevelName = dnsParent or
IsSubdomainOf(dnsParent, g.TopLevelName))) then
b := false
break
endif
endfor
if (b) then
trustedForestName := o!trustPartner
return true
endif
endif
endfor
endif
endfor
endfor
return false
5.65 FOREST_TRUST_RECORD_TYPE
typedef enum
{
ForestTrustTopLevelName = 0,
ForestTrustTopLevelNameEx = 1,
ForestTrustDomainInfo = 2
} FOREST_TRUST_RECORD_TYPE;
496 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.66 ForestRootDomainNC
procedure ForestRootDomainNC(): DSName
The ForestRootDomainNC procedure returns the DSName of the forest root domain NC.
5.67 FullReplicaExists
procedure FullReplicaExists(nc : DSName) : boolean
The FullReplicaExists procedure returns true if the NC replica with root nc is a full replica.
5.68 GCPAS
procedure GCPAS() : PARTIAL_ATTR_VECTOR_V1_EXT
Informative summary of behavior: The GCPAS procedure returns a reference to an instance of the
PARTIAL_ATTR_VECTOR_V1_EXT structure, which contains the list of attributes that can be present,
based on the schema, on a GC NC replica.
return pPartialAttrVector
5.69 GetFilteredAttributeSet
procedure GetFilteredAttributeSet() : sequence of ATTRTYP
497 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
filteredAttrSetObjSeq := select o from subtree SchemaNC() where
(fRODCFilteredAttribute in o!searchFlags) and
(not FLAG_ATTR_REQ_PARTIAL_SET_MEMBER in
o!systemFlags) and
(not o!systemOnly = true) and
(not AttrtypFromSchemaObj(o) in
{currentValue, dBCSPwd, unicodePwd,
ntPwdHistory, priorValue,
supplementalCredentials, trustAuthIncoming,
trustAuthOutgoing, lmPwdHistory,
initialAuthIncoming, initialAuthOutgoing,
msDS-ExecuteScriptPassword, displayName,
codePage, creationTime, lockoutDuration,
lockOutObservationWindow, logonHours,
lockoutThreshold, maxPwdAge, minPwdAge,
minPwdLength, netbiosName, pwdProperties,
pwdHistoryLength, pwdLastSet,
securityIdentifier, trustDirection,
trustPartner, trustPosixOffset, trustType,
rid, domainReplica, accountExpires,
ntMixedDomain, OperatingSystem,
OperationSystemVersion,
operatingSystemServicePack, fsmoRoleOwner,
trustAttributes, trustParent, flatName,
sidHistory, dnsHostName, lockoutTime,
servicePrincipalName, isCriticalSystemObject,
msDS-TrustForestTrustInfo, msDS-SPNSuffixes,
msDS-AdditionalDnsHostName, msDS-
AdditionalSamAccountName, msDS-
AllowedToDelegateTo, msDS-KrbTgtLink, msDS-
AuthenticatedAtDC, msDS-
SupportedEncryptionTypes})
for i := 0 to filteredAttrSetObjSeq.length-1
filteredAttrSet[i]:=
AttrtypFromSchemaObj(filteredAttrSetObjSeq [i])
endfor
return filteredAttrSet
5.70 GetNCType
procedure GetNCType(nc: DSName) : ULONG
Informative summary of behavior: The GetNCType procedure returns the type of the NC replica.
ncType: ULONG
ncType = 0;
498 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ncType := 0
else
ncType := ncType + {NCT_FILTERED_ATTRIBUTE_SET,
NCT_GC_PARTIAL}
endif
endif
return ncType
5.71 GetAttrVals
procedure GetAttrVals(
o: DSName,
att: ATTRTYP,
includeDeletedLinks: boolean): set of attribute value
The GetAttrVals procedure constructs a set V that contains each value of the attribute att from
object o.
If att is not a link attribute, the value of includeDeletedLinks is ignored. If att is a link attribute and
includeDeletedLinks = false, the set includes only those values v of att such that LinkStamp(o, att,
v).timeDeleted = 0. If att is a link attribute and includeDeletedLinks = true, the set contains all values
v of att, even those such that LinkStamp(o, att, v).timeDeleted ≠ 0.
5.72 GetCallerAuthorizationInfo
procedure GetCallerAuthorizationInfo(): ClientAuthorizationInfo
5.73 GetDefaultObjectCategory
procedure GetDefaultObjectCategory(class: ATTRTYP): DSName
The GetDefaultObjectCategory procedure returns the defaultObjectCategory value for the object
class class.
classObj: DSName
classObj := SchemaObj(class)
return classObj!defaultObjectCategory
5.74 GetDomainNC
procedure GetDomainNC(o: DSName): DSName
The DSName of the NC in which the object whose DSName is o is located if o is in an application
partition.
499 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The DSName of the NC that is the root for the domain where o is located if o is in a domain
partition.
5.75 GetDSNameFromAttrVal
procedure GetDSNameFromAttrVal(attrTyp: ATTRTYP, attrVal: ATTRVAL): DSName
The GetDSNameFromAttrVal procedure extracts the DSName from the ATTRVAL attrVal based on its
syntax, which is determined from the ATTRTYP attrTyp. If the syntax is not one of Object(DS-DN),
Object(DN-String), or Object(DN-Binary), this procedure returns a null DSName.
5.76 GetDSNameFromDN
procedure GetDSNameFromDN(dn: unicodestring): DSName
The GetDSNameFromDN procedure produces a DSName from dn. Let d represent the returned
DSName. It is the case that d.dn = dn. If there is an object o in an NC replica hosted by the server
such that o!distinguishedName = dn, then d.guid =o!objectGUID; otherwise, all fields of d.guid are
zero. Furthermore, if o!objectSid ≠ null, then d.sid = o!oobjectSid; otherwise d.sid = null.
5.77 GetDSNameFromNetworkAddress
procedure GetDSNameFromNetworkAddress(n: NetworkAddress): DSName
5.78 GetForestFunctionalLevel
procedure GetForestFunctionalLevel(): integer
The GetForestFunctionalLevel procedure returns the forest functional level (see [MS-ADTS] section
6.1.4.4).
partitionsContainer: DSName
partitionsContainer:= DescendantObject(ConfigNC(), "CN=Partitions,")
if partitionsContainer!msDS-Behavior-Version = null then
return DS_BEHAVIOR_WIN2000
else
return partitionsContainer!msDS-Behavior-Version
endif
5.79 GetFSMORoleOwner
procedure GetFSMORoleOwner(role: integer): DSName
500 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The GetFSMORoleOwner procedure returns the DSName of the nTDSDSA object of the DC that owns
the FSMO role specified by role. The following table lists the valid values for role.
FSMO_SCHEMA 1
FSMO_DOMAIN_NAMING 2
FSMO_PDC 3
FSMO_RID 4
FSMO_INFRASTRUCTURE 5
5.80 GetInstanceNameFromSPN
procedure GetInstanceNameFromSPN(spn: unicodestring): unicodestring
The GetInstanceNameFromSPN procedure syntactically extracts and returns the instance name from a
two-part or three-part SPN. The instance name is the second part of the SPN. For example, dc-
01.fabrikam.com is the instance name in the two-part SPN "ldap/dc-01.fabrikam.com" and in the
three-part SPN "ldap/dc-01.fabrikam.com/fabrikam.com".
5.81 GetObjectNC
procedure GetObjectNC(o: DSName): DSName
The GetObjectNC procedure returns the DSName of the NC in which the object whose DSName is o is
located, or returns NULL if the NC is not found or it is not of the DN form specified in [RFC2253].
5.82 GetProxyEpoch
procedure GetProxyEpoch(dnbinValue: DNBinary): DWORD
The GetProxyEpoch procedure returns the decoded proxy epoch field from the dnbinValue, which is a
proxiedObjectName value.
5.83 GetProxyType
procedure GetProxyType(dnbinValue: DNBinary): DWORD
The GetProxyType procedure returns the decoded proxy type field from the dnbinValue, which is a
proxiedObjectName value.
5.84 GetServiceClassFromSPN
procedure GetServiceClassFromSPN(spn: unicodestring): unicodestring
The GetServiceClassFromSPN procedure syntactically extracts and returns the service class from a
two-part or three-part SPN. The service class is the first part of the SPN. For example, "ldap" is the
501 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
service class in the two-part SPN "ldap/dc-01.fabrikam.com" and in the three-part SPN "ldap/dc-
01.fabrikam.com/fabrikam.com".
5.85 GetServiceNameFromSPN
procedure GetServiceNameFromSPN(spn: unicodestring): unicodestring
The GetServiceNameFromSPN procedure syntactically extracts and returns the service name from a
three-part SPN. If the supplied SPN is a two-part SPN, it will return null. The service name is the third
part of the SPN. For example, "fabrikam.com" is the service name in the three-part SPN "ldap/dc-
01.fabrikam.com/fabrikam.com".
The groupType bit flags can appear in values of the groupType attribute that define a group type.
The bit flags are presented below in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X Q B U R A X X X X X X X X X X X X X X X X X S X X X X X X X
G G G G G E
5.87 GUID
The type GUID has a well-defined null value, which is called the NULL GUID. The constant NULLGUID
is equal to this value.
When comparing two GUID values, each GUID value is treated as an octet string in little-endian byte
order.
Two GUID values g1 and g2 are equal if they are octet-for-octet identical.
Value g1 is less than value g2 only if there exists an N (where N is less than the size of the GUID type
in octets) such that octets 0...N-1 of g1 and g2 are identical, and octet N of g1 is less than octet N of
g2.
Value g1 is greater than value g2 only if there exists an N (where N is less than the size of the GUID
type in octets) such that octets 0...N-1 of g1 and g2 are identical, and octet N of g1 is greater than
octet N of g2.
502 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.88 GuidFromString
procedure GuidFromString(BracedFormat: boolean,
strGuid: unicodestring): GUID
The GuidFromString procedure converts the string representation of a GUID specified in strGuid (for
example, "{12AA5F43-C776-4D63-B347-1175DF806200}" or "12aa5f43-c776-4d63-b347-
1175df806200") to a binary GUID. When BracedFormat is true, to be a valid string representation of a
GUID, strGuid MUST be in the curly braced GUID string format as defined in [MS-DTYP] section
2.3.4.3. When BraceFormat is false, to be a valid string representation of a GUID, strGuid MUST be in
the string GUID format as defined in [RFC4122]. If strGuid is not a valid string representation of a
GUID, null is returned.
5.89 GuidToString
procedure GuidToString(guid: GUID): unicodestring
The GuidToString procedure converts guid to the concatenation of "{", the string representation
defined in [RFC4122] section 3, and "}"; for example, {12aa5f43-c776-4d63-b347-1175df806200}.
5.90 handle_t
handle_t is a concrete type for an RPC binding handle, as specified in [C706] section 4.2.9.7 and
[MS-DTYP] section 2.1.3.
The instanceType bit flags are bits that can appear in values of the instanceType attribute. The bit
flags are presented in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X N N N W U N X X X X X X X X X X X X X X X X X X X X X X X X
G C A R I H
NA (IT_NC_ABOVE, 0x00000008): The DC hosts the NC above this one. The IT_NC_HEAD bit must
also be set.
NC (IT_NC_COMING, 0x00000010): The NC replica is in the process of being constructed for the
first time via replication. IT_NC_HEAD must also be set.
NG (IT_NC_GOING, 0x00000020): The NC replica is in the process of being removed from the DC.
IT_NC_HEAD must also be set.
503 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.92 Is2PartSPN
procedure Is2PartSPN(spn: unicodestring): boolean
The Is2PartSPN procedure returns true if spn is an SPN consisting of two parts, and false otherwise.
5.93 Is3PartSPN
procedure Is3PartSPN(spn: unicodestring): boolean
The Is3PartSPN procedure returns true if spn is an SPN consisting of three parts, and false otherwise.
5.94 IsAdlds
procedure IsAdlds() : boolean
If the local DC is running Active Directory as AD LDS, this procedure returns TRUE. It returns
FALSE otherwise.
5.95 IsBuiltinPrincipal
procedure IsBuiltinPrincipal(sid: SID): boolean
The IsBuiltinPrincipal procedure returns true if sid is the SID of a built-in security principal, and
returns false if it is not.
5.96 IsDomainNameInTrustedForest
procedure IsDomainNameInTrustedForest(name: unicodestring,
var referredDomain: unicodestring) : boolean
5.97 IsDomainSidInTrustedForest
procedure IsDomainSidInTrustedForest(sid: SID): boolean
The IsDomainSidInTrustedForest procedure returns true if the domain identified by sid is in a forest
trusted by the caller's forest, as determined by the FOREST_TRUST_INFORMATION state of the caller's
forest, and false otherwise. The sid parameter is the SID of a domain.
504 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.98 IsDCAccount
procedure IsDCAccount(o: DSName): boolean
The IsDCAccount procedure returns true if the object represents the computer account of a DC.
5.99 IsForwardLinkAttribute
procedure IsForwardLinkAttribute (att:ATTYTYP): Boolean
The IsForwardLinkAttribute procedure returns true if the given ATTRTYP represents a forward link
attribute. Forward link attribute is defined in [MS-ADTS] section 3.1.1.1.6.
5.100 IsGC
procedure IsGC(): boolean
The IsGC procedure returns true if the DC on which it is called is a global catalog server as defined
in [MS-ADTS] section 3.1.1.1.10 or is in a forest that contains only one domain. Otherwise, the
procedure returns false.
5.101 IsGetNCChangesPermissionGranted
procedure IsGetNCChangesPermissionGranted(
msgIn: DRS_MSG_GETCHGREQ_V10) : boolean
ncRoot: DSName
clientDsaObj: DSName
serverObj: DSName
cachedAt: DSName
cachedUser: DSName
fRevealSecret: boolean
fRevealFilteredSet: boolean
ncRoot := GetObjectNC(msgIn.pNC^)
if not AccessCheckCAR(ncRoot, Ds-Replication-Get-Changes) then
return false
endif
fRevealSecret := true
if IsRevealSecretRequest(msgIn) then
if AccessCheckCAR(ncRoot, Ds-Replication-Get-Changes-All) = false
then
if (msgIn.ulExtendedOp = EXOP_REPL_SECRETS) then
clientDsaObj := select one o from ConfigNC()where
o!objectGUID = msgIn.uuidDsaObjDest
serverObj := clientDsaObj!parent
cachedAt := serverObj!serverReference
cachedUser := msgIn.pNC^
fRevealSecret := RevealSecretsForUserAllowed(
cachedAt, cachedUser)
else
505 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
fRevealSecret := false
endif
endif
endif
fRevealFilteredSet := true
if IsRevealFilteredAttr(msgIn) then
if (AccessCheckCAR(ncRoot, Ds-Replication-Get-Changes-All) = false
and
AccessCheckCAR(ncRoot, Ds-Replication-Get-Changes-In-Filtered-Set)
= false) then
fRevealFilteredSet := false
endif
endif
5.102 IsGUIDBasedDNSName
procedure IsGUIDBasedDNSName(o: DSName, instanceName: unicodestring):
boolean
The IsGUIDBasedDNSName procedure returns true if instanceName is the DNS host name of the DC,
identified by o, constructed in the form "<DSA GUID>._msdcs.<DNS forest name>".
5.103 IsMemberOfBuiltinAdminGroup
procedure IsMemberOfBuiltinAdminGroup(): boolean
The IsMemberOfBuiltinAdminGroup procedure returns true if the client security context, which MUST
be retrieved using the method described in [MS-RPCE] section 3.3.3.4.3, is a member of the
BUILTIN\Administrators group, and false if it is not. The BUILTIN\Administrators group is the group
with the SID S-1-5-32-544. [MS-SAMR] section 3.1.4.2 describes the accounts included in the built-in
Administrators group by default.
5.104 IsRecycleBinEnabled
procedure IsRecycleBinEnabled(): boolean
Informative summary of behavior: The IsRecycledBinEnabled procedure returns true if the Recycle
Bin optional feature is enabled. Otherwise, it returns false. For more details, see [MS-ADTS]
sections 3.1.1.9, 3.1.1.9.1, and 6.1.1.2.1
recycleBinFeatureGuid: GUID
scope: DSNAME
recycleBinFeatureGuid := {766ddcd8-acd0-445e-f3b9-a7f9b6744f2a}
scope := DSName of the nTDSDSA object
return IsOptionalFeatureEnabled (scope, recycleBinFeatureGuid)
5.105 IsRevealFilteredAttribute
procedure IsRevealFilteredAttribute(
506 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_MSG_GETCHGREQ_V10 msgIn) : boolean
Informative summary of behavior: The IsRevealFilteredAttribute procedure returns true if the source
DC is requesting attributes in the filtered set.
filteredAttrSet := GetFilteredAttributeSet()
for i := 0 to msgIn.pPartialAttrSet.cAttrs - 1
if msgIn.pPartialAttrSet.rgPartialAttr[i]) in
filteredAttrSet then
return true;
endif
endfor
for i := 0 to msgIn.pPartialAttrSetEx.cAttrs - 1
if msgIn.pPartialAttrSetEx.rgPartialAttr[i]) in
filteredAttrSet then
return true;
endif
endfor
return false;
5.106 IsPrivilegedAccessManagementEnabled
procedure IsPrivilegedAccessManagementEnabled(): boolean
privilegedAccessManagementFeatureGuid: GUID
scope: DSNAME
privilegedAccessManagementFeatureGuid := {ec43e873-cce8-4640-b4ab-07ffe4ab5bcd}
scope := DSName of the nTDSDSA object
return IsOptionalFeatureEnabled (scope, privilegedAccessManagementFeatureGuid)
5.107 IsRevealSecretRequest
procedure IsRevealSecretRequest(DRS_MSG_GETCHGREQ_V10 msgIn)
: boolean
Informative summary of behavior: The IsRevealSecretRequest procedure returns true if the source DC
is requesting secret attributes.
507 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if (msgIn.ulExtendedOp = EXOP_FSMO_REQ_ROLE or
msgIn.ulExtendedOp = EXOP_FSMO_REQ_RID_ALLOC or
msgIn.ulExtendedOp = EXOP_FSMO_RID_REQ_ROLE or
msgIn.ulExtendedOp = EXOP_FSMO_REQ_PDC or
msgIn.ulExtendedOp = EXOP_FSMO_ABANDON_ROLE) then
return true
endif
if (msgIn.ulExtendedOp = EXOP_REPL_SECRETS or
msgIn.pAttributeSet = null then /* requesting all attributes that
includes secrets*/
return true
endif
for i := 0 to msgIn.pPartialAttrSet.cAttrs - 1
if IsSecretAttribute(msgIn.pPartialAttrSet.rgPartialAttr[i]) then
return true;
endif
endfor
for i := 0 to msgIn.pPartialAttrSetEx.cAttrs - 1
if IsSecretAttribute(msgIn.pPartialAttrSetEx.rgPartialAttr[i]) then
return true;
endif
endfor
return false;
5.108 IsServerExtensionsChanged
procedure IsServerExtensionsChanged(
ServerExtensions: DRS_EXTENSIONS_INT): boolean;
The IsServerExtensionsChanged procedure returns true if the supplied extensions are different from
the current server extensions. Otherwise, it returns false.
5.109 IsUPNInTrustedForest
prodecure IsUPNInTrustedForest(upn: unicodestring): boolean
The IsUPNInTrustedForest procedure returns true if the domain containing the account identified by
upn is in a forest trusted by the caller's forest, as determined by the FOREST_TRUST_INFORMATION
state of the caller's forest, and false otherwise. The upn parameter is the UPN of an account in a
domain.
5.110 IsValidServiceName
procedure IsValidServiceName(o: DSName, serviceName: unicodestring):
boolean
508 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The IsValidServiceName procedure returns true if the name serviceName is a valid service name in an
SPN for the DC represented by computer object o.
1. For GC SPNs, the service name must be the DNS forest name.
2. For other classes of SPNs, the service name must be either the DNS domain name of the DC's
default domain or the DNS domain name of an application NC hosted by the DC.
5.111 KCCFailedConnections
KCCFailedConnections is an abstract type consisting of a sequence of tuples, one tuple for each DC
for which the connection attempt failed. Each tuple contains the following fields:
DsaDN: A unicodestring (section 3.4.3) that contains the DN of the nTDSDSA object that
corresponds to the DC.
TimeFirstFailure: A FILETIME that contains the time when the KCC noticed the first failure while
contacting the DC.
FailureCount: An integer that contains the total number of failures the KCC encountered while
contacting the DC.
LastResult: A DWORD that contains a Windows error code, as specified in [MS-ERREF] section
2.2, that indicates the reason for the last failure.
The global variable dc for a DC has an associated field dc.kccFailedConnections, which maintains the
DC's KCCFailedConnections state.
5.112 KCCFailedLinks
KCCFailedLinks is an abstract type that consists of a sequence of tuples, one tuple for each
neighboring DC for which a connection attempt failed.
The fields of the tuple are the same as the fields of the KCCFailedConnections tuple.
The global variable dc for a DC has an associated field dc.kccFailedLinks, which maintains the DC's
KCCFailedLinks state.
5.113 LARGE_INTEGER
A concrete type for a 64-bit signed integer, as specified in [MS-DTYP] section 2.3.5.
5.114 LDAP_CONN_PROPERTIES
LDAP_CONN_PROPERTIES is a concrete type that contains bit flags that identify properties of an
LDAP connection. The bit flags are presented below in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
M S N G G U S B X X X X X X S S X X X X X X X X X X X X X X X X
D PL G S C D S N L G
5 O S P L D N
509 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
X: Unused. MUST be zero and ignored.
SSL (0x00000002): The LDAP connection corresponds to a Secure Sockets Layer (SSL) connection.
UDP (0x00000004): The LDAP connection corresponds to a User Datagram Protocol (UDP)
connection.
GSS (0x00000010): The Generic Security Services Application Programming Interface (GSS-API)
security package was used for authentication.
NGO (0x00000020): The Simple and Protected GSS-API Negotiation (SPNEGO) security package
was used for authentication.
MD5 (0x00000080): The Digest-MD5 security package was used for authentication.
5.115.1.1 AttributeList
Type AttributeList = [next: AttributeList,
value: AttributeListElement]
AttributeList is an abstract type that contains information about the attributes of an object. It is a
tuple of the following:
5.115.1.2 AttributeListElement
Type AttributeListElement = [type: LDAPString,
vals: AttributeVals]
510 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.115.1.3 AttributeVals
Type AttributeVals = [next: AttributeVals,
value: LDAPString]
AttributeVals is an abstract type that contains information about the value(s) of an attribute. It is a
tuple of the following:
5.115.1.4 Control
Type Control = [controlType: LDAPString, criticality: BOOL,
controlValue: LDAPString]
Control is an abstract type that contains information about an LDAP control. It is a tuple of the
following:
5.115.1.5 DirSyncControlValue
Type DirSyncControlValue = [flags: ULONG, size: ULONG, cookie: LDAPString]
size: In the request control value, this field indicates the maximum number of bytes expected in the
reply. In the reply control value, it is set to 0.
5.115.1.6 DirSyncSearchArg
Type DirSyncSearchArg = [pObject: LDAPString, pFilter: LDAPString,
pSelection: ATTRBLOCK, sizeLimit: ULONG]
DirSyncSearchArg is an abstract type that contains information about the LDAP search request. It is
a tuple of the following:
pFilter: The string representation, as defined in [RFC2254], of the LDAP search filter.
511 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.115.1.7 LDAPString
Type LDAPString = [length: ULONG, value: * UCHAR]
LDAPString is an abstract type that contains information about a string of unsigned characters. It is
a tuple of the following:
value: The string of unsigned characters that can contain null characters.
5.115.1.8 SearchResultEntry
Type SearchResultEntry = [objectName: LDAPString,
attributes: AttributeList]
SearchResultEntry is an abstract type that contains information about a search result entry. It is a
tuple of the following:
5.115.1.9 SearchResultEntryList
Type SearchResultEntryList = [next: SearchResultEntryList,
entry: SearchResultEntry]
SearchResultEntryList is an abstract type that contains information about search result entries. It is
a tuple of the following:
5.115.2.1 Cookie
The Cookie structure is a concrete type that contains information about the cookie in the
LDAP_SERVER_DIRSYNC_OID control value.
typedef struct {
UCHAR signature[4];
ULONG version;
FILETIME creationTime;
ULONGLONG reserved;
ULONG utdVectorSize;
USN_VECTOR usnVector;
UUID uuidSourceDsaInvocationID;
UCHAR utdVector[variable];
} Cookie;
512 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
creationTime: The creation time.
reserved: Unused.
5.115.3 ProcessDirSyncSearchRequest
procedure ProcessDirSyncSearchRequest(
[in] searchArg: DirSyncSearchArg,
[in] dirSyncControlValue: DirSyncControlValue,
[out] searchResultEntryList: SearchResultEntryList,
[out] dirSyncResponseControl: Control
) : ULONG
err: ULONG
msgIn: DRS_MSG_GETCHGREQ_V10
msgOut: DRS_MSG_GETCHGREPLY_NATIVE
filter: LDAPString
replFlags: ULONG
replFlags := dirSyncControlValue.flags
filter := searchArg.pfilter
/* Transform the replication GetChanges reply to reply for the LDAP search
request with LDAP_SERVER_DIRSYNC_OID control. */
513 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
return err
endif
return 0 /* success */
5.115.4 DirSyncReqToGetChgReq
procedure DirSyncReqToGetChgReq(
[in] searchArg: DirSyncSearchArg,
[in] dirSyncControlValue: DirSyncControlValue,
[out] nativeRequest: DRS_MSG_GETCHGREQ_V10
): ULONG
baseObjectDsName: DSNAME
replFlags: ULONG
ulSizeLimit: ULONG
ulMaxBytes: ULONG
errCode: ULONG
/* Validate input */
/* If the base of the search is not the root of an NC,
return unwillingToPerform */
nativeRequest.pNC := baseObjectDsName
nativeRequest.ulFlags := 0
nativeRequest.ulMoreFlags := 0
replFlags := dirSyncControlValue.flags
if (LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER in replFlags) then
nativeRequest.ulFlags := nativeRequest.ulFlags + {DRS_GET_ANC}
endif
ulSizeLimit := 1000
if (searchArg.sizeLimit) then
ulSizeLimit := min(searchArg.sizeLimit, ulSizeLimit)
endif
ulMaxBytes := dirSyncControlValue.size
if (ulMaxBytes = 0) then
ulMaxBytes := 1024*1024
endif
nativeRequest.cMaxBytes := ulMaxBytes
cookie := dirSyncControlValue.cookie
errCode := GetUsnUtdVectorFromCookie (cookie, nativeRequest)
if (errCode ≠ 0) then
return errCode
endif
514 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
return 0 /* success */
5.115.5 GetChgReplyToSearchResult
procedure GetChgReplyToSearchResult (
[in] chgReply: DRS_MSG_GETCHGREPLY_NATIVE,
[out] searchResultEntryList: SearchResultEntryList,
[out] dirSyncResponseControl: Control)
objCount: ULONG
valCount: ULONG
replEntinfList: REPLENTINFLIST
responseControlValue: DirSyncControlValue
objectGuid: GUID
attrType: ATTRTYP
minCookieLength: ULONG
utdVectorSize: ULONG
objCount := chgReply.cNumObjects
valCount := chgReply.cNumValues
replEntinfList := chgReply.pObjects
while (not replEntinfList = null)
TransformEntinfToSearchEntry(replEntinfList.Entinf,
searchResultEntryList.entry)
replEntinfList := replEntinfList.pNextEntInf
searchResultEntryList := searchResultEntryList.next
endwhile
515 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
foreach distinct object GUID objectGuid, referred by replValInf,
in chgReply.rgValues
TransformReplValInfNativeListToSearchEntry(
replValInf.pObject, chgReply, searchResultEntryList.entry)
searchResultEntryList := searchResultEntryList.next
endfor
dirSyncResponseControl.value.controlType := LDAP_SERVER_DIRSYNC_OID
dirSyncResponseControl.value.criticality := false
return
5.115.6 TransformEntinfToSearchEntry
procedure TransformEntinfToSearchEntry (
[in] entinf: ENTINF
[out] searchResultEntry: SearchResultEntry
)
attrList: AttributeList
attrVals: AttributeVals
attrList := searchResultEntry.attributes
attrList.value.type := LDAPDisplayNameFromAttrTyp (
entInf.AttrBlock.pAttr[i].attrTyp)
attrVals := attrList.value.vals
516 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
attrVals.value := ValueFromATTRVAL(
entInf.AttrBlock.pAttr[i].AttrVal.pAVal[j],
Syntax(entInf.AttrBlock.pAttr[i].attrTyp),
dc.prefixTable)
attrVals := attrVals.next
endfor
attrList := attrList.next
endfor
return
5.115.7 TransformReplValInfNativeListToSearchEntry
procedure TransformReplValInfNativeListToSearchEntry (
[in] o: DSNAME,
[in] chgReply: DRS_MSG_GETCHGREPLY_NATIVE,
[out] searchResultEntry: SEARCH_RESULT_ENRTY
)
attrList: AttributeList
attrVals: AttributeVals
attributeType: ATTRTYP
attrList := searchResultEntry.attributes
attrVals.value := ValueFromATTRVAL(replAttrVal,
attrType,
dc.prefixTable)
attrVals := attrVals.next
endfor
attrList := attrList.next
endfor
return
517 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.115.8 TransformDSNameToLdapDN
procedure TransformDSNameToLdapDN (
[in] dsName: DSNAME
[out] dn: LDAPString
)
dn.length := dsName.NameLen
dn.value := dsName.StringName
return
5.115.9 LDAPDisplayNameFromAttrTyp
Procedure LDAPDisplayNameFromAttrTyp (
[in] attrTyp: ATTRTYP
) : LDAPString
oid : OID
attributeDisplayName: LDAPString
attrObj: DSName
return attrDisplayName
5.115.10 GetResponseDirSyncControlValue
procedure GetResponseDirSyncControlValue (
[in] chgReply: DRS_MSG_GETCHGREPLY_NATIVE
) : DirSyncControlValue
518 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
replControlValue: DirSyncControlValue
minCookieLength: ULONG
utdVectorSize: ULONG
pUpToDateVecSrcV1: UPTODATE_VECTOR_V1_EXT
replControlValue.flag := chgReply.fMoreData
replControlValue.size := 0 /* must be ignored by the client */
/* minimum possible cookie size in bytes; that is, the size of a cookie
when a UTD vector is not present in the cookie. */
minCookieLength := 17*4
utdVectorSize := 16 /* offsetof(UPTODATE_VECTOR,V1.rgCursors[0]) */
+ (pUpToDateVecSrcV1.V1.cNumCursors *
sizeof(UPTODATE_CURSOR_V1))
return replControlValue
5.115.11 GetUsnUtdVectorFromCookie
procedure GetUsnUtdVectorFromCookie(
[in] replCookie: LDAPString,
[in/out] nativeRequest: DRS_MSG_GETCHGREQ_V10
): ULONG
utdVectorSize: ULONG
minCookieLength: ULONG
/* minimum possible cookie size in bytes; that is, the size of a cookie
when a UTD vector is not present in the cookie. */
519 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
minCookieLength := 17*4
return protocolError
endif
utdVectorSize := replCookie.value.utdVectorSize
if (utdVectorSize < sizeof(UPTODATE_VECTOR_V1_EXT)
or
replCookie.length < minCookieLength +
utdVectorSize) then
utdVectorSize := 0
endif
if (replCookie.value.uuidSourceDsaInvocationId =
DSAObj()!invocationId) then
nativeRequest.usnvecFrom := replCookie.value.usnVector
endif
return 0 /* success */
5.115.12 SecurityCheckForChanges
procedure SecurityCheckForChanges(
[in] msgIn: DRS_MSG_GETCHGREQ_V10,
[in] filter: LDAPString
): ULONG
attrVecInFilter: PARTIAL_ATTR_VECTOR_V1_EXT
520 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if msgIn.pPartialAttrSet.cAttrs ≠ 0 and
IsFilteredAttributePresent(msgIn.pPartialAttrSet) = true and
AccessCheckCAR(msgIn.pNC,
Ds-Replication-Get-Changes-In-Filtered-Set) = false and
AccessCheckCAR(msgIn.pNC,
Ds-Replication-Get-Changes-All) = false
then
return insufficientAccessRights
endif
if attrVecInFilter.cAttrs ≠ 0 and
IsFilteredAttributePresent(attrVecInFilter) = true and
AccessCheckCAR(msgIn.pNC,
Ds-Replication-Get-Changes-In-Filtered-Set) = false and
AccessCheckCAR(msgIn.pNC,
Ds-Replication-Get-Changes-All) = false
then
return insufficientAccessRights
endif
return 0 /* success */
5.115.13 IsFilteredAttributePresent
procedure IsFilteredAttributePresent(
[in] attrVec: PARTIAL_ATTR_VECTOR_V1_EXT
) : boolean
filteredAttrSet := GetFilteredAttributeSet()
for i := 0 to attrVec.cAttrs - 1
if attrVec.rgPartialAttr[i] in filteredAttrSet then
return true
endif
endfor
return false
5.116 LDAPConnections
LDAPConnections is an abstract type for the LDAP connections associated with a DC. It is a
sequence of tuples, one tuple per LDAP connection currently open. Each tuple contains the following
fields:
iPAddress: A DWORD that contains the IPv4 address of the client machine that established the
connection.
521 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
notificationCount: An integer that contains the number of LDAP notifications enabled on the
connection.
secTimeConnected: An integer that contains the time, in seconds, that the connection has been
open.
flags: A DWORD that contains the LDAP_CONN_PROPERTIES bit flags that identify properties of
the connection.
totalRequests: An integer that contains the total number of LDAP requests processed on the
connection.
userName: A unicodestring (section 3.4.3) that contains the name of the security principal that
opened the connection.
The global variable dc for a DC has an associated field dc.ldapConnections, which maintains the DC's
LDAPConnections state.
5.117 LinkStamp
procedure LinkStamp(
o: DSName;
att: ATTRTYP;
val: attribute value): LinkValueStamp
The LinkStamp procedure returns the LinkValueStamp associated with the last update to add or
remove value val from the forward link attribute att of object o. If val was last updated when the
forest functional level was DS_BEHAVIOR_WIN2000 (see [MS-ADTS] section 6.1.4.4), no
LinkValueStamp is associated with val, and LinkStamp returns null.
5.118 LinkValueStamp
LinkValueStamp is an abstract type that denotes information about the last update to a link value
of an object. It is a tuple that consists of all the fields in AttributeStamp, plus the following additional
fields:
timeCreated: The date and time at which the first originating update was made.
timeDeleted: The date and time at which the last replicated update was made that deleted the
value, or 0 if the value is not currently deleted.
timeExpired: The date and time at which the value must be removed from the state of the DC.
Comparisons
Values of LinkValueStamp are partially ordered. Let d be the result of x.dwVersion - y.dwVersion, cast
as a 32-bit integer. Then given two stamps x and y, x is said to be greater than y if any of the
following is true:
522 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
x.timeCreated = y.timeCreated and d = 0 and x.timeChanged > y.timeChanged
Conversions
A value x of type LinkValueStamp can be converted to and from its wire format y of type
PROPERTY_META_DATA_EXT by associating the values of fields in x with the values of the like-named
fields in y and y.MetaData.
Note The value of timeDeleted does not appear in the wire format. On the wire, the
PROPERTY_META_DATA_EXT value always appears as a value of the MetaData field of a
REPLVALINF_V1 or REPLVALINF_V3 structure. Given value x of type LinkValueStamp and value z of
type REPLVALINF_V1 or REPLVALINF_V3, z.fIsPresent is TRUE if x.timeDeleted is 0 and FALSE if
x.timeDeleted is nonzero.
Note The value of timeExpired does not appear in the REPLVALINF_V1 wire format. In cases where
the REPLVALINF_V1 wire format is used, the value of timeExpired is not returned to the caller.
5.119 LinkValueStampCompare
procedure LinkValueStampCompare(
LinkValueStamp stamp1,
LinkValueStamp stamp2): integer
d: integer
d := 0
if d = 0 then
if stamp1.timeCreated > stamp2.timeCreated then
d := 1
else if stamp1.timeCreated < stamp2.timeCreated then
d := -1
endif
endif
if d = 0 then
/* The value of d will be the re result of stamp1.dwVersion -
* stamp2.dwVersion, cast as a 32-bit integer. For example, if
* stamp1.dwVersion is 1 and stamp2.dwVersion is 3, d is -2. If
* stamp1.dwVersion is 5 and stamp2.dwVersion is 0xFFFFFFFA,
* d is 11.
*/
d := stamp1.dwVersion - stamp2.dwVersion
endif
if d = 0 then
if stamp1.timeChanged > stamp2.timeChanged then
d := 1
523 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
else if stamp1.timeChanged < stamp2.timeChanged then
d := -1
endif
endif
if d = 0 then
if stamp1.uuidOriginating > stamp2.uuidOriginating then
d := 1
else if stamp1.uuidOriginating < stamp2.uuidOriginating then
d := -1
endif
endif
return d
5.120 LocalAttidFromRemoteAttid
procedure LocalAttidFromRemoteAttid(
remotePT: PrefixTable,
remoteAttid : ATTRTYP) : ATTRTYP
oid : OID
5.121 LONG
A concrete type for a 32-bit, signed integer, as specified in [MS-DTYP] section 2.2.27.
5.122 LONGLONG
A concrete type for a 64-bit, signed integer, as specified in [MS-DTYP] section 2.2.28.
5.123 LPWSTR
A concrete type for a pointer to a string of double-byte Unicode characters, as specified in [MS-
DTYP] section 2.2.36.
5.124 MakeAttid
procedure MakeAttid(var t: PrefixTable, o: OID) : ATTRTYP
The MakeAttid procedure translates an abstract OID o to a concrete ATTRTYP, using the prefix table
specified by t. This procedure can mutate the supplied prefix table. See section 5.16.4 for the
specification of this procedure.
5.125 MakeProxyValue
procedure MakeProxyValue(
dnPart: DSName,
524 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
proxyType: DWORD,
proxyEpoch: DWORD): DNBinary
The MakeProxyValue procedure constructs and returns a value in the proxiedObjectName format
(section 5.157) from the provided parts. Let d be the returned DNBinary. d.dn equals dnPart and
d.binary is constructed from proxyType and proxyEpoch.
5.126 MasterReplicaExists
procedure MasterReplicaExists(nc : DSName) : boolean
The MasterReplicaExists procedure returns true only if the NC replica with root nc is a writable NC
replica.
5.127 MD5_CTX
5.128 MD5Final
procedure MD5Final(var context: MD5_CTX)
5.129 MD5Init
procedure MD5Init(var context: MD5_CTX)
5.130 MD5Update
procedure MD5Update(
var context: MD5_CTX,
input: sequence of BYTE,
inputLen: integer)
5.131 MergeUTD
procedure MergeUTD(
utd1: UPTODATE_VECTOR_V1_EXT,
utd2: UPTODATE_VECTOR_V1_EXT): UPTODATE_VECTOR_V1_EXT
525 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Informative summary of behavior: The client does not want to include objects in the inconsistency-
detection process that have not yet replicated. To meet this goal, it uses the MergeUTD procedure to
compute an UPTODATE_VECTOR_V1_EXT that has minimal pairwise values for each uuidDsa.
For every uuidDsa that is in both utd1 and utd2, add the uuidDsa to the returned
UPTODATE_VECTOR_V1_EXT with a corresponding USN value such that the USN is the smaller of the
USNs corresponding to the uuidDsa in utd1 and utd2.
5.132 MTX_ADDR
The MTX_ADDR structure defines a concrete type for the network name of a DC.
typedef struct {
[range(1,256)] unsigned long mtx_namelen;
[size_is(mtx_namelen)] char mtx_name[];
} MTX_ADDR;
mtx_namelen: A 32-bit, unsigned integer that specifies the number of bytes in mtx_name,
including a terminating null character.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
mtx_namelen
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X X X F G S X X X X X X X X X X X X X X X X X X X X X X X X
P P P
GP (NCT_GC_PARTIAL, 0x00000002): Objects in the NC replica can only have attributes that are
specified in the GC partial attribute set.
526 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.134 NetworkAddress
For the RPC transport in AD LDS, the NetworkAddress is a UTF-8 string in the following format:
<DC-name>:<DC-identifier>
<DC-name> is an IP address in the UTF-8 format, a fully qualified DNS name, or a NetBIOS
name.
The colon (":") is the literal separator between the DC-name and the DC-identifier.
5.135 NewPrefixTable
procedure NewPrefixTable() : PrefixTable
The NewPrefixTable procedure creates a new PrefixTable that contains a set of default prefixes. See
section 5.16.4 for the specification of this procedure.
5.136 Nt4ReplicationState
Nt4ReplicationState is an abstract type for the replication state for Windows NT 4.0 BDCs. It is a
tuple that contains the following fields:
SamNT4ReplicationUSN: A USN that records the replication update sequence number for
SAM database updates that are relevant to the Windows NT 4.0 replication protocol. Relevant
updates are described in [MS-ADTS] section 3.1.1.7.2.2.
BuiltinNT4ReplicationUSN: A USN that records the replication update sequence number for
built-in database updates that are relevant to the Windows NT 4.0 replication protocol. The built-in
database contains the objects for built-in principals.
BuiltinCreationTime: A FILETIME at which the replication update sequence number for the built-
in database was set to 1.
The global variable dc for a DC has an associated field dc.nt4ReplicationState. When a DC owns the
PDC FSMO role, this field contains its Nt4ReplicationState. [MS-ADTS] section 3.1.1.7.1.1 describes
how the components of dc.nt4ReplicationState are maintained and used to support replication via the
Windows NT 4.0 replication mechanism. As an implementation-specific behavior, other DCs might
maintain the dc.nt4ReplicationState field as well.
527 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.137 NT4SID
typedef struct {
char Data[28];
} NT4SID;
Data: Bytes that make up a SID structure, as specified in [MS-DTYP] section 2.4.2, in little-endian
byte order.
5.138 NTSAPI_CLIENT_GUID
The valid system flags used on directory objects are specified in [MS-ADTS] section 6.1.1.2.2.3.1.
5.140 NULLGUID
NULLGUID is a value of type GUID that is entirely zero, that is, {00000000-0000-0000-0000-
000000000000}. This is a constant representation of the NULL GUID value.
5.141 ObjExists
procedure ObjExists(dsName: DSName): boolean
The ObjExists procedure returns true if dsName identifies an object in some NC replica hosted by
the server.
rt: DSName
rt:= select one v from all where v = dsName
if (rt = null) then
return false
else
return true
endif
5.142 OID
OID is an abstract type for representing values of type String(Object-Identifier). Values of this type
are a dotted decimal unicodestring (section 3.4.3), for example, "1.2.840.113556.1.4.159".
5.143 OID_t
The OID_t structure defines a concrete type for an OID or a prefix of an OID; it is a component of
type PrefixTableEntry.
typedef struct {
[range(0,10000)] unsigned int length;
[size_is(length)] BYTE* elements;
528 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} OID_t;
5.144 OidFromAttid
procedure OidFromAttid(t: PrefixTable, attr: ATTRTYP) : OID
The OidFromAttid procedure translates a concrete ATTRTYP attr to an abstract OID, using the prefix
table specified by t. See section 5.16.4 for the specification of this procedure.
5.145 parent
parent is an abstract attribute that is present on every object, as specified in [MS-ADTS] section
3.1.1.1.3. This attribute is part of the state model but is not exposed in the Active Directory
schema.
5.146 PARTIAL_ATTR_VECTOR_V1_EXT
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(1,1048576)] DWORD cAttrs;
[size_is(cAttrs)] ATTRTYP rgPartialAttr[];
} PARTIAL_ATTR_VECTOR_V1_EXT;
5.147 partialAttributeSet
The abstract type set of ATTRTYP simplifies the specification of methods that read and write the
attribute partialAttributeSet. Reading the attribute partialAttributeSet returns a single value, which is
of type set of ATTRTYP. Each element in the set is an attribute that is in the subset of attributes
replicated to the partial replica.
5.148 PartialGCReplicaExists
procedure PartialGCReplicaExists(nc : DSName) : boolean
529 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The PartialGCReplicaExists procedure returns true if the NC replica with root nc is a partial NC
replica.
5.149 PAS_DATA
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
version
size
flag
pas (variable)
...
5.150 PdcChangeLog
PdcChangeLog is an abstract type for a sequence of CHANGELOG_ENTRY objects. The change log is
used to support replication of certain Active Directory changes to Windows NT 4.0 BDCs, and is
specified in [MS-ADTS] section 3.1.1.7.
The global variable dc for a DC has an associated field dc.pdcChangeLog. When a DC owns the PDC
FSMO role, this field contains its change log. As an implementation-specific behavior, other DCs
might maintain the dc.pdcChangeLog field as well.
5.151 PerformAddOperation
procedure PerformAddOperation(
data: ENTINF,
var newObjectName: DSName,
prefixTable: PrefixTable,
boolean: fAsOriginating): integer
The PerformAddOperation procedure performs an add operation with the given ENTINF to create a
new object in the directory. For more details, see [MS-ADTS] section 3.1.1.5.2.
530 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
The resulting object has the DSNAME data.pName.
For each ATTR attr in data.AttrBlock, let attribute be the ATTRTYP returned by
LocalAttidFromRemoteAttid(prefixTable, attr.attrType). Then the object created by
PerformAddOperation has an attribute whose ATTRTYP is attribute and that has the values
attr.AttrVal.pAVal[0... attr.AttrVal.valCount].
If fAsOriginating is true, then add the object as an originating update. See [MS-ADTS] section
3.1.1.1.9.
If the add operation succeeds, the DSName of the created object is returned in newObjectName and
the procedure returns 0. If the add operation fails, the procedure returns a Windows error code.
5.152 PerformAddOperationAsSystem
procedure PerformAddOperationAsSystem(
data: ENTINF,
prefixTable: PrefixTable,
var newObjectName: DSNAME): integer
5.153 PrefixTable
PrefixTable is an abstract type for a prefix table. See section 5.16.4 for the specification of this
type.
5.154 PrefixTableEntry
The PrefixTableEntry structure defines a concrete type for mapping a range of ATTRTYP values to
and from OIDs. It is a component of the type SCHEMA_PREFIX_TABLE.
typedef struct {
unsigned long ndx;
OID_t prefix;
} PrefixTableEntry;
5.155 PROPERTY_META_DATA_EXT
The PROPERTY_META_DATA_EXT structure defines a concrete type for the stamp of the last
originating update to an attribute.
typedef struct {
DWORD dwVersion;
DSTIME timeChanged;
UUID uuidDsaOriginating;
USN usnOriginating;
531 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
} PROPERTY_META_DATA_EXT;
dwVersion: The version of the attribute values, starting at 1 and increasing by one with each
originating update.
5.156 PROPERTY_META_DATA_EXT_VECTOR
typedef struct {
[range(0,1048576)] DWORD cNumProps;
[size_is(cNumProps)] PROPERTY_META_DATA_EXT rgMetaData[];
} PROPERTY_META_DATA_EXT_VECTOR;
Values of the proxiedObjectName attribute are of DNBinary type. The binary portion is composed of
two DWORDs, which are stored in big-endian format. The first DWORD contains the "proxy type"
value. The following table lists the valid values for the first DWORD.
PROXY_TYPE_PROXY 0x1 Used by the reference update task. For more details, see [MS-ADTS]
section 3.1.1.6.2.
The second DWORD is the "proxy epoch" value, which is a DWORD counter value that is used by the
cross-NC move operation.
5.158 RDN
RDN is an abstract type for representing the relative distinguished name (RDN) (as specified in
[RFC2253]).
5.159 rdnType
rdnType is an abstract attribute present on every object. The rdnType of an object is the RDN
attribute of the object, that is, an ATTRTYP that identifies the attributeSchema object of the RDN
attribute. rdnType is not represented in the schema and does not replicate in the normal way.
On an originating Add, the new object's rdnType is derived from the most specific structural object
class of the new object.
532 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
On a replicated Add, rdnType is derived as follows:
If the forest functional level is less than DS_BEHAVIOR_WIN2003, rdnType is derived from the
objectClass of the object, which replicates.
If the forest functional level is DS_BEHAVIOR_WIN2003 or greater, rdnType is derived from the
DN of the object, which replicates.
5.160 RecycleObj
procedure RecycleObj(o: DSName)
The RecycleObj procedure transforms, as described in [MS-ADTS] section 3.1.1.5.5, the object whose
DSName is o into a recycled-object. All appropriate attributes (possibly including
distinguishedName) are changed or removed from the object to conform to the invariants of [MS-
ADTS] section 3.1.1.5.5. Any changes that need to be made to the object are performed as an
originating update, except for changes required to remove linked attribute values, which are simply
removed from the directory. Attributes and values that already conform to the invariants are not
changed. See [MS-ADTS] section 3.1.1.1.9 for more details on originating updates.
5.161 RemoveObj
procedure RemoveObj(o: DSName,treeDeletion: boolean): ULONG
The RemoveObj procedure performs a delete operation on the object whose DSName is o. If the
value of parameter treeDeletion is true, then the tree-delete variation of the operation is
performed. As described in [MS-ADTS] section 3.1.1.5.5, the delete operation transforms the
targeted object into a deleted-object or a tombstone, depending on the state of the Recycle
Bin optional feature. The tree-delete operation performs, as described in [MS-ADTS] section
3.1.1.5.5.7.3, a delete operation on all objects in the subtree rooted at the target object. All
appropriate attributes (possibly including distinguishedName) are changed or removed from the
deleted objects to conform to the invariants of [MS-ADTS] section 3.1.1.5.5. Any changes that
need to be made to the objects are performed as an originating update, except for changes
required to remove linked attribute values, which are simply removed from the directory.
Attributes and values that already conform to the invariants are not changed. See [MS-ADTS]
section 3.1.1.1.9 for more details on originating updates. If the delete operation succeeds, 0 is
returned. Otherwise, this procedure returns an error code, as specified in [MS-ADTS] section
3.1.1.5.5, that indicates the reason for the failure.
5.162 REPLENTINFLIST
The REPLENTINFLIST structure defines a concrete type for updates to one or more attributes of a
given object.
533 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
fIsNCPrefix: TRUE only if the object is an NC root.
pParentGuid: The value of the objectGUID attribute of the parent of the object, or null if not known
or not specified.
pMetaDataExt: The stamps for the attributes specified in Entinf.AttrBlock. Entinf.AttrBlock and
pMetaDataExt.rgMetaData are parallel arrays. For a given integer i in [0 ..
Entinf.AttrBlock.attrCount], the stamp for the attribute described by Entinf.AttrBlock.pAttr^[i] is
pMetaDataExt^.rgMetaData[i].
5.163 ReplicatedAttributes
procedure ReplicatedAttributes(): Set of ATTRTYP
The ReplicatedAttributes procedure returns the set of ATTRTYP of all attributes in the schema
excluding nonreplicated attributes. See [MS-ADTS] section 3.1.1.2.3 for more details on
nonreplicated attributes.
5.164 ReplicationQueue
TimeEnqueued: A FILETIME that contains the time when the operation was enqueued.
SerialNumber: A ULONG that contains a unique identifier associated with the operation.
Priority: A ULONG that contains the priority of the operation. Tasks with a higher priority value
are executed first. The priority is calculated by the server based on the type of operation and its
parameters.
Options: A DRS_OPTIONS that contains options associated with the replication operation.
NamingContext: A unicodestring (section 3.4.3) that contains the NC root of the NC replica
associated with the operation.
DsaDN: A unicodestring (section 3.4.3) that contains the DN of the nTDSDSA object of the DC
associated with the operation.
DsaAddress: A unicodestring (section 3.4.3) that contains the network address of the DC
associated with the operation.
UUIDNC: A GUID that contains the objectGUID of the NC root of the NC replica associated with
the operation.
UUIDDsa: A GUID that contains the DSA GUID of the DC associated with the operation.
The global variable dc for a DC has an associated field dc.replicationQueue, which maintains the DC's
ReplicationQueue state.
5.165 REPLTIMES
The REPLTIMES structure defines a concrete type for times at which periodic replication occurs.
534 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
UCHAR rgTimes[84];
} REPLTIMES;
rgTimes: A byte array of length 84 that is used to set periodic replication times. Each bit in this byte
array represents a 15-minute period for which replication can be scheduled within a one-week
period. The replication schedule begins on Sunday 12:00:00 AM UTC. Each byte in the array
represents a two-hour period of a week in ascending order, starting Sunday 12:00:00 AM UTC.
The most significant bit of a byte represents the earliest 15-minute period in the two-hour period,
and the rest of the bits in the byte represent their respective 15-minute periods in this order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
rgTimes...
...
...rgTimes
The abstract type ReplUpToDateVector simplifies the specification of methods that read and write the
replUpToDateVector attribute. Reading the replUpToDateVector attribute produces one or more
ReplUpToDateVector values.
timeLastSyncSuccess: The time at which the last successful replication occurred from the DC
identified by uuidDsa; for replication latency reporting only.
5.167 REPLVALINF_V1
The REPLVALINF_V1 structure defines a concrete type for the identity and stamp of a link value.
typedef struct {
DSNAME* pObject;
ATTRTYP attrTyp;
ATTRVAL Aval;
BOOL fIsPresent;
VALUE_META_DATA_EXT_V1 MetaData;
} REPLVALINF_V1;
535 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pObject: Identifies the object with the attribute that contains the link value.
fIsPresent: FALSE if and only if the link value has been removed from the attribute.
5.168 REPLVALINF_V3
The REPLVALINF_V3 structure defines a concrete type for the identity and stamp of a link value.
This structure contains all the same elements as a REPLVALINF_V1 structure except that the data
type of MetaData is changed from VALUE_META_DATA_EXT_V1 to
VALUE_META_DATA_EXT_V3. Because VALUE_META_DATA_EXT_V3 is a superset of
VALUE_META_DATA_EXT_V1, this structure is a superset of the REPLVALINF_V1 structure.
typedef struct {
DSNAME* pObject;
ATTRTYP attrTyp;
ATTRVAL Aval;
BOOL fIsPresent;
VALUE_META_DATA_EXT_V3 MetaData;
} REPLVALINF_V3;
pObject: Identifies the object with the attribute that contains the link value.
fIsPresent: FALSE if and only if the link value has been removed from the attribute.
5.169 REPLVALINF_NATIVE
5.170 REPS_FROM
The nonreplicated, multivalued attribute repsFrom is an optional attribute on the root object of
every NC replica. It is stored with the structure of the REPS_FROM concrete type, which is
represented by the following diagram.
Note In the following field descriptions, the source DC refers to the DC identified by the uuidDsaObj.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
dwVersion
dwReserved0
cb
536 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cConsecutiveFailures
timeLastSuccess
...
timeLastAttempt
...
ulResultLastAttempt
cbOtherDraOffset
cbOtherDra
ulReplicaFlags
...
...
dwReserved1
...
...
...
...
...
...
...
...
537 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwReserved
cbPasDataOffset
data (variable)
...
dwVersion (4 bytes): The version of this structure. The value must be 1 or 2.<49>
cConsecutiveFailures (4 bytes): An unsigned long that contains the number of consecutive failures
that have occurred while replicating from the source DC.
timeLastSuccess (8 bytes): A DSTIME that contains the time of the last successful replication
cycle with the source DC.
timeLastAttempt (8 bytes): A DSTIME that contains the time of the last replication attempt with the
source DC.
ulResultLastAttempt (4 bytes): A Win32 error code, as specified in [MS-ERREF] section 2.2, that
represents the result of the last replication attempt with the source DC.
cbOtherDraOffset (4 bytes): The offset from the start of the structure to a location in the data field,
specifying the start of a structure that contains a NetworkAddress for the source DC. If
dwVersion is 1, it is an MTX_ADDR structure. If dwVersion is 2, it is a DSA_RPC_INST
structure.
ulReplicaFlags (4 bytes): A ULONG. This field contains a set of DRS_OPTIONS that are applicable
when replicating from the source DC.
usnVec (24 bytes): A USN_VECTOR structure. This holds 0 or the usnvecTo field from the response
to the last IDL_DRSGetNCChanges replication request sent to the source DC.
uuidDsaObj (16 bytes): A GUID that is the DSA GUID of the source DC.
uuidInvocId (16 bytes): A GUID that contains the invocation ID of the source DC.
uuidTransportObj (16 bytes): A GUID that contains the objectGUID of the interSiteTransport object
that corresponds to the transport used for communication with the source DC.
cbPasDataOffset (4 bytes): The offset from the start of the structure to a location in the data field,
specifying the start of a PAS_DATA structure.
538 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
data (variable): The storage for the rest of the structure. The structures pointed to by
cbOtherDraOffset and cbPasDataOffset are packed into this field and can be referenced using
the offsets.
5.171 REPS_TO
The nonreplicated, multivalued attribute repsTo is an optional attribute on the root object of every
NC replica. It is stored with the structure of the REPS_TO concrete type, which is represented by
the following diagram.
This structure is used for both repsTo values and repsFrom values. Many of the fields are unused in
repsTo values, and some of the field names are misleading (for example, timeLastSuccess).
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
dwVersion
dwReserved0
cb
cConsecutiveFailures
timeLastSuccess
...
timeLastAttempt
...
ulResultLastAttempt
cbOtherDraOffset
cbOtherDra
ulReplicaFlags
...
...
dwReserved1
...
539 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
...
...
...
...
...
...
...
dwReserved
cbPasDataOffset
data (variable)
...
dwVersion (4 bytes): The version of this structure. The value must be 1 or 2.<50>
timeLastSuccess (8 bytes): A DSTIME structure that contains the time when the last successful
replication notification to the DC identified by uuidDsaObj was sent, or 0 if no replication
notification has been sent successfully.
timeLastAttempt (8 bytes): A DSTIME structure that contains the last time when an attempt was
made to send a replication notification to the DC identified by uuidDsaObj, or 0 if no attempt has
been made.
ulResultLastAttempt (4 bytes): An unsigned long that contains the result of the last attempt to
send a replication notification to the DC identified by uuidDsaObj. It has a value of 0 if the last
notification was sent successfully or a Windows error code (as specified in [MS-ERREF] section
2.2) otherwise.
cbOtherDraOffset (4 bytes): The offset from the start of the structure to a location in the data field,
specifying the start of a structure that contains a NetworkAddress. If dwVersion is 1, it is an
MTX_ADDR structure. If dwVersion is 2, it is a DSA_RPC_INST structure.
540 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
cbOtherDra (4 bytes): The size of the structure pointed to by cbOtherDraOffset.
ulReplicaFlags (4 bytes): A ULONG. This set contains DRS_WRIT_REP (section 5.41) if this replica
is writable. This set never contains any other elements.
data (variable): The storage for the rest of the structure. The structure pointed to by
cbOtherDraOffset is packed into this field and can be referenced using the offset.
The nonreplicated, multivalued attribute repsFrom is an optional attribute on the root object of
every NC replica. It is stored with the structure REPS_FROM.
The abstract type RepsFrom simplifies the specification of methods that read and write the attribute
repsFrom. Reading the attribute repsFrom produces one or more RepsFrom values using the
conversions from REPS_FROM specified below. Writing a RepsFrom value to the attribute repsFrom
stores a REPS_FROM using the reverse conversion.
uuidDsa: A GUID that corresponds to uuidDsaObj in REPS_FROM. This is the DSA GUID of the DC.
options: A ULONG that corresponds to ulReplicaFlags in REPS_FROM. This set contains one or more of
the following values chosen from DRS_OPTIONS:
DRS_INIT_SYNC: The replica must be replicated from the DC identified by uuidDsa when the
DC hosting this replica is started.
DRS_MAIL_REP: Replicate the NC replica from the DC identified by uuidDsa via SMTP (see
[MS-SRPL]).
541 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_USE_COMPRESSION: Replication response messages sent along this communication path
must be compressed.
The following additional values are preserved if they are present when reading ulReplicaFlags,
but are otherwise ignored by the protocol:
DRS_FULL_SYNC_PACKET: Replicate all updates in the replication request, even those that
would normally be filtered.
DRS_REF_GCSPN: Requests that the server add an entry to repsTo for the client on the root
object of the NC replica that is being replicated. When repsTo is set using this flag, the
notifying client DC contacts the server DC using the service principal name that begins with
"GC" (section 2.2.3.2).
schedule: A REPLTIMES that corresponds to rtSchedule in REPS_FROM. This contains the periodic
replication schedule.
usnVec: A USN_VECTOR that corresponds to the usnVec in REPS_FROM. This holds 0 or the usnvecTo
field from the response to the last IDL_DRSGetNCChanges replication request sent to the DC
identified by uuidDsa.
resultLastAttempt: The result of the last replication attempt with the DC identified by uuidDsa.
542 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pasData: A PAS_DATA value that corresponds to cbPasDataOffset in REPS_FROM. Contains the list
of attributes (being added to the partial attribute set for the NC on this DC) that are being
requested from the DC identified by uuidDsa as part of a PAS replication cycle.
When converting a RepsFrom to a REPS_FROM, assign zeros to all unused fields of REPS_FROM. If
naDsa is an empty string, set cbOtherDra to 0 and cbOtherDraOffset to 0. If pasData.pas.cAttrs is 0,
set cbPasDataOffset to 0.
The nonreplicated, multivalued attribute repsTo is an optional attribute on the root object of every
NC replica. It is stored as the structure REPS_TO.
The abstract type RepsTo simplifies the specification of methods that read and write the attribute
repsTo. Reading the attribute repsTo produces one or more RepsTo values using the conversions from
REPS_TO specified below. Writing a RepsTo value to the attribute repsTo stores a REPS_TO using the
reverse conversion.
uuidDsa: A GUID that corresponds to uuidDsaObj in REPS_TO. This is the DSA GUID of the target
DC.
options: Bit flags chosen from DRS_OPTIONS that correspond to ulReplicaFlags in REPS_TO. This set
contains the DRS_WRIT_REP value if this replica is writable.
The following additional values are preserved if they are present when reading ulReplicaFlags, but
are otherwise ignored by the protocol:
DRS_INIT_SYNC: The replica must be replicated from the DC identified by uuidDsa when the DC
hosting this replica is started.
DRS_MAIL_REP: Replicate the NC replica from the DC identified by uuidDsa via SMTP (see [MS-
SRPL]).
543 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_FULL_SYNC_PACKET: Replicate all updates in the replication request, even those that would
normally be filtered.
DRS_REF_GCSPN: Requests that the server add an entry to repsTo for the client on the root
object of the NC replica that is being replicated. When repsTo is set using this flag, the notifying
client DC contacts the server DC using the service principal name that begins with "GC" (section
2.2.3.2).
When converting a RepsTo to a REPS_TO, assign zeros to all unused fields of REPS_TO. If naDsa is an
empty string, set cbOtherDra to 0 and cbOtherDraOffset to 0.
5.174 Rid
Rid is an abstract type that consists of an integer that represents the relative identifier (RID)
component of a SID, as specified in [MS-DTYP] section 2.4.2.
5.175 Right
Note Since access rights and control access rights are non-overlapping sets, there is no ambiguity in
having one type represent rights of both kinds.
The valid access rights used in ACLs in security descriptors are defined in [MS-ADTS] section
5.1.3.2.
544 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.177 RPCClientContexts
RPCClientContexts is an abstract type that is a sequence of tuples, one tuple per RPC context for an
incoming RPC session to the DC. Each tuple contains the following fields:
RefCount: An integer that is used to reference count the number of references to the context.
IsBound: A Boolean value that is true if IDL_DRSUnbind has not yet been called on the RPC
context represented by this tuple, and false otherwise.
UUIDClient: A GUID that contains the value that was passed in as the puuidClientDsa argument
of IDL_DRSBind while establishing the context.
TimeLastUsed: A FILETIME that contains the last time a session corresponding to the context
was used in an RPC method call.
IPAddress: A DWORD that contains the IPv4 address of the client associated with the context.
PID: An integer that contains the process ID passed in by the client as the pextClient argument of
IDL_DRSBind while establishing the context.
The global variable dc for a DC has an associated field dc.rpcClientContexts, which maintains the DC's
RPCClientContexts state.
5.178 RPCOutgoingContexts
RPCOutgoingContexts is an abstract type that is a sequence of tuples, one tuple per RPC context for
an outgoing RPC session from the DC. Each tuple contains the following fields:
ServerName: A unicodestring (section 3.4.3) that contains the host name of the server.
IsBound: A Boolean value that is true if IDL_DRSUnbind has not yet been called on the RPC
context represented by this tuple, and false otherwise.
HandleFromCache: A Boolean value that is true if the context handle was retrieved from the
cache, and false otherwise.
HandleInCache: A Boolean value that is true if the context handle is still in the cache, and false
otherwise.
ThreadId: An integer that contains the thread ID of the thread that is using the context.
BindingTimeOut: An integer. If the context is set to be canceled, then this field contains the
time-out, in minutes.
CreateTime: A DSTIME value that contains the time when the context was created.
CallType: An integer that indicates the type of RPC call that the DC is waiting on. See
DS_REPL_SERVER_OUTGOING_CALL for possible values.
The global variable dc for a DC has an associated field dc.rpcOutgoingContexts, which maintains the
DC's RPCOutgoingContexts state.
sAMAccountType values describe information about various account type objects. See [MS-SAMR]
section 2.2.1.9 for descriptions of these values.
545 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Symbolic name Value
SAM_GROUP_OBJECT 0x10000000
SAM_NON_SECURITY_GROUP_OBJECT 0x10000001
SAM_ALIAS_OBJECT 0x20000000
SAM_NON_SECURITY_ALIAS_OBJECT 0x20000001
SAM_USER_OBJECT 0x30000000
SAM_MACHINE_ACCOUNT 0x30000001
SAM_TRUST_ACCOUNT 0x30000002
Only the values used by this protocol are contained in this table.
5.180 SCHEMA_PREFIX_TABLE
The SCHEMA_PREFIX_TABLE structure defines the concrete type for a table to map ATTRTYP values
to and from OIDs.
typedef struct {
[range(0,1048576)] DWORD PrefixCount;
[size_is(PrefixCount)] PrefixTableEntry* pPrefixEntry;
} SCHEMA_PREFIX_TABLE;
5.181 SchemaInfo
procedure SchemaInfo(): sequence of BYTE
The SchemaInfo procedure returns the value of the schemaInfo attribute on the object dc.schemaNC
or a default value if that attribute has no value.
5.182 SchemaNC
procedure SchemaNC(): DSName
5.183 SchemaObj
procedure SchemaObj(att: ATTRTYP): DSName
546 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Given the ATTRTYP att of an attributeSchema or classSchema object on this DC, the SchemaObj
procedure returns the dsname of the attributeSchema or the classSchema object.
5.184 ServerExtensions
procedure ServerExtensions(hDrs: DRS_HANDLE): DRS_EXTENSIONS_INT
The ServerExtensions procedure returns the server extensions presented in the IDL_DRSBind call that
created hDrs. Any fields not specified by the server in the ppextServer^ parameter of IDL_DRSBind
are set to 0.
5.185 SID
A concrete type for the Windows NT operating system SID structure, as specified in [MS-DTYP]
section 2.4.2.
5.186 SidFromStringSid
procedure SidFromStringSid(stringSID: unicodestring): SID
The SidFromStringSid procedure converts the string representation of a SID specified in stringSID (for
example, S-1-5-3) to the SID type, as specified in [MS-DTYP] section 2.4.2. See [MS-DTYP] section
2.4.2.1 for the string representation of a SID.
5.187 StampLessThanOrEqualUTD
procedure StampLessThanOrEqualUTD(
stamp: AttributeStamp,
utd: UPTODATE_VECTOR_V1_EXT) : boolean
i: integer
for i := 0 to utd.cNumCursors - 1
if utd.rgCursors[i].uuidDsa = stamp.uuidOriginating) and
(utd.rgCursors[i].usn >= stamp.usnOriginating) then
return true
endif
endfor
return false
5.188 StartsWith
procedure StartsWith(s: unicodestring, p: unicodestring): boolean
The StartsWith procedure returns true if the string p is a prefix of string s and returns false otherwise.
547 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.189 StringSidFromSid
procedure StringSidFromSid(sid: SID): unicodestring
The StringSidFromSid procedure converts a binary SID specified in sid to the string representation of a
SID (for example, S-1-5-3). See [MS-DTYP] section 2.4.2.1 for the string representation of a SID.
5.190 SubString
procedure SubString(
s: unicodestring, start: integer, length: integer): unicodestring
The SubString procedure returns the portion of s beginning at the zero-based index start and
containing length characters. If start is less than zero or greater than s.length-1, returns null. If length
+ start is greater than s.length, then length is treated as if it equals s.length - start.
5.191 Syntax
procedure Syntax(attr: ATTRTYP): AttributeSyntax
5.192 SYNTAX_ADDRESS
The SYNTAX_ADDRESS packet is the concrete type for a sequence of bytes or Unicode characters.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
dataLen
byteVal (variable)
...
dataLen (4 bytes): The size of the entire structure (including this field), in bytes.
The following structure definition shows an alternative representation of this data type.
typedef struct {
DWORD dataLen;
union {
BYTE byteVal[];
wchar_t uVal[];
};
} SYNTAX_ADDRESS;
5.193 SYNTAX_DISTNAME_BINARY
The SYNTAX_DISTNAME_BINARY packet is the concrete type for a combination of a DSNAME and a
binary or character data buffer.
548 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
structLen
SidLen
...
...
...
...
NameLen
StringName (variable)
...
Padding (variable)
...
dataLen
byteVal (variable)
...
structLen (4 bytes): The length of the structure, in bytes, up to and including the field StringName.
SidLen (4 bytes): The number of bytes in the Sid field used to represent the object's objectSid
attribute value. Zero indicates that the SYNTAX_DISTNAME_BINARY does not identify the
objectSid value of the directory object.
Guid (16 bytes): The value of the object's objectGUID attribute specified as a GUID structure, which
is defined in [MS-DTYP] section 2.3.4. If the values for all fields in the GUID structure are zero,
this indicates that the SYNTAX_DISTNAME_BINARY does not identify the objectGUID value of the
directory object.
Sid (28 bytes): The value of the object's objectSid attribute, its security identifier specified as a SID
structure, which is defined in [MS-DTYP] section 2.4.2. The size of this field is exactly 28 bytes,
regardless of the value of SidLen, which specifies how many bytes in this field are used.
NameLen (4 bytes): The number of characters in the StringName field, not including the terminating
null character, used to represent the object's distinguishedName attribute value. Zero indicates
549 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
that the SYNTAX_DISTNAME_BINARY does not identify the distinguishedName value of the
directory object.
Padding (variable): The padding (bytes with value zero) to align the field dataLen at a double word
boundary.
dataLen (4 bytes): The length of the remaining structure, including this field, in bytes.
The following structure definition shows an alternative representation of this data type.
typedef struct {
DSNAME Name;
SYNTAX_ADDRESS Data;
} SYNTAX_DISTNAME_BINARY;
The valid system flags used on directory objects are defined in [MS-ADTS] section 2.2.10.
5.195 UCHAR
A concrete type, as defined in [MS-DTYP] section 2.2.45. A UCHAR is an 8-bit, unsigned quantity.
5.196 ULARGE_INTEGER
typedef struct {
ULONGLONG QuadPart;
} ULARGE_INTEGER;
5.197 ULONG
A concrete type for a 32-bit, unsigned integer, as specified in [MS-DTYP] section 2.2.51.
5.198 ULONGLONG
A concrete type for a 64-bit, unsigned integer, as specified in [MS-DTYP] section 2.2.55.
5.199 UndeleteObject
procedure UndeleteObject(
obj: DSNAME,
attributesAndStamps: set of AttributeAndStamp)
550 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
For each attStamp in attributesAndStamps, the UndeleteObject procedure performs an originating
update to obj such that the value(s) of attStamp.attribute do not change, but AttrStamp(obj,
attStamp.attribute).dwVersion > attStamp.stamp.dwVersion. The effect of this update to obj is such
that this DC's values for these attributes replicate out to other DCs and overwrite the updates with
stamps in attributesAndStamps.
5.200 UnbindFromDSA()
procedure UnbindFromDSA(hDRS: DRS_HANDLE)
The UnbindFromDSA procedure closes the RPC connection that was established by the BindToDSA
procedure.
5.201 UpdateRefs
procedure UpdateRefs(DRS_MSG_UPDREFS_V1 msgIn): ULONG
The UpdateRefs method implements the core functionality of IDL_DRSUpdateRefs, that is, adds or
deletes a value from the repsTo of a specified NC replica.
err: DWORD
nc: DSName
rt: RepsTo
nc := msgIn.pNC^
/* If DRS_DEL_REF is specified, the return value is that associated with the DRS_DEL_REF
if DRS_DEL_REF in msgIn.ulOptions then
rt := select one v from nc!repsTo where
(v.naDsa = msgIn.pszDsaDest or
v.uuidDsa = msgIn.uuidDsaObjDest)
if rt = null then
err := ERROR_DS_DRA_REF_NOT_FOUND
else
nc!repsTo := nc!repsTo - {rt}
err := ERROR_SUCCESS
endif
endif
551 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
err := ERROR_DS_DRA_REF_ALREADY_EXISTS
endif
endif
return err
5.202 UPTODATE_CURSOR_V1
The UPTODATE_CURSOR_V1 structure is a concrete type for the replication state relative to a given
DC.
typedef struct {
UUID uuidDsa;
USN usnHighPropUpdate;
} UPTODATE_CURSOR_V1;
A cursor c with c.uuidDsa = x and c.usnHighPropUpdate = y indicates a replication state that includes
all changes originated by DC x at USN less than or equal to y.
5.203 UPTODATE_CURSOR_V2
The UPTODATE_CURSOR_V2 structure defines a concrete type for the replication state relative to a
given DC.
typedef struct {
UUID uuidDsa;
USN usnHighPropUpdate;
DSTIME timeLastSyncSuccess;
} UPTODATE_CURSOR_V2;
timeLastSyncSuccess: The time at which the last successful replication occurred from the DC
identified by uuidDsa; for replication latency reporting only.
A cursor c with c.uuidDsa = x and c.usnHighPropUpdate = y indicates a replication state that includes
all changes originated by DC x at USN less than or equal to y.
5.204 UPTODATE_VECTOR_V1_EXT
The UPTODATE_VECTOR_V1_EXT structure defines a concrete type for the replication state relative
to a set of DCs.
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(0,1048576)] DWORD cNumCursors;
DWORD dwReserved2;
[size_is(cNumCursors)] UPTODATE_CURSOR_V1 rgCursors[];
} UPTODATE_VECTOR_V1_EXT;
552 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
dwVersion: The version of this structure; MUST be 1.
rgCursors: An array of UPTODATE_CURSOR_V1. The items in this field MUST be sorted in increasing
order of the uuidDsa field.
5.205 UPTODATE_VECTOR_V2_EXT
The UPTODATE_VECTOR_V2_EXT structure defines a concrete type for the replication state relative
to a set of DCs.
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(0,1048576)] DWORD cNumCursors;
DWORD dwReserved2;
[size_is(cNumCursors)] UPTODATE_CURSOR_V2 rgCursors[];
} UPTODATE_VECTOR_V2_EXT;
rgCursors: An array of UPTODATE_CURSOR_V2. The items in this field MUST be sorted in increasing
order of the uuidDsa field.
The userAccountControl bits are bit flags that describe various qualities of a security account. The bit
flags are presented below in little-endian byte order.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
X X X L X X A X X X S W I X N D X X X X X X X X X X X X X P X X
O D T T D A A S
553 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ID (ADS_UF_INTERDOMAIN_TRUST_ACCOUNT, 0x00000800): The account for a domain-to-
domain trust.
5.207 UserNameFromNT4AccountName
procedure UserNameFromNT4AccountName(
nt4AccountName: unicodestring): unicodestring
If nt4AccountName is a name in Windows NT 4.0 account name format, that is, two components
separated by a backslash (for example, "DOMAIN\username"), the UserNameFromNT4AccountName
procedure returns the second component (the user name, or "username" in this example). If the
nt4AccountName is not in this format, null is returned.
5.208 USHORT
A concrete type for a 16-bit, unsigned integer, as specified in [MS-DTYP] section 2.2.58.
5.209 USN
USN is a concrete type for the variable usn specified in [MS-ADTS] section 3.1.1.1.9 and present in
the dc global variable.
5.210 USN_VECTOR
The USN_VECTOR structure defines a concrete type for the cookie (section 1.3.2) used to pass state
between calls to IDL_DRSGetNCChanges.
typedef struct {
USN usnHighObjUpdate;
USN usnReserved;
USN usnHighPropUpdate;
} USN_VECTOR;
usnHighObjUpdate: A USN.
usnReserved: A USN.
usnHighPropUpdate: A USN.
The USN_VECTOR type, as shown, is used in the DRS IDL. However, only the size of USN_VECTOR
(24 bytes) and the representation of its null value (24 zero bytes) are standardized for
interoperability.
554 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
5.211 UUID
5.212 ValidateDRSDemotionInput
procedure ValidateDRSDemotionInput(hDrs: DRS_HANDLE, opnum: integer)
The server MUST raise an ERROR_INVALID_PARAMETER exception when opnum = 25 and IsAdlds()
== false.
The server SHOULD raise an ERROR_INVALID_PARAMETER exception when opnum = 26 and IsAdlds()
== false.<51>
The server MUST raise an ERROR_INVALID_PARAMETER exception when opnum = 27 and IsAdlds()
== false.
5.213 ValidateDRSInput
procedure ValidateDRSInput(hDrs: DRS_HANDLE, opnum: integer)
Informative summary of behavior: The ValidateDRSInput procedure performs certain checks based on
the input and throws an exception, if needed.
if opnum = 0 then
return
endif
if IsAdlds() and
(opnum = 9 or /*IDL_DRSGetMemberships*/
opnum = 10 or /*IDL_DRSInterDomainMove*/
opnum = 11 or /*IDL_DRSGetNT4ChangeLog*/
opnum = 13 or /*IDL_DRSWriteSPN*/
opnum = 15 or /*IDL_DRSRemoveDsDomain*/
opnum = 16 or /*IDL_DRSDomainControllerInfo*/
opnum = 20 or /*IDL_DRSAddSidHistory*/
opnum = 21 or /*IDL_DRSGetMemberships2*/
opnum = 24 /*IDL_DRSQuerySitesByCost*/)
then
raise ERROR_INVALID_PARAMETER exception
endif
555 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
if AmIRODC() and
(opnum = 3 or /*IDL_DRSGetNCChanges*/
opnum = 10 or /*IDL_DRSInterDomainMove*/
opnum = 11 or /*IDL_DRSGetNT4ChangeLog*/
opnum = 14 or /*IDL_DRSRemoveDsServer*/
opnum = 15 or /*IDL_DRSRemoveDsDomain*/
opnum = 17 or /*IDL_DRSAddEntry*/
opnum = 20 /*IDL_DRSAddSidHistory*/)
then
raise ERROR_INVALID_PARAMETER exception
endif
ValidateDRSDemotionInput(hDrs, opnum)
5.214 Value
Value is an abstract type for attribute values used for abstract value representation (see section
5.16.2).
5.215 VALUE_META_DATA_EXT_V1
The VALUE_META_DATA_EXT_V1 structure defines a concrete type for the stamp of a link value.
typedef struct {
DSTIME timeCreated;
PROPERTY_META_DATA_EXT MetaData;
} VALUE_META_DATA_EXT_V1;
timeCreated: The date and time at which the first originating update was made.
MetaData: The remainder of the stamp; has the same PROPERTY_META_DATA_EXT type as used for
the stamp of an attribute.
5.216 VALUE_META_DATA_EXT_V3
The VALUE_META_DATA_EXT_V3 structure defines a concrete type for the stamp of a link value.
This structure is a superset of the VALUE_META_DATA_EXT_V1 structure.
typedef struct {
DSTIME timeCreated;
PROPERTY_META_DATA_EXT MetaData;
DWORD unused1;
DWORD unused2;
DWORD unused3;
DSTIME timeExpired;
} VALUE_META_DATA_EXT_V3;
timeCreated: The date and time at which the first originating update was made.
MetaData: The remainder of the stamp; has the same PROPERTY_META_DATA_EXT type as used for
the stamp of an attribute.
556 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
unused3: Unused. MUST be 0 and ignored
timeExpired: The date and time at which the link value must be removed from the state of the DC.
5.217 VALUE_META_DATA_EXT_NATIVE
5.218 ValueFromATTRVAL
procedure ValueFromATTRVAL(
a: ATTRVAL, s: Syntax, t: PrefixTable) : Value
5.219 VAR_SIZE_BUFFER_WITH_VERSION
The VAR_SIZE_BUFFER_WITH_VERSION structure defines a concrete type that is used to pass byte
buffers to certain messages. The exact byte pattern is dependent on the structure in which this
structure is being used.
ulVersion: The version of the buffer that is being sent. Handling of this field is performed by the
specific message that is using this structure.
ullPadding: Used to align the array of bytes in the rgbBuffer field to an 8-byte boundary.
rgbBuffer: An array of bytes. The content of the array depends on the specific message that is using
this structure. Starts on an 8-byte boundary.
5.220 WCHAR
A concrete type, as specified in [MS-DTYP] section 2.2.60. A WCHAR is a 16-bit, unsigned integer in
little-endian byte order that is used to store a double-byte Unicode character. A WCHAR * is a pointer
to a null-terminated Unicode string.
557 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
6 Security
General security considerations for this protocol are specified in section 2.2. Security considerations
for an individual method are specified in the subsection of section 4 that describes the behavior of that
method.
558 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
7 Appendix A: Full IDL
For ease of implementation, the full IDL is provided below, where "ms-dtyp.idl" refers to the IDL found
in [MS-DTYP] Appendix A.
import "ms-dtyp.idl";
[
uuid (e3514235-4b06-11d1-ab04-00c04fc2dcd2), version(4.0),
pointer_default (unique)
]
interface drsuapi
{
typedef struct {
char Data[28];
} NT4SID;
typedef struct {
unsigned long structLen;
unsigned long SidLen;
GUID Guid;
NT4SID Sid;
unsigned long NameLen;
[range(0, 10485761)] [size_is(NameLen + 1)] WCHAR StringName[];
} DSNAME;
typedef struct {
USN usnHighObjUpdate;
USN usnReserved;
USN usnHighPropUpdate;
} USN_VECTOR;
typedef struct {
UUID uuidDsa;
USN usnHighPropUpdate;
} UPTODATE_CURSOR_V1;
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(0,1048576)] DWORD cNumCursors;
DWORD dwReserved2;
[size_is(cNumCursors)] UPTODATE_CURSOR_V1 rgCursors[];
} UPTODATE_VECTOR_V1_EXT;
typedef struct {
[range(0,10000)] unsigned int length;
[size_is(length)] BYTE *elements;
} OID_t;
typedef struct {
unsigned long ndx;
OID_t prefix;
} PrefixTableEntry;
typedef struct {
[range(0,1048576)] DWORD PrefixCount;
[size_is(PrefixCount)] PrefixTableEntry *pPrefixEntry;
} SCHEMA_PREFIX_TABLE;
559 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(1,1048576)] DWORD cAttrs;
[size_is(cAttrs)] ATTRTYP rgPartialAttr[];
} PARTIAL_ATTR_VECTOR_V1_EXT;
typedef struct {
[range(1,256)] unsigned long mtx_namelen;
[size_is(mtx_namelen)] char mtx_name[];
} MTX_ADDR;
typedef struct {
[range(0,26214400)] ULONG valLen;
[size_is(valLen)] UCHAR *pVal;
} ATTRVAL;
typedef struct {
[range(0, 10485760)] ULONG valCount;
[size_is(valCount)] ATTRVAL *pAVal;
} ATTRVALBLOCK;
typedef struct {
ATTRTYP attrTyp;
ATTRVALBLOCK AttrVal;
} ATTR;
typedef struct {
[range(0, 1048576)] ULONG attrCount;
[size_is(attrCount)] ATTR *pAttr;
} ATTRBLOCK;
typedef struct {
DSNAME *pName;
unsigned long ulFlags;
ATTRBLOCK AttrBlock;
} ENTINF;
typedef struct {
DWORD dwVersion;
DSTIME timeChanged;
UUID uuidDsaOriginating;
USN usnOriginating;
} PROPERTY_META_DATA_EXT;
typedef struct {
[range(0,1048576)] DWORD cNumProps;
[size_is(cNumProps)] PROPERTY_META_DATA_EXT rgMetaData[];
} PROPERTY_META_DATA_EXT_VECTOR;
typedef struct {
UUID uuidDsa;
USN usnHighPropUpdate;
DSTIME timeLastSyncSuccess;
} UPTODATE_CURSOR_V2;
typedef struct {
DWORD dwVersion;
DWORD dwReserved1;
[range(0,1048576)] DWORD cNumCursors;
560 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DWORD dwReserved2;
[size_is(cNumCursors)] UPTODATE_CURSOR_V2 rgCursors[];
} UPTODATE_VECTOR_V2_EXT;
typedef struct {
DSTIME timeCreated;
PROPERTY_META_DATA_EXT MetaData;
} VALUE_META_DATA_EXT_V1;
typedef struct {
DSTIME timeCreated;
PROPERTY_META_DATA_EXT MetaData;
DWORD unused1;
DWORD unused2;
DWORD unused3;
DSTIME timeExpired;
} VALUE_META_DATA_EXT_V3;
typedef struct {
DSNAME *pObject;
ATTRTYP attrTyp;
ATTRVAL Aval;
BOOL fIsPresent;
VALUE_META_DATA_EXT_V1 MetaData;
} REPLVALINF_V1;
typedef struct {
DSNAME *pObject;
ATTRTYP attrTyp;
ATTRVAL Aval;
BOOL fIsPresent;
VALUE_META_DATA_EXT_V3 MetaData;
} REPLVALINF_V3;
typedef struct {
UCHAR rgTimes[84];
} REPLTIMES;
typedef struct {
DWORD status;
[string,unique] WCHAR *pDomain;
[string,unique] WCHAR *pName;
} DS_NAME_RESULT_ITEMW, *PDS_NAME_RESULT_ITEMW;
typedef struct {
DWORD cItems;
[size_is(cItems)] PDS_NAME_RESULT_ITEMW rItems;
} DS_NAME_RESULTW, *PDS_NAME_RESULTW;
typedef struct {
[string,unique] WCHAR *NetbiosName;
[string,unique] WCHAR *DnsHostName;
[string,unique] WCHAR *SiteName;
[string,unique] WCHAR *ComputerObjectName;
[string,unique] WCHAR *ServerObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
} DS_DOMAIN_CONTROLLER_INFO_1W;
typedef struct {
[string,unique] WCHAR *NetbiosName;
[string,unique] WCHAR *DnsHostName;
[string,unique] WCHAR *SiteName;
[string,unique] WCHAR *SiteObjectName;
[string,unique] WCHAR *ComputerObjectName;
[string,unique] WCHAR *ServerObjectName;
[string,unique] WCHAR *NtdsDsaObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
561 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
BOOL fIsGc;
GUID SiteObjectGuid;
GUID ComputerObjectGuid;
GUID ServerObjectGuid;
GUID NtdsDsaObjectGuid;
} DS_DOMAIN_CONTROLLER_INFO_2W;
typedef struct {
[string, unique] WCHAR* NetbiosName;
[string, unique] WCHAR* DnsHostName;
[string, unique] WCHAR* SiteName;
[string, unique] WCHAR* SiteObjectName;
[string, unique] WCHAR* ComputerObjectName;
[string, unique] WCHAR* ServerObjectName;
[string, unique] WCHAR* NtdsDsaObjectName;
BOOL fIsPdc;
BOOL fDsEnabled;
BOOL fIsGc;
BOOL fIsRodc;
GUID SiteObjectGuid;
GUID ComputerObjectGuid;
GUID ServerObjectGuid;
GUID NtdsDsaObjectGuid;
} DS_DOMAIN_CONTROLLER_INFO_3W;
typedef struct {
DWORD IPAddress;
DWORD NotificationCount;
DWORD secTimeConnected;
DWORD Flags;
DWORD TotalRequests;
DWORD Reserved1;
[string,unique] WCHAR *UserName;
} DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
ATTRTYP type;
BOOL valReturned;
ATTRVAL Val;
} INTFORMPROB_DRS_WIRE_V1;
typedef struct {
DSNAME *pObject;
ULONG count;
PROBLEMLIST_DRS_WIRE_V1 FirstProblem;
} ATRERR_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
DSNAME *pMatched;
} NAMERR_DRS_WIRE_V1;
562 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
UCHAR nameRes;
UCHAR unusedPad;
USHORT nextRDN;
} NAMERESOP_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
CONTREF_DRS_WIRE_V1 Refer;
} REFERR_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SECERR_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SVCERR_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} UPDERR_DRS_WIRE_V1;
typedef struct {
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} SYSERR_DRS_WIRE_V1;
563 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
[string] LPWSTR pszNamingContext;
[string] LPWSTR pszSourceDsaDN;
[string] LPWSTR pszSourceDsaAddress;
[string] LPWSTR pszAsyncIntersiteTransportDN;
DWORD dwReplicaFlags;
DWORD dwReserved;
UUID uuidNamingContextObjGuid;
UUID uuidSourceDsaObjGuid;
UUID uuidSourceDsaInvocationID;
UUID uuidAsyncIntersiteTransportObjGuid;
USN usnLastObjChangeSynced;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
FILETIME ftimeLastSyncAttempt;
DWORD dwLastSyncResult;
DWORD cNumConsecutiveSyncFailures;
} DS_REPL_NEIGHBORW;
typedef struct {
DWORD cNumNeighbors;
DWORD dwReserved;
[size_is(cNumNeighbors)] DS_REPL_NEIGHBORW rgNeighbor[];
} DS_REPL_NEIGHBORSW;
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
} DS_REPL_CURSOR;
typedef struct {
DWORD cNumCursors;
DWORD dwReserved;
[size_is(cNumCursors)] DS_REPL_CURSOR rgCursor[];
} DS_REPL_CURSORS;
typedef struct {
[string] LPWSTR pszAttributeName;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
} DS_REPL_ATTR_META_DATA;
typedef struct {
[string] LPWSTR pszDsaDN;
UUID uuidDsaObjGuid;
FILETIME ftimeFirstFailure;
DWORD cNumFailures;
DWORD dwLastResult;
} DS_REPL_KCC_DSA_FAILUREW;
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_KCC_DSA_FAILUREW rgDsaFailure[];
} DS_REPL_KCC_DSA_FAILURESW;
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_ATTR_META_DATA rgMetaData[];
} DS_REPL_OBJ_META_DATA;
typedef enum {
DS_REPL_OP_TYPE_SYNC = 0,
DS_REPL_OP_TYPE_ADD,
DS_REPL_OP_TYPE_DELETE,
564 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DS_REPL_OP_TYPE_MODIFY,
DS_REPL_OP_TYPE_UPDATE_REFS
} DS_REPL_OP_TYPE;
typedef struct {
FILETIME ftimeEnqueued;
ULONG ulSerialNumber;
ULONG ulPriority;
DS_REPL_OP_TYPE OpType;
ULONG ulOptions;
[string] LPWSTR pszNamingContext;
[string] LPWSTR pszDsaDN;
[string] LPWSTR pszDsaAddress;
UUID uuidNamingContextObjGuid;
UUID uuidDsaObjGuid;
} DS_REPL_OPW;
typedef struct {
FILETIME ftimeCurrentOpStarted;
DWORD cNumPendingOps;
[size_is(cNumPendingOps)] DS_REPL_OPW rgPendingOp[];
} DS_REPL_PENDING_OPSW;
typedef struct {
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszObjectDn;
DWORD cbData;
[size_is(cbData), ptr] BYTE *pbData;
FILETIME ftimeDeleted;
FILETIME ftimeCreated;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
} DS_REPL_VALUE_META_DATA;
typedef struct {
DWORD cNumEntries;
DWORD dwEnumerationContext;
[size_is(cNumEntries)] DS_REPL_VALUE_META_DATA rgMetaData[];
} DS_REPL_ATTR_VALUE_META_DATA;
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
} DS_REPL_CURSOR_2;
typedef struct {
DWORD cNumCursors;
DWORD dwEnumerationContext;
[size_is(cNumCursors)] DS_REPL_CURSOR_2 rgCursor[];
} DS_REPL_CURSORS_2;
typedef struct {
UUID uuidSourceDsaInvocationID;
USN usnAttributeFilter;
FILETIME ftimeLastSyncSuccess;
[string] LPWSTR pszSourceDsaDN;
} DS_REPL_CURSOR_3W;
typedef struct {
DWORD cNumCursors;
DWORD dwEnumerationContext;
[size_is(cNumCursors)] DS_REPL_CURSOR_3W rgCursor[];
} DS_REPL_CURSORS_3W;
typedef struct {
565 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[string] LPWSTR pszAttributeName;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
[string] LPWSTR pszLastOriginatingDsaDN;
} DS_REPL_ATTR_META_DATA_2;
typedef struct {
DWORD cNumEntries;
DWORD dwReserved;
[size_is(cNumEntries)] DS_REPL_ATTR_META_DATA_2 rgMetaData[];
} DS_REPL_OBJ_META_DATA_2;
typedef struct {
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszObjectDn;
DWORD cbData;
[size_is(cbData), ptr] BYTE *pbData;
FILETIME ftimeDeleted;
FILETIME ftimeCreated;
DWORD dwVersion;
FILETIME ftimeLastOriginatingChange;
UUID uuidLastOriginatingDsaInvocationID;
USN usnOriginatingChange;
USN usnLocalChange;
[string] LPWSTR pszLastOriginatingDsaDN;
} DS_REPL_VALUE_META_DATA_2;
typedef struct {
DWORD cNumEntries;
DWORD dwEnumerationContext;
[size_is(cNumEntries)] DS_REPL_VALUE_META_DATA_2 rgMetaData[];
} DS_REPL_ATTR_VALUE_META_DATA_2;
typedef struct {
[range(1,10000)] DWORD cb;
[size_is(cb)] BYTE rgb[];
} DRS_EXTENSIONS;
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME *pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecDestV1;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrVecDestV1;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
} DRS_MSG_GETCHGREQ_V3;
typedef struct {
UUID uuidTransportObj;
[ref] MTX_ADDR *pmtxReturnAddress;
DRS_MSG_GETCHGREQ_V3 V3;
} DRS_MSG_GETCHGREQ_V4;
typedef struct {
UUID uuidTransportObj;
[ref] MTX_ADDR *pmtxReturnAddress;
DRS_MSG_GETCHGREQ_V3 V3;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
} DRS_MSG_GETCHGREQ_V7;
566 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME *pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecSrcV1;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST* pObjects;
BOOL fMoreData;
} DRS_MSG_GETCHGREPLY_V1;
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME *pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V2_EXT *pUpToDateVecSrc;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST *pObjects;
BOOL fMoreData;
ULONG cNumNcSizeObjects;
ULONG cNumNcSizeValues;
[range(0,1048576)] DWORD cNumValues;
[size_is(cNumValues)] REPLVALINF_V1 *rgValues;
DWORD dwDRSError;
} DRS_MSG_GETCHGREPLY_V6;
typedef struct {
UUID uuidDsaObjSrc;
UUID uuidInvocIdSrc;
[unique] DSNAME *pNC;
USN_VECTOR usnvecFrom;
USN_VECTOR usnvecTo;
[unique] UPTODATE_VECTOR_V2_EXT *pUpToDateVecSrc;
SCHEMA_PREFIX_TABLE PrefixTableSrc;
ULONG ulExtendedRet;
ULONG cNumObjects;
ULONG cNumBytes;
[unique] REPLENTINFLIST *pObjects;
BOOL fMoreData;
ULONG cNumNcSizeObjects;
ULONG cNumNcSizeValues;
[range(0,1048576)] DWORD cNumValues;
[size_is(cNumValues)] REPLVALINF_V3 *rgValues;
DWORD dwDRSError;
} DRS_MSG_GETCHGREPLY_V9;
typedef struct {
DWORD cbUncompressedSize;
DWORD cbCompressedSize;
[size_is(cbCompressedSize)] BYTE *pbCompressedData;
} DRS_COMPRESSED_BLOB;
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME *pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecDestV1;
ULONG ulFlags;
567 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
} DRS_MSG_GETCHGREQ_V5;
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME *pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
} DRS_MSG_GETCHGREQ_V8;
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME *pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulMoreFlags;
} DRS_MSG_GETCHGREQ_V10;
typedef struct {
ULONG ulVersion;
ULONG cbByteBuffer;
ULONGLONG ullPadding;
[size_is(cbByteBuffer)] BYTE rgbBuffer[];
} VAR_SIZE_BUFFER_WITH_VERSION;
typedef struct {
UUID uuidDsaObjDest;
UUID uuidInvocIdSrc;
[ref] DSNAME *pNC;
USN_VECTOR usnvecFrom;
[unique] UPTODATE_VECTOR_V1_EXT *pUpToDateVecDest;
ULONG ulFlags;
ULONG cMaxObjects;
ULONG cMaxBytes;
ULONG ulExtendedOp;
ULARGE_INTEGER liFsmoInfo;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSet;
[unique] PARTIAL_ATTR_VECTOR_V1_EXT *pPartialAttrSetEx;
SCHEMA_PREFIX_TABLE PrefixTableDest;
ULONG ulMoreFlags;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION *pReservedBuffer;
} DRS_MSG_GETCHGREQ_V11;
568 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(8)] DRS_MSG_GETCHGREQ_V8 V8;
[case(10)] DRS_MSG_GETCHGREQ_V10 V10;
[case(11)] DRS_MSG_GETCHGREQ_V11 V11;
} DRS_MSG_GETCHGREQ;
typedef struct {
DRS_COMPRESSED_BLOB CompressedV1;
} DRS_MSG_GETCHGREPLY_V2;
typedef enum {
DRS_COMP_ALG_NONE = 0,
DRS_COMP_ALG_UNUSED = 1,
DRS_COMP_ALG_MSZIP = 2,
DRS_COMP_ALG_WIN2K3 = 3
} DRS_COMP_ALG_TYPE;
typedef struct {
DWORD dwCompressedVersion;
DRS_COMP_ALG_TYPE CompressionAlg;
DRS_COMPRESSED_BLOB CompressedAny;
} DRS_MSG_GETCHGREPLY_V7;
typedef struct {
[ref] DSNAME *pNC;
UUID uuidDsaSrc;
[unique] [string] char *pszDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPSYNC_V1;
typedef struct {
[ref] DSNAME *pNC;
UUID uuidDsaSrc;
[unique] [string] char *pszDsaSrc;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION *pReservedBuffer;
} DRS_MSG_REPSYNC_V2;
typedef struct {
[ref] DSNAME *pNC;
[ref] [string] char *pszDsaDest;
UUID uuidDsaObjDest;
ULONG ulOptions;
} DRS_MSG_UPDREFS_V1;
typedef struct {
[ref] DSNAME *pNC;
[ref] [string] char *pszDsaDest;
UUID uuidDsaObjDest;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_UPDREFS_V2;
569 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)] DRS_MSG_UPDREFS_V1 V1;
[case(2)] DRS_MSG_UPDREFS_V2 V2;
} DRS_MSG_UPDREFS;
typedef struct {
[ref] DSNAME *pNC;
[ref] [string] char *pszDsaSrc;
REPLTIMES rtSchedule;
ULONG ulOptions;
} DRS_MSG_REPADD_V1;
typedef struct {
[ref] DSNAME *pNC;
[unique] DSNAME *pSourceDsaDN;
[unique] DSNAME *pTransportDN;
[ref] [string] char *pszSourceDsaAddress;
REPLTIMES rtSchedule;
ULONG ulOptions;
} DRS_MSG_REPADD_V2;
typedef struct {
[ref] DSNAME *pNC;
[unique] DSNAME *pSourceDsaDN;
[unique] DSNAME *pTransportDN;
[ref] [string] char *pszSourceDsaAddress;
REPLTIMES rtSchedule;
ULONG ulOptions;
GUID correlationID;
[unique] VAR_SIZE_BUFFER_WITH_VERSION* pReservedBuffer;
} DRS_MSG_REPADD_V3;
typedef struct {
[ref] DSNAME *pNC;
[string] char *pszDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPDEL_V1;
typedef struct {
[ref] DSNAME *pNC;
UUID uuidSourceDRA;
[unique, string] char *pszSourceDRA;
REPLTIMES rtSchedule;
ULONG ulReplicaFlags;
ULONG ulModifyFields;
ULONG ulOptions;
} DRS_MSG_REPMOD_V1;
typedef struct {
DWORD dwFlags;
[range(1,10000)] DWORD cNames;
[size_is(cNames)] DSNAME **rpNames;
ATTRBLOCK RequiredAttrs;
SCHEMA_PREFIX_TABLE PrefixTable;
} DRS_MSG_VERIFYREQ_V1;
570 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef [switch_type(DWORD)] union {
[case(1)] DRS_MSG_VERIFYREQ_V1 V1;
} DRS_MSG_VERIFYREQ;
typedef struct {
DWORD error;
[range(0,10000)] DWORD cNames;
[size_is(cNames)] ENTINF *rpEntInf;
SCHEMA_PREFIX_TABLE PrefixTable;
} DRS_MSG_VERIFYREPLY_V1;
typedef enum {
RevMembGetGroupsForUser=1,
RevMembGetAliasMembership,
RevMembGetAccountGroups,
RevMembGetResourceGroups,
RevMembGetUniversalGroups,
GroupMembersTransitive,
RevMembGlobalGroupsNonTransitive
} REVERSE_MEMBERSHIP_OPERATION_TYPE;
typedef struct {
[range(1,10000)] ULONG cDsNames;
[size_is(cDsNames,)] DSNAME **ppDsNames;
DWORD dwFlags;
[range(1,7)] REVERSE_MEMBERSHIP_OPERATION_TYPE OperationType;
DSNAME *pLimitingDomain;
} DRS_MSG_REVMEMB_REQ_V1;
typedef struct {
ULONG errCode;
[range(0,10000)] ULONG cDsNames;
[range(0,10000)] ULONG cSidHistory;
[size_is(cDsNames,)] DSNAME **ppDsNames;
[size_is(cDsNames)] DWORD *pAttributes;
[size_is(cSidHistory,)] NT4SID **ppSidHistory;
} DRS_MSG_REVMEMB_REPLY_V1;
typedef struct {
char *pSourceDSA;
ENTINF *pObject;
UUID *pParentUUID;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG ulFlags;
} DRS_MSG_MOVEREQ_V1;
typedef struct {
[range(0,10000)] unsigned long cbBuffer;
unsigned long BufferType;
[size_is(cbBuffer)] BYTE *pvBuffer;
} DRS_SecBuffer;
typedef struct {
unsigned long ulVersion;
[range(0,10000)] unsigned long cBuffers;
[size_is(cBuffers)] DRS_SecBuffer *Buffers;
} DRS_SecBufferDesc;
571 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
DSNAME *pSrcDSA;
ENTINF *pSrcObject;
DSNAME *pDstName;
DSNAME *pExpectedTargetNC;
DRS_SecBufferDesc *pClientCreds;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG ulFlags;
} DRS_MSG_MOVEREQ_V2;
typedef struct {
ENTINF **ppResult;
SCHEMA_PREFIX_TABLE PrefixTable;
ULONG *pError;
} DRS_MSG_MOVEREPLY_V1;
typedef struct {
ULONG win32Error;
[unique] DSNAME *pAddedName;
} DRS_MSG_MOVEREPLY_V2;
typedef struct {
ULONG CodePage;
ULONG LocaleId;
DWORD dwFlags;
DWORD formatOffered;
DWORD formatDesired;
[range(1,10000)] DWORD cNames;
[string, size_is(cNames)] WCHAR **rpNames;
} DRS_MSG_CRACKREQ_V1;
typedef struct {
DS_NAME_RESULTW *pResult;
} DRS_MSG_CRACKREPLY_V1;
typedef struct {
DWORD dwFlags;
DWORD PreferredMaximumLength;
[range(0,10485760)] DWORD cbRestart;
[size_is(cbRestart)] BYTE *pRestart;
} DRS_MSG_NT4_CHGLOG_REQ_V1;
typedef struct {
LARGE_INTEGER SamSerialNumber;
LARGE_INTEGER SamCreationTime;
LARGE_INTEGER BuiltinSerialNumber;
572 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
LARGE_INTEGER BuiltinCreationTime;
LARGE_INTEGER LsaSerialNumber;
LARGE_INTEGER LsaCreationTime;
} NT4_REPLICATION_STATE;
typedef struct {
[range(0,10485760)] DWORD cbRestart;
[range(0,10485760)] DWORD cbLog;
NT4_REPLICATION_STATE ReplicationState;
DWORD ActualNtStatus;
[size_is(cbRestart)] BYTE *pRestart;
[size_is(cbLog)] BYTE *pLog;
} DRS_MSG_NT4_CHGLOG_REPLY_V1;
typedef struct {
DWORD operation;
DWORD flags;
[string] const WCHAR *pwszAccount;
[range(0,10000)] DWORD cSPN;
[string, size_is(cSPN)] const WCHAR **rpwszSPN;
} DRS_MSG_SPNREQ_V1;
typedef struct {
DWORD retVal;
} DRS_MSG_SPNREPLY_V1;
typedef struct {
[string] LPWSTR ServerDN;
[string] LPWSTR DomainDN;
BOOL fCommit;
} DRS_MSG_RMSVRREQ_V1;
typedef struct {
BOOL fLastDcInDomain;
} DRS_MSG_RMSVRREPLY_V1;
typedef struct {
[string] LPWSTR DomainDN;
} DRS_MSG_RMDMNREQ_V1;
typedef struct {
DWORD Reserved;
} DRS_MSG_RMDMNREPLY_V1;
573 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)] DRS_MSG_RMDMNREPLY_V1 V1;
} DRS_MSG_RMDMNREPLY;
typedef struct {
[string] WCHAR *Domain;
DWORD InfoLevel;
} DRS_MSG_DCINFOREQ_V1;
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_1W *rItems;
} DRS_MSG_DCINFOREPLY_V1;
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_2W *rItems;
} DRS_MSG_DCINFOREPLY_V2;
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_3W* rItems;
} DRS_MSG_DCINFOREPLY_V3;
typedef struct {
[range(0,10000)] DWORD cItems;
[size_is(cItems)] DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW *rItems;
} DRS_MSG_DCINFOREPLY_VFFFFFFFF;
typedef struct {
[ref] DSNAME *pObject;
ATTRBLOCK AttrBlock;
} DRS_MSG_ADDENTRYREQ_V1;
typedef struct {
ENTINFLIST EntInfList;
} DRS_MSG_ADDENTRYREQ_V2;
typedef struct {
ENTINFLIST EntInfList;
DRS_SecBufferDesc *pClientCreds;
} DRS_MSG_ADDENTRYREQ_V3;
typedef struct {
GUID Guid;
NT4SID Sid;
DWORD errCode;
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
} DRS_MSG_ADDENTRYREPLY_V1;
574 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
typedef struct {
GUID objGuid;
NT4SID objSid;
} ADDENTRY_REPLY_INFO;
typedef struct {
[unique] DSNAME *pErrorObject;
DWORD errCode;
DWORD dsid;
DWORD extendedErr;
DWORD extendedData;
USHORT problem;
[range(0,10000)] ULONG cObjectsAdded;
[size_is(cObjectsAdded)] ADDENTRY_REPLY_INFO *infoList;
} DRS_MSG_ADDENTRYREPLY_V2;
typedef struct {
DWORD dwRepError;
DWORD errCode;
[switch_is(errCode)] DIRERR_DRS_WIRE_V1 *pErrInfo;
} DRS_ERROR_DATA_V1;
typedef struct {
DSNAME *pdsErrObject;
DWORD dwErrVer;
[switch_is(dwErrVer)] DRS_ERROR_DATA *pErrData;
[range(0,10000)] ULONG cObjectsAdded;
[size_is(cObjectsAdded)] ADDENTRY_REPLY_INFO *infoList;
} DRS_MSG_ADDENTRYREPLY_V3;
typedef struct {
DWORD dwTaskID;
DWORD dwFlags;
} DRS_MSG_KCC_EXECUTE_V1;
typedef struct {
ULONGLONG hCtx;
LONG lReferenceCount;
BOOL fIsBound;
UUID uuidClient;
DSTIME timeLastUsed;
ULONG IPAddr;
int pid;
} DS_REPL_CLIENT_CONTEXT;
typedef struct {
[range(0,10000)] DWORD cNumContexts;
DWORD dwReserved;
[size_is(cNumContexts)] DS_REPL_CLIENT_CONTEXT rgContext[];
} DS_REPL_CLIENT_CONTEXTS;
typedef struct {
[string] LPWSTR pszServerName;
BOOL fIsHandleBound;
BOOL fIsHandleFromCache;
575 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
BOOL fIsHandleInCache;
DWORD dwThreadId;
DWORD dwBindingTimeoutMins;
DSTIME dstimeCreated;
DWORD dwCallType;
} DS_REPL_SERVER_OUTGOING_CALL;
typedef struct {
[range(0, 256)] DWORD cNumCalls;
DWORD dwReserved;
[size_is(cNumCalls)] DS_REPL_SERVER_OUTGOING_CALL rgCall[];
} DS_REPL_SERVER_OUTGOING_CALLS;
typedef struct {
DWORD InfoType;
[string] LPWSTR pszObjectDN;
UUID uuidSourceDsaObjGuid;
} DRS_MSG_GETREPLINFO_REQ_V1;
typedef struct {
DWORD InfoType;
[string] LPWSTR pszObjectDN;
UUID uuidSourceDsaObjGuid;
DWORD ulFlags;
[string] LPWSTR pszAttributeName;
[string] LPWSTR pszValueDN;
DWORD dwEnumerationContext;
} DRS_MSG_GETREPLINFO_REQ_V2;
typedef struct {
DWORD Flags;
[string] WCHAR *SrcDomain;
[string] WCHAR *SrcPrincipal;
[string, ptr] WCHAR *SrcDomainController;
[range(0,256)] DWORD SrcCredsUserLength;
[size_is(SrcCredsUserLength)] WCHAR *SrcCredsUser;
[range(0,256)] DWORD SrcCredsDomainLength;
[size_is(SrcCredsDomainLength)] WCHAR *SrcCredsDomain;
[range(0,256)] DWORD SrcCredsPasswordLength;
[size_is(SrcCredsPasswordLength)] WCHAR *SrcCredsPassword;
[string] WCHAR *DstDomain;
[string] WCHAR *DstPrincipal;
} DRS_MSG_ADDSIDREQ_V1;
576 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)] DRS_MSG_ADDSIDREQ_V1 V1;
} DRS_MSG_ADDSIDREQ;
typedef struct {
DWORD dwWin32Error;
} DRS_MSG_ADDSIDREPLY_V1;
typedef struct {
[range(1, 10000)] ULONG Count;
[size_is(Count)] DRS_MSG_REVMEMB_REQ_V1 *Requests;
} DRS_MSG_GETMEMBERSHIPS2_REQ_V1;
typedef struct {
[range(0, 10000)] ULONG Count;
[size_is(Count)] DRS_MSG_REVMEMB_REPLY_V1 *Replies;
} DRS_MSG_GETMEMBERSHIPS2_REPLY_V1;
typedef struct {
[ref] DSNAME *pNC;
UUID uuidDsaSrc;
ULONG ulOptions;
} DRS_MSG_REPVERIFYOBJ_V1;
typedef struct {
UUID guidStart;
DWORD cGuids;
DSNAME *pNC;
UPTODATE_VECTOR_V1_EXT *pUpToDateVecCommonV1;
UCHAR Md5Digest[16];
} DRS_MSG_EXISTREQ_V1;
typedef struct {
DWORD dwStatusFlags;
[range(0,10485760)] DWORD cNumGuids;
[size_is(cNumGuids)] UUID *rgGuids;
} DRS_MSG_EXISTREPLY_V1;
typedef struct {
[string] const WCHAR *pwszFromSite;
[range(1,10000)] DWORD cToSites;
[string, size_is(cToSites)] WCHAR **rgszToSites;
DWORD dwFlags;
} DRS_MSG_QUERYSITESREQ_V1;
577 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)] DRS_MSG_QUERYSITESREQ_V1 V1;
} DRS_MSG_QUERYSITESREQ;
typedef struct {
DWORD dwErrorCode;
DWORD dwCost;
} DRS_MSG_QUERYSITESREPLYELEMENT_V1;
typedef struct {
[range(0,10000)] DWORD cToSites;
[size_is(cToSites)] DRS_MSG_QUERYSITESREPLYELEMENT_V1 *rgCostInfo;
DWORD dwFlags;
} DRS_MSG_QUERYSITESREPLY_V1;
typedef struct {
DWORD dwReserved;
} DRS_MSG_INIT_DEMOTIONREQ_V1;
typedef struct {
DWORD dwOpError;
} DRS_MSG_INIT_DEMOTIONREPLY_V1;
typedef struct {
DWORD dwFlags;
UUID uuidHelperDest;
[ref] DSNAME* pNC;
} DRS_MSG_REPLICA_DEMOTIONREQ_V1;
typedef struct {
DWORD dwOpError;
} DRS_MSG_REPLICA_DEMOTIONREPLY_V1;
typedef struct {
DWORD dwOperations;
UUID uuidHelperDest;
[string] LPWSTR szScriptBase;
} DRS_MSG_FINISH_DEMOTIONREQ_V1;
typedef struct {
DWORD dwOperationsDone;
DWORD dwOpFailed;
DWORD dwOpError;
} DRS_MSG_FINISH_DEMOTIONREPLY_V1;
578 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)] DRS_MSG_FINISH_DEMOTIONREPLY_V1 V1;
} DRS_MSG_FINISH_DEMOTIONREPLY;
typedef struct {
[string] const WCHAR *pwszCloneDCName;
[string] const WCHAR *pwszSite;
} DRS_MSG_ADDCLONEDCREQ_V1;
typedef struct {
[string] WCHAR *pwszCloneDCName;
[string] WCHAR *pwszSite;
[range(0,1024)] DWORD cPasswordLength;
[size_is(cPasswordLength)] WCHAR *pwsNewDCAccountPassword;
} DRS_MSG_ADDCLONEDCREPLY_V1;
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_WRITENGCKEYREQ_V1 V1;
} DRS_MSG_WRITENGCKEYREQ;
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_WRITENGCKEYREPLY_V1 V1;
} DRS_MSG_WRITENGCKEYREPLY;
typedef
[switch_type(DWORD)]
union {
[case(1)]
DRS_MSG_READNGCKEYREQ_V1 V1;
} DRS_MSG_READNGCKEYREQ;
typedef
[switch_type(DWORD)]
union {
579 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[case(1)]
DRS_MSG_READNGCKEYREPLY_V1 V1;
} DRS_MSG_READNGCKEYREPLY;
// opnum 0
ULONG
IDL_DRSBind(
[in] handle_t rpc_handle,
[in, unique] UUID *puuidClientDsa,
[in, unique] DRS_EXTENSIONS *pextClient,
[out] DRS_EXTENSIONS **ppextServer,
[out, ref] DRS_HANDLE *phDrs);
// opnum 1
ULONG
IDL_DRSUnbind(
[in, out, ref] DRS_HANDLE *phDrs);
// opnum 2
ULONG
IDL_DRSReplicaSync(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPSYNC *pmsgSync);
// opnum 3
ULONG
IDL_DRSGetNCChanges(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_GETCHGREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETCHGREPLY *pmsgOut);
// opnum 4
ULONG
IDL_DRSUpdateRefs(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_UPDREFS *pmsgUpdRefs);
// opnum 5
ULONG
IDL_DRSReplicaAdd(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPADD *pmsgAdd);
// opnum 6
ULONG
IDL_DRSReplicaDel(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPDEL *pmsgDel);
// opnum 7
ULONG
IDL_DRSReplicaModify(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
[in, ref, switch_is(dwVersion)] DRS_MSG_REPMOD *pmsgMod);
// opnum 8
ULONG
IDL_DRSVerifyNames(
580 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_VERIFYREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_VERIFYREPLY *pmsgOut);
// opnum 9
ULONG
IDL_DRSGetMemberships(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_REVMEMB_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REVMEMB_REPLY *pmsgOut);
// opnum 10
ULONG
IDL_DRSInterDomainMove(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_MOVEREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)] DRS_MSG_MOVEREPLY *pmsgOut);
// opnum 11
ULONG
IDL_DRSGetNT4ChangeLog(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_NT4_CHGLOG_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_NT4_CHGLOG_REPLY *pmsgOut);
// opnum 12
ULONG
IDL_DRSCrackNames(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_CRACKREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_CRACKREPLY *pmsgOut);
// opnum 13
ULONG
IDL_DRSWriteSPN(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_SPNREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)] DRS_MSG_SPNREPLY *pmsgOut);
// opnum 14
ULONG
IDL_DRSRemoveDsServer(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_RMSVRREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMSVRREPLY *pmsgOut);
// opnum 15
ULONG
IDL_DRSRemoveDsDomain(
[in, ref] DRS_HANDLE hDrs,
581 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_RMDMNREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_RMDMNREPLY *pmsgOut);
// opnum 16
ULONG
IDL_DRSDomainControllerInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_DCINFOREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_DCINFOREPLY *pmsgOut);
// opnum 17
ULONG
IDL_DRSAddEntry(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_ADDENTRYREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDENTRYREPLY *pmsgOut);
// opnum 18
ULONG
IDL_DRSExecuteKCC(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_KCC_EXECUTE *pmsgIn);
// opnum 19
ULONG
IDL_DRSGetReplInfo(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_GETREPLINFO_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETREPLINFO_REPLY *pmsgOut);
// opnum 20
ULONG
IDL_DRSAddSidHistory(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_ADDSIDREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDSIDREPLY *pmsgOut);
// opnum 21
ULONG
IDL_DRSGetMemberships2(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_GETMEMBERSHIPS2_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_GETMEMBERSHIPS2_REPLY *pmsgOut);
// opnum 22
ULONG
IDL_DRSReplicaVerifyObjects(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwVersion,
582 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[in, ref, switch_is(dwVersion)] DRS_MSG_REPVERIFYOBJ *pmsgVerify);
// opnum 23
ULONG
IDL_DRSGetObjectExistence (
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_EXISTREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_EXISTREPLY *pmsgOut);
// opnum 24
ULONG
IDL_DRSQuerySitesByCost(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)] DRS_MSG_QUERYSITESREQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_QUERYSITESREPLY *pmsgOut);
// opnum 25
ULONG
IDL_DRSInitDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_INIT_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_INIT_DEMOTIONREPLY* pmsgOut);
// opnum 26
ULONG
IDL_DRSReplicaDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_REPLICA_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_REPLICA_DEMOTIONREPLY* pmsgOut);
// opnum 27
ULONG
IDL_DRSFinishDemotion(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_FINISH_DEMOTIONREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_FINISH_DEMOTIONREPLY* pmsgOut);
// opnum 28
ULONG
IDL_DRSAddCloneDC (
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_ADDCLONEDCREQ* pmsgIn,
[out, ref] DWORD * pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_ADDCLONEDCREPLY* pmsgOut
);
// opnum 29
583 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
ULONG
IDL_DRSWriteNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_WRITENGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_WRITENGCKEYREPLY* pmsgOut
);
// opnum 30
ULONG
IDL_DRSReadNgcKey(
[in, ref] DRS_HANDLE hDrs,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DRS_MSG_READNGCKEYREQ* pmsgIn,
[out, ref] DWORD* pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DRS_MSG_READNGCKEYREPLY* pmsgOut
);
typedef struct {
DWORD Flags;
[range(1,1024)] DWORD cbPassword;
[size_is(cbPassword)] BYTE *pbPassword;
} DSA_MSG_EXECUTE_SCRIPT_REQ_V1;
typedef struct {
DWORD dwOperationStatus;
[string] LPWSTR pwErrMessage;
} DSA_MSG_EXECUTE_SCRIPT_REPLY_V1;
typedef struct {
DWORD Reserved;
} DSA_MSG_PREPARE_SCRIPT_REQ_V1;
typedef struct {
DWORD dwOperationStatus;
[string] LPWSTR pwErrMessage;
[range(0,1024)] DWORD cbPassword;
[size_is(cbPassword)] BYTE *pbPassword;
[range(0,10485760)] DWORD cbHashBody;
[size_is(cbHashBody)] BYTE *pbHashBody;
[range(0,10485760)] DWORD cbHashSignature;
584 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
[size_is(cbHashSignature)] BYTE *pbHashSignature;
} DSA_MSG_PREPARE_SCRIPT_REPLY_V1;
// opnum 0
ULONG
IDL_DSAPrepareScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_PREPARE_SCRIPT_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_PREPARE_SCRIPT_REPLY *pmsgOut);
// opnum 1
ULONG
IDL_DSAExecuteScript(
[in] handle_t hRpc,
[in] DWORD dwInVersion,
[in, ref, switch_is(dwInVersion)]
DSA_MSG_EXECUTE_SCRIPT_REQ *pmsgIn,
[out, ref] DWORD *pdwOutVersion,
[out, ref, switch_is(*pdwOutVersion)]
DSA_MSG_EXECUTE_SCRIPT_REPLY *pmsgOut);
585 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
8 Appendix B: Product Behavior
The information in this specification is applicable to the following Microsoft products or supplemental
software. References to product versions include released service packs.
The terms "earlier" and "later", when used with a product version, refer to either all preceding
versions or all subsequent versions, respectively. The term "through" refers to the inclusive range of
versions. Applicable Microsoft products are listed chronologically in this section.
The following tables show the relationships between Microsoft product versions or supplemental
software and the roles they perform.
Exceptions, if any, are noted in this section. If an update version, service pack or Knowledge Base
(KB) number appears with a product name, the behavior changed in that update. The new behavior
586 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
also applies to subsequent updates unless otherwise specified. If a product edition appears with the
product version, behavior is different in that product edition.
Unless otherwise specified, any statement of optional behavior in this specification that is prescribed
using the terms "SHOULD" or "SHOULD NOT" implies product behavior in accordance with the
SHOULD or SHOULD NOT prescription. Unless otherwise specified, the term "MAY" implies that the
product does not follow the prescription.
<1> Section 2.1: Applicable Windows Server releases listen only on the RPC-over-TCP protocol
sequence. Windows clients attempt to connect using only the RPC-over-TCP protocol sequence.
<2> Section 2.2.2: Windows 2000 Server, Windows Server 2003, Windows Server 2003 R2, Windows
Server 2008, and Windows Server 2008 R2 AD DS DCs do not store the "RPC" SPN.
<3> Section 2.2.3: Windows implements DC-to-DC interaction with an SPN with service class
"E3514235-4B06-11D1-AB04-00C04FC2DCD2". See DRS_SPN_CLASS.
<5> Section 4.1: All IDL methods and their associated concrete types have existed in the drsuapi
RPC interface since Windows 2000 operating system except those listed in the following table. All IDL
methods and their associated concrete types continue to exist in this interface in subsequent versions
of Windows according to the applicability list at the beginning of this section.
587 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Introduced in Windows Server
Data type or IDL method Section release
<6> Section 4.1.1.1.2: Though this request version appears in the IDL, Windows DCs do not support
it. It was never supported in any of the applicable Windows Server releases.
<7> Section 4.1.1.1.6: Though this response version appears in the IDL, Windows DCs do not support
it.
<8> Section 4.1.1.3: This operation is only supported by AD LDS and AD DS in Windows Server
2008 and later.
<9> Section 4.1.2.2.6: The function determines whether auditing is enabled on the server by
querying the LSA information policy on the server associated with ctx and by confirming that the
information policy is set to generate both success and failure audits for the "account management"
audit category. To achieve this, the LsarOpenPolicy2, LsarQueryInformationPolicy, and LsarClose
messages in [MS-LSAD] are used ([MS-LSAD] sections 3.1.4.4.1, 3.1.4.4.4, and 3.1.4.9.4). The
srcDomainController variable in the IDL_DRSAddSidHistory method is used as the SystemName
parameter to LsarOpenPolicy2, and the DesiredAccess parameter to LsarOpenPolicy2 is set to
(POLICY_VIEW_AUDIT_INFORMATION + POLICY_VIEW_LOCAL_INFORMATION). On success, the
PolicyHandle acquired from the LsarOpenPolicy2 message is passed to LsarQueryInformationPolicy
with PolicyAuditEventsInformation as the information class. The check to determine whether success
and failure audits are enabled for "account management" is achieved by performing the following
evaluation:
PolicyInformation^.PolicyAuditEventsInfo.EventAuditingOptions[6] ∩
{ POLICY_AUDIT_EVENT_SUCCESS, POLICY_AUDIT_EVENT_FAILURE } =
{ POLICY_AUDIT_EVENT_SUCCESS, POLICY_AUDIT_EVENT_FAILURE }
The function generates an audit on the DC associated with ctx by adding the source principal
(pmsgIn^.V1.SrcPrincipal, where pmsgIn is a parameter to the IDL_DRSAddSidHistory method, which
in turn calls this method) to the group srcDomainFlatName$$$ on the DC associated with ctx, where
srcDomainFlatName is the NetBIOS name of the domain to which the source principal belongs. After
adding the principal to the group, it then removes the principal from the group, leaving the group in
its original state but having generated an audit event as a side effect of manipulating the group's
membership.
<10> Section 4.1.2.2.13: This test is implemented in two steps. First, it is determined if the DC
associated with ctx is running at least Windows 2000. This is determined by whether a SamrConnect5
or SamrConnect4 API call (as specified in [MS-SAMR]) to the DC is successful. If it is, the DC is
running at least Windows 2000, and the function returns true.
588 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Otherwise, the DC is considered to be running Windows NT 4.0 operating system. The function then
connects to the registry service on the DC named in ctx and queries the value of the "CSDVersion"
registry value on the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
registry key. If the value is not equal to any of the following strings, the function returns true;
otherwise, it returns false:
Service Pack 0
Service Pack 1
Service Pack 2
Service Pack 3
If the registry service on the DC could not be contacted, or if the registry key or registry value does
not exist, the function returns false.
<11> Section 4.1.3.1: Windows non-DC client callers always pass NTDSAPI_CLIENT_GUID in
puuidClientDsa. If a Windows DC client caller uses the returned DRS_HANDLE for subsequent calls to
the IDL_DRSWriteSPN method, then the client passes NTDSAPI_CLIENT_GUID in puuidClientDsa. In
any other cases, Windows DC client callers pass DC!serverGuid in puuidClientDsa.
<12> Section 4.1.3.1: Windows non-DC client callers always set the dwFlags field of the
DRS_EXTENSIONS_INT structure to zero. Windows non-DC client callers always set the SiteObjGuid
field of the DRS_EXTENSIONS_INT structure to the NULL GUID value. Windows non-DC client callers
always set the Pid field of the DRS_EXTENSIONS_INT structure to an implementation-specific, client-
local process identifier (PID).
Windows non-DC clients do not include the following fields in the DRS_EXTENSIONS_INT structure. In
addition, the following fields are included by Windows DC clients only if the clients are running the
corresponding versions of Windows.
Field Included by
ConfigObjGUID Windows DC clients running Windows Server 2003 R2 (AD LDS only) and Windows Server
2008 and later.
dwFlagsExt Windows DC clients running Windows Server 2003 R2 (AD LDS only) and Windows Server
2008 and later.
<13> Section 4.1.3.2: The ConfigObjGUID and dwFlagsExt fields in the DRS_EXTENSIONS_INT
structure are included only by servers running Windows Server 2003 R2 (AD LDS only) and Windows
Server 2008 and later.
<14> Section 4.1.5.2: All of the information levels listed in section 4.1.5.2 have existed in the drsuapi
RPC interface since Windows 2000, except as noted in the following table.
<15> Section 4.1.6.3: The Windows implementation of this method puts the KCC execution requests
in a local-machine work queue. If DS_KCC_FLAG_DAMPED is specified in the call to
589 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
IDL_DRSExecuteKCC and there is already a request pending, the execution request is not added to
the queue in order to reduce redundant requests.
<16> Section 4.1.7.3: The Windows implementation of the IDL_DRSFinishDemotion method causes
the underlying RPC protocol [MS-RPCE] to throw an RPC_S_INVALID_TAG exception when returning
ERROR_INVALID_PARAMETER.
<17> Section 4.1.10.1.1: The Windows implementation never declares msgIn.uuidInvocIdSrc and
msgIn.usnvecFrom that are otherwise valid to be stale.
<18> Section 4.1.10.1.1: The internal format of USN_VECTOR identifies the start of a cycle.
<21> Section 4.1.10.1.3: The Request Role extended operation is supported by Windows 2000
Server and later.
<22> Section 4.1.10.1.3: The Abandon Role extended operation is supported by Windows 2000
Server and later.
<23> Section 4.1.10.1.3: The Allocate RIDs extended operation is supported by Windows 2000
Server and later.
<24> Section 4.1.10.1.3: The Replicate Single Object extended operation is supported by Windows
Server 2003 and later.
<25> Section 4.1.10.1.3: The Replicate Single Object including Secret Data extended operation is
supported by Windows Server 2008 and later.
<26> Section 4.1.10.2.2: Though this request version appears in the IDL, Windows DCs never send
this request version by means of RPC. It exists solely to support SMTP replication (see [MS-SRPL]).
<27> Section 4.1.10.2.3: Although this request version appears in the IDL, Windows DCs never send
this request version using RPC. It exists solely to support SMTP replication ([MS-SRPL]).
<28> Section 4.1.10.2.5: Though this request version appears in the IDL, Windows DCs never send
this request version using RPC. It exists solely to support SMTP replication ([MS-SRPL]).
<29> Section 4.1.10.2.19: Windows Server 2003, Windows Server 2003 R2, Windows Server 2008,
and Windows Server 2008 R2 enforce the following range for the cbCompressedSize member:
"[range(1,10485760)]".
<30> Section 4.1.10.5.7: The server tests the response against the limits after adding each object
and link to the response, unless the object is a parent object that is being included because of the
Ancestors predicate (see the GetReplChanges method). If the test shows that the response has
exceeded one of the limits, the server stops adding to the response. The server might return more
objects or bytes than the limits.
<31> Section 4.1.10.6.6: Windows DCs assign the remainder of the bits in values of o!instanceType
for a given object o as follows:
IT_UNINSTANT: Set if and only if o is an NC root and its NC replica is not present on the DC.
IT_NC_ABOVE: Set if and only if o is an NC root and the DC has an NC replica with NC root p such
that p is the parent of o.
IT_NC_COMING: Set if and only if o is an NC root and the DC has not yet completed the first
replication cycle for that NC replica.
590 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
IT_NC_GOING: Set if and only if o is an NC root and the DC is in the process of removing its
replica of the NC.
<33> Section 4.1.14.2: The Windows implementation of the IDL_DRSInitDemotion method causes
the underlying RPC protocol (as specified in [MS-RPCE]) to throw an RPC_S_INVALID_TAG exception
when returning ERROR_ACCESS_DENIED.
<34> Section 4.1.15.1.2: Although this request version appears in the IDL, Windows DCs do not
support it. It was never supported in any of the applicable Windows Server releases.
<35> Section 4.1.15.1.5: Although this response version appears in the IDL, Windows DCs do not
support it.
<36> Section 4.1.16.3: The server returns the error ERROR_DS_GENERIC_ERROR if the Intersite
Messaging Service is not running on the server.
<37> Section 4.1.24.3: The Windows implementation of the for loop uses
IDL_DRSGetObjectExistence to determine if object o exists at refDsa, and logs a message to the
Windows Event Log.
<38> Section 5.39: In Windows 2000 Server, the cb field contains the count of bytes in the fields
dwFlags through Pid, inclusive, which is the size of the structure in that version minus the 4 bytes of
the cb field.
<39> Section 5.39: In AD DS and AD LDS servers running Windows Server 2003, and in AD DS
servers running Windows Server 2003 R2, the cb field contains the count of bytes in the fields
dwFlags through dwReplEpoch, inclusive, which is the size of the structure in those versions minus
the 4 bytes of the cb field.
<40> Section 5.39: In Windows Server 2003 R2 (AD LDS only), Windows Server 2008, Windows
Server 2008 R2, and Windows Server 2012, the cb field contains the count of bytes in the fields
dwFlags through ConfigObjGUID, inclusive, which is the size of the structure in those versions
minus the 4 bytes of the cb field.
<42> Section 5.39: This field contains the process ID of the client or server process, depending on
which is current.
<43> Section 5.39: The dwReplEpoch field in the DRS_EXTENSIONS_INT structure is included only
by servers running Windows Server 2003 and later.
<44> Section 5.39: The ConfigObjGUID and dwFlagsExt fields in the DRS_EXTENSIONS_INT
structure are included only by AD DS servers running Windows Server 2008 and later, and by AD LDS
servers running Windows Server 2003 R2 and later.
<45> Section 5.39: The ConfigObjGUID and dwFlagsExt fields in the DRS_EXTENSIONS_INT
structure are included only by AD DS servers running Windows Server 2008 and later, and by AD LDS
servers running Windows Server 2003 R2 and later.
<46> Section 5.39: The dwExtCaps field in the DRS_EXTENSIONS_INT structure is included only by
AD DS and AD LDS servers running Windows Server 2012 R2 and later.
<47> Section 5.41: All the DRS_OPTIONS listed in section 5.41 have existed in the drsuapi RPC
interface since Windows 2000 except those listed in the following table.
591 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Flag Introduced in Windows Server release
This flag is ignored inbound on the operating systems that are prior to its introduction.
All the DRS_OPTIONS listed in section 5.41 continue to exist in this interface in subsequent versions of
Windows according to the applicability list at the beginning of this section, except those listed in the
following table.
This flag is not to be used on the operating system from which it was removed or on subsequent
versions of the operating system. If this flag is used on a deprecated platform, the error code
ERROR_DS_DRA_INVALID_PARAMETER will be returned.
The following pseudocode specifies how to unmask the flags that are unsupported for each operating
system.
<48> Section 5.50: No range is supported on any member of DSNAME in Windows 2000 Server. A
range of 0 to 10485760 is supported on the NameLen member of DSNAME in Windows Server 2003
and Windows Server 2003 R2. A range of 0 to 10485761 is supported on the StringName member of
DSNAME in Windows Server 2008 and later.
<49> Section 5.170: Windows 2000 Server, Windows Server 2003, and Windows Server 2003 R2 AD
DS DCs have a value of 1 in the dwVersion field. Windows Server 2008 and later AD DS DCs have a
value of 2 in the dwVersion field. Windows Server 2003 R2 and later AD LDS DCs have a value of 2 in
the dwVersion field.
<50> Section 5.171: Windows 2000 Server, Windows Server 2003, and Windows Server 2003 R2 AD
DS DCs have a value of 1 in the dwVersion field. Windows Server 2008 and later AD DS DCs have a
value of 2 in the dwVersion field. Windows Server 2003 R2 and later AD LDS DCs have a value of 2
in the dwVersion field.
<51> Section 5.212: Windows Server 2008 and Windows Server 2008 R2 do not raise an
ERROR_INVALID_PARAMETER exception when opnum==26 and IsAdlds() == false. Instead, the
method IDL_DRSReplicaDemotion (section 4.1.21) executes, and the effects vary depending on
the NC specified in pmsgIn.V1.pNC.
Only the FSMO roles contained within the domain NC, as described in [MS-ADTS] section
3.1.1.1.11, FSMO Roles, are transferred to a replication partner.
592 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
pmsgIn.V1.pNC!repsFrom values are not removed.
593 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
9 Change Tracking
This section identifies changes that were made to this document since the last release. Changes are
classified as Major, Minor, or None.
The revision class Major means that the technical content in the document was significantly revised.
Major changes affect protocol interoperability or implementation. Examples of major changes are:
The revision class Minor means that the meaning of the technical content was clarified. Minor changes
do not affect protocol interoperability or implementation. Examples of minor changes are updates to
clarify ambiguity at the sentence, paragraph, or table level.
The revision class None means that no new technical changes were introduced. Minor editorial and
formatting changes may have been made, but the relevant technical content is identical to the last
released version.
The changes made to this document are listed in the following table. For more information, please
contact dochelp@microsoft.com.
Revision
Section Description
class
594 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
10 Index
A Concrete types (section 3.3.3 50, section 3.4.2 51)
Concrete value representations 446
Abstract types (section 3.3.3 50, section 3.4.3 52) Concrete value representations - converting to
Abstract value representations 448 abstract 450
Abstract value representations - converting to ConcretePTFromAbstractPT 467
concrete 450 ConfigNC 467
AbstractPTFromConcretePT 440 Configuration example 58
AccessCheckAttr 440 CONTREF_DRS_WIRE_V1 structure 69
AccessCheckCAR 441 Cookie structure 511
AccessCheckObject 441
AccessCheckWriteToSpnAttribute 441 D
AD LDS specifics 60
ADDENTRY_REPLY_INFO structure 66 Data display conventions 59
AmILHServer 443 Data types 440
AmIRODC 443 dc/DC 467
Applicability 41 DC-to-DC operations 44
Asynchronous processing 58 DefaultNC 468
ATRERR_DRS_WIRE_V1 structure 67 DescendantObject 469
ATTR structure 443 DN 469
ATTRBLOCK structure 444 DNBinary 469
Attributes 55 DomainNameFromNT4AccountName 469
AttributeStamp 444 DRS_COMP_ALG_TYPE enumeration 181
AttributeSyntax 445 DRS_COMPRESSED_BLOB structure 181
AttrStamp 445 DRS_ERROR_DATA_V1 structure 72
ATTRTYP 446 DRS_EXTENSIONS 469
AttrtypFromSchemaObj 446 DRS_EXTENSIONS structure 469
ATTRTYP-to-OID conversion 459 DRS_EXTENSIONS_INT 470
ATTRVAL DRS_EXTENSIONS_INT packet 470
abstract value representations 448 DRS_HANDLE 473
ATTRTYP-to-OID conversion 459 DRS_MSG_ADDCLONEDCREPLY_V1 structure 409
concrete value representations 446 DRS_MSG_ADDCLONEDCREQ_V1 structure 408
converting between abstract and concrete value DRS_MSG_ADDENTRYREPLY_V1 structure 65
representations 450 DRS_MSG_ADDENTRYREPLY_V2 structure 65
overview 446 DRS_MSG_ADDENTRYREPLY_V3 structure 66
ATTRVAL structure 446 DRS_MSG_ADDENTRYREQ_V1 structure 64
ATTRVALBLOCK 465 DRS_MSG_ADDENTRYREQ_V2 structure 64
ATTRVALBLOCK structure 465 DRS_MSG_ADDENTRYREQ_V3 structure 64
ATTRVALFromValue 465 DRS_MSG_ADDSIDREPLY_V1 structure 86
DRS_MSG_ADDSIDREQ_V1 structure 85
B DRS_MSG_CRACKREPLY_V1 structure 119
DRS_MSG_CRACKREQ_V1 structure 116
BOOL 465 DRS_MSG_DCINFOREPLY_V1 structure 140
BYTE 465 DRS_MSG_DCINFOREPLY_V2 structure 140
DRS_MSG_DCINFOREPLY_V3 structure 140
C DRS_MSG_DCINFOREPLY_VFFFFFFFF structure 140
DRS_MSG_DCINFOREQ_V1 structure 139
Capability negotiation 41 DRS_MSG_EXISTREPLY_V1 structure 273
Change tracking 593 DRS_MSG_EXISTREQ_V1 structure 272
CHANGE_LOG_ENTRIES 465 DRS_MSG_FINISH_DEMOTIONREPLY_V1 structure
CHANGELOG_ENTRY 466 156
CheckGroupMembership 466 DRS_MSG_FINISH_DEMOTIONREQ_V1 structure 155
Client initialization 60 DRS_MSG_GETCHGREPLY_V1 structure 177
ClientAuthorizationInfo 466 DRS_MSG_GETCHGREPLY_V2 structure 178
ClientExtensions 466 DRS_MSG_GETCHGREPLY_V6 structure 178
Client-to-DC operations DRS_MSG_GETCHGREPLY_V7 structure 179
security 45 DRS_MSG_GETCHGREPLY_V9 structure 179
security provider 46 DRS_MSG_GETCHGREQ_V10 structure 175
SPN for target DC in AD DS 46 DRS_MSG_GETCHGREQ_V3 structure 172
SPN for target DC in AD LDS 47 DRS_MSG_GETCHGREQ_V4 structure 173
Common configuration example 58 DRS_MSG_GETCHGREQ_V5 structure 173
COMPRESSED_DATA structure 181 DRS_MSG_GETCHGREQ_V7 structure 174
595 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
DRS_MSG_GETCHGREQ_V8 structure 174 DS_REPL_CURSORS_2 structure 282
DRS_MSG_GETMEMBERSHIPS2_REPLY_V1 structure DS_REPL_CURSORS_3W structure 282
168 DS_REPL_KCC_DSA_FAILURESW structure 285
DRS_MSG_GETMEMBERSHIPS2_REQ_V1 structure DS_REPL_KCC_DSA_FAILUREW structure 285
168 DS_REPL_NEIGHBORSW structure 280
DRS_MSG_GETREPLINFO_REQ_V1 structure 277 DS_REPL_NEIGHBORW structure 280
DRS_MSG_GETREPLINFO_REQ_V2 structure 277 DS_REPL_OBJ_META_DATA structure 283
DRS_MSG_INIT_DEMOTIONREPLY_V1 structure 324 DS_REPL_OBJ_META_DATA_2 structure 284
DRS_MSG_INIT_DEMOTIONREQ_V1 structure 323 DS_REPL_OP_TYPE 478
DRS_MSG_KCC_EXECUTE_V1 structure 153 DS_REPL_OP_TYPE enumeration 478
DRS_MSG_MOVEREPLY_V1 structure 326 DS_REPL_OPW structure 286
DRS_MSG_MOVEREPLY_V2 structure 327 DS_REPL_PENDING_OPSW structure 286
DRS_MSG_MOVEREQ_V1 structure 325 DS_REPL_SERVER_OUTGOING_CALL structure 290
DRS_MSG_MOVEREQ_V2 structure 326 DS_REPL_SERVER_OUTGOING_CALLS structure 289
DRS_MSG_NT4_CHGLOG_REPLY_V1 structure 266 DS_REPL_VALUE_META_DATA structure 287
DRS_MSG_NT4_CHGLOG_REQ_V1 structure 265 DS_REPL_VALUE_META_DATA_2 structure 288
DRS_MSG_QUERYSITESREPLY_V1 structure 337 DSA_ADDRESS_LIST_DRS_WIRE_V1 structure 69
DRS_MSG_QUERYSITESREPLYELEMENT_V1 structure DSA_MSG_EXECUTE_SCRIPT_REPLY_V1 structure
337 437
DRS_MSG_QUERYSITESREQ_V1 structure 336 DSA_MSG_EXECUTE_SCRIPT_REQ_V1 structure 437
DRS_MSG_REPADD_V1 structure 364 DSA_MSG_PREPARE_SCRIPT_REPLY_V1 structure
DRS_MSG_REPADD_V2 structure 364 433
DRS_MSG_REPDEL_V1 structure 369 DSA_MSG_PREPARE_SCRIPT_REQ_V1 structure 432
DRS_MSG_REPLICA_DEMOTIONREPLY_V1 structure DSA_RPC_INST 479
374 DSA_RPC_INST structure 479
DRS_MSG_REPLICA_DEMOTIONREQ_V1 structure DSAObj 478
373 DSName (section 5.49 479, section 5.50 479)
DRS_MSG_REPMOD_V1 structure 377 DSNAME equality 481
DRS_MSG_REPSYNC_V1 structure 380 DSNAME structure 479
DRS_MSG_REPVERIFYOBJ_V1 structure 384 DSTIME 481
DRS_MSG_REVMEMB_REPLY_V1 structure 162 DWORD 482
DRS_MSG_REVMEMB_REQ_V1 structure 160
DRS_MSG_RMDMNREPLY_V1 structure 357 E
DRS_MSG_RMDMNREQ_V1 structure 356
DRS_MSG_RMSVRREPLY_V1 structure 360 ENCRYPTED_PAYLOAD packet 182
DRS_MSG_RMSVRREQ_V1 structure 359 ENTINF 482
DRS_MSG_SPNREPLY_V1 structure 404 ENTINF structure 482
DRS_MSG_SPNREQ_V1 structure 404 ENTINF_EnumerateAttributes 483
DRS_MSG_UPDREFS_V1 structure 392 ENTINF_GetValue 482
DRS_MSG_VERIFYREPLY_V1 structure 398 ENTINF_SetValue 483
DRS_MSG_VERIFYREQ_V1 structure 397 ENTINFLIST 483
DRS_OPTIONS 474 ENTINFLIST structure 483
DRS_SecBuffer 476 Examples
DRS_SecBuffer structure 476 common configuration example 58
DRS_SecBufferDesc 478 data display conventions 59
DRS_SecBufferDesc structure 478 IDL_DRSBind method example 111
DRS_SPN_CLASS 478 Expunge 484
DS_DOMAIN_CONTROLLER_INFO_1W structure 141
DS_DOMAIN_CONTROLLER_INFO_2W structure 141 F
DS_DOMAIN_CONTROLLER_INFO_3W structure 142
DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW Fields - vendor-extensible 42
structure 143 FILETIME 484
DS_NAME_FORMAT enumeration 118 FilteredGCPAS 484
DS_NAME_RESULT_ITEMW structure 118 FilteredPAS 484
DS_NAME_RESULTW structure 119 FindChar 485
DS_REPL_ATTR_META_DATA structure 283 FindCharRev 485
DS_REPL_ATTR_META_DATA_2 structure 284 FOREST_TRUST_INFORMATION 486
DS_REPL_ATTR_VALUE_META_DATA structure 286 FOREST_TRUST_INFORMATION packet 486
DS_REPL_ATTR_VALUE_META_DATA_2 structure 288 FOREST_TRUST_RECORD_TYPE 495
DS_REPL_CLIENT_CONTEXT structure 289 FOREST_TRUST_RECORD_TYPE enumeration 495
DS_REPL_CLIENT_CONTEXTS structure 289 ForestRootDomainNC 496
DS_REPL_CURSOR structure 281 Full IDL 558
DS_REPL_CURSOR_2 structure 282 FullReplicaExists 496
DS_REPL_CURSOR_3W structure 283
DS_REPL_CURSORS structure 281 G
596 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Initialization 60
GCPAS 496 instanceType bit flags 502
GetAttrVals 498 INT32 packet 447
GetCallerAuthzInfo 498 INT64 packet 447
GetDefaultObjectCategory 498 INTFORMPROB_DRS_WIRE_V1 structure 68
GetDSNameFromDN 499 Introduction 22
GetDSNameOfEnterpriseRODCsGroup 163 Is2PartSPN 503
GetFilteredAttributeSet 496 Is3PartSPN 503
GetForestFunctionalLevel 499 IsBuiltinPrincipal 503
GetFSMORoleOwner 499 IsDCAccount 504
GetInstanceNameFromSPN 500 IsDomainNameInTrustedForest 503
GetNCType 497 IsGC 504
GetObjectNC 500 IsGetNCChangesPermissionGranted 504
GetProxyEpoch 500 IsGUIDBasedDNSName 505
GetProxyType 500 IsMemberOfBuiltinAdminGroup 505
GetServiceClassFromSPN 500 IsRecycleBinEnabled 505
GetServiceNameFromSPN 501 IsRevealFilteredAttribute 505
Glossary 23 IsRevealSecretRequest 506
groupType bit flags 501 IsValidServiceName 507
GUID 501
GuidFromString 502 K
GuidToString 502
KCCFailedConnections 508
H KCCFailedLinks 508
handle_t 502 L
597 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
overview 43 PROPERTY_META_DATA structure 183
transport 43 PROPERTY_META_DATA_EXT 530
Methods (section 1.3.1 37, section 4 61) PROPERTY_META_DATA_EXT structure 530
MTX_ADDR 525 PROPERTY_META_DATA_EXT_VECTOR 531
MTX_ADDR structure 525 PROPERTY_META_DATA_EXT_VECTOR structure 531
proxiedObjectName value format 531
N Pseudocode 51
NAMERESOP_DRS_WIRE_V1 structure 69 R
NAMERR_DRS_WIRE_V1 structure 68
Naming conventions 51 RDN 531
NCType bits 525 rdnType 531
NetworkAddress 526 Record packet 486
NewPrefixTable 526 RecycleObj 532
Normative references 35 References
NT4_REPLICATION_STATE structure 266 informative 37
Nt4ReplicationState 526 normative 35
NT4SID 527 REFERR_DRS_WIRE_V1 structure 68
NT4SID structure 527 Relationship to other protocols 40
NTDSTRANSPORT_OPT values 527 RemoveObj 532
NULLGUID 527 REPLENTINFLIST 532
REPLENTINFLIST structure 532
O ReplicationQueue 533
REPLTIMES 533
Object attributes 55 REPLTIMES structure 533
Object(Access-Point) 449 replUpToDateVector/ReplUpToDateVector 534
Object(DN-Binary) 449 REPLVALINF 534
Object(DN-String) 449 REPLVALINF structure 534
Object(DS-DN) 448 REPS_FROM 535
Object(OR-Name) 450 REPS_FROM packet 535
ObjExists 527 REPS_TO 538
OID 527 REPS_TO packet 538
OID_t 527 repsFrom/RepsFrom 540
OID_t structure 527 repsTo/RepsTo 542
OidFromAttid 528 RevealSecretsPolicy enumeration 215
Organization 49 REVERSE_MEMBERSHIP_OPERATION_TYPE
Overview 49 enumeration 161
Overview (synopsis) 37 Rid 543
Right 543
P RIGHT values 543
RPCClientContexts 544
Parameters - security index 557 RPCOutgoingContexts 544
parent 528
PARTIAL_ATTR_VECTOR_V1_EXT 528 S
PARTIAL_ATTR_VECTOR_V1_EXT structure 528
partialAttributeSet 528 sAMAccountType values 544
PartialGCReplicaExists 528 SCHEMA_PREFIX_TABLE 545
PAS_DATA 529 SCHEMA_PREFIX_TABLE structure 545
PAS_DATA packet 529 SchemaNC 545
PdcChangeLog 529 SchemaObj 545
PDS_NAME_RESULT_ITEMW 118 SECERR_DRS_WIRE_V1 structure 70
PDS_NAME_RESULTW 119 Security
PDSA_RPC_INST 479 background 43
PerformAddOperation 529 client-to-DC operations 45
PerformAddOperationAsSystem 530 DC-to-DC operations 44
PerformModifyOperation 233 implementer considerations 557
Preconditions 41 overview 43
PrefixTable 530 parameter index 557
PrefixTableEntry 530 provider (section 2.2.3.1 44, section 2.2.4.1 46)
PrefixTableEntry structure 530 service authentication 43
Prerequisites (section 1.5 41, section 3.3.1 49) SPN for target DC in AD DS 46
PROBLEMLIST_DRS_WIRE_V1 structure 67 SPN for target DC in AD LDS 47
Procedures 440 Security provider 44
Processing - asynchronous 58 Sequencing issues 38
Product behavior 585 Server extensions 546
598 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024
Server initialization 60
Service authentication 43
SID 546
SidFromStringSid 546
SPN for target DC in AD DS 46
SPN for target DC in AD LDS 47
SPN target DC in AD DS 44
SPN target DC in AD LDS 45
StampLessThanOrEqualUTD 546
Standards assignments 42
StartsWith 546
State model 49
String(NT-Sec-Desc) 450
String(Sid) 450
String(Teletex) 450
StringSidFromSid 547
SubString 547
SVCERR_DRS_WIRE_V1 structure 71
Syntax 547
SYNTAX_ADDRESS packet 547
SYNTAX_DISTNAME_BINARY packet 547
SYSERR_DRS_WIRE_V1 structure 71
systemFlags values 549
UCHAR 549
ULARGE_INTEGER structure 549
ULONG 549
ULONGLONG 549
UPDERR_DRS_WIRE_V1 structure 71
UPTODATE_CURSOR_V1 structure 551
UPTODATE_CURSOR_V2 structure 551
UPTODATE_VECTOR_V1_EXT structure 551
UPTODATE_VECTOR_V2_EXT structure 552
userAccountControl bits 552
UserNameFromNT4AccountName 553
USHORT 553
USN 553
USN_VECTOR structure 553
UUID 554
Value 555
VALUE_META_DATA_EXT_V1 structure 555
ValueFromATTRVAL 556
Values (section 5.16.1 446, section 5.16.2 448,
section 5.16.3 450)
Variables 440
Vendor-extensible fields 42
Versioning 41
WCHAR 556
599 / 599
[MS-DRSR] - v20240423
Directory Replication Service (DRS) Remote Protocol
Copyright © 2024 Microsoft Corporation
Release: April 23, 2024