summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-05-18 18:24:15 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-05-18 18:24:15 +0200
commitdf3842dff6a9cd517ccbf014532b649f43a382e0 (patch)
tree4d2639428d28b103387cadcc88f9cd330a4c4c2c
parent0059708dd732bf1949134e40dc0e516d8d31300e (diff)
TestDisk: check presence of HFS+ backup superblock
-rw-r--r--src/hfsp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/hfsp.c b/src/hfsp.c
index c9bb6e9..1f0856b 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;