4.1.23.2 Server Behavior of the IDL_DRSReplicaSync Method

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)
  
 /* Validate the version */
 if dwVersion ≠ 1 then
   return ERROR_DS_DRA_INVALID_PARAMETER
 endif
 msgIn := pmsgSync^.V1
  
 /* 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
  
 /* Validate the specified NC. */
 nc := msgIn.pNC^
 if not ObjExists(nc) then
   return ERROR_DS_DRA_BAD_NC
 endif
  
 if (DRS_SYNC_BYNAME in options and msgIn.pszDsaSrc = null)
     or (not DRS_SYNC_BYNAME in options and msgIn.uuidDsaSrc = null)
     or (not DRS_SYNC_BYNAME in options and msgIn.uuidDsaSrc = NULLGUID) then
   return ERROR_DS_DRA_INVALID_PARAMETER
 endif
  
 if AccessCheckCAR(nc, DS-Replication-Synchronize) then
   return ERROR_DS_DRA_ACCESS_DENIED
 endif
  
 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
  
 rf := select all v in nc!repsFrom
       where DRS_SYNC_ALL in options
             or (DRS_SYNC_BYNAME in options
                 and v.naDsa = msgIn.pszDsaSrc)
             or (not DRS_SYNC_BYNAME in options
                 and v.uuidDsa = msgIn.uuidDsaSrc)
 if rf = null then
   return ERROR_DS_DRA_NO_REPLICA
 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
  
   /* Replicate nc from the DC specified by r.uuidDsa. */
   
   ReplicateNCRequestMsg(
     hDrs,
     versionRequestMsg,
     nc,
     r,
     options,
     cMaxObjects,
     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.
  
       If there are any failures from this replication attempt, assign an
       appropriate error value to err, and then break out of the for loop.
  
   endif
 endfor
  
 return err

For information about Windows support for the DRS_SYNC_ALL flag, see the product behavior note in section 5.41.