git-svn-id: svn://10.65.10.50/branches/R_10_00@23110 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2015-06-17 07:13:32 +00:00
parent c8927bedaf
commit 9c648a2557
15 changed files with 160 additions and 375 deletions

View File

@ -84,6 +84,7 @@ protected:
void update_preferred();
void add_to_preferred();
void manage_preferred();
void manage_mail();
bool dongle_update_needed() const;
bool test_programs();
@ -1493,9 +1494,9 @@ bool TMenu_application::dongle_update_needed() const
if (remote_name.exist())
{
const long remote_date = xvt_fsys_file_attr(remote_name, XVT_FILE_ATTR_MTIME);
const long local_date = xvt_fsys_file_attr(local_name, XVT_FILE_ATTR_MTIME);
const long local_date = xvt_fsys_file_attr(local_name, XVT_FILE_ATTR_MTIME);
if (remote_date > local_date)
::fcopy(remote_name, local_name);
xvt_fsys_fcopy(remote_name, local_name);
}
}
Tdninst dninst; // file aggiornatissimo ormai ...
@ -1515,7 +1516,7 @@ bool TMenu_application::user_create()
if (dongle().type() == _no_dongle)
{
if (!yesno_box(TR("ATTENZIONE\nQuesto programma è in versione dimostrativa.\n"
"Esso funzionera' con alcune limitazioni sulle registrazioni.\n"
"Esso funzionerà con alcune limitazioni sulle registrazioni.\n"
"Si desidera proseguire?")))
return false;
}
@ -2264,6 +2265,20 @@ void TMenu_application::manage_preferred()
delete m;
}
void TMenu_application::manage_mail()
{
TMask m("ba0100m");
TConfig cfg(CONFIG_USER, "Mail");
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->set(f->field()->read(cfg, "Mail"));
if (m.run() == K_ENTER)
{
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->field()->write(cfg, "Mail", f->get());
}
}
/* Deprecated
int TMenu_application::do_tree()
{
@ -2360,6 +2375,7 @@ bool TMenu_application::menu(MENU_TAG mt)
if (check_user())
_mask->stop_run(K_CTRL + 'R'); // Ricarica maschera
break;
case MENU_ITEM_ID(8): manage_mail(); break;
default:
if (mt >= MENU_ITEM_ID(50) && mt < MENU_ITEM_ID(50+_preferred.items()))
{

View File

@ -1,5 +1,4 @@
#include <config.h>
#include <controls.h>
#include <diction.h>
#include <prefix.h>
#include <toolfld.h>

View File

@ -202,12 +202,17 @@ bool save_campo_xml()
chiavetta.SetAttr("Update", d.last_update().string());
switch (d.hardware())
{
case _dongle_hardlock: chiavetta.SetAttr("Model", "Hardlock"); break;
case _dongle_eutron : chiavetta.SetAttr("Model", "Eutron"); break;
case _dongle_network : chiavetta.SetAttr("Model", "Network server");
case _dongle_network:
case _dongle_ssanet:
chiavetta.SetAttr("Model", "Network server");
chiavetta.SetAttr("Server", d.server_name());
break;
default: chiavetta.SetAttr("Model", "Unknown"); break;
case _dongle_ssa :
chiavetta.SetAttr("Model", "SSA");
break;
default:
chiavetta.SetAttr("Model", "Unknown");
break;
}
TConfig ini("install.ini", "Main");

View File

@ -15,12 +15,12 @@ public:
TProfiler_mask();
};
TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15)
TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 20)
{
add_button_tool(DLG_OK, PR("Elabora"), TOOL_ELABORA);
add_button_tool(DLG_INFO, PR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, PR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, "", TOOL_QUIT);
add_button_tool(DLG_OK, PR("Elabora"), TOOL_ELABORA);
add_button_tool(DLG_INFO, PR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, PR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, "", TOOL_QUIT);
TToken_string codes, items;
codes.add(0); items.add(TR("Tutti i test"));
@ -31,8 +31,8 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15)
codes.add(5); items.add(TR("Lettura causale senza cache"));
codes.add(6); items.add(TR("Creazione e cancellazione records"));
codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo"));
add_radio(101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items);
add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U");
add_radio (101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items);
add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U");
}
@ -42,7 +42,7 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15)
class TTest_application : public TSkeleton_application
{
TProgind* _pi;
TProgress_monitor* _pi;
clock_t start_timer() const;
@ -76,7 +76,7 @@ clock_t TTest_application::start_timer() const
clock_t TTest_application::start_progind(const long items, const char* prompt)
{
CHECK(_pi == NULL, "Double progress indicator");
_pi = new TProgind(items, prompt, true, true);
_pi = new TProgress_monitor(items, prompt, true);
return start_timer();
}
@ -110,7 +110,7 @@ bool TTest_application::test1(TLog_report& log)
msg.format(FR("%ld records %ld msec"), r, clock() - start);
_pi->set_text(msg);
if (!_pi->addstatus(1))
if (!_pi->add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
@ -140,7 +140,7 @@ bool TTest_application::test2(TLog_report& log)
TString80 msg;
{
const int times = 10;
TProgind p(times, TR("Lettura cursore comuni"), TRUE, TRUE);
TProgress_monitor p(times, TR("Lettura cursore comuni"));
start = start_timer();
for (int i = 0; i < times; i++)
{
@ -149,7 +149,7 @@ bool TTest_application::test2(TLog_report& log)
msg.format("Lettura cursore comuni\n%ld records %ld msec", r, clock() - start);
p.set_text(msg);
if (!p.addstatus(1))
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
@ -181,7 +181,7 @@ bool TTest_application::test3(TLog_report& log)
TString256 msg;
{
const int times = 10;
TProgind p(times, TR("Lettura cursore C.A.P."), TRUE, TRUE);
TProgress_monitor p(times, TR("Lettura cursore C.A.P."));
start = start_timer();
for (int i = 0; i < times; i++)
{
@ -216,23 +216,23 @@ bool TTest_application::test4(TLog_report& log)
clock_t start;
{
const int times = 10;
TProgind p(times, TR("Lettura casuale tramite cache"), TRUE, TRUE);
TProgress_monitor p(times, TR("Lettura casuale tramite cache"));
cache().get(LF_COMUNI, cod); // Inizializzazione
start = start_timer();
for (int i = 0; i < times; i++)
{
if (!p.addstatus(1))
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
for (long j = 0; j < 10000; j++)
{
const int rn = rand();
cod.format(" |%c%03d", 'A'+(rn%2), rn % 1000);
cache().get(LF_COMUNI, cod);
r++;
}
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
}
}
@ -255,17 +255,11 @@ bool TTest_application::test5(TLog_report& log)
clock_t start;
{
const int times = 10;
TProgind p(times, TR("Lettura casuale senza cache"), TRUE, TRUE);
TProgress_monitor p(times, TR("Lettura casuale senza cache"));
TLocalisamfile f(LF_COMUNI);
start = start_timer();
for (int i = 0; i < times; i++)
{
if (!p.addstatus(1))
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
for (long j = 0; j < 10000; j++)
{
const int rn = rand();
@ -273,6 +267,12 @@ bool TTest_application::test5(TLog_report& log)
f.put(COM_COM, cod);
f.read();
r++;
}
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
}
}
@ -301,7 +301,7 @@ bool TTest_application::test6(TLog_report& log)
{
tab.put("CODTAB", i+1);
tab.write();
if (!_pi->addstatus(1))
if (!_pi->add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
@ -325,7 +325,7 @@ bool TTest_application::test6(TLog_report& log)
for (cur = 0; cur.pos() < n; ++cur)
{
cur.file().remove();
if (!_pi->addstatus(1))
if (!_pi->add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;

View File

@ -141,14 +141,7 @@ void TRequest_form::update_serno(const TString& num)
const TDate today(TODAY);
TForm_item& data = find_field('H', odd_page, FF_DATARICH);
data.set(today.string());
const char* hw = "";
switch (::dongle().hardware())
{
case _dongle_ssa : hw = "SSA"; break;
case _dongle_hardlock: hw = "HARDLOCK"; break;
default: hw = "EUTRON"; break;
}
find_field('H',odd_page,FF_DONGLE_HW).set(hw);
find_field('H',odd_page,FF_DONGLE_HW).set("SSA");
TForm_item& serno = find_field('H', odd_page, FF_DONGLE_SN);
serno.set(num);
}
@ -216,16 +209,10 @@ protected:
void load_masklistino(TMask & m);
void save_masklistino(TMask & m);
int build_sheet(bool on = true);
void build_key_column();
bool burn_dongle();
static void keyext(const TString & s, word * v);
static void encode_second_key();
static bool date_hnd(TMask_field& f, KEY k);
static bool serno_hnd(TMask_field& f, KEY k);
static bool k_notify(TSheet_field& f, int r, KEY k);
static bool change_users_handler(TMask_field&, KEY key);
static bool maxuser_handler(TMask_field& fld, KEY key);
@ -355,79 +342,6 @@ void TAttivazione_moduli::garble_year(word y, TString& str1, TString& str2) cons
str2 = garble_md5(y);
}
void TAttivazione_moduli::build_key_column()
{
TWait_cursor hourglass;
TSheet_field& sf = _msk->sfield(F_MODULI);
sf.enable_column(F_KEY, false);
const TDongle& d = dongle();
TString8 tmp1, tmp2;
FOR_EACH_SHEET_ROW_BACK(sf, i, riga)
{
if (!sf.cell_disabled(i, 1))
{
const int module = riga->get_int(2);
garble_module(module, tmp1, tmp2);
#ifdef DBG
if (d.type() == _developer_dongle)
riga->add(tmp2, 3); else // Backdoor di debug: mostra chiave web
#endif
riga->add(tmp1, 3); // Normalmente mostra chiave hardware
}
}
sf.force_update();
_msk->set(F_USERS, d.max_users());
_msk->set(F_ASSIST, d.year_assist());
}
bool TAttivazione_moduli::burn_dongle()
{
TDongle& din = ::dongle();
bool ok = din.type() == _user_dongle;
if (ok)
{
TString16 key;
TSheet_field& sf = _msk->sfield(F_MODULI);
FOR_EACH_SHEET_ROW(sf, i, riga)
{
key = riga->get(3); key.trim();
if (key.not_empty())
{
const int module = riga->get_int(2);
TString8 str1, str2;
garble_module(module, str1, str2);
const bool good = (key == str1) || (key == str2);
if (good)
{
if (!din.active(module) &&
yesno_box(FR("Confermare l'attivazione del modulo %d:\n%s"),
module, riga->get(0)))
din.activate(module);
}
else
{
if (din.active(module) &&
yesno_box(FR("Confermare la disattivazione del modulo %d:\n%s"),
module, riga->get(0)))
din.deactivate(module);
}
}
}
if (din.dirty())
{
ok = din.burn();
if (!ok)
error_box(TR("Impossibile riprogrammare la chiave"));
}
}
return ok;
}
bool TAttivazione_moduli::maxuser_handler(TMask_field& fld, KEY key)
{
bool ok = true;
@ -666,47 +580,12 @@ void TAttivazione_moduli::init_mask()
const TDate oggi(TODAY);
const int nmod = build_sheet();
const TDongle& d = ::dongle();
switch (d.hardware())
{
case _dongle_hardlock: _msk->set_caption(TR("Attivazione HARDLOCK")); break;
case _dongle_eutron : _msk->set_caption(TR("Attivazione EUTRON")); break;
default : _msk->set_caption(TR("Attivazione SSA")); break;
}
_msk->set(F_SN, d.number());
_msk->set(F_DT, oggi);
_msk->set(F_USERS, d.max_users());
_msk->set(F_ASSIST, d.year_assist());
}
bool TAttivazione_moduli::serno_hnd(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
app().build_key_column();
return true;
}
bool TAttivazione_moduli::date_hnd(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
const TDate data(f.get());
const TDate oggi(TODAY);
if (data > oggi)
return f.error_box(FR("La data deve essere antecedente a quella di sistema"));
/*
const TDate& last_update = ::dongle().last_update();
if (data < last_update)
return f.error_box(FR("La data deve essere successiva al %s"), last_update.string());
const int year_assist = ::dongle().year_assist()+1;
if (data.year() > year_assist)
return f.error_box(FR("La data deve essere antecedente al 31-12-%d"), year_assist);
*/
}
return true;
}
bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k)
{
if (k == K_INS || k == K_DEL)
@ -971,19 +850,6 @@ bool TAttivazione_moduli::create()
return false; // Aggiornamento automatico riuscito!
}
if (d.hardware() == _dongle_network)
{
if (yesno_box(TR("Questo programma non puo' essere utilizzato in quanto è in funzione il server di autorizzazioni.\n"
"Si desidera connettersi al server per effettuare le operazioni di attivazione?")))
{
TString server = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
if (server.find(':') < 0)
server << ":1883";
server.insert("http://");
xvt_sys_goto_url(server, "open");
}
return false;
}
_im = new TInformazione_moduli;
@ -992,50 +858,11 @@ bool TAttivazione_moduli::create()
_msk = new TMask("ba1500a") ;
_msk->set_handler(F_CHANGEUSERS, change_users_handler);
_msk->set_handler(F_CHANGEASSIST, change_assist_handler);
_msk->set_handler(DLG_PRINT, print_handler);
TDongleType mydongle = ::dongle().type();
#ifdef DBG
if (mydongle == _developer_dongle && is_power_reseller(true))
mydongle = _aga_dongle;
#endif
if (mydongle == _aga_dongle)
{
_msk->show(F_AGA);
_msk->set_handler(F_AGA, aga_handler);
}
TSheet_field& sf = _msk->sfield(F_MODULI);
sf.set_notify(k_notify);
const bool can_edit = serno() != 0 && d.hardware() != _dongle_ssa;
switch (mydongle)
{
case _user_dongle:
_msk->set_handler(F_DT, date_hnd);
case _developer_dongle:
init_mask();
_serno=_msk->get_int(F_SN);
sf.enable_column(F_ENABLE, can_edit);
sf.enable_column(F_KEY, can_edit);
break;
case _aga_dongle:
_msk->set_handler(F_SN, serno_hnd);
_msk->enable(F_SN);
init_mask();
_serno=_msk->get_int(F_SN);
build_sheet(false);
sf.enable_column(1, can_edit);
build_key_column();
break;
default:
break;
}
enable_menu_item(M_FILE_PG_SETUP);
enable_menu_item(M_FILE_PRINT);
return TSkeleton_application::create();
@ -1050,19 +877,12 @@ bool TAttivazione_moduli::destroy()
void TAttivazione_moduli::main_loop()
{
if (_msk->run() == K_ENTER)
burn_dongle();
_msk->run();
}
int ba1500(int argc, char** argv)
{
// dipende dalla check_parameters fatta in main()
if (user() == ::dongle().administrator())
{
TAttivazione_moduli a ;
a.run(argc, argv, TR("Attivazione moduli"));
}
else
error_box(FR("Utente %s non abilitato all'attivazione"), (const char*)user());
TAttivazione_moduli a ;
a.run(argc, argv, TR("Stato attivazione moduli"));
return 0;
}

