From 173728605dd74642071cfa0e47ccda482fe11cc6 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 30 May 2023 10:28:53 +0200 Subject: [PATCH] EgtExecutor 2.5e5 : - migliorato controllo gestione chiave di rete. --- DllNesting.cpp | 9 ++++++++- DllNesting.h | 2 +- EXE_General.cpp | 10 ++++++++-- EgtExecutor.rc | Bin 18890 -> 18890 bytes 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DllNesting.cpp b/DllNesting.cpp index 6ca5f71..d560f5f 100644 --- a/DllNesting.cpp +++ b/DllNesting.cpp @@ -45,8 +45,15 @@ HMODULE s_hENs = nullptr ; //----------------------------------------------------------------------------- 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 if ( ! TestKeyForENs( sKey, 0, pLogger)) { FreeNestingDll() ; diff --git a/DllNesting.h b/DllNesting.h index 89d6db9..2c59a3f 100644 --- a/DllNesting.h +++ b/DllNesting.h @@ -19,7 +19,7 @@ class ILogger ; 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 IsLoadedNestingDll( void) ; void MySetENsLogger( ILogger* pLogger) ; diff --git a/EXE_General.cpp b/EXE_General.cpp index b80f87a..e9158e9 100644 --- a/EXE_General.cpp +++ b/EXE_General.cpp @@ -29,6 +29,7 @@ #include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EGnPcInfo.h" +#include "/EgtDev/Include/EGnGetKeyData.h" #include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtLogger.h" #include "/EgtDev/Include/EgtStringConverter.h" @@ -115,7 +116,7 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg) LOG_INFO( s_pGenLog, MyGetEMkVersion()) // 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()) // Info sulla protezione e sul sistema @@ -218,6 +219,7 @@ bool ExeSetKey( const string& sKey) { s_sKey = sKey ; + SetEGnKey( s_sKey) ; return true ; } @@ -248,6 +250,7 @@ bool ExeSetLockType( int nType) { s_nKeyType = nType ; + SetEGnKeyType( s_nKeyType) ; return SetLockType( nType) ; } @@ -256,6 +259,7 @@ bool ExeSetNetHwKey( bool bNetHwKey) { s_bNetHwKey = bNetHwKey ; + SetEGnNetHwKey( s_bNetHwKey) ; return SetNetHwKey( bNetHwKey) ; } @@ -412,7 +416,7 @@ ExeGetKeyInfo( string& sKey) if ( sLockId.empty()) return false ; int nLockSN = 0 ; - if ( s_bNetHwKey || GetLockSN( nLockSN)) + if ( GetLockSN( nLockSN)) sLockId += " (" + ToString( nLockSN) + ")" ; } // altrimenti @@ -431,6 +435,7 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev) { // verifico la chiave e il livello int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ; + SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ; if ( nRet != KEY_OK) { string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ; 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 unsigned int nOpt1 ; int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ; + SetEGnKeyOptions( nRet, nOpt1, nOpt2, s_nKeyOptExpDays) ; if ( nRet != KEY_OK) { nOpt2 = 0 ; string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ; diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 1dc3b8701170146a7dda9efe8f8bbdad3826ad52..66f546bfb73a67198761a4409faf390d7711354b 100644 GIT binary patch delta 81 zcmX>#neo(Q#tpyN7)>|-W^-i*QjT29S-`yGOp`YVRxz4RcH~Ol+$UrM5eQG delta 81 zcmX>#neo(Q#tpyN7>zgoW^-i*QjT29S-`yGOp`YVRxuh+cH~Ol+$UrM5