Support for further WISO Steuer software versions

Close https://github.com/cgsecurity/testdisk/pull/77
Edited by Christophe GRENIER
This commit is contained in:
Volker Wildi 2020-03-09 18:09:59 +01:00 committed by Christophe Grenier
parent cc8c9454d3
commit 5934cf54e9

View file

@ -33,10 +33,17 @@
#include "common.h"
static void register_header_check_steuer(file_stat_t *file_stat);
static const char *extension_steuer2014="steuer2014";
static const char *extension_steuer2015="steuer2015";
static const char *extension_steuer2016="steuer2016";
static const char *extension_steuer2017="steuer2017";
static const char *extension_steuer2018="steuer2018";
static const char *extension_steuer2019="steuer2019";
static const char *extension_steuer2020="steuer2020";
const file_hint_t file_hint_steuer2014= {
.extension="steuer2014",
.description="Steuer 2014/2015",
.description="Steuer 2014/...",
.max_filesize=100*1024*1024,
.recover=1,
.enable_by_default=1,
@ -59,10 +66,30 @@ static int header_check_steuer(const unsigned char *buffer, const unsigned int b
return 0;
memset(&tm_time, 0, sizeof(struct tm));
reset_file_recovery(file_recovery_new);
if(le32(h->version1)>=0x13)
file_recovery_new->extension="steuer2015";
else
file_recovery_new->extension=file_hint_steuer2014.extension;
switch(le32(h->version1))
{
case 0x00 ... 0x12:
file_recovery_new->extension=extension_steuer2014;
break;
case 0x13:
file_recovery_new->extension=extension_steuer2015;
break;
case 0x14:
file_recovery_new->extension=extension_steuer2016;
break;
case 0x15:
file_recovery_new->extension=extension_steuer2017;
break;
case 0x16:
file_recovery_new->extension=extension_steuer2018;
break;
case 0x17:
file_recovery_new->extension=extension_steuer2019;
break;
default:
file_recovery_new->extension=extension_steuer2020;
break;
}
#ifdef HAVE_STRPTIME
strptime(h->date_string, "%b %d %Y %H:%M:%S", &tm_time);
file_recovery_new->time=mktime(&tm_time);