View File

@ -8,11 +8,8 @@
#define F_DT 212
#define F_MODULI 213
#define F_USERS 214
#define F_CHANGEUSERS 215
#define F_ASSIST 216
#define F_CHANGEASSIST 217
#define F_PRINT 218
#define F_AGA 219
/*
#define F_AGGLISTINO 220
@ -23,7 +20,6 @@
#define F_NOMEMOD 101
#define F_ENABLE 102
#define F_CODE 103
#define F_KEY 104
#define FF_DATARICH 101

View File

@ -11,55 +11,33 @@ END
ENDPAGE
PAGE "Attivazione Moduli" -1 -1 79 21
PAGE "Stato Attivazione Moduli" -1 -1 79 21
STRING F_SN 5
BEGIN
PROMPT 54 1 "N.Serie "
PROMPT 1 0 "Numero di serie "
FLAGS "DUZ"
END
DATE F_DT
BEGIN
PROMPT 54 2 "Data "
FLAGS "A"
END
NUMBER F_USERS 4
BEGIN
PROMPT 54 3 "Utenti "
PROMPT 31 0 "Utenti "
FLAGS "D"
END
BUTTON F_CHANGEUSERS 6 1
BEGIN
PROMPT 71 3 "Cambia"
END
NUMBER F_ASSIST 4
BEGIN
PROMPT 54 4 "Assistenza "
PROMPT 54 0 "Assistenza "
FLAGS "D"
END
BUTTON F_CHANGEASSIST 6 1
BEGIN
PROMPT 71 4 "Cambia"
END
BUTTON F_AGA 18
BEGID
PROMPT 22 4 " Dati Release "
FLAGS "H"
END
SPREADSHEET F_MODULI 78
BEGIN
PROMPT 1 5 "Moduli"
PROMPT 1 1 "Moduli"
ITEM "Modulo@40"
ITEM "Att."
ITEM "Cod."
ITEM "Chiave@8"
FLAGS "D"
END
ENDPAGE
@ -85,12 +63,6 @@ BEGIN
FLAGS "D"
END
STRING F_KEY 8
BEGIN
PROMPT 1 6 "Chiave "
FLAGS "U"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""

View File

@ -67,7 +67,7 @@ bool update_dninst(bool force)
bool update_assistance_year()
{
TDongle& donkey = dongle();
const bool remote = donkey.hardware() == _dongle_network;
const bool remote = donkey.network();
update_dninst(true);
@ -84,12 +84,7 @@ bool update_assistance_year()
if (dninst.find_serno())
{
donkey.set_year_assist(dninst_year);
bool done = false;
if (remote)
done = rpc_DongleYearActivate(dninst_year);
else
done = donkey.burn();
return done || show_error(TR("Errore di aggiornamento della chiave di protezione"));
return true;
} //if(sn==serno...
else
{

View File

@ -286,25 +286,7 @@ bool TInstaller_mask::should_precheck_module(int modnumber) const
//che tipo di installazione e'?
int TInstaller_mask::test_station_type() const
{
TConfig ini(CONFIG_INSTALL, "Main");
int type = ini.get_int("Type");
//se type non e' definito nei valori giusti (1=standard,2=server,3=client)
if (type < 1 || type > 3)
{
const bool testdb = ini.get_bool("TestDatabase");
//const bool testprg = ini.get_bool("TestPrograms");
if (testdb)
{
if (dongle().hardware() == _dongle_network) //se usa un server di chiavi->server
type = 2;
else
type = 1;
}
else
type = 3;
ini.set("Type", type); //cosi' lo definisce se non c'e'
}
const int type = ini_get_int(CONFIG_INSTALL, "Main", "Type", 1);
return type;
}
@ -338,7 +320,7 @@ int TInstaller_mask::precheck_modules(bool only_newer)
bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease;
// non spunta automaticamente il modulo server su installazioni che non siano server
if (cod_module == "sr" && (test_station_type() != 2 || !xvt_sys_dongle_server_is_running()))
if (cod_module == "sr" && (test_station_type() != 2 || !xvt_sys_dongle_server_running()))
{
chk = false;
disable_row(r);
@ -559,14 +541,13 @@ bool TInstaller_mask::autoload()
if (internet) //internet patches
{
TProgress_monitor pi(1, TR("Controllo lista aggiornamenti"), false); // progind NON bloccabile: causa errore impossibile!
http_dir(http_server, http_path, modules);
pi.set_max(modules.items());
pi.set_text(TR("Download lista aggiornamenti"));
{
TProgress_monitor pi(1, TR("Controllo lista aggiornamenti"), false); // progind NON bloccabile: causa errore impossibile!
http_dir(http_server, http_path, modules);
}
TProgress_monitor pi(modules.items(), TR("Download lista aggiornamenti"));
for (int i = modules.last(); i >= 0; i--)
{
if (!pi.add_status())
break;
TString& str = modules.row(i);
if (str.ends_with("a.ini", true))
{
@ -596,6 +577,9 @@ bool TInstaller_mask::autoload()
}
else
modules.destroy(i);
if (!pi.add_status())
break;
}
modules.pack();
}
@ -1804,7 +1788,7 @@ bool TInstaller_mask::on_key(KEY key)
bool TInstaller_mask::is_program_dir(const TFilename& path)
{
//controlla l'esistenza di alcuni files chiave di campo
const char* const essential[] = {"install.ini", "campo.ini", "campo.aut", "ba0.exe", "xvaga.dll", NULL };
const char* const essential[] = {"install.ini", "campo.ini", "campo.aut", "ba0.exe", "ba1.exe", "xvaga.dll", NULL };
bool ok = true;
for (int i = 0; ok && essential[i]; i++)
{
@ -1915,13 +1899,13 @@ protected:
protected:
virtual bool create();
virtual bool use_files() const { return false; }
virtual bool test_assistance_year() const;
virtual bool test_assistance_year(bool verbose) const;
virtual void main_loop();
void convert_archives();
};
bool TInstaller::test_assistance_year() const
bool TInstaller::test_assistance_year(bool) const
{
// Per il momento lascia continuare: ci pensa poi la create
return true;
@ -1929,21 +1913,13 @@ bool TInstaller::test_assistance_year() const
bool TInstaller::create()
{
if (!TApplication::test_assistance_year(true))
{
TExternal_app attivazione("ba1 -4");
attivazione.run();
dongle().login(); // Rilegge anno assistenza
}
else
update_dninst(false); // Aggiorna se necessario
//crea la maschera di installazione
_m = new TInstaller_mask();
_m = new TInstaller_mask();
//se e' un client
//se e' un client
if (_m->station_type() == 3)
{
update_dninst(false); // Aggiorna se necessario
_m->disable_check();
_m->disable(F_UPDATE);
_m->disable(DLG_USER);

View File

@ -8,17 +8,20 @@ bool run_as_admin()
bool yes = true;
TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista
OSVERSIONINFO VerInfo;
OSVERSIONINFO VerInfo = { 0 };
VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&VerInfo);
::GetVersionEx(&VerInfo);
if (VerInfo.dwMajorVersion >= 6) // If Vista or newer,
{
HANDLE hToken; // read elevation type
BOOL bOK = OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
DWORD infoLen;
yes = GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve
&elevationType, // receives return value
sizeof(elevationType), &infoLen) != 0; // receives returned length
HANDLE hToken = NULL; // read elevation type
BOOL bOK = ::OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
if (bOK)
{
DWORD infoLen;
yes = ::GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve
&elevationType, // receives return value
sizeof(elevationType), &infoLen) != 0; // receives returned length
}
}
return yes;
}

View File

@ -116,7 +116,7 @@ int TStampa_deleghe_IVA::select()
TToken_string d(80);
_ditte->destroy();
begin_wait();
xvt_scr_set_busy_cursor();
for (_nditte->first(); _nditte->good(); _nditte->next())
{
TLocalisamfile& anag = _nditte->lfile(LF_ANAG);
@ -154,7 +154,7 @@ int TStampa_deleghe_IVA::select()
}
}
}
end_wait();
xvt_scr_set_busy_cursor();
int res = 1;
if (_ditte->items() > 0)

View File

@ -842,10 +842,16 @@ void Tdninst_mask::save_sheet()
_dninst.set(key, "*", str.trim());
}
}
if (_dninst.save(10))
int y, v, t, p;
main_app().get_version_info(y, v, t, p);
const int curr = v;
const int prev = v-1;
if (_dninst.save(prev))
{
fill_sheet();
const TFilename ftp10 = remote_dninst(10);
const TFilename ftp10 = remote_dninst(prev);
if (ftp10 != DNINST_ZIP && ftp10.starts_with("ftp://"))
if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp10))
{
@ -853,14 +859,14 @@ void Tdninst_mask::save_sheet()
if (fcopy(DNINST_ZIP, DNINST_BAK))
{
_dninst.save(11);
const TFilename ftp11 = remote_dninst(11);
_dninst.save(curr);
const TFilename ftp11 = remote_dninst(curr);
send_remote_dninst(ftp11);
fcopy(DNINST_BAK, DNINST_ZIP);
remove(DNINST_BAK);
}
}
_dninst.save(11); // Sicurezza
_dninst.save(curr);
}
}
@ -1112,6 +1118,7 @@ protected:
virtual bool use_files() const { return false; }
virtual bool create();
virtual void main_loop();
virtual bool test_assistance_year(bool) const { return true; }
};
bool Tdninst_manager::create()
@ -1119,10 +1126,8 @@ bool Tdninst_manager::create()
if (user() != dongle().administrator())
return error_box(TR("Utente non abilitato"));
const word n = dongle().number();
// 8453 = Ilaria; 8517 = Sara
const TString& host = get_hostname();
if (n != 8453 && n != 8517 && !is_power_station() &&
if (!is_power_station() &&
!host.ends_with("giardini", true) &&
host.compare("pccopw7", -1, true) != 0 &&
host.compare("pcpiccolow7", -1, true) != 0)

View File

@ -885,10 +885,11 @@ void TConversione_archivi::convert_codconc()
void TConversione_archivi::rebuild_indexes()
{
do_events();
begin_wait();
TWait_cursor hourglass;
prefix().set("com");
rebuild_dir_indexes();
/*
TSystemisamfile ditte(LF_NDITTE);
ditte.open();
@ -907,7 +908,15 @@ void TConversione_archivi::rebuild_indexes()
ditte.readat(rec);
}
ditte.close();
end_wait();
*/
TPointer_array ditte;
prefix().firms(ditte);
for (int i = 0; i < ditte.items(); i++)
{
const long codditta = ditte.get_long(i);
set_firm(codditta);
rebuild_dir_indexes();
}
}
void TConversione_archivi::rebuild_dir_indexes()
@ -918,10 +927,10 @@ void TConversione_archivi::rebuild_dir_indexes()
d.get(LF_DIR);
const int items = (int)d.eod();
TString80 s("Ricostruzione indici ");
TString80 s(TR("Ricostruzione indici "));
if (is_com) s << "comuni";
else s << " della ditta " << atol (pref);
if (is_com) s << TR("dati comuni");
else s << TR(" ditta ") << atol (pref);
TProgind p(items ? items : 1, s, TRUE, TRUE, 70);

