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

Function dump_editor

src/edit.c:225–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225static int dump_editor(const unsigned char *nom_dump,const unsigned int lng, const int menu_pos)
226{
227 unsigned int pos;
228 int done=0;
229 unsigned int menu;
230 const struct MenuItem menuDump[]=
231 {
232 { 'P', "Previous",""},
233 { 'N', "Next","" },
234 { 'Q',"Quit","Quit dump section"},
235 { 0, NULL, NULL }
236 };
237 /* write dump to log file*/
238 dump_log(nom_dump, lng);
239 /* ncurses interface */
240 pos=(menu_pos==KEY_DOWN?0:lng/0x10-EDIT_MAX_LINES);
241 menu=(menu_pos==KEY_DOWN?1:0);
242 mvwaddstr(stdscr, EDIT_Y, EDIT_X, msg_DUMP_HEXA);
243 do
244 {
245 unsigned int i,j;
246 unsigned char car;
247 for (i=pos; (i<lng/0x10)&&((i-pos)<EDIT_MAX_LINES); i++)
248 {
249 wmove(stdscr,EDIT_Y+i-pos,EDIT_X);
250 wclrtoeol(stdscr);
251 wprintw(stdscr,"%04X ",i*0x10);
252 for(j=0; j< 0x10;j++)
253 {
254 car=*(nom_dump+i*0x10+j);
255 wprintw(stdscr,"%02x", car);
256 if(j%4==(4-1))
257 wprintw(stdscr," ");
258 }
259 wprintw(stdscr," ");
260 for(j=0; j< 0x10;j++)
261 {
262 car=*(nom_dump+i*0x10+j);
263 if ((car<32)||(car >= 127))
264 wprintw(stdscr,".");
265 else
266 wprintw(stdscr,"%c", car);
267 }
268 }
269 switch (wmenuSelect(stdscr, INTER_EDIT_Y+1, INTER_EDIT_Y, INTER_EDIT_X, menuDump, 8, "PNQ", MENU_HORIZ | MENU_BUTTON | MENU_ACCEPT_OTHERS, menu))
270 {
271 case 'p':
272 case 'P':
273 case KEY_UP:
274 menu=0;
275 if(pos>0)
276 pos--;
277 else
278 done=KEY_UP;
279 break;
280 case 'n':
281 case 'N':
282 case KEY_DOWN:

Callers 1

interface_editor_ncursesFunction · 0.85

Calls 2

dump_logFunction · 0.85
wmenuSelectFunction · 0.85

Tested by

no test coverage detected