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

Function write_MBR_code

src/tmbrcode.c:43–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#define INTER_DISK_X 0
42#define INTER_DISK_Y 7
43int write_MBR_code(disk_t *disk_car)
44{
45 aff_copy(stdscr);
46 wmove(stdscr,5,0);
47 wprintw(stdscr,"%s\n",disk_car->description(disk_car));
48 wmove(stdscr,INTER_DISK_Y,INTER_DISK_X);
49 if(disk_car->arch->write_MBR_code==NULL)
50 {
51 display_message("Function to write a new MBR code not implemented for this partition type.\n");
52 return 1;
53 }
54 wprintw(stdscr,msg_WRITE_MBR_CODE);
55 if(ask_YN(stdscr)!=0 && ask_confirmation("Write a new copy of MBR code, confirm ? (Y/N)")!=0)
56 {
57 if(disk_car->arch->write_MBR_code(disk_car))
58 {
59 display_message("Write error: Can't write new MBR code.\n");
60 return 2;
61 }
62 else
63 display_message("A new copy of MBR code has been written.\nYou have to reboot for the change to take effect.\n");
64 }
65 return 0;
66}
67#else
68int write_MBR_code(disk_t *disk_car)
69{

Callers 2

menu_disk_cliFunction · 0.85
menu_disk_ncursesFunction · 0.85

Calls 4

display_messageFunction · 0.85
ask_YNFunction · 0.85
ask_confirmationFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected