summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-01-05 15:13:25 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-01-05 15:13:25 +0100
commit82dc685578d5b69b49ba9ca3feb13717e124fed5 (patch)
treebe431c559d462a1a2901a440de8165e8b22a12ca /src
parentc97811941d9338f79b53d3af273938b5d17452dd (diff)
PhotoRec: recover Rhino / openNURBS .3dm files
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/file_3dm.c55
-rw-r--r--src/file_list.c2
3 files changed, 58 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index bfaf06d..25ac8c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,7 @@ testdisk_SOURCES = $(base_C) $(base_H) $(fs_C) $(fs_H) $(testdisk_ncurses_C) $(t
file_C = filegen.c \
file_list.c \
file_1cd.c \
+ file_3dm.c \
file_7z.c \
file_DB.c \
file_a.c \
diff --git a/src/file_3dm.c b/src/file_3dm.c
new file mode 100644
index 0000000..5c81e9d
--- /dev/null
+++ b/src/file_3dm.c
@@ -0,0 +1,55 @@
+/*
+
+ File: file_3dm.c
+
+ Copyright (C) 2013 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_3dm(file_stat_t *file_stat);
+
+const file_hint_t file_hint_3dm= {
+ .extension="3dm",
+ .description="Rhino / openNURBS",
+ .min_header_distance=0,
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_3dm
+};
+
+static int header_check_3dm(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)
+{
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_3dm.extension;
+ return 1;
+}
+
+static void register_header_check_3dm(file_stat_t *file_stat)
+{
+ register_header_check(0, "3D Geometry File Format ", 24, &header_check_3dm, file_stat);
+}
diff --git a/src/file_list.c b/src/file_list.c
index 174af83..0d57832 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -28,6 +28,7 @@
#include "filegen.h"
extern const file_hint_t file_hint_1cd;
+extern const file_hint_t file_hint_3dm;
extern const file_hint_t file_hint_7z;
extern const file_hint_t file_hint_DB;
extern const file_hint_t file_hint_a;
@@ -299,6 +300,7 @@ file_enable_t list_file_enable[]=
{
{ .enable=0, .file_hint=&file_hint_sig },
{ .enable=0, .file_hint=&file_hint_1cd },
+ { .enable=0, .file_hint=&file_hint_3dm },
{ .enable=0, .file_hint=&file_hint_7z },
{ .enable=0, .file_hint=&file_hint_DB },
{ .enable=0, .file_hint=&file_hint_a },