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

Function hd_parse

src/hdaccess.c:267–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265
266
267list_disk_t *hd_parse(list_disk_t *list_disk, const int verbose, const int testdisk_mode)
268{
269 unsigned int i;
270#ifdef DJGPP
271 int ind_stop=0;
272 for(i=0x80;(i<0x88)&&!ind_stop;i++)
273 {
274 disk_t *disk_car=hd_identify(verbose, i, testdisk_mode);
275 if(disk_car)
276 list_disk=insert_new_disk(list_disk,disk_car);
277 else
278 ind_stop=1;
279 }
280#elif defined(__CYGWIN__) || defined(__MINGW32__)
281 {
282 char device_hd[]="\\\\.\\PhysicalDrive00";
283 char device_cdrom[]="\\\\.\\C:";
284 /* Disk */
285 for(i=0;i<64;i++)
286 {
287 disk_t *disk_car;
288 sprintf(device_hd,"\\\\.\\PhysicalDrive%u", i);
289 disk_car=file_test_availability_win32(device_hd, verbose, testdisk_mode);
290 list_disk=insert_new_disk(list_disk,disk_car);
291 }
292 /* cdrom and digital camera */
293 for(i='C';i<='Z';i++)
294 {
295 disk_t *disk_car;
296 device_cdrom[strlen(device_cdrom)-2]=i;
297 disk_car=file_test_availability_win32(device_cdrom, verbose, testdisk_mode);
298 if((testdisk_mode&TESTDISK_O_ALL)==TESTDISK_O_ALL)
299 list_disk=insert_new_disk(list_disk,disk_car);
300 else
301 list_disk=insert_new_disk_nodup(list_disk,disk_car,device_cdrom, verbose);
302 }
303 }
304#elif defined(__APPLE__)
305 {
306 char device[100];
307 /* Disk */
308 for(i=0;i<20;i++)
309 {
310 snprintf(device, sizeof(device), "/dev/disk%u", i);
311 list_disk=insert_new_disk(list_disk, file_test_availability(device, verbose, testdisk_mode));
312 }
313 for(i=0;i<20;i++)
314 {
315 snprintf(device, sizeof(device), "/dev/rdisk%u", i);
316 list_disk=insert_new_disk(list_disk, file_test_availability(device, verbose, testdisk_mode));
317 }
318 }
319#elif defined(DISABLED_FOR_FRAMAC)
320#elif defined(TARGET_LINUX)
321 {
322 int j;
323 char device[100];
324 char device_ide[]="/dev/hda";

Callers 4

mainFunction · 0.85
display_disk_listFunction · 0.85
mainFunction · 0.85
QPhotorecMethod · 0.85

Calls 6

hd_identifyFunction · 0.85
insert_new_diskFunction · 0.85
insert_new_disk_nodupFunction · 0.85
snprintfFunction · 0.85
hd_glob_parseFunction · 0.85

Tested by 2

display_disk_listFunction · 0.68
mainFunction · 0.68