EgtLock :

- modifiche per gestire versione VVmm con prime due cifre versione e seconde due mese (esempio 2301).
This commit is contained in:
Dario Sassi
2020-12-28 18:55:24 +00:00
parent 6a9111ff6f
commit 2f1fc5ad20
+10 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2020
//----------------------------------------------------------------------------
// File : KeyProc.cpp Data : 03.08.20 Versione : 2.2h1
// File : KeyProc.cpp Data : 26.12.20 Versione : 2.2l1
// Contenuto : Funzioni per la gestione della chiave.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 10.09.14 DS Creazione modulo.
// 29.02.16 DS Controllo prodotti con & (and bit a bit).
// 12.07.16 DS In recupero opzioni, se chiave ko azzero risultati.
// 26.12.20 DS Gestione versione MMmm (vecchie chiavi convertite).
//
//----------------------------------------------------------------------------
@@ -27,7 +28,7 @@
using namespace std ;
//----------------------------------------------------------------------------
static const int MIN_DAYS = 18477 ; // giorni al 03/08/2020 dal 1/1/1970
static const int MIN_DAYS = 18621 ; // giorni al 25/12/2020 dal 1/1/1970
static const int N_STEP = 7 ;
//----------------------------------------------------------------------------
@@ -123,11 +124,16 @@ VerifyKey( const string& sKey, int nProd, int nVer, int nLev,
if ( ! ReadKey( sKey, sScramKey,
nKProd, nKVer, nKLev, nKExpDays,
nKOpt1, nKOpt2, nKOptExpDays))
return KEY_ERR_KEYDECODE ;
return KEY_ERR_KEYDECODE ;
// aggiusto i dati di versione
if ( nVer < 100)
nVer = nVer * 100 + 7 ;
if ( nKVer < 100)
nKVer = nKVer * 100 + 7 ;
// verifico dati prodotto
if ( ( nProd & nKProd) != nProd)
return KEY_ERR_PROD ;
if ( nVer > nKVer)
if ( nVer > nKVer + 100)
return KEY_ERR_VER ;
if ( nLev > nKLev)
return KEY_ERR_LEV ;