summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-09-03 18:25:08 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2016-09-03 18:25:08 +0200
commit67e7ee73953da02b0ebe180544b51a2cba8b38b3 (patch)
tree7af9f57a6310027f41413d6eb6561911e9cae66d
parent7bc1d5a6c2fe2e032a9dddb625af7963d9c79e6e (diff)
PhotoRec: recover Silhouette Cameo cutting machine .studio files
-rw-r--r--src/Makefile.am1
-rw-r--r--src/file_list.c2
-rw-r--r--src/file_studio.c67
3 files changed, 70 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2ed14fa..4aa1a19 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -290,6 +290,7 @@ file_C = filegen.c \
file_steuer2014.c \
file_stl.c \
file_stu.c \
+ file_studio.c \
file_swf.c \
file_tar.c \
file_tax.c \
diff --git a/src/file_list.c b/src/file_list.c
index 9dab9ab..88c52af 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -293,6 +293,7 @@ extern const file_hint_t file_hint_sqlite;
extern const file_hint_t file_hint_sqm;
extern const file_hint_t file_hint_steuer2014;
extern const file_hint_t file_hint_stl;
+extern const file_hint_t file_hint_studio;
extern const file_hint_t file_hint_stuffit;
extern const file_hint_t file_hint_swf;
extern const file_hint_t file_hint_tar;
@@ -614,6 +615,7 @@ file_enable_t list_file_enable[]=
{ .enable=0, .file_hint=&file_hint_sqm },
{ .enable=0, .file_hint=&file_hint_steuer2014 },
{ .enable=0, .file_hint=&file_hint_stl },
+ { .enable=0, .file_hint=&file_hint_studio },
{ .enable=0, .file_hint=&file_hint_stuffit },
{ .enable=0, .file_hint=&file_hint_swf },
{ .enable=0, .file_hint=&file_hint_tar },
diff --git a/src/file_studio.c b/src/file_studio.c
new file mode 100644
index 0000000..d6b84da
--- /dev/null
+++ b/src/file_studio.c
@@ -0,0 +1,67 @@
+/*
+
+ File: file_studio.c
+
+ Copyright (C) 2016 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"
+#include "common.h"
+
+static void register_header_check_studio(file_stat_t *file_stat);
+
+const file_hint_t file_hint_studio= {
+ .extension="studio",
+ .description="Silhouette Cameo cutting machine",
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_studio
+};
+
+struct silhouette_header
+{
+ char magic[12];
+ char unk[2];
+ uint32_t size;
+} __attribute__ ((gcc_struct, __packed__));
+
+static int header_check_studio(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 struct silhouette_header *hdr=(const struct silhouette_header *)buffer;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_studio.extension;
+ file_recovery_new->calculated_file_size=(uint64_t)le32(hdr->size)+77;
+ file_recovery_new->data_check=&data_check_size;
+ file_recovery_new->file_check=&file_check_size;
+ file_recovery_new->min_filesize=65;
+ return 1;
+}
+
+static void register_header_check_studio(file_stat_t *file_stat)
+{
+ register_header_check(0, "silhouette04;", 13, &header_check_studio, file_stat);
+}