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