diff --git a/AUTHORS b/AUTHORS index c1e6cdca..fa1fc0ee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ TestDisk and PhotoRec are written and maintained by Christophe GRENIER -TestDisk logos has been created by Simone Brandt and by Dmitri Zdorov, -PhotoRec logo by Marcel Bruins. +TestDisk logos has been created by Simone Brandt and by Dmitri Zdorov in 2001, +PhotoRec logo by Marcel Bruins in 2006. diff --git a/src/Makefile.am b/src/Makefile.am index 04c00649..e5379775 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,7 +20,7 @@ testdisk_SOURCES = testdisk.c $(base_C) $(base_H) $(fs_C) $(fs_H) testdisk.h adv #ntfs_udl.c ntfs_udl.h -photorec_SOURCES = photorec.c photorec.h phrecn.c phrecn.h dir.c dir.h ext2p.c ext2p.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h fatp.c fatp.h filegen.c filegen.h file_7z.c file_a.c file_ab.c file_ace.c file_aif.c file_all.c file_asf.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_cm.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dir.c file_djv.c file_doc.c file_dpx.c file_dsc.c file_dta.c file_dv.c file_dwg.c file_elf.c file_evt.c file_exe.c pe.h file_ext.c file_fh10.c file_fh5.c file_flac.c file_flv.c file_fs.c file_gif.c file_gz.c file_imb.c file_indd.c file_dump.c file_itu.c file_jpg.c file_jpg.h file_max.c file_mdb.c file_mdf.c file_mid.c file_mkv.c file_mov.c file_mp3.c file_mpg.c file_mrw.c file_mus.c file_mysql.c file_njx.c file_ogg.c file_orf.c file_pap.c file_pcx.c file_pdf.c file_png.c file_prc.c file_ps.c file_psd.c file_pst.c file_ptb.c file_qbb.c file_qdf.c file_qxd.c file_ra.c file_raf.c file_rar.c file_raw.c file_rdc.c file_reg.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sit.c file_skp.c file_spe.c file_spss.c file_stu.c file_swf.c file_tar.c file_tib.c file_tiff.c file_txt.c file_vmdk.c file_wmf.c file_x3f.c file_xcf.c file_xm.c file_zip.c geometry.c list.c list.h ole.h ntfs_dir.c ntfs_dir.h ntfsp.c ntfsp.h ntfs_inc.h sessionp.c sessionp.h $(base_C) $(base_H) $(fs_C) $(fs_H) $(ICON_PHOTOREC) +photorec_SOURCES = photorec.c photorec.h phrecn.c phrecn.h dir.c dir.h ext2p.c ext2p.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h fatp.c fatp.h filegen.c filegen.h file_7z.c file_a.c file_ab.c file_ace.c file_aif.c file_all.c file_asf.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_cm.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dir.c file_djv.c file_doc.c file_dpx.c file_dsc.c file_dta.c file_dv.c file_dwg.c file_elf.c file_evt.c file_exe.c pe.h file_ext.c file_fh10.c file_fh5.c file_flac.c file_flv.c file_fs.c file_gif.c file_gz.c file_imb.c file_indd.c file_dump.c file_itu.c file_jpg.c file_jpg.h file_max.c file_mdb.c file_mdf.c file_mid.c file_mkv.c file_mov.c file_mp3.c file_mpg.c file_mrw.c file_mus.c file_mysql.c file_njx.c file_ogg.c file_orf.c file_pap.c file_pcx.c file_pdf.c file_png.c file_prc.c file_ps.c file_psd.c file_pst.c file_ptb.c file_qbb.c file_qdf.c file_qxd.c file_ra.c file_raf.c file_rar.c file_raw.c file_rdc.c file_reg.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sit.c file_skp.c file_spe.c file_spss.c file_stu.c file_swf.c file_tar.c file_tib.c file_tiff.c file_txt.c file_vmdk.c file_wpd.c file_wmf.c file_x3f.c file_xcf.c file_xm.c file_zip.c geometry.c list.c list.h ole.h ntfs_dir.c ntfs_dir.h ntfsp.c ntfsp.h ntfs_inc.h sessionp.c sessionp.h $(base_C) $(base_H) $(fs_C) $(fs_H) $(ICON_PHOTOREC) #diskcp_SOURCES = diskcp.c types.h diff --git a/src/file_wpd.c b/src/file_wpd.c new file mode 100644 index 00000000..0426c8ea --- /dev/null +++ b/src/file_wpd.c @@ -0,0 +1,66 @@ +/* + + File: file_wpd.c + + Copyright (C) 1998-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_STRING_H +#include +#endif +#include +#include "types.h" +#include "filegen.h" + +static void register_header_check_wpd(file_stat_t *file_stat); +static int header_check_wpd(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new); + +const file_hint_t file_hint_wpd= { + .extension="wpd", + .description="Corel Documents", + .min_header_distance=0, + .max_filesize=PHOTOREC_MAX_FILE_SIZE, + .recover=1, + .header_check=&header_check_wpd, + .register_header_check=®ister_header_check_wpd +}; + +static const unsigned char wpd_header[4]= {0xff, 'W','P','C'}; + +static void register_header_check_wpd(file_stat_t *file_stat) +{ + register_header_check(0, wpd_header,sizeof(wpd_header), &header_check_wpd, file_stat); +} + +static int header_check_wpd(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new) +{ + if(memcmp(buffer, wpd_header, sizeof(wpd_header))==0) + { + reset_file_recovery(file_recovery_new); + file_recovery_new->extension=file_hint_wpd.extension; + file_recovery_new->min_filesize=24; + file_recovery_new->calculated_file_size=(uint64_t)buffer[20]+(((uint64_t)buffer[21])<<8)+(((uint64_t)buffer[22])<<16)+(((uint64_t)buffer[23])<<24); + file_recovery_new->data_check=&data_check_size; + file_recovery_new->file_check=&file_check_size; + return 1; + } + return 0; +} diff --git a/src/photorec.c b/src/photorec.c index 3dd25354..a42de22b 100644 --- a/src/photorec.c +++ b/src/photorec.c @@ -182,6 +182,7 @@ extern const file_hint_t file_hint_tiff; extern const file_hint_t file_hint_fasttxt; extern const file_hint_t file_hint_txt; extern const file_hint_t file_hint_vmdk; +extern const file_hint_t file_hint_wpd; extern const file_hint_t file_hint_wmf; extern const file_hint_t file_hint_x3f; extern const file_hint_t file_hint_xcf; @@ -895,6 +896,7 @@ int main( int argc, char **argv ) { .enable=1, .file_hint=&file_hint_fasttxt }, { .enable=1, .file_hint=&file_hint_txt }, { .enable=1, .file_hint=&file_hint_vmdk }, + { .enable=1, .file_hint=&file_hint_wpd }, { .enable=1, .file_hint=&file_hint_wmf }, { .enable=1, .file_hint=&file_hint_x3f }, { .enable=1, .file_hint=&file_hint_xcf },