View File

@ -3,45 +3,32 @@
#include "bainst.h"
int main(int argc,char** argv)
{
TApplication::check_parameters(argc, argv);
int r = 0;
if (argc < 2) return 0;
if (argc < 2)
return 0;
TString4 mod;
mod.strncpy(argv[2], 2);
mod.lower();
if (mod == "cg")
r = bainst07(argc,argv); // pre/post installazione contabilità generale:
else if (mod == "ce")
r = bainst11(argc, argv);// pre/post installazione cespiti
else if (mod == "at")
r = bainst17(argc, argv);// pre/post installazione avis
else if (mod == "in")
r = bainst18(argc, argv);// pre/post installazione intra
else if (mod == "vd")
r = bainst23(argc, argv);// pre/post installazione vendite al dettaglio
else if (mod == "tc")
r = bainst27(argc, argv);//pre/post installazione trasferimento altre contabilità
else if (mod == "ve")
r = bainst31(argc, argv);// pre/post installazione vendite:
else if (mod == "mg")
r = bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "ef")
r = bainst34(argc, argv);// pre/post installazione effetti:
else if (mod == "db")
r = bainst35(argc, argv);// pre/post installazione distinta base:
else if (mod == "sv")
r = bainst38(argc, argv);// pre/post installazione statistiche:
else if (mod == "mr")
r = bainst39(argc, argv);// pre/post installazione MRP
else if (mod == "lv")
r = bainst41(argc, argv);// pre/post installazione lavanderie
else
r = bainst00(argc, argv);// pre/post installazione base
if (mod == "cg") r = bainst07(argc,argv); // pre/post installazione contabilità generale:
else if (mod == "ce") r = bainst11(argc, argv);// pre/post installazione cespiti
else if (mod == "at") r = bainst17(argc, argv);// pre/post installazione avis
else if (mod == "in") r = bainst18(argc, argv);// pre/post installazione intra
//else if (mod == "vd") r = bainst23(argc, argv);// pre/post installazione vendite al dettaglio
else if (mod == "tc") r = bainst27(argc, argv);//pre/post installazione trasferimento altre contabilità
else if (mod == "ve") r = bainst31(argc, argv);// pre/post installazione vendite:
else if (mod == "mg") r = bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "ef") r = bainst34(argc, argv);// pre/post installazione effetti:
else if (mod == "db") r = bainst35(argc, argv);// pre/post installazione distinta base:
else if (mod == "sv") r = bainst38(argc, argv);// pre/post installazione statistiche:
else if (mod == "mr") r = bainst39(argc, argv);// pre/post installazione MRP
else if (mod == "lv") r = bainst41(argc, argv);// pre/post installazione lavanderie
else r = bainst00(argc, argv);// pre/post installazione base
return 0;
}

