private void FreeSubKeys(KeyNodeCell subkeyCell) { if (subkeyCell.SubKeysIndex == -1) { throw new InvalidOperationException("No subkey list"); } Cell list = _hive.GetCell <Cell>(subkeyCell.SubKeysIndex); SubKeyIndirectListCell indirectList = list as SubKeyIndirectListCell; if (indirectList != null) { ////foreach (int listIndex in indirectList.CellIndexes) for (int i = 0; i < indirectList.CellIndexes.Count; ++i) { int listIndex = indirectList.CellIndexes[i]; _hive.FreeCell(listIndex); } } _hive.FreeCell(list.Index); }
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); }