CmpCreateExtendedControlSets

INT64 __fastcall CmpCreateExtendedControlSets(INT64 a1){
  __int64 v2; 
  __int64 *v3; 
  __int64 *v4; 
  INT64 result; 
  __int64 v6; 
  __int64 *v7; 
  if( !CmStateSeparationEnabled
    || (LODWORD(result) = CmpCreateControlSet((_LOADER_PARAMETER_BLOCK *)L"DEVICES"), (int)(result + 0x80000000) < 0)
    || (_DWORD)result == -1073741772 )
  {
    v2 = *(_QWORD *)(a1 + 240);
    v3 = (__int64 *)(v2 + 312);
    v4 = *(__int64 **)(v2 + 312);
    while( v4 != v3 )
    {
      if( (*((_DWORD *)v4 + 6) & 0x80u) != 0 )
      {
        LODWORD(result) = CmpCreateControlSet((_LOADER_PARAMETER_BLOCK *)v4[6]);
        if( (int)result < 0 )
          return result;
      }
      v2 = *(_QWORD *)(a1 + 240);
      v4 = (__int64 *)*v4;
      v3 = (__int64 *)(v2 + 312);
    }
    if( CmStateSeparationEnabled )
    {
      v6 = v2 + 312;
      v7 = *(__int64 **)(v2 + 312);
      while( v7 != (__int64 *)v6 )
      {
        if( (v7[3] & 0x40) != 0 )
        {
          result = CmpCreateControlSetOverride();
          if( (int)result < 0 )
            return result;
        }
        v7 = (__int64 *)*v7;
        v6 = *(_QWORD *)(a1 + 240) + 312i64;
      }
    }
    return 0i64;
  }
  return result;
}

Referenced by:

CmInitSystem1