EgtLock :
- modifiche per meglio riconoscere il tipo di errore con la chiave di rete.
This commit is contained in:
+6
-2
@@ -136,8 +136,12 @@ VerifyKey( const string& sKey, int nProd, int nVer, int nLev,
|
||||
{
|
||||
// creo la chiave di scramble
|
||||
string sLockId2 ;
|
||||
if ( ! GetLockId2( sLockId2))
|
||||
return KEY_ERR_MACHID ;
|
||||
if ( ! GetLockId2( sLockId2)) {
|
||||
if ( NotFoundNetHwKey())
|
||||
return KEY_ERR_NETKEY_NOTFOUND ;
|
||||
else
|
||||
return KEY_ERR_MACHID ;
|
||||
}
|
||||
string sScramKey ;
|
||||
if ( ! ConvertLockId2ToScramKey( sLockId2, sScramKey))
|
||||
return KEY_ERR_SCRAMKEY ;
|
||||
|
||||
+13
-3
@@ -65,6 +65,16 @@ CloseNetHwKey( void)
|
||||
return NetDongleClose() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
NotFoundNetHwKey( void)
|
||||
{
|
||||
if ( s_bNetHwKey)
|
||||
return NetDongleNotFound() ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetLockId( string& sLockId)
|
||||
@@ -80,10 +90,10 @@ GetLockId( string& sLockId)
|
||||
case KEY_LOCK_TYPE_SW :
|
||||
return GetMachineId( sLockId) ;
|
||||
case KEY_LOCK_TYPE_HW :
|
||||
if ( ! s_bNetHwKey)
|
||||
return GetDongleId( sLockId) ;
|
||||
else
|
||||
if ( s_bNetHwKey)
|
||||
return GetNetDongleId( s_nNetUserId, s_sAddrPort, sLockId) ;
|
||||
else
|
||||
return GetDongleId( sLockId) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-7
@@ -111,9 +111,11 @@ NetDongleConnect( int nNetUserId, const string& sAddrPort)
|
||||
int nStatusND = 0 ;
|
||||
if ( &sAddrPort == nullptr || sAddrPort.empty() ||
|
||||
sAddrPort.find_first_not_of( " \t\r\n") == std::string::npos)
|
||||
s_net_data = xnd_net_data_create_resolving_local_search( s_env, XND_DEFAULT_PORT, label, 30000, 0, 0, &nStatusND) ;
|
||||
else
|
||||
s_net_data = xnd_net_data_create_resolving_addr_port( s_env, s_sAddrPort.c_str(), 0, 30000, &nStatusND) ;
|
||||
s_net_data = xnd_net_data_create_resolving_local_search( s_env, XND_DEFAULT_PORT, label, 10000, 0, 0, &nStatusND) ;
|
||||
else {
|
||||
s_sAddrPort = sAddrPort ;
|
||||
s_net_data = xnd_net_data_create_resolving_addr_port( s_env, s_sAddrPort.c_str(), 0, 0, &nStatusND) ;
|
||||
}
|
||||
if ( s_net_data == nullptr) {
|
||||
xnd_xlt_env_release( s_env) ;
|
||||
return false ;
|
||||
@@ -174,8 +176,6 @@ NetDongleConnect( int nNetUserId, const string& sAddrPort)
|
||||
}
|
||||
if ( s_dev_ctx == nullptr) {
|
||||
xnd_xlt_env_release( s_env) ;
|
||||
s_env = nullptr ;
|
||||
s_net_data = nullptr ;
|
||||
return false ;
|
||||
}
|
||||
// apro la sessione
|
||||
@@ -183,8 +183,6 @@ NetDongleConnect( int nNetUserId, const string& sAddrPort)
|
||||
if ( nStatOP != 0) {
|
||||
xnd_xlt_devctx_release( s_dev_ctx) ;
|
||||
xnd_xlt_env_release( s_env) ;
|
||||
s_env = nullptr ;
|
||||
s_net_data = nullptr ;
|
||||
s_dev_ctx = nullptr ;
|
||||
return false ;
|
||||
}
|
||||
@@ -202,3 +200,10 @@ NetDongleClose( void)
|
||||
s_env = nullptr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
NetDongleNotFound( void)
|
||||
{
|
||||
return ( s_env != nullptr && s_net_data == nullptr) ;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2022-2023
|
||||
// EgalTech 2022-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : NetDongleId.h Data : 09.10.23 Versione : 2.5j1
|
||||
// File : NetDongleId.h Data : 09.04.24 Versione : 2.6d2
|
||||
// Contenuto : Dichiarazione funzioni locali per gestione/calcolo Id chiave.
|
||||
//
|
||||
//
|
||||
@@ -19,3 +19,4 @@
|
||||
bool GetNetDongleId( int nNetUserId, const std::string& sAddrPort, std::string& sDongleId) ;
|
||||
bool NetDongleConnect( int nNetUserId, const std::string& sAddrPort) ;
|
||||
bool NetDongleClose( void) ;
|
||||
bool NetDongleNotFound( void) ;
|
||||
|
||||
Reference in New Issue
Block a user