View File

@ -33,12 +33,12 @@ int TSystemtempfile::load(
// @xref <mf TSystemisamfile::dump>
{
FILE* fl = fopen(from, "r");
int err=NOERR;
FILE* fl = NULL;
int err = fopen_s(&fl, from, "r");;
if (fl == NULL)
{
error_box("Non riesco ad aprire il file %s",from);
return 2;
cantread_box(from);
return err;
}
TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
TString16 firm, year, attprev("00000");
@ -217,16 +217,16 @@ int TSystemtempfile::dump(
// @xref <mf TSystemisamfile::load>
{
FILE* f = fopen(to, "w");
FILE* f = NULL;
int err = fopen_s(&f, to, "w");
if (f == NULL)
{
setstatus(2);
return 2;
return err;
}
if (withdeleted) nkey = 0;
int err = ferror(f);
if (withdeleted)
nkey = 0;
err = ferror(f);
//open(FALSE, nkey ? TRUE : FALSE);
TString s(512);
@ -539,8 +539,10 @@ bool TInstallmodule_app::install_firm()
// riconverte le macro delle date
tabstd.dump(tempfile);
TScanner scan(tempfile);
FILE *dest=fopen((const char *)stdtabname,"w");
while (TRUE) {
FILE *dest = NULL;
fopen_s(&dest, stdtabname, "w");
while (dest)
{
TString &line=scan.line();
if (line.empty()) break;