summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-21 18:34:14 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-21 18:34:14 +0200
commit179ddff52b82753def3b15d38b3f8a18173e46d7 (patch)
treec9de57cba617a4aa89c223ec7a36205fdafe0d28 /src
parente6b99a902be42a0da234cbe90d5a4bac633175b7 (diff)
Dsplay number of sectors as long long unsigned integer
Diffstat (limited to 'src')
-rw-r--r--src/geometry.c2
-rw-r--r--src/godmode.c44
-rw-r--r--src/tdiskop.c2
3 files changed, 35 insertions, 13 deletions
diff --git a/src/geometry.c b/src/geometry.c
index baac0d6..3a605db 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -87,7 +87,7 @@ int change_geometry_cli(disk_t *disk_car, char ** current_cmd)
if(strncmp(*current_cmd,"C,",2)==0)
{
(*current_cmd)+=2;
- tmp_val = atoi(*current_cmd);
+ tmp_val = atol(*current_cmd);
while(*current_cmd[0]!=',' && *current_cmd[0]!='\0')
(*current_cmd)++;
if (tmp_val > 0)
diff --git a/src/godmode.c b/src/godmode.c
index af2b6f2..de30f19 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -514,6 +514,7 @@ static void search_NTFS_from_backup(disk_t *disk_car, list_part_t *list_part, co
}
typedef enum { INDSTOP_CONTINUE=0, INDSTOP_STOP=1, INDSTOP_SKIP=2, INDSTOP_QUIT=3 } indstop_t;
+
static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_org, const int verbose, const int dump_ind, const int fast_mode, char **current_cmd)
{
unsigned char *buffer_disk;
@@ -570,15 +571,36 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
CHS_t start;
offset2CHS_inline(disk_car,search_location,&start);
#ifdef HAVE_NCURSES
- if(old_cylinder!=start.cylinder &&
- (disk_car->geom.heads_per_cylinder>1 || (start.cylinder & 0x7FFF)==0))
+ if(disk_car->geom.heads_per_cylinder>1)
+ {
+ if(old_cylinder!=start.cylinder)
+ {
+ old_cylinder=start.cylinder;
+ wmove(stdscr,ANALYSE_Y,ANALYSE_X);
+ wclrtoeol(stdscr);
+ wprintw(stdscr,"Analyse cylinder %5u/%u: %02u%%",
+ start.cylinder, disk_car->geom.cylinders-1,
+ (unsigned int)(search_location*100/disk_car->disk_size));
+ wrefresh(stdscr);
+ switch(check_enter_key_or_s(stdscr))
+ {
+ case 1:
+ ind_stop=INDSTOP_STOP;
+ break;
+ case 2:
+ ind_stop=INDSTOP_SKIP;
+ break;
+ }
+ }
+ }
+ else if((start.cylinder & 0x7FFF)==0)
{
- old_cylinder=start.cylinder;
wmove(stdscr,ANALYSE_Y,ANALYSE_X);
wclrtoeol(stdscr);
- wprintw(stdscr,"Analyse cylinder %5u/%u: %02u%%",
- start.cylinder, disk_car->geom.cylinders-1,
- (unsigned int)((uint64_t)start.cylinder*100/disk_car->geom.cylinders));
+ wprintw(stdscr,"Analyse sector %11llu/%lu: %02u%%",
+ search_location / disk_car->sector_size,
+ (disk_car->disk_size-1)/disk_car->sector_size,
+ (unsigned int)(search_location*100/disk_car->disk_size));
wrefresh(stdscr);
switch(check_enter_key_or_s(stdscr))
{
@@ -872,11 +894,11 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
free(new_partition);
}
if(verbose>0)
- log_warning("This partition ends after the disk limits. (start=%lu, size=%lu, end=%lu, disk end=%lu)\n",
- (unsigned long)(partition->part_offset/disk_car->sector_size),
- (unsigned long)(partition->part_size/disk_car->sector_size),
- (unsigned long)(pos_fin/disk_car->sector_size),
- (unsigned long)(disk_car->disk_size/disk_car->sector_size));
+ log_warning("This partition ends after the disk limits. (start=%llu, size=%llu, end=%llu, disk end=%llu)\n",
+ (unsigned long long)(partition->part_offset/disk_car->sector_size),
+ (unsigned long long)(partition->part_size/disk_car->sector_size),
+ (unsigned long long)(pos_fin/disk_car->sector_size),
+ (unsigned long long)(disk_car->disk_size/disk_car->sector_size));
else
log_warning("This partition ends after the disk limits.\n");
}
diff --git a/src/tdiskop.c b/src/tdiskop.c
index 6f55479..b28e5fb 100644
--- a/src/tdiskop.c
+++ b/src/tdiskop.c
@@ -137,7 +137,7 @@ static int menu_disk_ncurses(disk_t *disk, const int verbose,int dump_ind, const
wprintw(stdscr, "%s\n", disk->description_short(disk));
wmove(stdscr,6,0);
if(disk->geom.heads_per_cylinder == 1 && disk->geom.sectors_per_head == 1)
- wprintw(stdscr, " %lu sectors", disk->geom.cylinders);
+ wprintw(stdscr, " %llu sectors", (long long unsigned)(disk->disk_size / disk->sector_size));
else
wprintw(stdscr, " CHS %lu %u %u",
disk->geom.cylinders, disk->geom.heads_per_cylinder, disk->geom.sectors_per_head);