CmpFreeSecurityDescriptor

void __fastcall CmpFreeSecurityDescriptor(_HHIVE *Hive, INT64 Cell){
  _CELL_DATA *v3; 
  _CELL_DATA *v4; 
  _CELL_DATA *v5; 
  ULONG_PTR Security; 
  _CELL_DATA *v7; 
  unsigned int Type; 
  int v9; 
  int v10; 
  int v11; 
  int v12; 

  v11 = -1;
  v9 = -1;
  v12 = 0;
  v10 = 0;
  v3 = 0i64;
  v4 = Hive->GetCellRoutine(Hive, Cell, &v11);
  v5 = v4;
  if( v4 )
  {
    Security = v4->u.KeyNode.Security;
    if( Security != -1 )
    {
      v7 = Hive->GetCellRoutine(Hive, Security, &v9);
      v3 = v7;
      if( v7 )
      {
        Type = v7->u.KeyValue.Type;
        if( Type == 1 )
        {
          Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v9);
          v3 = 0i64;
          CmpRemoveSecurityCellList(Hive, Security);
          HvFreeCell((ULONG_PTR)Hive, Security);
        }
        else
        {
          v3->u.KeyValue.Type = Type - 1;
        }
        v5->u.KeyNode.Security = -1;
      }
    }
    Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v11);
    if( v3 )
      Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v9);
  }
}

Referenced by:

CmpCopySaclToVirtualKey
CmpCreateChild
CmpFreeKeyByCell
CmpSyncKeyValues