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,28 +196,31 @@ bool DongleTest()
srand(883);
DecodeString(line);
const int ass_year = atoi(line);
srand(ass_year);
while (!keys.eof())
if (ass_year > yearKey) // Non devo abbassare l'anno di assistenza!
{
keys.getline(line, sizeof(line));
DecodeString(line);
unsigned int sn = (unsigned int)atol(line);
if (sn == serno || line[0] == '*')
srand(ass_year);
while (!keys.eof())
{
ok = TRUE;
break;
keys.getline(line, sizeof(line));
DecodeString(line);
unsigned int sn = (unsigned int)atol(line);
if (sn == serno || line[0] == '*')
{
ok = TRUE;
break;
}
}
if (ok)
{
wsprintf(line, "Il contratto di manutenzione %d verrà attivato automaticamente", ass_year);
WarningBox(line);
}
else
{
wsprintf(line, "È necessario contattare l'assistenza tecnica\n"
"per l'abilitazione del contratto di manutenzione %d", verYear);
WarningBox(line);
}
}
if (ok)
{
wsprintf(line, "Il contratto di manutenzione %d verrà attivato automaticamente", ass_year);
WarningBox(line);
}
else
{
wsprintf(line, "È necessario contattare l'assistenza tecnica\n"
"per l'abilitazione del contratto di manutenzione %d", verYear);
WarningBox(line);
}
}
else

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,43 +134,46 @@ 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);
srand(ass_year);
while (!keys.eof())
if (ass_year > dongle().year_assist())
{
TString& line = keys.line();
if (line.empty())
break;
decode_string(dninst_key, line.get_buffer());
sn = atoi(line);
if (sn == serno)
const int serno = get_serial_number();
srand(ass_year);
while (!keys.eof())
{
dongle().set_year_assist(ass_year);
if (dongle().burn())
TString& line = keys.line();
if (line.empty())
break;
decode_string(dninst_key, line.get_buffer());
const int sn = atoi(line);
if (sn == serno)
{
message_box(FR("Il contratto %d è stato attivato automaticamente"), ass_year);
return TRUE;
}
else
{
show_error(FR("errore di scrittura sulla chiave di protezione"));
return FALSE;
dongle().set_year_assist(ass_year);
if (dongle().burn())
{
message_box(FR("Il contratto %d è stato attivato automaticamente"), ass_year);
return TRUE;
}
else
{
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"));
}
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"));