Commentato l'uso della chiave in demo

git-svn-id: svn://10.65.10.50/trunk@5999 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-01-22 07:57:57 +00:00
parent e8327cfd48
commit 8b22f99c2a

View File

@ -8,7 +8,9 @@
#include <utility.h>
#include <urldefid.h>
#ifndef _DEMO_
#include <hlapi_c.h>
#endif
#include "ba1.h"
#include "ba1500.h"
@ -25,8 +27,6 @@
#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),
@ -36,7 +36,9 @@ TDongle::TDongle()
}
void TDongle::garble(word k[4]) const
{
{
#ifndef _DEMO_
#if XVT_OS == XVT_OS_SCOUNIX
INT_OFF();
HL_ON(_port, ModAd);
@ -46,10 +48,13 @@ void TDongle::garble(word k[4]) const
#else
HL_CODE(EYECAST k, 1);
#endif
#endif // _DEMO_
}
bool TDongle::already_programmed() const
{
{
#ifndef _DEMO_
word data[4];
memcpy(data, &_eprom[60], sizeof(data));
garble(data);
@ -66,8 +71,8 @@ bool TDongle::already_programmed() const
const TDate d(yyyymmdd);
if (d.year() < 1997 || d > today)
return FALSE;
return TRUE;
#endif // _DEMO_
return TRUE;
}
bool TDongle::login(bool test_all_keys)
@ -75,6 +80,9 @@ 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)
{
@ -89,7 +97,6 @@ bool TDongle::login(bool test_all_keys)
}
_port = Hl_Port(USERADR);
#else
if (test_all_keys)
{
HL_LOGOUT();
@ -125,17 +132,19 @@ bool TDongle::login(bool test_all_keys)
{
#ifdef DBG
if (data[0] == 0x3283)
{
// _type = _aga_key;
{
_type = _aga_key;
_serno = 0;
}
#else
if (_type == _user_key)
ok = FALSE;
#endif
#endif // DBG
}
}
#endif // SCOUNIX
#endif // _DEMO_
if (ok)
{
if (_serno > 0)
@ -205,20 +214,24 @@ bool TDongle::login(bool test_all_keys)
_year_assist = _last_update.year();
}
}
#endif
return ok;
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++)
{
@ -234,13 +247,15 @@ bool TDongle::write_octect(word reg, word k[4]) const
HL_READ(address, (int*)&test);
if (test != k[r])
error_box("Errore di scrittura sul registro %u", address);
#endif
#endif // DBG
}
return err == STATUS_OK;
#endif // _DEMO_
}
bool TDongle::burn()
{
return FALSE;
if (!dirty() || _serno == 0 || _serno == 0xFFFF)
return FALSE;
@ -833,8 +848,10 @@ bool TAttivazione_moduli::print_handler(TMask_field& fld, KEY key)
void TAttivazione_moduli::generate_key()
{
#if XVT_OS == XVT_OS_SCOUNIX
word ud[4];
#ifndef _DEMO_
#if XVT_OS == XVT_OS_SCOUNIX
INT_OFF();
HL_ON(_port, USERADR);
ud[0] = HL_RD(_port, 48);
@ -844,17 +861,15 @@ void TAttivazione_moduli::generate_key()
HL_OFF(_port);
INT_ON();
#else
word ud[4];
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_
int nmod;
_msk->set(F_K2, format("%04X%04X%04X%04X", ud[0], ud[1], ud[2], ud[3]));
nmod = build_sheet();
int nmod = build_sheet();
ud[0] = _dongle.number();
ud[1] = K1 | (nmod & LBYTEMASK);
@ -927,6 +942,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();
@ -943,6 +959,7 @@ bool TAttivazione_moduli::user_hnd(TMask_field & f, KEY k)
HL_WRITE(50, ud2[2]);
HL_WRITE(51, ud2[3]);
#endif
#endif // _DEMO_
}
else
sf.force_update();
@ -1382,8 +1399,6 @@ int ba1500(int argc, char** argv)
a.run(argc, argv, "Attivazione moduli");
}
else
{
error_box("L'utente %s non e' abilitato all'esecuzione di questo programma", (const char*)user());
}
return 0;
}