Risolto conflitto dovuto all'eliminiazione della classe TDongle locale
usando quella di libreria git-svn-id: svn://10.65.10.50/trunk@6206 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5c27fd8d63
commit
e7719da42f
497
ba/ba1500.cpp
497
ba/ba1500.cpp
@ -8,9 +8,8 @@
|
||||
#include <utility.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#ifndef _DEMO_
|
||||
#include <hlapi_c.h>
|
||||
#endif
|
||||
#define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
||||
#define BITSET(w,p,v) ((v) ? ((w) |= (0x0001 << (p))) : ((w) &= (~(0x0001 << (p)))))
|
||||
|
||||
#include "ba1.h"
|
||||
#include "ba1500.h"
|
||||
@ -25,295 +24,6 @@
|
||||
#define LBYTEMASK 0x00FF
|
||||
#define UBYTEMASK 0xFF00
|
||||
|
||||
#define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
||||
#define BITSET(w,p,v) ((v) ? ((w) |= (0x0001 << (p))) : ((w) &= (~(0x0001 << (p)))))
|
||||
|
||||
TDongle::TDongle()
|
||||
: _type(_user_key), _serno(0xFFFF), _dirty(FALSE),
|
||||
_max_users(1), _year_assist(1997)
|
||||
{
|
||||
memset(_eprom, 0, sizeof(_eprom));
|
||||
}
|
||||
|
||||
void TDongle::garble(word k[4]) const
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
INT_OFF();
|
||||
HL_ON(_port, ModAd);
|
||||
K_EYE(_port, k, HLBLOCK);
|
||||
HL_OFF(_port);
|
||||
INT_ON();
|
||||
#else
|
||||
HL_CODE(EYECAST k, 1); // HLBLOCK = 1
|
||||
#endif
|
||||
|
||||
#endif // _DEMO_
|
||||
}
|
||||
|
||||
bool TDongle::already_programmed() const
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
word data[4];
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (data[0] < 1997 || data[0] > 2997)
|
||||
return FALSE;
|
||||
|
||||
if (data[1] == 0 || data[1] >= 10000)
|
||||
return FALSE;
|
||||
|
||||
const TDate today(TODAY);
|
||||
const long& giulio = (const long&)data[2];
|
||||
const long yyyymmdd = today.julian2date(giulio);
|
||||
const TDate d(yyyymmdd);
|
||||
if (d.year() < 1997 || d > today)
|
||||
return FALSE;
|
||||
#endif // _DEMO_
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TDongle::login(bool test_all_keys)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
_type = _user_key;
|
||||
|
||||
#ifdef _DEMO_
|
||||
_serno = 0;
|
||||
#else
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
if (test_all_keys)
|
||||
{
|
||||
if (Hl_Port(AGAADR) != 0)
|
||||
_type = _aga_key;
|
||||
else
|
||||
if (Hl_Port(PRASSIADR) != 0)
|
||||
_type = _prassi_key;
|
||||
else
|
||||
if (Hl_Port(PROCOMADR) != 0)
|
||||
_type = _prcom_key;
|
||||
}
|
||||
_port = Hl_Port(USERADR);
|
||||
#else
|
||||
if (test_all_keys)
|
||||
{
|
||||
HL_LOGOUT();
|
||||
if (HL_LOGIN(AGAADR, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||
_type = _aga_key;
|
||||
else
|
||||
{
|
||||
HL_LOGOUT();
|
||||
if (HL_LOGIN(PRASSIADR, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||
_type = _prassi_key;
|
||||
else
|
||||
{
|
||||
HL_LOGOUT();
|
||||
if (HL_LOGIN(PROCOMADR, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||
_type = _procom_key;
|
||||
}
|
||||
}
|
||||
}
|
||||
HL_LOGOUT();
|
||||
ok = HL_LOGIN(USERADR, DONT_CARE, REFKEY, VERKEY) == STATUS_OK;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
HL_READBL((char*)_eprom);
|
||||
|
||||
word data[4];
|
||||
memcpy(data, _eprom, sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (data[0] == 0xFAE8)
|
||||
_serno = data[1];
|
||||
else
|
||||
{
|
||||
if (data[0] == 0x3283) // chiave programmatori !!
|
||||
{
|
||||
#ifdef DBG
|
||||
// _type = _aga_key; // eliminato perché giudicato troppo pericoloso
|
||||
// se la DBG version arriva nelle mani di qualcuno
|
||||
// ci inchiappetta tutti i programmi senza darci una lira!
|
||||
|
||||
#endif // DBG
|
||||
_serno = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // SCOUNIX
|
||||
#endif // _DEMO_
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (_serno > 0)
|
||||
{
|
||||
const bool already = already_programmed();
|
||||
|
||||
_module.reset();
|
||||
_module.set(0, TRUE);
|
||||
const int last_word = already ? 12 : 4;
|
||||
word data[4];
|
||||
|
||||
// Legge flag di attivazione dei moduli
|
||||
for (int i = 0; i < last_word; i += 4)
|
||||
{
|
||||
memcpy(data, &_eprom[48+i], sizeof(data));
|
||||
garble(data);
|
||||
if (data[3] == _serno) // Validate block
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
word parola = data[j] ^ _serno;
|
||||
if (parola)
|
||||
{
|
||||
for (int b = 15; b >= 0; b--)
|
||||
{
|
||||
if (BITTEST(parola, b))
|
||||
{
|
||||
const word bit = i * 12 + j * 16 + b;
|
||||
_module.set(bit + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Legge anno di assitenza e numero massimo di utenti
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (already)
|
||||
{
|
||||
_year_assist = data[0];
|
||||
_max_users = data[1];
|
||||
const long& giulio = (const long&)data[2];
|
||||
const long yyyymmdd = _last_update.julian2date(giulio);
|
||||
_last_update = yyyymmdd;
|
||||
}
|
||||
else
|
||||
{
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
_dirty = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_type != _user_key)
|
||||
{
|
||||
_module.set(MAX_AUT);
|
||||
_module.set(); // Activate all modules
|
||||
}
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::logout()
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
HL_LOGOUT();
|
||||
#endif
|
||||
_serno = 0xFFFF;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TDongle::write_octect(word reg, word k[4]) const
|
||||
{
|
||||
#ifdef _DEMO_
|
||||
return FALSE;
|
||||
#else
|
||||
int err = STATUS_OK;
|
||||
for (word r = 0; r < 4; r++)
|
||||
{
|
||||
const word address = reg+r;
|
||||
err = HL_WRITE(address, k[r]);
|
||||
if (err != STATUS_OK)
|
||||
{
|
||||
error_box("Errore di scrittura sul registro %u", address);
|
||||
break;
|
||||
}
|
||||
#ifdef DBG
|
||||
word test;
|
||||
HL_READ(address, (int*)&test);
|
||||
if (test != k[r])
|
||||
error_box("Errore di scrittura sul registro %u", address);
|
||||
#endif // DBG
|
||||
}
|
||||
return err == STATUS_OK;
|
||||
#endif // _DEMO_
|
||||
}
|
||||
|
||||
bool TDongle::burn()
|
||||
{
|
||||
#ifdef _DEMO_
|
||||
return FALSE;
|
||||
#endif // _DEMO_
|
||||
|
||||
if (!dirty() || _serno == 0 || _serno == 0xFFFF)
|
||||
return FALSE;
|
||||
|
||||
word data[4];
|
||||
|
||||
const TDate today(TODAY);
|
||||
const bool already = already_programmed();
|
||||
if (already)
|
||||
{
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
if (data[0] < 1997 || data[0] > 2997)
|
||||
return error_box("On Line Assistance error.");
|
||||
if (data[1] == 0 || data[1] >= 10000)
|
||||
return error_box("Bad users number.");
|
||||
const long& val = (const long&)data[2];
|
||||
const long yyyymmdd = today.julian2date(val);
|
||||
const TDate date(yyyymmdd);
|
||||
if (date > today)
|
||||
return error_box("Too late sir: key has already expired!");
|
||||
}
|
||||
|
||||
data[0] = _year_assist;
|
||||
data[1] = _max_users;
|
||||
long& val = (long&)data[2];
|
||||
val = today.date2julian();
|
||||
garble(data);
|
||||
write_octect(60, data);
|
||||
_last_update = today;
|
||||
|
||||
word module = 1;
|
||||
for (int octect = 0; octect < 3; octect++)
|
||||
{
|
||||
for(int parola = 0; parola < 3; parola++)
|
||||
{
|
||||
word& p = data[parola];
|
||||
p = 0;
|
||||
for (int bit = 0; bit < 16; bit++)
|
||||
{
|
||||
if (active(module))
|
||||
BITSET(p, bit, TRUE);
|
||||
module++;
|
||||
}
|
||||
p ^= _serno;
|
||||
}
|
||||
data[3] = _serno;
|
||||
garble(data);
|
||||
write_octect(48 + 4*octect, data);
|
||||
}
|
||||
|
||||
_dirty = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TInformazione_moduli::TInformazione_moduli()
|
||||
@ -334,7 +44,6 @@ TInformazione_moduli::TInformazione_moduli()
|
||||
const int l = s.len();
|
||||
if (l > 2)
|
||||
{
|
||||
// t = format("%-40s", (const char*)s.right(l-3));
|
||||
t = s.mid(3);
|
||||
t.add(s.left(2));
|
||||
}
|
||||
@ -389,24 +98,27 @@ int TInformazione_moduli::get_module_by_order(int index)
|
||||
return -1;
|
||||
}
|
||||
|
||||
TDongle::KeyType TInformazione_moduli::get_owner(int module) const
|
||||
// Calcola il produttore ufficiale di module
|
||||
TDongleType TInformazione_moduli::get_owner(int module) const
|
||||
{
|
||||
if (module >= 40 && module <= 46)
|
||||
return TDongle::_procom_key;
|
||||
return _procom_dongle;
|
||||
|
||||
const int aut[] = { CMAUT, ATAUT, POAUT, AFAUT, TCAUT, TMAUT,
|
||||
VEAUT, MGAUT, ORAUT, EFAUT, DBAUT, SVAUT, -1 };
|
||||
for (int a = 0; aut[a] >= 0; a++)
|
||||
if (module == aut[a])
|
||||
return TDongle::_aga_key;
|
||||
return _aga_dongle;
|
||||
|
||||
return TDongle::_prassi_key;
|
||||
return _prassi_dongle;
|
||||
}
|
||||
|
||||
bool TInformazione_moduli::test_owner(int module, TDongle::KeyType owner) const
|
||||
// Testa se module appartiene al produttore owner
|
||||
// N.B. L'AGA possiede anche tutti i moduli PRASSI
|
||||
bool TInformazione_moduli::test_owner(int module, TDongleType owner) const
|
||||
{
|
||||
TDongle::KeyType ow = get_owner(module);
|
||||
bool yes = owner == ow || (owner == TDongle::_aga_key && ow == TDongle::_prassi_key);
|
||||
TDongleType ow = get_owner(module);
|
||||
bool yes = owner == ow || (owner == _aga_dongle && ow == _prassi_dongle);
|
||||
return yes;
|
||||
}
|
||||
|
||||
@ -495,9 +207,7 @@ class TAttivazione_moduli : public TApplication
|
||||
TMask* _msk;
|
||||
TInformazione_moduli* _im;
|
||||
|
||||
TDongle _dongle;
|
||||
word _serno;
|
||||
|
||||
word _wanted_users, _wanted_assist;
|
||||
|
||||
protected:
|
||||
@ -518,7 +228,6 @@ protected:
|
||||
void build_key_column();
|
||||
|
||||
bool burn_dongle();
|
||||
TDongle& dongle() { return _dongle; }
|
||||
|
||||
static void keyext(const TString & s, word * v);
|
||||
static void encode_second_key();
|
||||
@ -565,7 +274,7 @@ int TAttivazione_moduli::build_sheet(bool on)
|
||||
riga = d; riga.trim();
|
||||
const int module = _im->get_module_by_order(i);
|
||||
|
||||
const bool ics = module == 0 || (on && _dongle.active(module));
|
||||
const bool ics = module == 0 || (on && ::dongle().active(module));
|
||||
if (ics)
|
||||
{
|
||||
riga.add("X");
|
||||
@ -581,7 +290,7 @@ int TAttivazione_moduli::build_sheet(bool on)
|
||||
|
||||
void TAttivazione_moduli::garble(word k[4]) const
|
||||
{
|
||||
_dongle.garble(k);
|
||||
::dongle().garble(k);
|
||||
}
|
||||
|
||||
void TAttivazione_moduli::garble(word n, TString& str) const
|
||||
@ -643,14 +352,14 @@ void TAttivazione_moduli::build_key_column()
|
||||
}
|
||||
sf.force_update();
|
||||
|
||||
_msk->set(F_USERS, _dongle.max_users());
|
||||
_msk->set(F_ASSIST, _dongle.year_assist());
|
||||
_msk->set(F_USERS, ::dongle().max_users());
|
||||
_msk->set(F_ASSIST, ::dongle().year_assist());
|
||||
}
|
||||
|
||||
bool TAttivazione_moduli::burn_dongle()
|
||||
{
|
||||
bool ok = _dongle.type() == TDongle::_user_key;
|
||||
|
||||
TDongle& din = ::dongle();
|
||||
bool ok = din.type() == _user_dongle;
|
||||
if (ok)
|
||||
{
|
||||
TString16 str, key;
|
||||
@ -665,28 +374,24 @@ bool TAttivazione_moduli::burn_dongle()
|
||||
garble(module, str);
|
||||
if (key == str)
|
||||
{
|
||||
if (!_dongle.active(module) &&
|
||||
if (!din.active(module) &&
|
||||
yesno_box("Confermare l'attivazione del modulo %d:\n%s",
|
||||
module, riga->get(0)))
|
||||
{
|
||||
_dongle.activate(module);
|
||||
}
|
||||
din.activate(module);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_dongle.active(module) &&
|
||||
if (din.active(module) &&
|
||||
yesno_box("Confermare la disattivazione del modulo %d:\n%s",
|
||||
module, riga->get(0)))
|
||||
{
|
||||
_dongle.deactivate(module);
|
||||
}
|
||||
din.deactivate(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_dongle.dirty())
|
||||
if (din.dirty())
|
||||
{
|
||||
ok = _dongle.burn();
|
||||
ok = din.burn();
|
||||
if (!ok)
|
||||
error_box("Impossibile riprogrammare la chiave");
|
||||
}
|
||||
@ -723,8 +428,8 @@ bool TAttivazione_moduli::change_users_handler(TMask_field& fld, KEY key)
|
||||
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||
|
||||
TDongle& dongle = app().dongle();
|
||||
if (dongle.type() == TDongle::_user_key)
|
||||
TDongle& dongle = ::dongle();
|
||||
if (dongle.type() == _user_dongle)
|
||||
m.set(101, dongle.max_users());
|
||||
else
|
||||
{
|
||||
@ -735,7 +440,7 @@ bool TAttivazione_moduli::change_users_handler(TMask_field& fld, KEY key)
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
const int utenti = m.get_int(101);
|
||||
if (dongle.type() == TDongle::_user_key)
|
||||
if (dongle.type() == _user_dongle)
|
||||
{
|
||||
if (utenti > 0 && utenti < 10000)
|
||||
{
|
||||
@ -798,8 +503,8 @@ bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key)
|
||||
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||
|
||||
TDongle& dongle = app().dongle();
|
||||
if (dongle.type() == TDongle::_user_key)
|
||||
TDongle& dongle = ::dongle();
|
||||
if (dongle.type() == _user_dongle)
|
||||
m.set(101, dongle.year_assist());
|
||||
else
|
||||
{
|
||||
@ -810,7 +515,7 @@ bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key)
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
const word year = m.get_int(101);
|
||||
if (dongle.type() == TDongle::_user_key)
|
||||
if (dongle.type() == _user_dongle)
|
||||
{
|
||||
if (year > dongle.year_assist() && year <= 2997)
|
||||
{
|
||||
@ -868,45 +573,37 @@ bool TAttivazione_moduli::aga_handler(TMask_field& fld, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TAttivazione_moduli::generate_key()
|
||||
{
|
||||
word ud[4];
|
||||
const TDate oggi(TODAY);
|
||||
const int nmod = build_sheet();
|
||||
|
||||
#ifndef _DEMO_
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
INT_OFF();
|
||||
HL_ON(_port, USERADR);
|
||||
ud[0] = HL_RD(_port, 48);
|
||||
ud[1] = HL_RD(_port, 49);
|
||||
ud[2] = HL_RD(_port, 50);
|
||||
ud[3] = HL_RD(_port, 51);
|
||||
HL_OFF(_port);
|
||||
INT_ON();
|
||||
#else
|
||||
HL_READ(48, (int*)&ud[0]);
|
||||
HL_READ(49, (int*)&ud[1]);
|
||||
HL_READ(50, (int*)&ud[2]);
|
||||
HL_READ(51, (int*)&ud[3]);
|
||||
#endif
|
||||
#endif // _DEMO_
|
||||
|
||||
_msk->set(F_K2, format("%04X%04X%04X%04X", ud[0], ud[1], ud[2], ud[3]));
|
||||
int nmod = build_sheet();
|
||||
ud[0] = _dongle.number();
|
||||
ud[1] = K1 | (nmod & LBYTEMASK);
|
||||
|
||||
long & l = (long &) ud[2];
|
||||
TDate d(TODAY);
|
||||
l = d.year()*10000L + d.month()*100L + d.day();
|
||||
if (::dongle().hardware() == _dongle_hardlock)
|
||||
{
|
||||
word ud[4];
|
||||
::dongle().read_words(48, 4, ud);
|
||||
_msk->set(F_K2, format("%04X%04X%04X%04X", ud[0], ud[1], ud[2], ud[3]));
|
||||
|
||||
garble(ud);
|
||||
_msk->set(F_K1, format("%04X%04X%04X%04X", ud[0], ud[1], ud[2], ud[3]));
|
||||
_msk->set(F_SN, _dongle.number());
|
||||
_msk->set(F_DT, d);
|
||||
ud[0] = ::dongle().number();
|
||||
ud[1] = K1 | (nmod & LBYTEMASK);
|
||||
long& l = (long&)ud[2];
|
||||
l = oggi.year()*10000L + oggi.month()*100L + oggi.day();
|
||||
|
||||
_msk->set(F_USERS, _dongle.max_users());
|
||||
_msk->set(F_ASSIST, _dongle.year_assist());
|
||||
garble(ud);
|
||||
_msk->set(F_K1, format("%04X%04X%04X%04X", ud[0], ud[1], ud[2], ud[3]));
|
||||
}
|
||||
else
|
||||
{
|
||||
_msk->hide(F_K1);
|
||||
_msk->hide(F_K2);
|
||||
_msk->hide(F_K3);
|
||||
_msk->hide(F_K4);
|
||||
}
|
||||
|
||||
_msk->set(F_SN, ::dongle().number());
|
||||
_msk->set(F_DT, oggi);
|
||||
_msk->set(F_USERS, ::dongle().max_users());
|
||||
_msk->set(F_ASSIST, ::dongle().year_assist());
|
||||
}
|
||||
|
||||
int hexdigit(char c)
|
||||
@ -965,24 +662,7 @@ bool TAttivazione_moduli::user_hnd(TMask_field & f, KEY k)
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
keyext(k4, ud2);
|
||||
#ifndef _DEMO_
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
word port = app()._dongle.port();
|
||||
INT_OFF();
|
||||
HL_ON(port, ModAd);
|
||||
HL_WR(port, 48, ud2[0]);
|
||||
HL_WR(port, 49, ud2[1]);
|
||||
HL_WR(port, 50, ud2[2]);
|
||||
HL_WR(port, 51, ud2[3]);
|
||||
HL_OFF(port);
|
||||
INT_ON();
|
||||
#else
|
||||
HL_WRITE(48, ud2[0]);
|
||||
HL_WRITE(49, ud2[1]);
|
||||
HL_WRITE(50, ud2[2]);
|
||||
HL_WRITE(51, ud2[3]);
|
||||
#endif
|
||||
#endif // _DEMO_
|
||||
::dongle().write_words(48, 4, ud2);
|
||||
}
|
||||
else
|
||||
sf.force_update();
|
||||
@ -1007,11 +687,11 @@ bool TAttivazione_moduli::date_hnd(TMask_field& f, KEY k)
|
||||
if (data > oggi)
|
||||
return f.error_box("La data deve essere antecedente a quella di sistema");
|
||||
|
||||
const TDate& last_update = app()._dongle.last_update();
|
||||
const TDate& last_update = ::dongle().last_update();
|
||||
if (data < last_update)
|
||||
return f.error_box("La data deve essere successiva al %s", last_update.string());
|
||||
|
||||
const int year_assist = app()._dongle.year_assist()+1;
|
||||
const int year_assist = ::dongle().year_assist()+1;
|
||||
if (data.year() > year_assist)
|
||||
return f.error_box("La data deve essere antecedente al 31-12-%d", year_assist);
|
||||
}
|
||||
@ -1148,13 +828,13 @@ void TAttivazione_moduli::print_request()
|
||||
TForm_item& manut = form.find_field('B', odd_page, 105);
|
||||
|
||||
TInstall_ini ini;
|
||||
const bool special = _wanted_assist > _dongle.year_assist() || _wanted_users != 0;
|
||||
const word users = max(_wanted_users, _dongle.max_users());
|
||||
const bool special = _wanted_assist > ::dongle().year_assist() || _wanted_users != 0;
|
||||
const word users = max(_wanted_users, ::dongle().max_users());
|
||||
|
||||
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
||||
for (TDongle::KeyType owner = TDongle::_aga_key;
|
||||
owner <= TDongle::_procom_key;
|
||||
owner = TDongle::KeyType(owner+1))
|
||||
for (TDongleType owner = _aga_dongle;
|
||||
owner <= _procom_dongle;
|
||||
owner = TDongleType(owner+1))
|
||||
{
|
||||
int found = 0;
|
||||
TString str;
|
||||
@ -1162,7 +842,7 @@ void TAttivazione_moduli::print_request()
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
const int module = _im->get_module_by_order(r);
|
||||
const bool active = _dongle.active(module);
|
||||
const bool active = ::dongle().active(module);
|
||||
const bool wanted = *row->get(1) > ' ';
|
||||
|
||||
if (!special && active)
|
||||
@ -1176,7 +856,7 @@ void TAttivazione_moduli::print_request()
|
||||
{
|
||||
printer().open();
|
||||
form.update_serno(_msk->get(F_SN));
|
||||
form.update_dongle(_dongle);
|
||||
form.update_dongle(::dongle());
|
||||
}
|
||||
|
||||
str.format("%3d", ++found);
|
||||
@ -1194,7 +874,7 @@ void TAttivazione_moduli::print_request()
|
||||
if (active)
|
||||
{
|
||||
real old_full, old_assist;
|
||||
ini.prices(str, _dongle.max_users(), old_full, old_assist);
|
||||
ini.prices(str, ::dongle().max_users(), old_full, old_assist);
|
||||
full -= old_full;
|
||||
assist -= old_assist;
|
||||
}
|
||||
@ -1218,11 +898,11 @@ void TAttivazione_moduli::print_request()
|
||||
num.set(str);
|
||||
|
||||
str.format("Variazione del numero utenti da %u a %u",
|
||||
_dongle.max_users(), _wanted_users);
|
||||
::dongle().max_users(), _wanted_users);
|
||||
descr.set(str);
|
||||
form.print(-1);
|
||||
}
|
||||
if (_wanted_assist > _dongle.year_assist())
|
||||
if (_wanted_assist > ::dongle().year_assist())
|
||||
{
|
||||
str.format("%3d", ++found);
|
||||
num.set(str);
|
||||
@ -1287,7 +967,7 @@ void TAttivazione_moduli::print_answer()
|
||||
str.format("%3d", ++found);
|
||||
num.set(str);
|
||||
str.format("Variazione del numero utenti da %u a %u",
|
||||
_dongle.max_users(), _wanted_users);
|
||||
::dongle().max_users(), _wanted_users);
|
||||
descr.set(str);
|
||||
garble_user(_wanted_users, str);
|
||||
codice.set(str);
|
||||
@ -1315,7 +995,7 @@ void TAttivazione_moduli::print_answer()
|
||||
|
||||
void TAttivazione_moduli::print()
|
||||
{
|
||||
if (_dongle.type() == TDongle::_user_key)
|
||||
if (::dongle().type() == _user_dongle)
|
||||
print_request();
|
||||
else
|
||||
print_answer();
|
||||
@ -1323,7 +1003,7 @@ void TAttivazione_moduli::print()
|
||||
|
||||
bool TAttivazione_moduli::create()
|
||||
{
|
||||
bool ok = _dongle.login(TRUE);
|
||||
bool ok = ::dongle().login(TRUE);
|
||||
if (!ok)
|
||||
return FALSE;
|
||||
|
||||
@ -1338,7 +1018,7 @@ bool TAttivazione_moduli::create()
|
||||
_msk->set_handler(F_CHANGEUSERS, change_users_handler);
|
||||
_msk->set_handler(F_CHANGEASSIST, change_assist_handler);
|
||||
_msk->set_handler(F_PRINT, print_handler);
|
||||
if (_dongle.type() == TDongle::_aga_key)
|
||||
if (::dongle().type() == _aga_dongle)
|
||||
{
|
||||
_msk->show(F_AGA);
|
||||
_msk->set_handler(F_AGA, aga_handler);
|
||||
@ -1348,31 +1028,34 @@ bool TAttivazione_moduli::create()
|
||||
sf.set_notify(k_notify);
|
||||
|
||||
const int un = _im->unassigned();
|
||||
const TDongle::KeyType mydongle = _dongle.type();
|
||||
const TDongleType mydongle = ::dongle().type();
|
||||
switch (mydongle)
|
||||
{
|
||||
case TDongle::_user_key:
|
||||
case _user_dongle:
|
||||
{
|
||||
_msk->disable(F_K1);
|
||||
_msk->disable(F_K2);
|
||||
_msk->set_handler(F_K4, user_hnd);
|
||||
|
||||
if (::dongle().hardware() == _dongle_hardlock)
|
||||
{
|
||||
_msk->disable(F_K1);
|
||||
_msk->disable(F_K2);
|
||||
_msk->set_handler(F_K4, user_hnd);
|
||||
}
|
||||
_msk->enable(F_DT);
|
||||
_msk->set_handler(F_DT, date_hnd);
|
||||
|
||||
generate_key();
|
||||
// sf.enable_column(F_ENABLE, FALSE);
|
||||
sf.enable_column(F_KEY, serno() != 0);
|
||||
}
|
||||
break;
|
||||
case TDongle::_prassi_key:
|
||||
case TDongle::_aga_key:
|
||||
case TDongle::_procom_key:
|
||||
case _prassi_dongle:
|
||||
case _aga_dongle:
|
||||
case _procom_dongle:
|
||||
{
|
||||
_msk->set_handler(F_K2, decode_hnd);
|
||||
_msk->disable(F_K3);
|
||||
_msk->disable(F_K4);
|
||||
|
||||
if (::dongle().hardware() == _dongle_hardlock)
|
||||
{
|
||||
_msk->set_handler(F_K2, decode_hnd);
|
||||
_msk->disable(F_K3);
|
||||
_msk->disable(F_K4);
|
||||
}
|
||||
_msk->set_handler(F_SN, serno_hnd);
|
||||
_msk->enable(F_SN);
|
||||
|
||||
|
12
ba/ba1500a.h
12
ba/ba1500a.h
@ -1,13 +1,13 @@
|
||||
#define F_K1 201
|
||||
#define F_K2 202
|
||||
#define F_K2A 203
|
||||
#define F_K2B 204
|
||||
#define F_K2C 205
|
||||
//#define F_K2A 203
|
||||
//#define F_K2B 204
|
||||
//#define F_K2C 205
|
||||
#define F_K3 206
|
||||
#define F_K4 207
|
||||
#define F_K4A 208
|
||||
#define F_K4B 209
|
||||
#define F_K4C 210
|
||||
//#define F_K4A 208
|
||||
//#define F_K4B 209
|
||||
//#define F_K4C 210
|
||||
#define F_SN 211
|
||||
#define F_DT 212
|
||||
#define F_MODULI 213
|
||||
|
Loading…
x
Reference in New Issue
Block a user