Patch level : 10.0
Files correlati : tutti Ricompilazione Demo : [ ] Commento : Aggiunto log_message per diagnostica su file campo.log Ora utilizzato per verifica login a chiavi hw/sw git-svn-id: svn://10.65.10.50/branches/R_10_00@22592 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d6107f0226
commit
5356e8206f
@ -102,32 +102,6 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
case E_CREATE:
|
||||
if (_application->pre_create())
|
||||
{
|
||||
if (dongle().demo())
|
||||
{
|
||||
const TString16 dname(encode("DATA"));
|
||||
const TString16 hname(encode("ORA"));
|
||||
TConfig c(CONFIG_INSTALL, "Main");
|
||||
TDate data(decode(c.get(dname)));
|
||||
TDate oggi(TODAY);
|
||||
real remaining_time(decode(c.get(hname)));
|
||||
main_app()._start_time = time(NULL);
|
||||
|
||||
if (data < oggi)
|
||||
{
|
||||
data = oggi;
|
||||
c.set(dname, encode(data));
|
||||
c.set(hname, encode("120.00"));
|
||||
}
|
||||
else
|
||||
if (data == oggi)
|
||||
{
|
||||
if (remaining_time <= ZERO)
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Setta il vero menu principale se diverso dal default
|
||||
const int meno = _application->argc() > 1 ? atoi(_application->argv(1)+1) : 0;
|
||||
ignore_xvt_errors(TRUE);
|
||||
@ -287,24 +261,6 @@ void TApplication::stop_run()
|
||||
{
|
||||
if (_savefirm)
|
||||
prefix().set_codditta(_savefirm);
|
||||
if (dongle().demo())
|
||||
{
|
||||
const TString16 hname(encode("ORA"));
|
||||
TConfig c(CONFIG_INSTALL, "Main");
|
||||
real remaining_time(decode(c.get(hname)));
|
||||
if (name() != "ba0100")
|
||||
{
|
||||
time_t wt = time(NULL);
|
||||
int delay = (int) (wt - _start_time);
|
||||
if (delay < 0)
|
||||
remaining_time = ZERO;
|
||||
else
|
||||
remaining_time -= (delay / 60.0);
|
||||
c.set(hname, encode(remaining_time.string()));
|
||||
}
|
||||
else
|
||||
message_box(TR("Questo e' un programma dimostrativo.\nOggi rimangono %s minuti di utilizzo."), remaining_time.string(3, 0));
|
||||
}
|
||||
terminate();
|
||||
|
||||
xvt_app_destroy();
|
||||
|
@ -228,6 +228,8 @@ bool TDongle::hardlock_login(bool test_all_keys)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
log_message("hardlock_login() failed");
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -299,13 +301,13 @@ bool TDongle::hardlock_login(bool test_all_keys)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::eutron_login(bool test_all_keys)
|
||||
bool TDongle::eutron_login(bool /*test_all_keys*/) // AGA dongle pitifully died
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
const char* labels[2] = { "AGA.CAMPO", "25EBAI" };
|
||||
TDongleType types[2] = { _user_dongle, _developer_dongle };
|
||||
for (int k = test_all_keys ? 0 : 1; k < 2; k++)
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
const unsigned char* pwd = (const unsigned char*)::encode(labels[k]);
|
||||
ok = xvt_dongle_sl_login((const unsigned char*)labels[k], pwd) != 0;
|
||||
@ -315,6 +317,8 @@ bool TDongle::eutron_login(bool test_all_keys)
|
||||
_type = types[k];
|
||||
break;
|
||||
}
|
||||
else
|
||||
log_message("eutron_login(\"%s\") failed", labels[k]);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
@ -407,6 +411,8 @@ bool TDongle::ssa_login(const char* mod)
|
||||
else
|
||||
set_developer_permissions();
|
||||
}
|
||||
else
|
||||
log_message("ssa_login() failed with code %d", err);
|
||||
return _serno != 0xFFFF;
|
||||
}
|
||||
|
||||
@ -445,7 +451,9 @@ bool TDongle::network_login(bool test_all_keys)
|
||||
warning_box("ATTENZIONE! Il server di protezione non e' aggiornato:\n"
|
||||
"Controllare la corretta installazione del servizio");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
log_message("rpc_UserLogin(%s, %s) failed", (const char*)server, (const char*)utente);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
bool burn();
|
||||
|
||||
TDongleHardware hardware() const { return _hardware; }
|
||||
bool local() const { return _hardware == _dongle_hardlock || _hardware == _dongle_eutron; }
|
||||
bool local() const { return _hardware != _dongle_network && ok(); }
|
||||
bool network() const { return _hardware == _dongle_network; }
|
||||
const TString& administrator(TString* pwd = NULL) const;
|
||||
int oem() const;
|
||||
|
@ -247,9 +247,8 @@ char* format(
|
||||
// @comm Il funzionamento e' come la <f sprintf> del C, solo che non e' necessario passare la
|
||||
// stringa di destinazione alla funzione.
|
||||
{
|
||||
va_list pars;
|
||||
|
||||
char buf[512];
|
||||
va_list pars;
|
||||
va_start(pars, fmt);
|
||||
const int tot = _vsnprintf(buf, sizeof(buf), fmt, pars);
|
||||
va_end(pars);
|
||||
@ -261,6 +260,36 @@ char* format(
|
||||
return tmp.get_buffer();
|
||||
}
|
||||
|
||||
void log_message(const char* fmt, ...)
|
||||
{
|
||||
static FILE* flog = NULL;
|
||||
|
||||
if (flog == NULL)
|
||||
{
|
||||
const char* const f = "campo.log";
|
||||
const TDate oggi(TODAY);
|
||||
if (oggi.day() <= 3 && fsize(f) > 1024*1024)
|
||||
flog = fopen(f, "w");
|
||||
else
|
||||
flog = fopen(f, "a");
|
||||
}
|
||||
|
||||
if (fmt && *fmt)
|
||||
{
|
||||
TString80 str;
|
||||
time_t t; time(&t);
|
||||
str << ctime(&t);
|
||||
str.rtrim() << ' ';
|
||||
fprintf(flog, (const char*)str);
|
||||
|
||||
va_list pars;
|
||||
va_start(pars, fmt);
|
||||
const int tot = vfprintf(flog, fmt, pars);
|
||||
va_end(pars);
|
||||
}
|
||||
fputc('\n', flog);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Converte la coppia nome-parametro in una stringa che identifica il programma
|
||||
|
@ -37,6 +37,7 @@ const char* itor(int i);
|
||||
bool fcopy(const char* orig, const char* dest, bool append = false, bool advanced = false);
|
||||
bool fexist(const char* file);
|
||||
long fsize(const char* file);
|
||||
void log_message(const char* fmt, ...);
|
||||
|
||||
bool make_dir(const char* dir);
|
||||
bool remove_file(const char* file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user