diff --git a/DllMain.h b/DllMain.h index d7ecbb1..7da7299 100644 --- a/DllMain.h +++ b/DllMain.h @@ -20,4 +20,5 @@ int GetEGkDebugLev( void) ; ILogger* GetEGkLogger( void) ; const std::string& GetEGkKey( void) ; +bool GetEGkNetHwKey( void) ; int ProcessEvents( int nProg, int nPause) ; diff --git a/EGkDllMain.cpp b/EGkDllMain.cpp index cefba90..0ee5a33 100644 --- a/EGkDllMain.cpp +++ b/EGkDllMain.cpp @@ -115,6 +115,7 @@ GetEGkLogger( void) //----------------------------------------------------------------------------- static string s_sKey ; static int s_nKeyType = KEY_LOCK_TYPE_ANY ; +static bool s_bNetHwKey = false ; //----------------------------------------------------------------------------- void @@ -130,6 +131,13 @@ SetEGkKeyType( int nType) s_nKeyType = nType ; } +//----------------------------------------------------------------------------- +void +SetEGkNetHwKey( bool bNetHwKey) +{ + s_bNetHwKey = bNetHwKey ; +} + //----------------------------------------------------------------------------- const string& GetEGkKey( void) @@ -138,6 +146,13 @@ GetEGkKey( void) return s_sKey ; } +//----------------------------------------------------------------------------- +bool +GetEGkNetHwKey( void) +{ + return s_bNetHwKey ; +} + //----------------------------------------------------------------------------- void InitFontManager( const string& sNfeFontDir, const string& sDefaultFont) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index a846373..5466574 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/GeomDB.cpp b/GeomDB.cpp index 2de393f..7cf67a4 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -37,22 +37,25 @@ IGeomDB* CreateGeomDB( void) { // verifico la chiave e le opzioni - unsigned int nOpt1, nOpt2 ; - int nOptExpDays ; - int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, - nOpt1, nOpt2, nOptExpDays) ; - if ( nRet != KEY_OK && ! EqualNoCase( GetEGkKey(), "EGkBase")) { - if ( nRet != KEY_OK) { - string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return nullptr ; - } - if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) { - string sErr = "Error on Key (GKC/OPT)" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return nullptr ; + if ( ! GetEGkNetHwKey()) { + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK && ! EqualNoCase( GetEGkKey(), "EGkBase")) { + if ( nRet != KEY_OK) { + string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return nullptr ; + } + if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) { + string sErr = "Error on Key (GKC/OPT)" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return nullptr ; + } } } + // creo il GeomDB return static_cast ( new( nothrow) GeomDB) ; } @@ -272,19 +275,21 @@ bool GeomDB::Save( int nId, const string& sFileOut, int nFlag) const { // verifico la chiave e le opzioni - unsigned int nOpt1, nOpt2 ; - int nOptExpDays ; - int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, - nOpt1, nOpt2, nOptExpDays) ; - if ( nRet != KEY_OK) { - string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return false ; - } - if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) { - string sErr = "Error on Key (GKS/OPT)" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return false ; + if ( ! GetEGkNetHwKey()) { + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return false ; + } + if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) { + string sErr = "Error on Key (GKS/OPT)" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return false ; + } } // assegno Id base @@ -382,19 +387,21 @@ bool GeomDB::Save( const INTVECTOR& vId, const string& sFileOut, int nFlag) const { // verifico la chiave e le opzioni - unsigned int nOpt1, nOpt2 ; - int nOptExpDays ; - int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, - nOpt1, nOpt2, nOptExpDays) ; - if ( nRet != KEY_OK) { - string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return false ; - } - if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) { - string sErr = "Error on Key (GKS/OPT)" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return false ; + if ( ! GetEGkNetHwKey()) { + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return false ; + } + if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) { + string sErr = "Error on Key (GKS/OPT)" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return false ; + } } // assegno Id base (nessuna riduzione degli Id) @@ -513,7 +520,10 @@ GeomDB::SaveHeader( NgeWriter& ngeOut) const // LockId del sistema come commento string sLockId ; - if ( ! GetLockId( sLockId)) { + if ( GetEGkNetHwKey()) { + sLockId = "NET-000000" ; + } + else if ( ! GetLockId( sLockId)) { LOG_ERROR( GetEGkLogger(), "Error on Key (1)") return false ; }