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

Function interface_check_disk_access_ncurses

src/diskacc.c:43–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42#ifdef HAVE_NCURSES
43static int interface_check_disk_access_ncurses(disk_t *disk_car)
44{
45 static const struct MenuItem menuDiskAccess[]=
46 {
47 { 'C', "Continue", "Continue even if write access isn't available"},
48 { 'Q', "Quit", "Return to disk selection"},
49 { 0,NULL,NULL}
50 };
51 unsigned int menu=0;
52 int car;
53 int line=9;
54 aff_copy(stdscr);
55 wmove(stdscr,4,0);
56 wprintw(stdscr,"%s\n",disk_car->description_short(disk_car));
57 wmove(stdscr,6,0);
58 wprintw(stdscr,"Write access for this media is not available.");
59 wmove(stdscr,7,0);
60 wprintw(stdscr,"TestDisk won't be able to modify it.");
61#ifdef DJGPP
62#elif defined(__CYGWIN__) || defined(__MINGW32__)
63 wmove(stdscr,line++,0);
64 wprintw(stdscr,"- You may need to be administrator to have write access.\n");
65 wmove(stdscr,line++,0);
66 wprintw(stdscr,"Under Vista, select TestDisk, right-click and choose \"Run as administrator\".\n");
67#elif defined HAVE_GETEUID
68 if(geteuid()!=0)
69 {
70 wmove(stdscr,line++,0);
71 wprintw(stdscr,"- You may need to be root to have write access.\n");
72#if defined(__APPLE__)
73 wmove(stdscr,line++,0);
74 wprintw(stdscr,"Use the sudo command to launch TestDisk.\n");
75#endif
76 wmove(stdscr,line++,0);
77 wprintw(stdscr,"- Check the OS permissions for this file or device.\n");
78 }
79#endif
80#if defined(__APPLE__)
81 wmove(stdscr,line++,0);
82 wprintw(stdscr,"- No partition from this disk must be mounted:\n");
83 wmove(stdscr,line++,0);
84 wprintw(stdscr,"Open the Disk Utility (In Finder -> Application -> Utility folder)\n");
85 wmove(stdscr,line++,0);
86 wprintw(stdscr,"and press Unmount button for each volume from this disk\n");
87#endif
88 wmove(stdscr,line,0);
89 wprintw(stdscr,"- This media may be physically write-protected, check the jumpers.\n");
90 car= wmenuSelect_ext(stdscr, 23, INTER_DISK_Y, INTER_DISK_X, menuDiskAccess, 10,
91 "CQ", MENU_VERT | MENU_VERT_WARN | MENU_BUTTON, &menu,NULL);
92 if(car=='c' || car=='C')
93 return 0;
94 return 1;
95}
96#endif
97
98int interface_check_disk_access(disk_t *disk_car, char **current_cmd)

Callers 1

Calls 2

wmenuSelect_extFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected