summaryrefslogtreecommitdiffstats
path: root/src/fat_adv.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-01-07 11:42:10 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-01-07 11:42:10 +0100
commit106fb14319f27da60ed76667a11bdae3fb4db057 (patch)
tree08a3a43ab3ee21443af45bd9e29988ed8018c27a /src/fat_adv.c
parentd741d15777e4249d824f0ba5db3350ac6fe56cb7 (diff)
Make FAT RebuildBS works when there is a single FAT table
Diffstat (limited to 'src/fat_adv.c')
-rw-r--r--src/fat_adv.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/fat_adv.c b/src/fat_adv.c
index 39b3d4c..1674383 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -1831,7 +1831,11 @@ static upart_type_t select_fat_info(const info_offset_t *info_offset, const unsi
{
wmove(stdscr,INTER_FAT_ASK_Y, INTER_FAT_ASK_X);
fat2_location=ask_number(fat2_location,0,max_sector_offset,"FAT2 location ");
- if(fat2_location>*reserved)
+ if(fat2_location == *reserved)
+ {
+ *fats=1;
+ }
+ else if(fat2_location > *reserved)
{
*fat_length=fat2_location-*reserved;
wmove(stdscr,INTER_FAT_ASK_Y, INTER_FAT_ASK_X);
@@ -2016,7 +2020,7 @@ int rebuild_FAT_BS(disk_t *disk_car, partition_t *partition, const int verbose,
(fat_length==0)||(reserved==0))
{
uint64_t start_data=0;
- if(find_sectors_per_cluster(disk_car, partition, verbose, dump_ind, interface,&sectors_per_cluster,&start_data)==0)
+ if(find_sectors_per_cluster(disk_car, partition, verbose, dump_ind, interface, &sectors_per_cluster, &start_data, upart_type)==0)
{
display_message("Can't find cluster size\n");
return 0;
@@ -2064,9 +2068,12 @@ int rebuild_FAT_BS(disk_t *disk_car, partition_t *partition, const int verbose,
fat_length=(start_data-reserved-((dir_entries-1)/16+1))/fats;
break;
case UP_FAT32:
- reserved=32;
- if((start_data&1)!=0)
- reserved+=1;
+ if(reserved==0)
+ {
+ reserved=32;
+ if((start_data&1)!=0)
+ reserved+=1;
+ }
fat_length=(start_data-reserved)/fats;
break;
default: /* No compiler warning */