EgtExecutor 2.5e5 :

- migliorato controllo gestione chiave di rete.
This commit is contained in:
DarioS
2023-05-30 10:28:53 +02:00
parent d069b33424
commit 173728605d
4 changed files with 17 additions and 4 deletions
+8 -1
View File
@@ -45,8 +45,15 @@ HMODULE s_hENs = nullptr ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2) LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2, bool bNetHwKey)
{ {
// non ammessa con chiave di rete
if ( bNetHwKey) {
std::string sErr = "Warning on Key (ENS/NET)" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
FreeNestingDll() ;
return false ;
}
// verifico la chiave // verifico la chiave
if ( ! TestKeyForENs( sKey, 0, pLogger)) { if ( ! TestKeyForENs( sKey, 0, pLogger)) {
FreeNestingDll() ; FreeNestingDll() ;
+1 -1
View File
@@ -19,7 +19,7 @@ class ILogger ;
class IAutoNester ; class IAutoNester ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2) ; bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2, bool bNetHwKey) ;
bool FreeNestingDll( void) ; bool FreeNestingDll( void) ;
bool IsLoadedNestingDll( void) ; bool IsLoadedNestingDll( void) ;
void MySetENsLogger( ILogger* pLogger) ; void MySetENsLogger( ILogger* pLogger) ;
+8 -2
View File
@@ -29,6 +29,7 @@
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EGnPcInfo.h" #include "/EgtDev/Include/EGnPcInfo.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtLogger.h" #include "/EgtDev/Include/EgtLogger.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
@@ -115,7 +116,7 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
LOG_INFO( s_pGenLog, MyGetEMkVersion()) LOG_INFO( s_pGenLog, MyGetEMkVersion())
// carico libreria nesting opzionale (non può usare la chiave di rete) // carico libreria nesting opzionale (non può usare la chiave di rete)
if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey)) if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetENsVersion()) LOG_INFO( s_pGenLog, MyGetENsVersion())
// Info sulla protezione e sul sistema // Info sulla protezione e sul sistema
@@ -218,6 +219,7 @@ bool
ExeSetKey( const string& sKey) ExeSetKey( const string& sKey)
{ {
s_sKey = sKey ; s_sKey = sKey ;
SetEGnKey( s_sKey) ;
return true ; return true ;
} }
@@ -248,6 +250,7 @@ bool
ExeSetLockType( int nType) ExeSetLockType( int nType)
{ {
s_nKeyType = nType ; s_nKeyType = nType ;
SetEGnKeyType( s_nKeyType) ;
return SetLockType( nType) ; return SetLockType( nType) ;
} }
@@ -256,6 +259,7 @@ bool
ExeSetNetHwKey( bool bNetHwKey) ExeSetNetHwKey( bool bNetHwKey)
{ {
s_bNetHwKey = bNetHwKey ; s_bNetHwKey = bNetHwKey ;
SetEGnNetHwKey( s_bNetHwKey) ;
return SetNetHwKey( bNetHwKey) ; return SetNetHwKey( bNetHwKey) ;
} }
@@ -412,7 +416,7 @@ ExeGetKeyInfo( string& sKey)
if ( sLockId.empty()) if ( sLockId.empty())
return false ; return false ;
int nLockSN = 0 ; int nLockSN = 0 ;
if ( s_bNetHwKey || GetLockSN( nLockSN)) if ( GetLockSN( nLockSN))
sLockId += " (" + ToString( nLockSN) + ")" ; sLockId += " (" + ToString( nLockSN) + ")" ;
} }
// altrimenti // altrimenti
@@ -431,6 +435,7 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{ {
// verifico la chiave e il livello // verifico la chiave e il livello
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ; int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ;
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
if ( nRet != KEY_OK) { if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ; string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
LOG_ERROR( s_pGenLog, sErr.c_str()) ; LOG_ERROR( s_pGenLog, sErr.c_str()) ;
@@ -448,6 +453,7 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
// verifico la chiave e le opzioni // verifico la chiave e le opzioni
unsigned int nOpt1 ; unsigned int nOpt1 ;
int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ; int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ;
SetEGnKeyOptions( nRet, nOpt1, nOpt2, s_nKeyOptExpDays) ;
if ( nRet != KEY_OK) { if ( nRet != KEY_OK) {
nOpt2 = 0 ; nOpt2 = 0 ;
string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ; string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ;
BIN
View File
Binary file not shown.