From df3842dff6a9cd517ccbf014532b649f43a382e0 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sun, 18 May 2014 18:24:15 +0200 Subject: [PATCH] TestDisk: check presence of HFS+ backup superblock --- src/hfsp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/hfsp.c b/src/hfsp.c index c9bb6e95..1f0856bc 100644 --- a/src/hfsp.c +++ b/src/hfsp.c @@ -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;