summaryrefslogtreecommitdiff
authorChristophe Grenier <grenier@cgsecurity.org>2010-07-23 06:51:51 (GMT)
committer Christophe Grenier <grenier@cgsecurity.org>2010-07-23 06:51:51 (GMT)
commitd5431cc6985c6c862bf89768d96f277453f104f5 (patch)
treeb1b358a576c8d92ef74c69a1b374b8dbd57f10a0
parent34097cdf96e4885af4ca4426017a2e9ea9fd0d92 (diff)
PhotoRec: recover Apple QuickTake 100 files
Diffstat
-rw-r--r--src/Makefile.am1
-rw-r--r--src/file_list.c2
-rw-r--r--src/file_qkt.c64
3 files changed, 67 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d3d9f34..259ab56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -175,6 +175,7 @@ file_C = filegen.c \
file_pzh.c \
file_qbb.c \
file_qdf.c \
+ file_qkt.c \
file_qxd.c \
file_r3d.c \
file_ra.c \
diff --git a/src/file_list.c b/src/file_list.c
index b292bed..cf2c3fa 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -177,6 +177,7 @@ extern const file_hint_t file_hint_pzf;
extern const file_hint_t file_hint_pzh;
extern const file_hint_t file_hint_qbb;
extern const file_hint_t file_hint_qdf;
+extern const file_hint_t file_hint_qkt;
extern const file_hint_t file_hint_qxd;
extern const file_hint_t file_hint_r3d;
extern const file_hint_t file_hint_ra;
@@ -382,6 +383,7 @@ file_enable_t list_file_enable[]=
{ .enable=0, .file_hint=&file_hint_pzh },
{ .enable=0, .file_hint=&file_hint_qbb },
{ .enable=0, .file_hint=&file_hint_qdf },
+ { .enable=0, .file_hint=&file_hint_qkt },
{ .enable=0, .file_hint=&file_hint_qxd },
{ .enable=0, .file_hint=&file_hint_r3d },
{ .enable=0, .file_hint=&file_hint_ra },
diff --git a/src/file_qkt.c b/src/file_qkt.c
new file mode 100644
index 0000000..701dab7
--- a/dev/null
+++ b/src/file_qkt.c
@@ -0,0 +1,64 @@
+/*
+
+ File: file_qkt.c
+
+ Copyright (C) 2010 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_qkt(file_stat_t *file_stat);
+static int header_check_qkt(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_qkt= {
+ .extension="qkt",
+ .description="Apple QuickTake 100",
+ .min_header_distance=0,
+ .max_filesize=1024*1024*1024,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_qkt
+};
+
+static const unsigned char qkt_header[8]= {
+ 'q' , 'k' , 't' , 'k' , 0x00, 0x00, 0x00, 0x08
+};
+
+static void register_header_check_qkt(file_stat_t *file_stat)
+{
+ register_header_check(0, qkt_header, sizeof(qkt_header), &header_check_qkt, file_stat);
+}
+
+static int header_check_qkt(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, qkt_header, sizeof(qkt_header))==0)
+ {
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_qkt.extension;
+ return 1;
+ }
+ return 0;
+}