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 1dc3b87..66f546b 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