diff --git a/DllMain.h b/DllMain.h index bad65e2..6d2c606 100644 --- a/DllMain.h +++ b/DllMain.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2013-2013 +// EgalTech 2013-2023 //---------------------------------------------------------------------------- -// File : DllMain.h Data : 17.02.14 Versione : 1.5b3 +// File : DllMain.h Data : 30.05.23 Versione : 2.5e5 // Contenuto : Prototipi funzioni per uso locale della DLL. // // @@ -21,3 +21,4 @@ ILogger* GetEGrLogger( void) ; const std::string& GetEGrKey( void) ; bool GetEGrNetHwKey( void) ; +bool VerifyKey( int nKeyOpt) ; diff --git a/EGrDllMain.cpp b/EGrDllMain.cpp index 16db938..a7e3a54 100644 --- a/EGrDllMain.cpp +++ b/EGrDllMain.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2014-2014 +// EgalTech 2014-2023 //---------------------------------------------------------------------------- -// File : EGrDllMain.cpp Data : 13.02.14 Versione : 1.5b1 +// File : EGrDllMain.cpp Data : 30.05.23 Versione : 2.5e // Contenuto : Inizializzazione della DLL. // // @@ -16,6 +16,7 @@ #include "DllMain.h" #include "/EgtDev/Include/EGrDllMain.h" #include "/EgtDev/Include/EGnGetModuleVer.h" +#include "/EgtDev/Include/EGnGetKeyData.h" #include "/EgtDev/Include/EgtTrace.h" //--------------------------- Costanti ---------------------------------------- @@ -118,3 +119,30 @@ GetEGrNetHwKey( void) { return s_bNetHwKey ; } + +//----------------------------------------------------------------------------- +bool +VerifyKey( int nKeyOpt) +{ + // Controllo della licenza + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( ! GetEGrNetHwKey()) + nRet = GetKeyOptions( GetEGrKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + std::string sErr = "Error on Key (GRC/" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGrLogger(), sErr.c_str()) ; + return false ; + } + if ( ( nOpt1 & KEYOPT_EGR_BASE) == 0 || + ( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) || + nOptExpDays < GetCurrDay()) { + std::string sErr = "Warning on Key (GRC/OPT)" ; + LOG_ERROR( GetEGrLogger(), sErr.c_str()) ; + return false ; + } + return true ; +} diff --git a/EgtGraphics.rc b/EgtGraphics.rc index 793f481..8a060cd 100644 Binary files a/EgtGraphics.rc and b/EgtGraphics.rc differ diff --git a/ImageMgr.cpp b/ImageMgr.cpp index b603071..90223f2 100644 --- a/ImageMgr.cpp +++ b/ImageMgr.cpp @@ -29,10 +29,8 @@ IEgrImageMgr* CreateEgrImageMgr( void) { // verifico la chiave e le opzioni - if ( ! GetEGrNetHwKey()) { - if ( ! TestKeyForEGr( GetEGrKey(), 0, GetEGrLogger())) - return nullptr ; - } + if ( ! VerifyKey( 0)) + return nullptr ; // creo l'oggetto return static_cast ( new(nothrow) ImageMgr) ; } diff --git a/SceneBasic.cpp b/SceneBasic.cpp index 9aa2634..10c498b 100644 --- a/SceneBasic.cpp +++ b/SceneBasic.cpp @@ -38,10 +38,8 @@ IEGrScene* CreateEGrScene( void) { // verifico la chiave e le opzioni - if ( ! GetEGrNetHwKey()) { - if ( ! TestKeyForEGr( GetEGrKey(), 0, GetEGrLogger())) - return nullptr ; - } + if ( ! VerifyKey( 0)) + return nullptr ; // creo l'oggetto return static_cast ( new(nothrow) Scene) ; }