예제 #1
0
 private void LinkSubKey(string name, int cellIndex)
 {
     if (_cell.SubKeysIndex == -1)
     {
         SubKeyHashedListCell newListCell = new SubKeyHashedListCell(_hive, "lf");
         newListCell.Add(name, cellIndex);
         _hive.UpdateCell(newListCell, true);
         _cell.NumSubKeys   = 1;
         _cell.SubKeysIndex = newListCell.Index;
     }
     else
     {
         ListCell list = _hive.GetCell <ListCell>(_cell.SubKeysIndex);
         _cell.SubKeysIndex = list.LinkSubKey(name, cellIndex);
         _cell.NumSubKeys++;
     }
     _hive.UpdateCell(_cell, false);
 }
예제 #2
0
        internal static Cell Parse(RegistryHive hive, int index, byte[] buffer, int pos)
        {
            string type = Utilities.BytesToString(buffer, pos, 2);

            Cell result = null;

            switch (type)
            {
            case "nk":
                result = new KeyNodeCell(index);
                break;

            case "sk":
                result = new SecurityCell(index);
                break;

            case "vk":
                result = new ValueCell(index);
                break;

            case "lh":
            case "lf":
                result = new SubKeyHashedListCell(hive, index);
                break;

            case "li":
            case "ri":
                result = new SubKeyIndirectListCell(hive, index);
                break;

            default:
                throw new RegistryCorruptException("Unknown cell type '" + type + "'");
            }

            result.ReadFrom(buffer, pos);
            return(result);
        }