diff --git a/src/helpers/partutil.c b/src/helpers/partutil.c index 72a8fe3..ec7ab2f 100644 --- a/src/helpers/partutil.c +++ b/src/helpers/partutil.c @@ -489,6 +489,33 @@ part_table_parse_msdos_extended (int fd, DEBUG ("MSDOS_MAGIC found"); + n = 0; + int type = embr[MSDOS_PARTTABLE_OFFSET + n * 16 + 4]; + if (5 == type) { + PartitionEntry *pe; + PartitionTable* e_part_table; + guint64 pstart; + guint64 psize; + DEBUG("Wow extended partition points to another extended! Recursing into it"); + pstart = block_size * ((guint64) get_le32 (&(embr[MSDOS_PARTTABLE_OFFSET + n * 16 + 8]))); + psize = block_size * ((guint64) get_le32 (&(embr[MSDOS_PARTTABLE_OFFSET + n * 16 + 12]))); + e_part_table = part_table_parse_msdos_extended (fd, pstart, psize, block_size); + if (e_part_table != NULL) + { + pe = part_entry_new (e_part_table, &(embr[MSDOS_PARTTABLE_OFFSET + n * 16]), 16, offset + + MSDOS_PARTTABLE_OFFSET + n * 16); + if (pe != NULL) + { + if (p == NULL) + { + p = part_table_new_empty (PART_TYPE_MSDOS_EXTENDED, block_size); + p->offset = offset; + p->size = size; + } + p->entries = g_slist_append (p->entries, pe); + } + } + } else { if (p == NULL) { p = part_table_new_empty (PART_TYPE_MSDOS_EXTENDED, block_size); @@ -538,6 +565,7 @@ part_table_parse_msdos_extended (int fd, p->entries = g_slist_append (p->entries, pe); } } + } }