CmpSortDriverList

INT64 __fastcall CmpSortDriverList(_HHIVE *Hive, INT64 ControlSet, _LIST_ENTRY *DriverListHead){
  _CELL_DATA *(__fastcall *GetCellRoutine)(_HHIVE *, unsigned int, _HV_GET_CELL_CONTEXT *); 
  INT64 result; 
  unsigned int SubKeyByName; 
  unsigned int v8; 
  unsigned int ValueByName; 
  _CELL_DATA *v10; 
  UINT8 v11; 
  int v12[2]; 
  _HV_GET_CELL_CONTEXT CellContext; 
  _UNICODE_STRING OrderList; 
  UINT realsize; 
  int v16; 
  int v17; 

  realsize = 0;
  *(_DWORD *)&CellContext.BinContext._bf_0 = 0;
  v12[1] = 0;
  v17 = 0;
  GetCellRoutine = Hive->GetCellRoutine;
  OrderList = 0i64;
  CellContext.Cell = -1;
  v12[0] = -1;
  v16 = -1;
  result = (__int64)GetCellRoutine(Hive, ControlSet, (_HV_GET_CELL_CONTEXT *)&v16);
  if( result )
  {
    SubKeyByName = CmpFindSubKeyByName((__int64)Hive, result, (_UNICODE_STRING *)&CmpControlString);
    result = ((__int64(__fastcall *)(_HHIVE *, int *))Hive->ReleaseCellRoutine)(Hive, &v16);
    if( SubKeyByName != -1 )
    {
      result = (INT64)Hive->GetCellRoutine(Hive, SubKeyByName, &v16);
      if( result )
      {
        v8 = CmpFindSubKeyByName((__int64)Hive, result, (_UNICODE_STRING *)L"\"$");
        result = ((__int64(__fastcall *)(_HHIVE *, int *))Hive->ReleaseCellRoutine)(Hive, &v16);
        if( v8 != -1 )
        {
          result = (INT64)Hive->GetCellRoutine(Hive, v8, &v16);
          if( result )
          {
            ValueByName = CmpFindValueByName((__int64)Hive, result, (__int64)L"\b\n");
            result = ((__int64(__fastcall *)(_HHIVE *, int *))Hive->ReleaseCellRoutine)(Hive, &v16);
            if( ValueByName != -1 )
            {
              result = (INT64)Hive->GetCellRoutine(Hive, ValueByName, v12);
              if( result )
              {
                if( *(_DWORD *)(result + 12) == 7 )
                {
                  v10 = CmpValueToData(Hive, ValueByName, (_CM_KEY_VALUE *)result, &realsize, &CellContext);
                  OrderList.Buffer = &v10->u.KeyNode.Signature;
                  result = ((__int64(__fastcall *)(_HHIVE *, int *))Hive->ReleaseCellRoutine)(Hive, v12);
                  if( v10 )
                  {
                    OrderList.MaximumLength = realsize - 2;
                    OrderList.Length = realsize - 2;
                    v11 = CmpDoSort(DriverListHead, &OrderList);
                    result = ((__int64(__fastcall *)(_HHIVE *, _HV_GET_CELL_CONTEXT *))Hive->ReleaseCellRoutine)(
                               Hive,
                               &CellContext);
                    LOBYTE(result) = v11;
                    return result;
                  }
                }
                else
                {
                  result = ((__int64(__fastcall *)(_HHIVE *, int *))Hive->ReleaseCellRoutine)(Hive, v12);
                }
              }
            }
          }
        }
      }
    }
  }
  LOBYTE(result) = 0;
  return result;
}

Referenced by:

CmGetSystemDriverList