From 9bcb974a44f6edc08ee0949b6fd8f0c1be4acdf0 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 1 Mar 2016 08:42:31 +0000 Subject: [PATCH] KeyGenerator 1.6n9 : - aggiunta gestione primi 16 bit di opzioni 2 - ricompilato con nuova gestione chiave per id di prodotto in OR con id librerie base - cambiato id di prodotto. --- KeyGenerator.cpp | 2 +- KeyGenerator.rc | Bin 24638 -> 28270 bytes KeyGeneratorDlg.cpp | 26 ++++++++++++++++++++++---- resource.h | Bin 3856 -> 5416 bytes 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/KeyGenerator.cpp b/KeyGenerator.cpp index 1849975..ac27999 100644 --- a/KeyGenerator.cpp +++ b/KeyGenerator.cpp @@ -85,7 +85,7 @@ CKeyGeneratorApp::InitInstance( void) // verifico la protezione SetLockType( KEY_LOCK_TYPE_HW) ; string sKey = GetPrivateProfileStringUtf8( "General", "Key", "", m_pszProfileName) ; - if ( VerifyKey( sKey, 1230, 16, 10) != KEY_OK) + if ( VerifyKey( sKey, 823, 16, 10) != KEY_OK) return FALSE ; // gestione linea di comando diff --git a/KeyGenerator.rc b/KeyGenerator.rc index 73e157c2388473c5f4f6a39fd4d40449ced61a63..34988d3608a2bcae2e8967256bb26cb45c50d8de 100644 GIT binary patch delta 816 zcmZXSO>5Lp6oyZnc4k`X^dpn`uv2GJU9=EtZaSSL!(bT&i%_lDLTfku0a}JZ%2ep0 zp#R`(1rgi`B9&|e!H=yg6_-leg*y@4xf0)- zS>%w-B6o?GvtPAFU=Cf-&dx)w0r*tsZu(*HWq3KI`9U@Jd0?vzs#o-v{h2n1-+jjxw0Z2zpM7idhF#Vyac?u=kA0=U5ozIZ0;eA8Spx8zw`le2$mr$)KRWWXK;%{<7pEm!Uie?kok-nFrpUx{P|A(Ahk!RJ& z=}oma8micxdF-o2J|7O5Jm#f?gXxyRmuItl%d_NaUZE9Q!?i*;aJA_+EzxzliK6IK z*}L?TxpR$0mwE^sXdW39Q1{{X#;vHSo4 delta 226 zcmaENhjHHl#tmW|?1l_F3`PtFlMVUwC;M<*VKm*W$f?Z8Z3Gln07@7$7)~x^YuMM(qS-XFrR!;*>rQ1um>-zA%g{j+2p%| z?vvjs)PQ*=lk*iznGF~$CqGwQIr#~v%;p*cC(+6GoVYd{x#=)XR`3*>T;Rbn`J4w2 ls{znzXYYrOo5An90U`!VFj|0cqTC3W(O}l6#%LmJgoo# diff --git a/KeyGeneratorDlg.cpp b/KeyGeneratorDlg.cpp index 435fcf8..453c047 100644 --- a/KeyGeneratorDlg.cpp +++ b/KeyGeneratorDlg.cpp @@ -266,14 +266,22 @@ CKeyGeneratorDlg::LoadFile( const char* szFile) 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 nSel = - 1 ; + switch ( nProd) { + case 823 : nSel = 0 ; break ; + case 1231 : nSel = 1 ; break ; + case 5327 : nSel = 2 ; break ; + case 9423 : nSel = 3 ; break ; + case 17615 : nSel = 4 ; break ; + } + ((CComboBox*)GetDlgItem( IDC_PROD))->SetCurSel( nSel) ; int nVer = GetPrivateProfileInt( sSec.c_str(), "Ver", 0, szFile) ; ((CComboBox*)GetDlgItem( IDC_VER))->SetCurSel( nVer - 15) ; int nLev = GetPrivateProfileInt( sSec.c_str(), "Lev", 0, szFile) ; ((CComboBox*)GetDlgItem( IDC_LEV))->SetCurSel( nLev - 1) ; int nExpTime = GetPrivateProfileInt( sSec.c_str(), "ExpDays", 0, szFile) ; if ( nExpTime != 0) - ((CDateTimeCtrl*)GetDlgItem( IDC_EXPIRATION))->SetTime( &CTime( nExpTime * 24 * 3600)) ; + ((CDateTimeCtrl*)GetDlgItem( IDC_EXPIRATION))->SetTime( &CTime( unsigned( nExpTime) * 24 * 3600)) ; int nOpt1 = GetPrivateProfileInt( sSec.c_str(), "Opt1", 0, szFile) ; for ( int i = IDC_CHECK01, j = 0 ; i <= IDC_CHECK16 ; ++ i, ++ j) { if ( ( nOpt1 & ( 1 << j)) != 0) @@ -282,10 +290,16 @@ CKeyGeneratorDlg::LoadFile( const char* szFile) ((CButton*)GetDlgItem( i))->SetCheck( BST_UNCHECKED) ; } int nOpt2 = GetPrivateProfileInt( sSec.c_str(), "Opt2", 0, szFile) ; + for ( int i = IDC_CHECK2_01, j = 0 ; i <= IDC_CHECK2_16 ; ++ i, ++ j) { + if ( ( nOpt2 & ( 1 << j)) != 0) + ((CButton*)GetDlgItem( i))->SetCheck( BST_CHECKED) ; + else + ((CButton*)GetDlgItem( i))->SetCheck( BST_UNCHECKED) ; + } // check non ancora inseriti nel dialogo int nOptExpTime = GetPrivateProfileInt( sSec.c_str(), "OptExpDays", 0, szFile) ; if ( nOptExpTime != 0) - ((CDateTimeCtrl*)GetDlgItem( IDC_OPT_EXPIR))->SetTime( &CTime( nOptExpTime * 24 * 3600)) ; + ((CDateTimeCtrl*)GetDlgItem( IDC_OPT_EXPIR))->SetTime( &CTime( unsigned( nOptExpTime) * 24 * 3600)) ; return true ; } @@ -355,6 +369,10 @@ CKeyGeneratorDlg::OnGenerate( void) nOpt1 += ( 1 << j) ; } unsigned int nOpt2 = 0 ; + for ( int i = IDC_CHECK2_01, j = 0 ; i <= IDC_CHECK2_16 ; ++ i, ++ j) { + if ( ((CButton*)GetDlgItem( i))->GetCheck() == BST_CHECKED) + nOpt2 += ( 1 << j) ; + } if ( ! mKey.SetOptions( nOpt1, nOpt2)) { AfxMessageBox( L"Inserisci Opzioni valide") ; return ; @@ -375,7 +393,7 @@ CKeyGeneratorDlg::OnGenerate( void) WritePrivateProfileInt( "Licence", "OptExpDays", nOptDays, AfxGetApp()->m_pszProfileName) ; // verifico la protezione string sPKey = GetPrivateProfileStringUtf8( "General", "Key", "", AfxGetApp()->m_pszProfileName) ; - if ( VerifyKey( sPKey, 1230, 16, 10) != KEY_OK) + if ( VerifyKey( sPKey, 823, 16, 10) != KEY_OK) return ; // calcolo la chiave if ( ! mKey.CalcKey()) { diff --git a/resource.h b/resource.h index b7afe04ae1aea585b14187af9df4ce0a30e25bcb..28c2631c715b3055bbca2b3d3d9b8dc07e8f6764 100644 GIT binary patch delta 383 zcmZ9II}Uf93TNCv|^samO8eesT-O+l{w34??$|DQtQN2kF35~{xx&e z6ja&kFIJfF$(BFR!lbRIq3CI-fb0*tGtF)snS)B1Z~shz z$(HgZRXmbXOl4{Z`%CoBP!mCG7DiM3$t+M)te{^_1f|IfNFTT0#rj7^=kW9fa_dom delta 22 ecmZ3XH9>B}3ZBgegq|@n8c$9X5}&+JBntp%e+Y2^