KeyGenerator 1.6g8 :

- aggiornamento e modifiche per gestione codici chiavi hardware.
This commit is contained in:
Dario Sassi
2015-07-29 07:11:13 +00:00
parent 12867cc4fb
commit c94137d649
6 changed files with 49 additions and 30 deletions
+34 -21
View File
@@ -14,7 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "KeyMaker.h"
#include "/EgtDev/Include/SELkMachineId.h"
#include "/EgtDev/Include/SELkLockId.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtIniFile.h"
@@ -31,8 +31,8 @@ using namespace std ;
KeyMaker::KeyMaker( void)
{
m_sCustomer.clear() ;
m_sMachineId.clear() ;
m_sMachineId2.clear() ;
m_sLockId.clear() ;
m_sLockId2.clear() ;
m_sScramKey.clear() ;
m_nProd = 0 ;
m_nVer = 0 ;
@@ -56,19 +56,32 @@ KeyMaker::SetCustomer( const string& sCustomer)
//----------------------------------------------------------------------------
bool
KeyMaker::SetMachineId( const string& sMachineId2)
KeyMaker::SetLockId( const string& sLockId2)
{
// calcolo identificativo macchina in chiaro
string sMachineId ;
if ( ! ConvertMachineId2ToMachineId( sMachineId2, sMachineId))
return false ;
// calcolo chiave di scramble
string sScramKey ;
if ( ! ConvertMachineId2ToScramKey( sMachineId2, sScramKey))
return false ;
m_sMachineId2 = sMachineId2 ;
m_sMachineId = sMachineId ;
m_sScramKey = sScramKey ;
// se identificativo di chiave, è direttamente in chiaro
if ( sLockId2.find( KEY_LOCK_HW_START) != string::npos) {
m_sLockId2 = sLockId2 ;
m_sLockId = sLockId2 ;
// calcolo chiave di scramble
string sScramKey ;
if ( ! ConvertLockIdToScramKey( m_sLockId, sScramKey))
return false ;
m_sScramKey = sScramKey ;
}
// altrimenti
else {
// calcolo identificativo macchina in chiaro
string sLockId ;
if ( ! ConvertLockId2ToLockId( sLockId2, sLockId))
return false ;
// calcolo chiave di scramble
string sScramKey ;
if ( ! ConvertLockId2ToScramKey( sLockId2, sScramKey))
return false ;
m_sLockId2 = sLockId2 ;
m_sLockId = sLockId ;
m_sScramKey = sScramKey ;
}
return true ;
}
@@ -210,11 +223,11 @@ KeyMaker::DiffLicence( const char* szFile)
string sCust = GetPrivateProfileStringUtf8( sSec.c_str(), "Customer", "", szFile) ;
if ( sCust != m_sCustomer)
return true ;
string sMachId = GetPrivateProfileStringUtf8( sSec.c_str(), "MachineId", "", szFile) ;
if ( sMachId != m_sMachineId2)
string sLockId = GetPrivateProfileStringUtf8( sSec.c_str(), "LockId", "", szFile) ;
if ( sLockId != m_sLockId2)
return true ;
string sClearMachId = GetPrivateProfileStringUtf8( sSec.c_str(), "ClearMachineId", "", szFile) ;
if ( sClearMachId != m_sMachineId)
string sClearLockId = GetPrivateProfileStringUtf8( sSec.c_str(), "ClearLockId", "", szFile) ;
if ( sClearLockId != m_sLockId)
return true ;
int nProd = GetPrivateProfileInt( sSec.c_str(), "Product", 0, szFile) ;
if ( nProd != m_nProd)
@@ -250,9 +263,9 @@ KeyMaker::WriteLicence( const char* szSec, const char* szFile, bool bAll)
if ( bAll)
WritePrivateProfileStringUtf8( szSec, "Date", CurrDateTime().c_str(), szFile) ;
WritePrivateProfileStringUtf8( szSec, "Customer", m_sCustomer.c_str(), szFile) ;
WritePrivateProfileStringUtf8( szSec, "MachineId", m_sMachineId2.c_str(), szFile) ;
WritePrivateProfileStringUtf8( szSec, "LockId", m_sLockId2.c_str(), szFile) ;
if ( bAll)
WritePrivateProfileStringUtf8( szSec, "ClearMachineId", m_sMachineId.c_str(), szFile) ;
WritePrivateProfileStringUtf8( szSec, "ClearLockId", m_sLockId.c_str(), szFile) ;
WritePrivateProfileInt( szSec, "Product", m_nProd, szFile) ;
WritePrivateProfileInt( szSec, "Ver", m_nVer, szFile) ;
WritePrivateProfileInt( szSec, "Lev", m_nLev, szFile) ;