KeyGenerator 1.6g8 :
- aggiornamento e modifiche per gestione codici chiavi hardware.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -82,6 +83,7 @@ CKeyGeneratorApp::InitInstance( void)
|
||||
m_pszProfileName = p ;
|
||||
|
||||
// verifico la protezione
|
||||
SetLockType( KEY_LOCK_TYPE_HW) ;
|
||||
string sKey = GetPrivateProfileStringUtf8( "General", "Key", "", m_pszProfileName) ;
|
||||
if ( VerifyKey( sKey, 1230, 16, 10) != KEY_OK)
|
||||
return FALSE ;
|
||||
|
||||
Binary file not shown.
@@ -46,12 +46,14 @@
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -64,6 +66,7 @@
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>c:\EgtDev\Extern\OxySec\Lib\x32\oxyxlt.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
@@ -96,6 +99,7 @@
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>c:\EgtDev\Extern\OxySec\Lib\x32\oxyxlt.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
|
||||
+6
-6
@@ -263,8 +263,8 @@ CKeyGeneratorDlg::LoadFile( const char* szFile)
|
||||
sSec += ToString( nLast) ;
|
||||
string sCust = GetPrivateProfileStringUtf8( sSec.c_str(), "Customer", "", szFile) ;
|
||||
GetDlgItem( IDC_CUSTOMER)->SetWindowTextW( stringtoW( sCust)) ;
|
||||
string sMachId = GetPrivateProfileStringUtf8( sSec.c_str(), "MachineId", "", szFile) ;
|
||||
GetDlgItem( IDC_MACHID)->SetWindowTextW( stringtoW( sMachId)) ;
|
||||
string sLockId = GetPrivateProfileStringUtf8( sSec.c_str(), "LockId", "", szFile) ;
|
||||
GetDlgItem( IDC_MACHID)->SetWindowTextW( stringtoW( sLockId)) ;
|
||||
int nProd = GetPrivateProfileInt( sSec.c_str(), "Product", 0, szFile) ;
|
||||
((CComboBox*)GetDlgItem( IDC_PROD))->SetCurSel( nProd - 1230) ;
|
||||
int nVer = GetPrivateProfileInt( sSec.c_str(), "Ver", 0, szFile) ;
|
||||
@@ -306,12 +306,12 @@ CKeyGeneratorDlg::OnGenerate( void)
|
||||
WritePrivateProfileStringUtf8( "Licence", "Customer", sCust.c_str(), AfxGetApp()->m_pszProfileName) ;
|
||||
// recupero l'identificativo macchina (tipo 2)
|
||||
GetDlgItem( IDC_MACHID)->GetWindowTextW( wszTemp) ;
|
||||
string sMachId = wstrztoA( wszTemp) ;
|
||||
if ( ! mKey.SetMachineId( sMachId)) {
|
||||
AfxMessageBox( L"Id Macchina vuoto o errato") ;
|
||||
string sLockId = wstrztoA( wszTemp) ;
|
||||
if ( ! mKey.SetLockId( sLockId)) {
|
||||
AfxMessageBox( L"Id Serratura vuoto o errato") ;
|
||||
return ;
|
||||
}
|
||||
WritePrivateProfileStringUtf8( "Licence", "MachineId", sMachId.c_str(), AfxGetApp()->m_pszProfileName) ;
|
||||
WritePrivateProfileStringUtf8( "Licence", "LockId", sLockId.c_str(), AfxGetApp()->m_pszProfileName) ;
|
||||
// recupero il prodotto
|
||||
GetDlgItem( IDC_PROD)->GetWindowTextW( wszTemp) ;
|
||||
string sProd = wstrztoA( wszTemp) ;
|
||||
|
||||
+34
-21
@@ -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) ;
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ class KeyMaker
|
||||
public :
|
||||
KeyMaker(void) ;
|
||||
bool SetCustomer( const std::string& sCustomer) ;
|
||||
bool SetMachineId( const std::string& sMachineId2) ;
|
||||
bool SetLockId( const std::string& sLockId2) ;
|
||||
bool SetProduct( const std::string& sProd) ;
|
||||
bool SetVersion( const std::string& sVer) ;
|
||||
bool SetLevel( const std::string& sLev) ;
|
||||
@@ -39,8 +39,8 @@ class KeyMaker
|
||||
|
||||
private :
|
||||
std::string m_sCustomer ;
|
||||
std::string m_sMachineId ;
|
||||
std::string m_sMachineId2 ;
|
||||
std::string m_sLockId ;
|
||||
std::string m_sLockId2 ;
|
||||
std::string m_sScramKey ;
|
||||
std::string m_sKey ;
|
||||
int m_nProd ;
|
||||
|
||||
Reference in New Issue
Block a user