4.1.26.2 Server Behavior of the IDL_DRSUpdateRefs Method

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 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^
  
 if (options – {DRS_ASYNC_OP, DRS_GETCHG_CHECK, DRS_WRIT_REP, DRS_DEL_REF, DRS_ADD_REF, DRS_REF_GCSPN} != 0) then
   return ERROR_DS_DRA_INVALID_PARAMETER
  
 if ((DRS_WRIT_REP in options) and not (IT_WRITE in nc!instanceType)) or
     not ObjExists(nc) then
   return ERROR_DS_DRA_BAD_NC
 endif
  
 if not AccessCheckCAR(nc, DS-Replication-Manage-Topology) then
   return ERROR_DS_DRA_ACCESS_DENIED
 endif
  
 /* Perform repsTo value add, delete, or combination of add/delete to the specified NC replica, 
  * the result value is a Windows error code or 0
 result := UpdateRefs(pmsgIn^.V1) 
 if(result ≠ ERROR_SUCCESS) then
   return result
 endif
  
 /* If DRS_GETCHG_CHECK is specified, ERROR_DS_DRA_REF_NOT_FOUND and
  * ERROR_DS_DRA_REF_ALREADY_EXISTS are ignored. */
 if DRS_GETCHG_CHECK in options and 
 (err = ERROR_DS_DRA_REF_NOT_FOUND or err = ERROR_DS_DRA_REF_ALREADY_EXISTS) then
    err := 0
 endif
  
 return err