PhotoRec: recover history.dat file from Sony Ericson phone

This commit is contained in:
Christophe Grenier 2010-05-21 08:58:05 +02:00
parent b84e9c90f2
commit 7d40e13a7f

View file

@ -33,6 +33,7 @@
static void register_header_check_dat(file_stat_t *file_stat);
static int header_check_dat(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_datIE(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_dat_history(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_dat= {
.extension="dat",
@ -51,10 +52,14 @@ static const unsigned char datIE_header[0x1c]= {
'M', 'M', 'F', ' ', 'V', 'e', 'r', ' ',
'5', '.', '2', 0x00};
/* Found on Sony Ericson phone */
static const unsigned char dat_history[8]={ 'N', 'F', 'P', 'K', 'D', 'D', 'A', 'T'};
static void register_header_check_dat(file_stat_t *file_stat)
{
register_header_check(0, dat_header,sizeof(dat_header), &header_check_dat, file_stat);
register_header_check(0, datIE_header,sizeof(datIE_header), &header_check_datIE, file_stat);
register_header_check(4, dat_history, sizeof(dat_history), &header_check_dat_history, file_stat);
}
static int header_check_dat(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)
@ -82,3 +87,14 @@ static int header_check_datIE(const unsigned char *buffer, const unsigned int bu
}
return 0;
}
static int header_check_dat_history(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[4], dat_history, sizeof(dat_history))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_dat.extension;
return 1;
}
return 0;
}