From 5934cf54e9d22ee80759d0e78d784f53fa19d78a Mon Sep 17 00:00:00 2001 From: Volker Wildi <3668514+vwildi@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:09:59 +0100 Subject: [PATCH] Support for further WISO Steuer software versions Close https://github.com/cgsecurity/testdisk/pull/77 Edited by Christophe GRENIER --- src/file_steuer2014.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/file_steuer2014.c b/src/file_steuer2014.c index e2938258..eba07027 100644 --- a/src/file_steuer2014.c +++ b/src/file_steuer2014.c @@ -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);