summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/file_hds.c77
-rw-r--r--src/file_list.c4
-rw-r--r--src/file_mxf.c71
4 files changed, 153 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fab582c..5a9f8d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ testdisk_ncurses_H = addpart.h adv.h askloc.h chgtype.h chgtypen.h dimage.h dirn
testdisk_SOURCES = $(base_C) $(base_H) $(fs_C) $(fs_H) $(testdisk_ncurses_C) $(testdisk_ncurses_H) dir.c dir.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h ntfs_dir.c ntfs_dir.h ntfs_inc.h rfs_dir.c rfs_dir.h $(ICON_TESTDISK) next.c next.h
-file_C = filegen.c file_list.c file_7z.c file_a.c file_ab.c file_abcdp.c file_ace.c file_ahn.c file_aif.c file_all.c file_als.c file_amd.c file_amr.c file_ape.c file_arj.c file_asf.c file_asm.c file_atd.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_chm.c file_cm.c file_compress.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dim.c file_dir.c file_djv.c file_doc.c file_dpx.c file_drw.c file_ds2.c file_dsc.c file_dss.c file_dta.c file_dump.c file_dv.c file_dwg.c file_elf.c file_emf.c file_evt.c file_exe.c file_ext.c file_fcp.c file_fcs.c file_fbk.c file_fdb.c file_fh10.c file_fh5.c file_fits.c file_flac.c file_flv.c file_fob.c file_frm.c file_fs.c file_gho.c file_gif.c file_gpg.c file_gz.c file_ifo.c file_imb.c file_indd.c file_iso.c file_itu.c file_jpg.c file_kdb.c file_lnk.c file_logic.c file_m2ts.c file_max.c file_mb.c file_mcd.c file_mdb.c file_mdf.c file_mfa.c file_mfg.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_one.c file_orf.c file_paf.c file_pap.c file_pcap.c file_pct.c file_pcx.c file_pdf.c file_pfx.c file_png.c file_prc.c file_prt.c file_ps.c file_psd.c file_psp.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_res.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sib.c file_sit.c file_skp.c file_sp3.c file_spe.c file_spf.c file_spss.c file_sql.c file_sqm.c file_stl.c file_stu.c file_swf.c file_tar.c file_tax.c file_tib.c file_tiff.c file_tph.c file_txt.c file_veg.c file_vmdk.c file_wks.c file_wmf.c file_wnk.c file_wpd.c file_wv.c file_x3f.c file_xcf.c file_xm.c file_xsv.c file_zip.c
+file_C = filegen.c file_list.c file_7z.c file_a.c file_ab.c file_abcdp.c file_ace.c file_ahn.c file_aif.c file_all.c file_als.c file_amd.c file_amr.c file_ape.c file_arj.c file_asf.c file_asm.c file_atd.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_chm.c file_cm.c file_compress.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dim.c file_dir.c file_djv.c file_doc.c file_dpx.c file_drw.c file_ds2.c file_dsc.c file_dss.c file_dta.c file_dump.c file_dv.c file_dwg.c file_elf.c file_emf.c file_evt.c file_exe.c file_ext.c file_fcp.c file_fcs.c file_fbk.c file_fdb.c file_fh10.c file_fh5.c file_fits.c file_flac.c file_flv.c file_fob.c file_frm.c file_fs.c file_gho.c file_gif.c file_gpg.c file_gz.c file_hds.c file_ifo.c file_imb.c file_indd.c file_iso.c file_itu.c file_jpg.c file_kdb.c file_lnk.c file_logic.c file_m2ts.c file_max.c file_mb.c file_mcd.c file_mdb.c file_mdf.c file_mfa.c file_mfg.c file_mid.c file_mkv.c file_mov.c file_mp3.c file_mpg.c file_mrw.c file_mus.c file_mxf.c file_mysql.c file_njx.c file_ogg.c file_one.c file_orf.c file_paf.c file_pap.c file_pcap.c file_pct.c file_pcx.c file_pdf.c file_pfx.c file_png.c file_prc.c file_prt.c file_ps.c file_psd.c file_psp.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_res.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sib.c file_sit.c file_skp.c file_sp3.c file_spe.c file_spf.c file_spss.c file_sql.c file_sqm.c file_stl.c file_stu.c file_swf.c file_tar.c file_tax.c file_tib.c file_tiff.c file_tph.c file_txt.c file_veg.c file_vmdk.c file_wks.c file_wmf.c file_wnk.c file_wpd.c file_wv.c file_x3f.c file_xcf.c file_xm.c file_xsv.c file_zip.c
file_H = list.h file_jpg.h file_tar.h file_sp3.h file_tiff.h filegen.h pe.h ole.h
diff --git a/src/file_hds.c b/src/file_hds.c
new file mode 100644
index 0000000..b2d5d35
--- /dev/null
+++ b/src/file_hds.c
@@ -0,0 +1,77 @@
+/*
+
+ File: file_hds.c
+
+ Copyright (C) 2009 Christophe GRENIER <grenier@cgsecurity.org>
+
+ 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 <config.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <stdio.h>
+#include "types.h"
+#include "filegen.h"
+
+
+static void register_header_check_hds(file_stat_t *file_stat);
+static int header_check_hds(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_hds= {
+ .extension="hds",
+ .description="Parallels disk image",
+ .min_header_distance=0,
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_hds
+};
+
+static const unsigned char hds_header[20]= {
+ 'W','i','t','h','o','u','t','F','r','e','e','S','p','a','c','e',
+ 0x02, 0x00, 0x00, 0x00
+};
+
+// always little-endian
+struct parallels_header {
+ char magic[16]; // "WithoutFreeSpace"
+ uint32_t version;
+ uint32_t heads;
+ uint32_t cylinders;
+ uint32_t tracks;
+ uint32_t catalog_entries;
+ uint32_t nb_sectors;
+ char padding[24];
+} __attribute__((packed));
+
+static void register_header_check_hds(file_stat_t *file_stat)
+{
+ register_header_check(0, hds_header,sizeof(hds_header), &header_check_hds, file_stat);
+}
+
+static int header_check_hds(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,hds_header,sizeof(hds_header))==0)
+ {
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_hds.extension;
+ return 1;
+ }
+ return 0;
+}
diff --git a/src/file_list.c b/src/file_list.c
index 09db6ef..d9d4f6e 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -94,6 +94,7 @@ extern const file_hint_t file_hint_gho;
extern const file_hint_t file_hint_gif;
extern const file_hint_t file_hint_gpg;
extern const file_hint_t file_hint_gz;
+extern const file_hint_t file_hint_hds;
extern const file_hint_t file_hint_ifo;
extern const file_hint_t file_hint_imb;
extern const file_hint_t file_hint_indd;
@@ -118,6 +119,7 @@ extern const file_hint_t file_hint_mp3;
extern const file_hint_t file_hint_mpg;
extern const file_hint_t file_hint_mrw;
extern const file_hint_t file_hint_mus;
+extern const file_hint_t file_hint_mxf;
extern const file_hint_t file_hint_mysql;
extern const file_hint_t file_hint_njx;
extern const file_hint_t file_hint_ogg;
@@ -251,6 +253,7 @@ file_enable_t list_file_enable[]=
{ .enable=0, .file_hint=&file_hint_gif },
{ .enable=0, .file_hint=&file_hint_gpg },
{ .enable=0, .file_hint=&file_hint_gz },
+ { .enable=0, .file_hint=&file_hint_hds },
{ .enable=0, .file_hint=&file_hint_ifo },
{ .enable=0, .file_hint=&file_hint_imb },
{ .enable=0, .file_hint=&file_hint_indd },
@@ -276,6 +279,7 @@ file_enable_t list_file_enable[]=
{ .enable=0, .file_hint=&file_hint_mrw },
{ .enable=0, .file_hint=&file_hint_mus },
{ .enable=0, .file_hint=&file_hint_mysql },
+ { .enable=0, .file_hint=&file_hint_mxf },
{ .enable=0, .file_hint=&file_hint_njx },
{ .enable=0, .file_hint=&file_hint_ogg },
{ .enable=0, .file_hint=&file_hint_one },
diff --git a/src/file_mxf.c b/src/file_mxf.c
new file mode 100644
index 0000000..4d1a611
--- /dev/null
+++ b/src/file_mxf.c
@@ -0,0 +1,71 @@
+/*
+
+ File: file_mxf.c
+
+ Copyright (C) 2009 Christophe GRENIER <grenier@cgsecurity.org>
+
+ 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 <config.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <stdio.h>
+#include "types.h"
+#include "filegen.h"
+
+
+static void register_header_check_mxf(file_stat_t *file_stat);
+static int header_check_mxf(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_mxf= {
+ .extension="mxf",
+ .description="Material Exchange Format",
+ .min_header_distance=0,
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_mxf
+};
+
+/* http://tools.ietf.org/html/rfc4539
+ * Media Type Registration for the
+ * Society of Motion Picture and Television Engineers (SMPTE)
+ * Material Exchange Format (MXF)
+ * */
+
+static const unsigned char mxf_header[11]= {
+ 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01,
+ 0x0d, 0x01, 0x02
+};
+
+static void register_header_check_mxf(file_stat_t *file_stat)
+{
+ register_header_check(0, mxf_header,sizeof(mxf_header), &header_check_mxf, file_stat);
+}
+
+static int header_check_mxf(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,mxf_header,sizeof(mxf_header))==0)
+ {
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_mxf.extension;
+ return 1;
+ }
+ return 0;
+}