summaryrefslogtreecommitdiffstats
path: root/src/file_veg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:06:15 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:06:15 +0100
commita73c594e06ee1e4d5b1c25b79846ee24a13b8495 (patch)
tree13f8019d398e851a81865e72259016b94526827c /src/file_veg.c
parent0620a4a4664117844d54c2bd0b0fcef609c338e2 (diff)
PhotoRec: better .riff signature
Diffstat (limited to 'src/file_veg.c')
-rw-r--r--src/file_veg.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/file_veg.c b/src/file_veg.c
index 6d3c87f..0863984 100644
--- a/src/file_veg.c
+++ b/src/file_veg.c
@@ -30,9 +30,7 @@
#include "types.h"
#include "filegen.h"
-
static void register_header_check_veg(file_stat_t *file_stat);
-static int header_check_veg(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_veg= {
.extension="veg",
@@ -41,27 +39,22 @@ const file_hint_t file_hint_veg= {
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1,
.enable_by_default=1,
- .register_header_check=&register_header_check_veg
+ .register_header_check=&register_header_check_veg
};
-static const unsigned char veg_header[4]= {'r','i','f','f'};
-
-static void register_header_check_veg(file_stat_t *file_stat)
+static int header_check_veg(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, veg_header,sizeof(veg_header), &header_check_veg, file_stat);
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->calculated_file_size=(uint64_t)buffer[0x10] + (((uint64_t)buffer[0x11])<<8) +
+ (((uint64_t)buffer[0x12])<<16) + (((uint64_t)buffer[0x13])<<24);
+ file_recovery_new->data_check=&data_check_size;
+ file_recovery_new->file_check=&file_check_size;
+ file_recovery_new->extension=file_hint_veg.extension;
+ return 1;
}
-static int header_check_veg(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_veg(file_stat_t *file_stat)
{
- if(memcmp(buffer,veg_header,sizeof(veg_header))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->calculated_file_size=(uint64_t)buffer[0x10] + (((uint64_t)buffer[0x11])<<8) +
- (((uint64_t)buffer[0x12])<<16) + (((uint64_t)buffer[0x13])<<24);
- file_recovery_new->data_check=&data_check_size;
- file_recovery_new->file_check=&file_check_size;
- file_recovery_new->extension=file_hint_veg.extension;
- return 1;
- }
- return 0;
+ static const unsigned char veg_header[5]= {'r','i','f','f', '.'};
+ register_header_check(0, veg_header,sizeof(veg_header), &header_check_veg, file_stat);
}