TestDisk: check presence of HFS+ backup superblock

This commit is contained in:
Christophe Grenier 2014-05-18 18:24:15 +02:00
parent 0059708dd7
commit df3842dff6

View file

@ -62,6 +62,12 @@ int check_HFSP(disk_t *disk_car,partition_t *partition,const int verbose)
return 1;
}
set_HFSP_info(partition, (const struct hfsp_vh *)buffer);
if(disk_car->pread(disk_car, buffer, HFSP_BOOT_SECTOR_SIZE,
partition->part_offset + partition->part_size - 0x400) == HFSP_BOOT_SECTOR_SIZE &&
test_HFSP(disk_car,(struct hfsp_vh *)buffer,partition,verbose,0)==0)
{
strcat(partition->info, " + Backup");
}
free(buffer);
return 0;
}
@ -84,6 +90,17 @@ int recover_HFSP(disk_t *disk_car, const struct hfsp_vh *vh,partition_t *partiti
}
partition->part_size=part_size;
set_HFSP_info(partition, vh);
if(backup==0)
{
unsigned char *buffer=(unsigned char*)MALLOC(HFSP_BOOT_SECTOR_SIZE);
if(disk_car->pread(disk_car, buffer, HFSP_BOOT_SECTOR_SIZE,
partition->part_offset + partition->part_size - 0x400) == HFSP_BOOT_SECTOR_SIZE &&
test_HFSP(disk_car,(struct hfsp_vh *)buffer,partition,verbose,0)==0)
{
strcat(partition->info, " + Backup");
}
free(buffer);
}
partition->part_type_i386=P_HFSP;
partition->part_type_mac=PMAC_HFS;
partition->part_type_gpt=GPT_ENT_TYPE_MAC_HFS;