summaryrefslogtreecommitdiffstats
path: root/src/file_orf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:14:11 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:14:11 +0100
commit882c63bcc27793d798fe0f9994c6f948338b7b98 (patch)
treef5662756a6701e80183150d511186f35f11a41b4 /src/file_orf.c
parentf1cbfbbe9e14e145dd192cfd33062a4af907e805 (diff)
PhotoRec: better .orf signature
Diffstat (limited to 'src/file_orf.c')
-rw-r--r--src/file_orf.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/file_orf.c b/src/file_orf.c
index 0806f07..0591622 100644
--- a/src/file_orf.c
+++ b/src/file_orf.c
@@ -32,7 +32,6 @@
#include "file_tiff.h"
static void register_header_check_orf(file_stat_t *file_stat);
-static int header_check_orf(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_orf= {
.extension="orf",
@@ -44,30 +43,26 @@ const file_hint_t file_hint_orf= {
.register_header_check=&register_header_check_orf
};
-static const unsigned char orf_header_IIRS[4]= { 0x49, 0x49, 0x52, 0x53};
-static const unsigned char orf_header_IIRO[4]= { 'I', 'I', 'R', 'O'};
+static int header_check_orf_IIRS(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_orf.extension;
+ return 1;
+}
-static void register_header_check_orf(file_stat_t *file_stat)
+static int header_check_orf_IIRO(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)
{
- register_header_check(0, orf_header_IIRS, sizeof(orf_header_IIRS), &header_check_orf, file_stat);
- register_header_check(0, orf_header_IIRO, sizeof(orf_header_IIRO), &header_check_orf, file_stat);
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_orf.extension;
+ file_recovery_new->time=get_date_from_tiff_header((const TIFFHeader *)buffer, buffer_size);
+ file_recovery_new->file_check=&file_check_tiff;
+ return 1;
}
-static int header_check_orf(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)
+static void register_header_check_orf(file_stat_t *file_stat)
{
- if(memcmp(buffer, orf_header_IIRS, sizeof(orf_header_IIRS))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_orf.extension;
- return 1;
- }
- if(memcmp(buffer, orf_header_IIRO, sizeof(orf_header_IIRO))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_orf.extension;
- file_recovery_new->time=get_date_from_tiff_header((const TIFFHeader *)buffer, buffer_size);
- file_recovery_new->file_check=&file_check_tiff;
- return 1;
- }
- return 0;
+ static const unsigned char orf_header_IIRS[4]= { 0x49, 0x49, 0x52, 0x53};
+ static const unsigned char orf_header_IIRO[8]= { 'I', 'I', 'R', 'O', 0x08, 0x00, 0x00, 0x00};
+ register_header_check(0, orf_header_IIRS, sizeof(orf_header_IIRS), &header_check_orf_IIRS, file_stat);
+ register_header_check(0, orf_header_IIRO, sizeof(orf_header_IIRO), &header_check_orf_IIRO, file_stat);
}