summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <[email protected]>2007-12-21 08:31:11 +0100
committerChristophe Grenier <[email protected]>2007-12-21 08:31:11 +0100
commitc75bcf2b025255a8ec83b184798b0ec8ee887297 (patch)
treecdb1166097c54b00ed4450a52ca76a505219e294 /src
parentcdb8cbe5fc19346f79922ca25cdc30f7ed88c6d1 (diff)
Add Outlook .msg, MS VB .cls detection in PhotoRec
Diffstat (limited to 'src')
-rw-r--r--src/file_doc.c4
-rw-r--r--src/file_txt.c13
-rw-r--r--src/file_zip.c2
3 files changed, 17 insertions, 2 deletions
diff --git a/src/file_doc.c b/src/file_doc.c
index c999c78b..eadb7b21 100644
--- a/src/file_doc.c
+++ b/src/file_doc.c
@@ -154,6 +154,10 @@ static int header_check_doc(const unsigned char *buffer, const unsigned int buff
{
file_recovery_new->extension="mws";
}
+ else if(find_in_mem(buffer,buffer_size,"_\0_\0n\0a\0m\0e\0i\0d\0_\0v\0e\0r\0s\0i\0o\0n\0001\0.\0000\0",38)!=NULL)
+ { /* Outlook */
+ file_recovery_new->extension="msg";
+ }
else
file_recovery_new->extension=file_hint_doc.extension;
return 1;
diff --git a/src/file_txt.c b/src/file_txt.c
index 56a8dd16..bab40722 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -43,6 +43,7 @@ extern const file_hint_t file_hint_pdf;
extern const file_hint_t file_hint_zip;
static inline int filtre(unsigned char car);
+static inline int UTF2Lat(unsigned char *buffer_lower, const unsigned char *buffer, const int buf_len);
static void register_header_check_txt(file_stat_t *file_stat);
static int header_check_txt(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);
@@ -74,6 +75,7 @@ file_hint_t file_hint_txt= {
.register_header_check=&register_header_check_txt
};
+static const unsigned char header_cls[24] = {'V','E','R','S','I','O','N',' ','1','.','0',' ','C','L','A','S','S','\r','\n','B','E','G','I','N'};
static const unsigned char header_imm[13] = {'M','I','M','E','-','V','e','r','s','i','o','n',':'};
static const unsigned char header_imm2[13] = {'R','e','t','u','r','n','-','P','a','t','h',':',' '};
static const unsigned char header_mail[5] = {'F','r','o','m',' '};
@@ -93,6 +95,7 @@ static void register_header_check_txt(file_stat_t *file_stat)
static void register_header_check_fasttxt(file_stat_t *file_stat)
{
+ register_header_check(0, header_cls,sizeof(header_cls), &header_check_fasttxt, file_stat);
register_header_check(0, header_imm,sizeof(header_imm), &header_check_fasttxt, file_stat);
register_header_check(0, header_imm2,sizeof(header_imm2), &header_check_fasttxt, file_stat);
register_header_check(0, header_mail,sizeof(header_mail), &header_check_fasttxt, file_stat);
@@ -170,7 +173,7 @@ static int filtre(unsigned char car)
/* destination should have an extra byte available for null terminator
return read size */
-static int UTF2Lat(unsigned char *buffer_lower, const unsigned char *buffer, int buf_len)
+static int UTF2Lat(unsigned char *buffer_lower, const unsigned char *buffer, const int buf_len)
{
const unsigned char *p; /* pointers to actual position in source buffer */
unsigned char *q; /* pointers to actual position in destination buffer */
@@ -282,6 +285,14 @@ static int header_check_fasttxt(const unsigned char *buffer, const unsigned int
{
const char sign_grisbi[] = "Version_grisbi";
const char sign_fst[] = "QBFSD";
+ if(memcmp(buffer,header_cls,sizeof(header_cls))==0)
+ {
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->data_check=&data_check_txt;
+ file_recovery_new->file_check=&file_check_size;
+ file_recovery_new->extension="cls";
+ return 1;
+ }
/* Incredimail has .imm extension but this extension isn't frequent */
if(memcmp(buffer,header_imm,sizeof(header_imm))==0 ||
memcmp(buffer,header_imm2,sizeof(header_imm2))==0 ||
diff --git a/src/file_zip.c b/src/file_zip.c
index 1e515a20..2e7b4aa3 100644
--- a/src/file_zip.c
+++ b/src/file_zip.c
@@ -48,7 +48,7 @@ static unsigned int pos_in_mem(const unsigned char *haystack, const unsigned int
const file_hint_t file_hint_zip= {
.extension="zip",
- .description="zip archive",
+ .description="zip archive including OpenOffice and MSOffice 2007",
.min_header_distance=0,
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1,