summaryrefslogtreecommitdiffstats
path: root/src/file_fp7.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-02-25 08:41:16 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2015-02-25 08:41:16 +0100
commit2c7f6562724019ba8ec8ea42fe0816ff82b2538e (patch)
tree51027548e9b29b76aef6ea45a317e571b0db6fea /src/file_fp7.c
parentca2efe739e144b535aa3079c74062d75bc3fa51e (diff)
PhotoRec: recover FrontPage Pro 12 files as .f12 instead of .fp7
Diffstat (limited to 'src/file_fp7.c')
-rw-r--r--src/file_fp7.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/file_fp7.c b/src/file_fp7.c
index f974cce..f4da463 100644
--- a/src/file_fp7.c
+++ b/src/file_fp7.c
@@ -2,7 +2,7 @@
File: file_fp7.c
- Copyright (C) 2009 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2009,2015 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
@@ -42,24 +42,31 @@ const file_hint_t file_hint_fp7= {
.register_header_check=&register_header_check_fp7
};
-static const unsigned char fp7_header[0x14]= {
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,
- 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0xc0, 'H',
- 'B', 'A', 'M', '7'
-};
-
-static void register_header_check_fp7(file_stat_t *file_stat)
+static void file_check_fp7(file_recovery_t *file_recovery)
{
- register_header_check(0, fp7_header,sizeof(fp7_header), &header_check_fp7, file_stat);
+ file_recovery->file_size=file_recovery->file_size/4096*4096;
}
static int header_check_fp7(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,fp7_header,sizeof(fp7_header))==0)
- {
- reset_file_recovery(file_recovery_new);
+ if(buffer_size < 0x230 || memcmp(&buffer[0x20d], "HBAM", 4)!=0)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->min_filesize=4096;
+ file_recovery_new->file_check=&file_check_fp7;
+ if(memcmp(&buffer[0x21e], "Pro 12", 6)==0)
+ file_recovery_new->extension="fp12";
+ else
file_recovery_new->extension=file_hint_fp7.extension;
- return 1;
- }
- return 0;
+ return 1;
+}
+
+static void register_header_check_fp7(file_stat_t *file_stat)
+{
+ static const unsigned char fp7_header[0x14]= {
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,
+ 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0xc0, 'H',
+ 'B', 'A', 'M', '7'
+ };
+ register_header_check(0, fp7_header,sizeof(fp7_header), &header_check_fp7, file_stat);
}