Add Outlook .msg, MS VB .cls detection in PhotoRec

This commit is contained in:
Christophe Grenier 2007-12-21 08:31:11 +01:00
parent cdb8cbe5fc
commit c75bcf2b02
3 changed files with 17 additions and 2 deletions

View file

@ -154,6 +154,10 @@ static int header_check_doc(const unsigned char *buffer, const unsigned int buff
{ {
file_recovery_new->extension="mws"; 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 else
file_recovery_new->extension=file_hint_doc.extension; file_recovery_new->extension=file_hint_doc.extension;
return 1; return 1;

View file

@ -43,6 +43,7 @@ extern const file_hint_t file_hint_pdf;
extern const file_hint_t file_hint_zip; extern const file_hint_t file_hint_zip;
static inline int filtre(unsigned char car); 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 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); 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 .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_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_imm2[13] = {'R','e','t','u','r','n','-','P','a','t','h',':',' '};
static const unsigned char header_mail[5] = {'F','r','o','m',' '}; 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) 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_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_imm2,sizeof(header_imm2), &header_check_fasttxt, file_stat);
register_header_check(0, header_mail,sizeof(header_mail), &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 /* destination should have an extra byte available for null terminator
return read size */ 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 */ const unsigned char *p; /* pointers to actual position in source buffer */
unsigned char *q; /* pointers to actual position in destination 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_grisbi[] = "Version_grisbi";
const char sign_fst[] = "QBFSD"; 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 */ /* Incredimail has .imm extension but this extension isn't frequent */
if(memcmp(buffer,header_imm,sizeof(header_imm))==0 || if(memcmp(buffer,header_imm,sizeof(header_imm))==0 ||
memcmp(buffer,header_imm2,sizeof(header_imm2))==0 || memcmp(buffer,header_imm2,sizeof(header_imm2))==0 ||

View file

@ -48,7 +48,7 @@ static unsigned int pos_in_mem(const unsigned char *haystack, const unsigned int
const file_hint_t file_hint_zip= { const file_hint_t file_hint_zip= {
.extension="zip", .extension="zip",
.description="zip archive", .description="zip archive including OpenOffice and MSOffice 2007",
.min_header_distance=0, .min_header_distance=0,
.max_filesize=PHOTOREC_MAX_FILE_SIZE, .max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1, .recover=1,