Patch level : 2.0 488

Files correlati     : ba1.exe
Ricompilazione Demo : [ ]
Commento            :

Eliminata possibilita' di programmare un anno di assistenza inferiore
a quello memorizzato sulla chiave di protezione


git-svn-id: svn://10.65.10.50/trunk@11203 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-06-03 08:28:28 +00:00
parent 4f569ec3c4
commit 06b62f6cb0
2 changed files with 55 additions and 47 deletions

View File

@ -137,7 +137,7 @@ void DecodeString(char* data)
int ThisYear()
{
int anno = 2001;
int anno = 2003;
time_t lt;
if (time(&lt) == 0)
{
@ -196,6 +196,8 @@ bool DongleTest()
srand(883);
DecodeString(line);
const int ass_year = atoi(line);
if (ass_year > yearKey) // Non devo abbassare l'anno di assistenza!
{
srand(ass_year);
while (!keys.eof())
{
@ -220,6 +222,7 @@ bool DongleTest()
WarningBox(line);
}
}
}
else
{
ErrorBox("Impossibile verificare il contratto di manutenzione");

View File

@ -53,7 +53,7 @@ HIDDEN bool build_dninst(const TFilename& name)
{
srand(883);
year = atoi(line);
CHECKD(year >= 1997 && year <= 2997, "Anno errato:", year);
CHECKD(year >= 2001 && year <= 3001, "Anno errato:", year);
}
encode_string(dninst_key, line);
@ -83,6 +83,7 @@ HIDDEN bool show_error(const char* str)
return error_box(msg);
}
/*
HIDDEN int module2number(const TString& mod)
{
static TAssoc_array* ass = NULL;
@ -107,6 +108,7 @@ HIDDEN int module2number(const TString& mod)
}
return n;
}
*/
bool update_dninst(bool force)
{
@ -122,7 +124,7 @@ bool update_dninst(bool force)
fcopy(remote_name, keys_name);
#ifdef DBG
else
build_dninst(remote_name);
build_dninst(remote_name); // La cifrature del file avviene solo in DEBUG!
#endif
}
return TRUE;
@ -132,27 +134,27 @@ bool update_assistance_year()
{
update_dninst(TRUE);
TScanner keys("dninst.zip");
bool ok = FALSE;
if (keys.ok())
const TFilename dninst = "dninst.zip";
if (dninst.exist())
{
const int serno = get_serial_number();
int sn = 0;
char dninst_key[8] = "";
TScanner keys(dninst);
TString& anno = keys.line();
srand(883);
decode_string(dninst_key, anno.get_buffer());
const int ass_year = atoi(anno);
if (ass_year > dongle().year_assist())
{
const int serno = get_serial_number();
srand(ass_year);
while (!keys.eof())
{
TString& line = keys.line();
if (line.empty())
break;
decode_string(dninst_key, line.get_buffer());
sn = atoi(line);
const int sn = atoi(line);
if (sn == serno)
{
dongle().set_year_assist(ass_year);
@ -163,13 +165,16 @@ bool update_assistance_year()
}
else
{
show_error(FR("errore di scrittura sulla chiave di protezione"));
show_error(FR("Errore di scrittura sulla chiave di protezione"));
return FALSE;
}
}
}
show_error(TR("Il numero di serie di questa postazione non è presente sul database"));
}
else
show_error(TR("L'anno di assistenza sul database e' inferiore a quello registrato sulla chiave di protezione"));
}
else
show_error(TR("Il database dei numeri di serie non è accessibile"));
return FALSE;