diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..0b6eca93 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +Use "git log" or consult http://git.cgsecurity.org/cgit/testdisk/ diff --git a/photorec_64x64.png b/photorec_64x64.png new file mode 100644 index 00000000..9e38dbdf Binary files /dev/null and b/photorec_64x64.png differ diff --git a/src/diskcp.c b/src/diskcp.c deleted file mode 100644 index 76696ee5..00000000 --- a/src/diskcp.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - - File: diskcp.c - - Copyright (C) 2007 Christophe GRENIER - - This software is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write the Free Software Foundation, Inc., 51 - Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include -#include -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#ifdef HAVE_SYS_MOUNT_H -#include /* BLKFLSBUF */ -#endif -#ifdef HAVE_SYS_DISK_H -#include -#endif -#include "types.h" -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -enum { STATUS_NON_TRIED = '?', STATUS_NON_SPLIT = '/', STATUS_BAD_BLOCK = '-', STATUS_DONE = '+' }; - -const char *size_to_unit(uint64_t disk_size, char *buffer) -{ - if(disk_size<(uint64_t)10*1024) - sprintf(buffer,"%u B", (unsigned)disk_size); - else if(disk_size<(uint64_t)10*1024*1024) - sprintf(buffer,"%u KB / %u KiB", (unsigned)(disk_size/1000), (unsigned)(disk_size/1024)); - else if(disk_size<(uint64_t)10*1024*1024*1024) - sprintf(buffer,"%u MB / %u MiB", (unsigned)(disk_size/1000/1000), (unsigned)(disk_size/1024/1024)); - else if(disk_size<(uint64_t)10*1024*1024*1024*1024) - sprintf(buffer,"%u GB / %u GiB", (unsigned)(disk_size/1000/1000/1000), (unsigned)(disk_size/1024/1024/1024)); - else - sprintf(buffer,"%u TB / %u TiB", (unsigned)(disk_size/1000/1000/1000/1000), (unsigned)(disk_size/1024/1024/1024/1024)); - return buffer; -} - -int main(int argc, char **argv) -{ - int i; - int readsize; - int readsize_min; - int readsize_max; - uint64_t readok=0; - uint64_t location; - uint64_t old_status_location=0; - int old_status=STATUS_DONE; - int sector_size=512; - int current_disk=0; - int first_disk; - int nbr_disk=0; - int disk_src[1]; - int disk_dst; - FILE *log; - char *buffer; - uint64_t disk_size=0; - int gap=-1; - if(argc<=2) - { - printf("disk_cp src dst\n"); - return 1; - } - /* O_DIRECT ? */ - if((disk_src[nbr_disk++]=open(argv[1],O_LARGEFILE|O_RDONLY|O_BINARY))<0) - { - printf("Can't open file %s\n",argv[1]); - return 1; - } - if((disk_dst=open(argv[2],O_LARGEFILE|O_RDWR|O_BINARY|O_CREAT,0644))<0) - { - printf("Can't open file %s\n",argv[2]); - return 1; - } - { - void *res; - uint64_t longsectors64=0; - if (ioctl(disk_src[0], BLKGETSIZE64, &longsectors64)>=0) - { - disk_size=longsectors64; - } - readsize_min=sector_size; - /* 1,2,4,8,16,32 */ - readsize_max=16*sector_size; - readsize=readsize_min; - first_disk=current_disk; - if(posix_memalign(&res,4096,readsize_max)!=0) - { - printf("posix_memalign failed\n"); - close(disk_dst); - return 1; - } - buffer=(char*)res; - } - if(1==2) - { - if((log=fopen("diskcp.log","w"))==NULL) - { - printf("Can't create diskcp.log file\n"); - return 1; - } - /* It may be possible to improve the speed by using readv, a ttl (or a timestamp) may be used for bad disks */ - for(location=0;location=start[nbr];location-=readsize_min) - { - - } - } - } - } - fclose(log); - fclose(oldlog); - } - - /* Pass 3: read */ - for(i=0;i + + This software is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write the Free Software Foundation, Inc., 51 + Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + */ +#ifndef _FAT_COMMON_H +#define _FAT_COMMON_H +#ifdef __cplusplus +extern "C" { +#endif +unsigned int fat_get_cluster_from_entry(const struct msdos_dir_entry *entry); +int is_fat_directory(const unsigned char *buffer); +unsigned int get_dir_entries(const struct fat_boot_sector *fat_header); +unsigned int fat_sector_size(const struct fat_boot_sector *fat_header); +unsigned int fat_sectors(const struct fat_boot_sector *fat_header); + +#ifdef __cplusplus +} /* closing brace for extern "C" */ +#endif +#endif