Example #1
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);
        }
Example #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;
        }