MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / photorec_progressbar

Function photorec_progressbar

src/phnc.c:80–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80pstatus_t photorec_progressbar(WINDOW *window, const unsigned int pass, const struct ph_param *params, const uint64_t offset, const time_t current_time)
81{
82 const partition_t *partition=params->partition;
83 const unsigned int sector_size=params->disk->sector_size;
84 if(params->status!=STATUS_FIND_OFFSET)
85 {
86 wmove(window,8,0);
87 wclrtoeol(window);
88 wprintw(window,"Destination %s", params->recup_dir);
89 }
90 wmove(window,10,0);
91 wclrtoeol(window);
92 if(params->status==STATUS_EXT2_ON_BF || params->status==STATUS_EXT2_OFF_BF)
93 {
94 wprintw(window,"Bruteforce %10lu sectors remaining (test %u), ",
95 (unsigned long)((offset-partition->part_offset)/sector_size),
96 pass);
97 }
98 else
99 {
100 wprintw(window,"Pass %u - Reading sector %10llu/%llu, ",
101 pass,
102 (unsigned long long)((offset-partition->part_offset)/sector_size),
103 (unsigned long long)(partition->part_size/sector_size));
104 }
105 if(params->status==STATUS_FIND_OFFSET)
106 wprintw(window,"%u/10 headers found\n", params->file_nbr);
107 else
108 wprintw(window,"%u files found\n", params->file_nbr);
109 wmove(window,11,0);
110 wclrtoeol(window);
111 if(current_time > params->real_start_time)
112 {
113 const time_t elapsed_time=current_time - params->real_start_time;
114 wprintw(window,"Elapsed time %uh%02um%02us",
115 (unsigned)(elapsed_time/60/60),
116 (unsigned)(elapsed_time/60%60),
117 (unsigned)(elapsed_time%60));
118 if(offset > partition->part_offset && params->status!=STATUS_EXT2_ON_BF && params->status!=STATUS_EXT2_OFF_BF)
119 {
120 const time_t eta=(partition->part_offset+partition->part_size-1-offset)*elapsed_time/(offset-partition->part_offset);
121 wprintw(window," - Estimated time to completion %uh%02um%02u\n",
122 (unsigned)(eta/3600),
123 (unsigned)((eta/60)%60),
124 (unsigned)(eta%60));
125 }
126 }
127 photorec_info(window, params->file_stats);
128 wrefresh(window);
129 return(check_enter_key_or_s(window)==0?PSTATUS_OK:PSTATUS_STOP);
130}
131#endif

Callers 3

photorec_bf_fragFunction · 0.85
photorec_find_blocksizeFunction · 0.85
photorec_auxFunction · 0.85

Calls 2

photorec_infoFunction · 0.85
check_enter_key_or_sFunction · 0.85

Tested by

no test coverage detected