summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-01-27 08:38:17 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-01-27 08:38:17 +0100
commit9998392d2127737982e10c01a515649328329196 (patch)
tree824f9aa0fa0926739cfbb70400bd690f9d7fd388
parent130c0373d3f4cbc7a21bf9381aef4543814bbcf2 (diff)
TestDisk: display the partition table type if autodetected
-rw-r--r--src/common.h1
-rw-r--r--src/intrfn.c11
-rw-r--r--src/partauto.c16
3 files changed, 24 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h
index b102730..2121c17 100644
--- a/src/common.h
+++ b/src/common.h
@@ -367,6 +367,7 @@ struct param_disk_struct
int (*sync)(disk_t *disk_car);
int (*clean)(disk_t *disk_car);
const arch_fnct_t *arch;
+ const arch_fnct_t *arch_autodetected;
void *data;
uint64_t disk_real_size;
uint64_t user_max;
diff --git a/src/intrfn.c b/src/intrfn.c
index 8df69a7..365d9de 100644
--- a/src/intrfn.c
+++ b/src/intrfn.c
@@ -1293,6 +1293,17 @@ int interface_partition_type_ncurses(disk_t *disk_car)
wprintw(stdscr,"%s\n",disk_car->description_short(disk_car));
wmove(stdscr,INTER_PARTITION_Y-1,0);
wprintw(stdscr,"Please select the partition table type, press Enter when done.");
+ if(disk_car->arch_autodetected!=NULL)
+ {
+ wmove(stdscr,19,0);
+ wprintw(stdscr, "Hint: ");
+ if(has_colors())
+ wbkgdset(stdscr,' ' | COLOR_PAIR(2));
+ wprintw(stdscr, "%s", disk_car->arch_autodetected->part_name);
+ if(has_colors())
+ wbkgdset(stdscr,' ' | COLOR_PAIR(0));
+ wprintw(stdscr, " partition table type has been detected.");
+ }
wmove(stdscr,20,0);
wprintw(stdscr,"Note: Do NOT select 'None' for media with only a single partition. It's very");
wmove(stdscr,21,0);
diff --git a/src/partauto.c b/src/partauto.c
index e081743..8f0686d 100644
--- a/src/partauto.c
+++ b/src/partauto.c
@@ -93,11 +93,19 @@ void autodetect_arch(disk_t *disk)
disk->arch=&arch_mac;
list_part=disk->arch->read_part(disk,verbose,0);
}
- if(list_part==NULL)
- disk->arch=arch;
- part_free_list(list_part);
#ifndef DEBUG_PARTAUTO
log_set_levels(old_levels);
#endif
- log_info("Partition table type (auto): %s\n", disk->arch->part_name);
+ if(list_part!=NULL)
+ {
+ disk->arch_autodetected=disk->arch;
+ log_info("Partition table type (auto): %s\n", disk->arch->part_name);
+ }
+ else
+ {
+ disk->arch_autodetected=NULL;
+ disk->arch=arch;
+ log_info("Partition table type default to %s\n", arch->part_name);
+ }
+ part_free_list(list_part);
}