4.1.14.2 Server Behavior of the IDL_DRSInitDemotion Method

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