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

This commit is contained in:
guy 2015-06-17 07:15:42 +00:00
parent 6c86e3468a
commit af7e6544ae
15 changed files with 166 additions and 895 deletions

View File

@ -3,9 +3,6 @@
//Es. wxArrayString 'as' + 'AcceptRefuse' -> asAcceptRefuse
#include "wxinc.h"
#ifdef WIN32
#include <shlobj.h>
#endif
#include <wx/protocol/http.h>
#include <wx/snglinst.h>
@ -14,6 +11,8 @@
#include "wizard.h"
#include "utils.h"
#include <shlobj.h>
///////////////////////////////////////////////////////////
// CampoFrame
///////////////////////////////////////////////////////////
@ -49,10 +48,8 @@ void CampoFrame::OnErase(wxEraseEvent& e)
int nHeight = rect.GetHeight()/14;
wxFont* pFont = wxTheFontList->FindOrCreateFont(nHeight, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD);
dc.SetFont(*pFont);
dc.SetBackgroundMode(wxTRANSPARENT);
int w, h;
dc.GetTextExtent(RESELLER, &w, &h);
int w = 0, h = 0; dc.GetTextExtent(RESELLER, &w, &h);
while (w > rect.width)
{
nHeight = nHeight * rect.width / w;
@ -63,6 +60,7 @@ void CampoFrame::OnErase(wxEraseEvent& e)
const int k = nHeight / 16 + 1;
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetTextForeground(c2);
dc.DrawText(RESELLER, rect.GetRight()-w-k/2, rect.GetHeight()-h-k/2);
dc.SetTextForeground(c1);
@ -82,8 +80,7 @@ void CampoFrame::OnErase(wxEraseEvent& e)
}
CampoFrame::CampoFrame()
: wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0)
CampoFrame::CampoFrame() : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0)
{
ShowFullScreen(true);
}
@ -116,7 +113,7 @@ protected:
void ClientUpdate();
void NormalSetup();
bool SystemRunning(const wxString& strAppName, wxString strMsg) const;
bool LurchIsRunning() const;
int LurchRunning() const;
bool CampoIsRunning() const;
//metodi di interfaccia con Windows
@ -128,10 +125,6 @@ protected:
bool StartLurch(const wxString& strPrgLocPath) const;
bool LurchWasRunning() const { return m_bLurchWasRunning; }
bool CreateAutostartSSA(const LurchMode iSrvAutostartMode, const wxString& strPath);
bool SSAagentRunning() const { return false; } // TBI
bool StopSSAagent() const { return false; } // TBI
//metodi di interfaccia con il registry di Windows
wxString ReadRootRegistryKey(const wxString strKey) const;
wxString ReadLocalMachineRegistryKey(const wxString strKey) const;
@ -257,11 +250,11 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
bool ok = wxDirExists(strDesktopPath);
if (ok)
{
CoInitialize(NULL);
::CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
IShellLink* psl = NULL;
HRESULT hres = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres))
{
// Set the path to the shortcut target and add the description.
@ -295,19 +288,6 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
}
strPath << strIcon;
/* Obsoleto
//controlla se è in un sistema windows che richiede icone a 256 colori (win2000, win2003 termserv)
int nVersion = 0;
bool bServer = false;
GetWinVer(NULL, 0, nVersion, bServer);
if (nVersion == W2K || nVersion == W2003)
{
const int nPosCol = strIcon.Len() - 4;
strIcon.insert(nPosCol, "_256");
}
*/
psl->SetIconLocation(strPath, 0);
// Query IShellLink for the IPersistFile interface for saving the
@ -345,203 +325,25 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
//-------------------------------------------
bool CampoSetup::StopLurch() const
{
bool ok = false;
//cerca e ferma authoriz e lurch come processi
for (int i = 0; i < 2; i++)
{
wxHTTP scServer;
if (scServer.Connect("127.0.0.1", i == 0 ? 1883 : 10000))
{
//if (scServer.BuildRequest("/stop.cgi", 0))
wxInputStream* isIs = scServer.GetInputStream("/stop.cgi");
if (isIs)
{
delete isIs;
wxSleep(3);
ok = true;
break;
}
}
}
//se lurch e' un servizio lo stoppa
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
if (!strValue.IsEmpty())
{
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET STOP Lurch";
wxExecute(strExecService, wxEXEC_SYNC);
}
return ok;
const wxString strExecService = "Servers/SSAservice -stop";
return wxExecute(strExecService, wxEXEC_SYNC) > 0;
}
bool CampoSetup::StartLurch(const wxString& strPrgLocPath) const
{
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
bool ok = false;
if (!strValue.IsEmpty())
{
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET START Lurch";
ok = wxExecute(strExecService, wxEXEC_SYNC) > 0;
}
else
{
wxString strPath = strPrgLocPath;
strPath += "/servers/lurch.exe";
ok = wxExecute(strPath, wxEXEC_ASYNC) > 0;
}
return ok;
const wxString strExecService = strPrgLocPath + "Servers/SSAservice -start";
return wxExecute(strExecService) > 0;
}
bool CampoSetup::CreateAutostartLurch(const LurchMode iSrvAutostartMode, const wxString& strPath)
{
//creazione dei filenames e dei path necessari in giro per la funzione
//filename (con path quindi) di Lurch.exe
wxFileName strExe(strPath, wxT("lurch.exe"));
strExe.AppendDir("servers");
//stringa path della cartella Servers in base alle scelte dell'utente
const wxString strSrvPath = strExe.GetPath();
if (LurchRunning())
StopLurch();
//1) Cerca di eliminare Lurch se presente come servizio
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
if (!strValue.IsEmpty())
{
//elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!)
//utilizza il programma instsrv.exe dentro la cartella servers installata
wxString strRemove = strSrvPath + "\\instsrv Lurch REMOVE";
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
}
//2) Cerca di fermare Lurch se presente come programma in esecuzione automatica
else
{
if (LurchIsRunning())
StopLurch();
}
switch (iSrvAutostartMode)
{
//esecuzione server come servizi (magia!)
case lm_service:
{
//aggiunge la voce ai servizi di windows (dentro strumenti di amministrazione)
//utilizza i programmi instrv.exe e srvany.exe dentro la cartella servers installata
wxString strCreateService = strSrvPath + "\\instsrv Lurch ";
strCreateService += strSrvPath;
strCreateService += "\\srvany.exe";
//esegue il programma di installazione servizi di Windows creando la voce
const long lExec = wxExecute(strCreateService, wxEXEC_SYNC);
if (lExec >= 0)
{
//crea le voci nel registry di windows
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application", strExe.GetFullPath());
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Description", "Servizi Campo Enterprise");
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Group", "Campo Enterprise");
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET START Lurch";
//avvia il servizio
const long lExecLurch = wxExecute(strExecService, wxEXEC_SYNC);
if (lExecLurch < 0)
WarningBox("Impossibile eseguire il servizio del gestore applicazioni.\nLanciarlo manualmente dagli strumenti di amministrazione nel pannello di controllo!");
}
else
WarningBox("Impossibile registrare il servizio per l'esecuzione automatica del gestore applicazioni.\nSelezionare una diversa modalità di esecuzione!");
}
break;
//link nella cartella esecuzione automatica
case lm_autostart:
{
CreateIcon(CSIDL_COMMON_STARTUP, strExe, "Lurch");
const long lExec = wxExecute(strExe.GetFullPath(), wxEXEC_ASYNC);
if (lExec > 0)
MessageBox("Gestore delle autorizzazioni avviato");
else
ErrorBox("Impossibile avviare il gestore delle autorizzazioni");
}
break;
default:
break;
}
return true;
const wxString strCreateService = "Servers/SSAservice -install";
return wxExecute(strCreateService) > 0;
}
bool CampoSetup::CreateAutostartSSA(const LurchMode iSrvAutostartMode, const wxString& strPath)
{
wxFileName strExe(strPath, wxT("SSAstub.exe"));
strExe.AppendDir("servers");
if (!strExe.FileExists())
return ErrorBox("Impossibile eseguire " + strExe.GetFullPath());
//stringa path della cartella Servers in base alle scelte dell'utente
const wxString strSrvPath = strExe.GetPath();
//1) Cerca di eliminare SSAagent se presente come servizio
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\SSAagent\\Parameters\\Application");
if (!strValue.IsEmpty())
{
//elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!)
//utilizza il programma instsrv.exe dentro la cartella servers installata
wxString strRemove = strSrvPath + "\\instsrv SSAagent REMOVE";
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
}
//2) Cerca di fermare SSAagent se presente come programma in esecuzione automatica
else
{
if (SSAagentRunning())
StopSSAagent();
}
switch (iSrvAutostartMode)
{
//esecuzione server come servizi (magia!)
case lm_service:
{
//aggiunge la voce ai servizi di windows (dentro strumenti di amministrazione)
//utilizza i programmi instrv.exe e srvany.exe dentro la cartella servers installata
wxString strCreateService = strSrvPath + "\\instsrv SSAagent ";
strCreateService += strSrvPath;
strCreateService += "\\srvany.exe";
//esegue il programma di installazione servizi di Windows creando la voce
const long lExec = wxExecute(strCreateService, wxEXEC_SYNC);
if (lExec >= 0)
{
//crea le voci nel registry di windows
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\SSAagent\\Parameters\\Application", strExe.GetFullPath());
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\SSAagent\\Description", "Protezione Campo Enterprise");
WriteLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\SSAagent\\Group", "Campo Enterprise");
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET START SSAagent";
//avvia il servizio
const long lExecLurch = wxExecute(strExecService, wxEXEC_SYNC);
if (lExecLurch < 0)
WarningBox("Impossibile eseguire il servizio SSAagent.\nLanciarlo manualmente dagli strumenti di amministrazione nel pannello di controllo!");
}
else
WarningBox("Impossibile registrare il servizio per l'esecuzione automatica di SSAagent.\nSelezionare una diversa modalità di esecuzione!");
}
break;
//link nella cartella esecuzione automatica
case lm_autostart:
{
CreateIcon(CSIDL_COMMON_STARTUP, strExe, "SSAagent");
const long lExec = wxExecute(strExe.GetFullPath(), wxEXEC_ASYNC);
if (lExec > 0)
MessageBox("SSAagent avviato");
else
ErrorBox("Impossibile avviare SSAagent");
}
break;
default:
break;
}
return true;
}
//----------------------------------------------------------------
// Metodi di utility per i vari tipi di aggiornamento
@ -595,7 +397,7 @@ bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strS
{
bool ok = false;
wxArrayString asFilesList;
size_t uFilesToCopy;
size_t uFilesToCopy = 0;
//..contando anche quanti sono e memorizzandoli in un array asFileList
if(wxDir::Exists(strSrc))
{
@ -624,8 +426,7 @@ bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strS
}
//Adesso puo' far ripartire il server di chiavi
const bool bLurch = strModule == "sr" && LurchWasRunning();
if (bLurch)
if (strModule == "sr" && LurchWasRunning())
StartLurch(strPrgLocPath);
return uFilesToCopy > 0;
@ -769,7 +570,7 @@ int CampoSetup::ClientUpdateModule(const wxString& strLocalPath, const wxString&
}
//se ci sono zip deve scompattarli (per ora esiste solo res.zip)
if (strCurrFile.EndsWith("res.zip"))
if (strCurrFile.EndsWith("res.zip")) // Non confonderti con dninst.zip
{
UnzipFile(strDstPath, strLocalPath + "/res");
}
@ -845,7 +646,7 @@ bool CampoSetup::HTTPGet(const wxString& strLocalPath, const wxString& strWebSit
bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const
{
bool ok = false;
int nLocVer, nLocPatch;
int nLocVer = 20911000, nLocPatch = 100; // Fingo la versione 10.0
{
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strModule);
nLocVer = iniLocalInstall.GetInt("Versione");
@ -886,8 +687,11 @@ bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxStri
//lavora solo con i files del modulo in questione
if (strHref.StartsWith(strModule))
{
const wxString strPatch = strHref.Mid(2, 4).Lower();
const wxString strExt = strHref.Right(4).Lower();
if (strExt!=".ini" && strExt!=".zip")
continue;
const wxString strPatch = strHref.Mid(2, 4).Lower();
// 1) e' un pacco
//se e' un pacco devo sapere se e' piu' recente della installazione corrente (potrebbe essere un pacco nuovo..
//..ricompattato) oppure se e' piu' vecchio e non va toccato (e' ad esempio il pacco originale)
@ -915,7 +719,7 @@ bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxStri
else //se invece e' una normale patch... else di if(strPatch=="inst"..
{
//controlla che sia più avanti del suo livello patch e che sia un file utile (servono solo .ini e .zip)
if (atoi(strPatch) > nLocPatch && (strExt==".ini" || strExt==".zip"))
if (atoi(strPatch) > nLocPatch)
HTTPGet(strTempDir+strHref, strWebPath+strHref);
}
} //if(strHref.StartsWith(strModule))...
@ -977,8 +781,8 @@ void CampoSetup::DiskUpdate()
//aggiornamento dei moduli SY ed SR da disco
//il modulo SY va aggiornato comunque
#ifndef NDEBUG
strRemotePath = "c:/campo11/cd/program/";
DiskUpdateModule(strLocalPath, strRemotePath, "li");
strRemotePath = "c:/campo12/cd/program/";
DiskUpdateModule(strLocalPath, strRemotePath, "sc");
#else
DiskUpdateModule(strLocalPath, strRemotePath, "sy");
//il modulo SR va aggiornato solo se usato (si sta aggiornando il cpu con il gestore delle chiavi)
@ -1145,7 +949,6 @@ void CampoSetup::NormalSetup()
}
else
strFileCurr = "";
}
else //files vari di altre subdirectory che si installano sempre (es. recdesc)
{
@ -1258,7 +1061,7 @@ void CampoSetup::NormalSetup()
{ //parentesi necessaria per la scrittura immediata (non cancellare! serve per debug)
//paragrafo [Main]
CampoIniFile CampoIniMain(strPrgLocPath + "/campo.ini", "Main");
const unsigned int uDongleType = m_pWizard->GetDongleType();
const unsigned int uDongleType = m_pWizard->GetDongleType(); // 3 o 4 dopo la morte delle chiavi hw
CampoIniMain.Set("Donglehw", uDongleType);
CampoIniMain.Set("Study", strDataPath);
CampoIniMain.Set("Firm", "com");
@ -1270,7 +1073,7 @@ void CampoSetup::NormalSetup()
{
CampoIniFile CampoIniSrv(strPrgLocPath + "/campo.ini", "Server");
CampoIniSrv.Set("Dongle", m_pWizard->GetSrvAuth());
CampoIniSrv.Set("Dictionary", m_pWizard->GetSrvDict());
// CampoIniSrv.Set("Dictionary", m_pWizard->GetSrvDict());
}
} //if(bNewInstallation...
else //e' un aggiornamento! scrive il type
@ -1367,28 +1170,7 @@ void CampoSetup::NormalSetup()
{
const LurchMode iSrvAutostartMode = m_pWizard->GetSrvAutostartMode();
if (iSrvAutostartMode != lm_none)
{
const wxString strSrvLocPath = strPrgLocPath + "/servers";
if (!wxFileName::DirExists(strSrvLocPath))
{
wxFileName strSrvCDPath(GetSetupDir(), "srvany.exe");
strSrvCDPath.AppendDir("..");
strSrvCDPath.AppendDir("servers");
strSrvCDPath.MakeAbsolute();
if (strSrvCDPath.FileExists())
CopyDir(strSrvCDPath.GetPath(), strSrvLocPath);
}
if (wxFileName::DirExists(strSrvLocPath))
{
if (m_pWizard->GetDongleType() < 3)
CreateAutostartLurch(iSrvAutostartMode, strPrgLocPath);
else
CreateAutostartSSA(iSrvAutostartMode, strPrgLocPath);
}
else
WarningBox("Impossibile configurare il server di autorizzazioni:\nnon esiste la cartella " + strSrvLocPath);
}
CreateAutostartLurch(iSrvAutostartMode, strPrgLocPath);
}
@ -1452,6 +1234,7 @@ void CampoSetup::NormalSetup()
////////////////////////////////////////////////////////////////////////////////////
// Metodi per il controllo preventivo di eventuali cazzate in procinto di accadere
////////////////////////////////////////////////////////////////////////////////////
bool CampoSetup::SystemRunning(const wxString& strAppName, wxString strMsg) const
{
strMsg.Replace(wxT("PRODUCT"), PRODUCT);
@ -1461,9 +1244,8 @@ bool CampoSetup::SystemRunning(const wxString& strAppName, wxString strMsg) cons
bool bRetry = true;
while (bRetry)
{
wxSingleInstanceChecker sicProgram(strAppName);
int i;
for (i = 10; i > 0 && sicProgram.IsAnotherRunning(); i--)
for (i = 10; i > 0 && FindProcessId(strAppName); i--)
wxSleep(1);
bRetry = false;
@ -1478,23 +1260,19 @@ bool CampoSetup::SystemRunning(const wxString& strAppName, wxString strMsg) cons
}
bool CampoSetup::LurchIsRunning() const
int CampoSetup::LurchRunning() const
{
//cerca Lurch che funziona come programma (esecuzione in modalità avvio automatico)...
bool ok = SystemRunning("Lurch", wxEmptyString);
if (!ok)
//cerca SSAservice che funziona come servizio
int run = 0;
if (SystemRunning("SSAservice", wxEmptyString))
run |= 1;
if (!run)
{
//...se non lo trova cerca il solo Authoriz sempre come programma...
ok = SystemRunning("Authorization", wxEmptyString);
//se non trova nulla cerca Lurch come servizio...
if (!ok)
{
int year = 0;
wxString strSrv = "127.0.0.1";
ok = ServerLogin(year, strSrv) != 0xFFFF;
}
//...se non lo trova cerca il solo Authoriz come programma...
if (SystemRunning("Authorization", wxEmptyString))
run |= 2;
}
return ok;
return run;
}
@ -1526,8 +1304,6 @@ bool CampoSetup::CampoIsRunning() const
asModuli.Add("ba");
asModuli.Add("cg");
asModuli.Add("ve");
asModuli.Add("mg");
asModuli.Add("lv");
}
//scandisce l'array dei moduli alla ricerca di un eventuale programma di campo ancora running a sua insaputa
@ -1539,10 +1315,9 @@ bool CampoSetup::CampoIsRunning() const
strAppName = asModuli[i];
strAppName += ('0'+j);
wxSingleInstanceChecker sicProgram(strAppName);
if (sicProgram.IsAnotherRunning())
{
strAppName << " è in esecuzione! E' necessario terminarlo utilizzando il Task Manager di Windows.";
strAppName << " è in esecuzione! E' necessario terminarlo utilizzando la Gestione Attività di Windows.";
ErrorBox(strAppName);
return true;
}
@ -1567,12 +1342,9 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
}
//controllo di eventuali Campo o servers attivi e conseguente interruzione dell'installazione
m_bLurchWasRunning = LurchIsRunning();
m_bLurchWasRunning = LurchRunning() != 0;
if (m_bLurchWasRunning)
{
//cazzone
const unsigned short sCazzoni = ServerLoggedUsers("127.0.0.1");
//fine cazzone
wxString msg;
msg << "Per poter aggiornare/installare il programma " << PRODUCT
<< " deve temporaneamente essere disattivato il gestore delle licenze!\n"
@ -1614,8 +1386,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
{
TCHAR strFileName[260];
::GetModuleFileName(NULL, strFileName, 260);
//wxFileName strPath(argv[0]);
wxFileName strPath(strFileName);
strPath.MakeAbsolute();
m_strSetupPath = strPath.GetPath();

View File

@ -1,44 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ACCORDO DI LICENZA SUL SOFTWARE</title>
</head>
<body>
<h4><p align=center>ACCORDO DI LICENZA SUL SOFTWARE</p></h4>
<hr></hr>
<p>Ai termini ed alle condizioni che seguono, AGA s.r.l., in forza dei diritti di sfruttamento commerciale, si obbliga e concede in licenza d'uso al Cliente il prodotto di software corredato dalla documentazione d'uso. Pertanto AGA s.r.l. (di seguito indicata come Concedente), non vende alcun diritto per il proprio software, e mantiene ogni diritto su tutto il software distribuito.
Il Concedente da una parte ed il Cliente dall'altra, concordano quindi tra loro quanto segue:</p>
<p>L'installazione dei programmi contenuti in questo CD-ROM implica l'accettazione e l'osservanza dei termini specificati in questo accordo di licenza, tranne che per quanto concerne l'applicazione dell'art. 1341 C.C.</p>
<ol>
<li>CONCESSIONE DI LICENZA. A fronte del pagamento del corrispettivo della licenza, compreso nel prezzo di acquisto di questo prodotto, e dell'accordo di osservanza dei termini e delle condizioni di questa licenza, il Concedente, cede all'Acquirente, il Licenziatario, un diritto non esclusivo all'utilizzo ed alla dimostrazione di questa copia di programma software (di seguito chiamato Software) su di un unico computer (dotato cioè di una sola unità centrale) ed in un'unica locazione per tutto il periodo di osservanza dei termini di questo accordo di licenza. Se il computer sul quale viene utilizzato il Software è un sistema multiutente, la licenza è valida per tutti gli utenti di quell'unico computer, senza esborso per ulteriori licenze. Il Concedente si riserva tutti i diritti non espressamente ceduti al Licenziatario.</li>
<li>PROPRIETA' DEL SOFTWARE. Come Licenziatario, l'acquirente è proprietario del supporto magnetico o fisico sul quale il Software è stato originariamente registrato, ma, in base al presente accordo, il Concedente mantiene la proprietà del Software registrato sulla copia (o copie) del CD-ROM originale e di tutte le copie di Software successive, indipendentemente dalla forma o dal supporto in cui vengono fornite le copie originali e quelle successive. La presente licenza non implica la vendita del Software originale o di qualsiasi eventuale copia successiva.</li>
<li>COPIE DI BACKUP. E' espressamente proibito effettuare copie non autorizzate del Software, ivi compreso Software modificato, combinato con altri, o allegato ad altro Software, o della documentazione. Il licenziatario è responsabile a tutti i fini legali per qualunque infrazione causata o incoraggiata dalla non osservanza dei termini di questa licenza.
Sulla base di quanto sopra, e posto che il Software non sia protetto contro la copia, è consentito effettuare una (1) copia del Software a soli scopi di backup.</li>
<li>UTILIZZO DEL SOFTWARE. In qualità di Licenziatario l'acquirente è autorizzato a trasferire fisicamente il Software da un computer all'altro a condizione che il suo utilizzo sia limitato ad un computer per volta. Non è consentito il trasferimento elettronico del Software da un computer all'altro tramite rete di comunicazione dati. È altresì vietata la distribuzione a terzi di copie del Software e della relativa documentazione. Il licenziatario non e' inoltre autorizzato alla modifica, traduzione, adattazione, reingegnerizzazione, decompilazione, disassemblaggio o alla creazione di applicazioni derivate basate sul Software. È altresì' vietato modificare, tradurre, adattare e creare applicazioni derivate basate sulla documentazione senza previo consenso scritto da parte del Concedente.</li>
<li>CESSIONE DEL SOFTWARE. Il Software viene ceduto in licenza unicamente al Licenziatario e non può essere ceduto a terzi senza previo consenso scritto da parte del Concedente. L'utente autorizzato all'utilizzo del Software è tenuto all'osservanza dei termini e delle condizioni espressi in questa licenza e nella garanzia limitata. In nessun caso è consentito cedere, assegnare, offrire in leasing, vendere o disporre in altro modo del Software su base permanente o provvisoria se non nei termini qui espressamente specificati.</li>
<li>DURATA. Il presente contratto resterà in vigore per un periodo di cinque (5) anni dalla data di acquisto riportata sulla ricevuta di acquisto. Alla fine di tale periodo, tale accordo sarà risolto. Questo contratto può anche essere risolto dal Concedente sulla base dell'art. 11 (clausola risolutiva espressa). Alla fine del rapporto, quale che ne sia la causa, tutto il materiale deve essere riconsegnato al Concedente oppure distrutto da parte del Licenziatario.</li>
<li>AGGIORNAMENTI. Il Concedente può produrre, di volta in volta, versioni aggiornate del Software che, a discrezione del Concedente, verranno messe a disposizione del Licenziatario e degli utenti autorizzati.</li>
<li>LEGGE APPLICABILE. La presente licenza e' soggetta alla legge italiana e verrà messa in vigore a beneficio del Concedente, dei suoi assegnatari e successori.</li>
<li>ATTESTAZIONE. Il Licenziatario attesta di aver scelto il Software corrispondente alle proprie necessità, di aver preso visione della relativa documentazione e del presente accordo. Egli riconosce che il presente accordo costituisce la totalità delle intese intercorse.</li>
<li>GARANZIA LIMITATA, MANUTENZIONE, RESPONSABILITA' ED ASSISTENZA. Il Concedente garantisce al Licenziatario originario che il CD-ROM sul quale e' registrato il Software è esente da difetti di materiale e di lavorazione nell'uso e nelle prestazioni normali per un periodo di novanta (90) giorni dalla data di consegna documentata da una copia della ricevuta.
Il Concedente non garantisce che il pacchetto Software funzioni correttamente in tutte le possibili combinazioni hardware/software. E' possibile che il programma non funzioni correttamente con versioni modificate del sistema operativo, con taluni programmi di "spooling" delle stampe o di utilità, o con stampanti fornite da Costruttori indipendenti.
Sebbene il Concedente abbia collaudato il Software e controllato la documentazione, non garantisce espressamente o implicitamente, per quel che riguarda questo Software o la sua documentazione, la loro qualità, le caratteristiche, la commerciabilità e l'utilizzo in particolari applicazioni.
Quindi questo Software e documentazione sono dati in licenza "come tali", e il licenziatario si assume tutti i rischi circa la loro qualità ed esecuzione.
In nessun caso il Concedente sarà responsabile per danni diretti, indiretti, particolari, incidentali o susseguenti, scaturiti dall'uso o dalla non capacita' d'uso del Software o della documentazione, anche se avvertita della possibilità di tali danni. In particolare il Concedente non avrà responsabilità per programmi e dati memorizzati, o utilizzati con suo Software, compresi i costi per il recupero di tali programmi o dati.</li>
<li>CLAUSOLA RISOLUTIVA ESPRESSA. Nel caso di inadempimento da parte del Licenziatario degli obblighi di cui all'art. 3 (divieto di effettuare copie), art. 4 (modi di utilizzo del Software, distribuzione a terzi di copie, traduzione, modifica, reingegnerizzazione, adattazione, decompilazione, disassemblaggio, creazione di applicazioni basate sul Software o sulla documentazione), art. 5 (cessione a terzi, leasing o locazione a terzi, atti di disposizione), il Concedente potrà ritenere automaticamente risolto il presente contratto senza avviso al Licenziatario.</li>
</ol>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

View File

@ -1,26 +0,0 @@
[Standard]
AdvancedGraphics = X
ButtonBack = 192,192,192
ButtonDark = 128,128,128
ButtonLight = 255,255,255
Campi3D = X
Dimension = 32,0,0
Disabled = 64,64,64
DisabledBack = 192,192,192
EasyRider = X
EasyRiderColor = 228,225,221
EnterAsTab = X
Focus = 0,0,0
FocusBack = 255,255,0
FontDesc = 01\\Verdana\\0\\8\\WIN01/8/0/0/0/400/0/0/0/0/0/0/0/0/Verdana
MaskBack = 201,194,188
MaskDark = 128,128,128
MaskLight = 255,255,255
NativeControls = X
Normal = 0,0,0
NormalBack = 255,255,255
RequiredBack = 255,255,153
ToolBack = 128,128,128
ToolSize = 48
ToolText = X
TreeView = 3

View File

@ -1,15 +1,8 @@
#include "wxinc.h"
#include <wx/socket.h>
#include "key.h"
#include "utils.h"
extern "C"
{
#include "../xvaga/hlapi_c.h"
#include "../xvaga/skeylink.h"
}
///////////////////////////////
// Utilities //
///////////////////////////////
@ -19,333 +12,20 @@ static int ThisYear()
}
///////////////////////////////
// Gestione chiave Hardlock //
// Gestione chiave remota //
///////////////////////////////
bool HardlockGarble(unsigned short* data)
unsigned short ServerLogin(int& year, const wxString& strSrvName)
{
HL_CODE(data, 1);
return true;
return 0;
}
unsigned short HardlockLogin(int& year)
{
unsigned short serno = 0xFFFF;
unsigned char REFKEY[16] = "CAMPOKEY";
unsigned char VERKEY[16] = "ìpÙˆ¬cê<";
if (HL_LOGIN(26952, LOCAL_DEVICE, REFKEY, VERKEY) == STATUS_OK)
{
unsigned short eprom[64]; memset(eprom, 0, sizeof(eprom));
HL_READBL((unsigned char*)eprom);
unsigned short data[4];
memcpy(data, eprom, sizeof(data));
HardlockGarble(data);
if (data[0] == 0xFAE8)
serno = data[1];
else
serno = 0;
memcpy(data, &eprom[60], sizeof(data));
if (HardlockGarble(data))
year = (int)data[0];
HL_LOGOUT();
}
return serno;
}
///////////////////////////////
// Gestione chiave Eutron //
///////////////////////////////
void EncodeEutronPassword(char* str)
{
const char* const key = "QSECOFR-";
char tmp[16];
int i;
for (i = 0; str[i]; i++)
tmp[i] = str[i] + (i < 8 ? key[i] : str[i - 8]);
tmp[i] = '\0';
strcpy(str, tmp);
}
unsigned short EutronLogin(int& year)
{
unsigned short serno = 0xFFFF;
const char* const login[2] = { "AGA.CAMPO", "25EBAI" };
for (int i = 0; i < 2; i++)
{
KEY_NET eutron_key;
memset(&eutron_key, 0, sizeof(KEY_NET));
eutron_key.net_command = NET_KEY_OPEN;
eutron_key.command = LOCATING_MODE;
const char* const chiaro = login[i];
char cifrato[16];
strcpy(cifrato, chiaro);
EncodeEutronPassword(cifrato);
memset(eutron_key.label, 0, LABEL_LENGTH);
strcpy((char*)eutron_key.label, chiaro);
memset(eutron_key.password, 0, PASSWORD_LENGTH);
strcpy((char*)eutron_key.password, cifrato);
smartlink(&eutron_key);
if (eutron_key.status == ST_OK)
{
eutron_key.net_command = NET_KEY_ACCESS;
eutron_key.command = BLOCK_READING_MODE;
short* pointer = (short*)(&eutron_key.data[0]);
short* number = (short*)(&eutron_key.data[2]);
*pointer = 0; // Posizione in cui leggere
*number = 8; // Words da leggere
eutron_key.status = -1;
smartlink(&eutron_key);
if (eutron_key.status == ST_OK)
{
serno = (unsigned short)atol((const char*)eutron_key.data+4);
if (i == 0)
{
const unsigned short y = *(unsigned short*)(eutron_key.data+12);
if (y > 2000 && y < 3000)
year = y;
}
else
year = ThisYear();
eutron_key.net_command = NET_KEY_CLOSE;
smartlink(&eutron_key);
break;
}
}
}
return serno;
}
//////////////////////////////////
// Gestione Server di chiavi //
//////////////////////////////////
class TBordello
{
WX_DECLARE_STRING_HASH_MAP(wxSocketClient*, TBrothel);
TBrothel m_map;
public:
wxSocketClient& Zoccola(wxIPV4address& ip);
wxSocketClient* QuellaBuona();
void Chiudi();
virtual ~TBordello();
} m_bordello;
wxSocketClient& TBordello::Zoccola(wxIPV4address& ip)
{
const wxString strIP = ip.IPAddress();
if (m_map[strIP] == NULL)
{
m_map[strIP] = new wxSocketClient;
m_map[strIP]->SetTimeout(2);
}
return *m_map[strIP];
}
wxSocketClient* TBordello::QuellaBuona()
{
wxSocketClient* good = NULL;
for(TBrothel::iterator it = m_map.begin(); it != m_map.end(); ++it )
{
wxSocketClient* sc = (wxSocketClient*)it->second;
if (sc != NULL)
{
sc->WaitOnConnect(0, 1);
if (sc->IsConnected())
{
good = sc;
break;
}
}
}
return good;
}
void TBordello::Chiudi()
{
for(TBrothel::iterator it = m_map.begin(); it != m_map.end(); ++it )
{
wxSocketClient* sc = (wxSocketClient*)it->second;
if (sc != NULL)
sc->Destroy();
}
}
TBordello::~TBordello()
{
/* Non funziona per oggetti statici
for(TBrothel::iterator it = m_map.begin(); it != m_map.end(); ++it )
{
wxSocketClient* sc = (wxSocketClient*)it->second;
sc->Destroy();
}
*/
m_map.clear();
}
static unsigned short InquireSocketNumber(wxSocketClient& sc, const wxString& strCommand)
{
sc.Discard();
sc.Write(strCommand, (wxUint32)strCommand.Len());
long number[2] = { 0L, 0L };
sc.Read(number, sizeof(number));
return (unsigned short)number[1];
}
//metodo per sapere dal server di chiave quanti sono gli utonti connessi
unsigned short ServerLoggedUsers(const wxString& strSrvName)
{
unsigned short nUtonti = 0;
wxIPV4address ip;
wxString strHost, strService;
const int nColon = strSrvName.Find(':');
if (nColon > 0)
{
strHost = strSrvName.Left(nColon);
strService = strSrvName.Mid(nColon+1);
}
else
{
strHost = strSrvName;
strService = wxT("1883");
}
if (ip.Hostname(strHost) && ip.Service(strService)) //riesce a connettersi
{
wxSocketClient& sc = m_bordello.Zoccola(ip);
if (sc.IsConnected() || sc.Connect(ip)) //il computer remoto risponde
{
// quante licenze sono loggate al momento (utonti connessi)
nUtonti = InquireSocketNumber(sc, "DongleLoggedLicenses");
}
}
return nUtonti;
}
static unsigned short InquireServer(const wxString& strSrvName, int& year, const bool bMsg)
{
unsigned short serno = 0xFFFF;
year = 0;
wxString strHost, strService;
const int nColon = strSrvName.Find(':');
if (nColon > 0)
{
strHost = strSrvName.Left(nColon);
strService = strSrvName.Mid(nColon+1);
}
else
{
strHost = strSrvName;
strService = wxT("1883");
}
wxIPV4address ip;
if (!ip.Hostname(strHost) || !ip.Service(strService)) //indirizzo NON valido o porta scazzata!
{
if (bMsg)
ErrorBox("Indirizzo IP errato!");
return serno;
}
wxSocketClient& sc = m_bordello.Zoccola(ip);
if (sc.IsConnected() || sc.Connect(ip)) //il computer remoto risponde
{
// ma il server e' davvero acceso o spento ?
serno = InquireSocketNumber(sc, "DongleNumber()");
year = InquireSocketNumber(sc, "DongleYear()");
}
else
{
if (bMsg)
{
wxString strMsg;
strMsg << "Il server " << strSrvName << " non risponde!";
ErrorBox(strMsg);
}
}
return serno;
}
unsigned short ServerLogin(int& year, wxString& strSrvName)
{
unsigned short serno = 0xFFFF;
//se non specificato un nome/indirizzo di server, lo cerca tra i miei "cpu fratelli" in rete
if (strSrvName.IsEmpty())
{
//intanto deve trovare il suo IP di rete
wxIPV4address ipLocal;
ipLocal.AnyAddress();
wxString strMyName = ipLocal.Hostname();
ipLocal.Hostname(strMyName);
const wxString strMyIP = ipLocal.IPAddress();
if (strMyIP.Len() > 7)
{
const unsigned short MaxSck = 256;
for (int i = 0; i < MaxSck; i++)
{
if ((i+1) % 64 == 0) // ogni 16 zoccole controllo se ce n'e' una bbona.
{
wxSleep(1);
wxSocketClient* sc = m_bordello.QuellaBuona();
if (sc != NULL)
{
wxIPV4address ipRemote;
sc->GetPeer(ipRemote);
strSrvName = ipRemote.Hostname();
break;
}
m_bordello.Chiudi();
}
//deve sostituire l'ultima cifra dell'IP con tutti i numeri che vanno da 0 a 255 alla ricerca del server
wxString strSrvIP = strMyIP.BeforeLast('.');
strSrvIP << "." << i; //ip del computer remoto
if (strSrvIP != strMyIP)
{
wxIPV4address ipRemote;
if (ipRemote.Hostname(strSrvIP) && ipRemote.Service("1883"))
{
wxSocketClient& sc = m_bordello.Zoccola(ipRemote);
if (!sc.IsConnected())
sc.Connect(ipRemote, ipLocal, false);
}
}
}
m_bordello.Chiudi();
} //if(strMyIP.Len()...
} //if(strSrvName.Is...
if (!strSrvName.IsEmpty())
serno = InquireServer(strSrvName, year, false);
return serno;
}
bool DictionaryLogin(const wxString& strSrvName)
{
return false;
}
///////////////////////////////
// Gestione chiave SSA //
///////////////////////////////
unsigned short SSALogin(int& year)
unsigned short DongleLogin(int& year)
{
unsigned short serno = 0xFFFF;
bool good = true;

View File

@ -1,16 +1,7 @@
#ifndef __KEY_H
#define __KEY_H
bool HardlockGarble(unsigned short* data);
unsigned short HardlockLogin(int& year);
unsigned short DongleLogin(int& year);
unsigned short ServerLogin(int& year, const wxString& strSrvName);
void EncodeEutronPassword(char* str);
unsigned short EutronLogin(int& year);
unsigned short SSALogin(int& year);
unsigned short ServerLogin(int& year, wxString& strSrvName);
unsigned short ServerLoggedUsers(const wxString& strSrvName);
bool DictionaryLogin(const wxString& strSrvName);
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 KiB

View File

@ -1,36 +1,68 @@
#include "wxinc.h"
#include "utils.h"
#ifdef WIN32
#include <shlobj.h>
#include <lm.h>
#endif
#include <shlobj.h>
#include <psapi.h>
#pragma comment(lib, "Psapi.lib")
DWORD FindProcessId(LPCTSTR strProcess)
{
DWORD* aProcesses = NULL;
DWORD nItems = 0, nFound = 0, i = 0;
DWORD pid = 0;
for (nItems = 256; ; nItems *= 2)
{
DWORD cbNeeded = 0;
free(aProcesses);
aProcesses = (DWORD*)calloc(nItems, sizeof(DWORD));
if (!EnumProcesses(aProcesses, nItems*sizeof(DWORD), &cbNeeded))
{
free(aProcesses);
return FALSE;
}
nFound = cbNeeded / sizeof(DWORD);
if (nFound < nItems)
break;
}
for (i = 0; i < nFound && pid == 0; i++) if (aProcesses[i])
{
HANDLE hProcess = ::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] );
if (hProcess != NULL)
{
HMODULE hMod;
DWORD cbNeeded;
if (::EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) )
{
TCHAR szProcessName[MAX_PATH] = { 0 };
::GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) );
if (strstr(szProcessName, strProcess) != NULL)
pid = aProcesses[i];
}
// Release the handle to the process.
CloseHandle( hProcess );
}
}
free(aProcesses);
return pid;
}
//metodo per farsi ritornare l'ID di sessione e quindi sapere se si e' in modalita' termserv (win2000,win2003,win2008)
int GetSessionId()
{
// DWORD session = 0;
// ::ProcessIdToSessionId(GetCurrentProcessId(), &session);
// return (int) session;
return WTSGetActiveConsoleSessionId(); // Unknown modern way!
DWORD session = 0;
::ProcessIdToSessionId(GetCurrentProcessId(), &session);
return (int) session;
}
//lista delle versioni di windows
#define WUNKNOWNSTR _T("unknown Windows version")
/*
#define W95STR _T("Windows 95")
#define W95SP1STR _T("Windows 95 SP1")
#define W95OSR2STR _T("Windows 95 OSR2")
#define W98STR _T("Windows 98")
#define W98SP1STR _T("Windows 98 SP1")
#define W98SESTR _T("Windows 98 SE")
#define WMESTR _T("Windows ME")
#define WNT351STR _T("Windows NT 3.51")
#define WNT4STR _T("Windows NT 4")
*/
#define W2KSTR _T("Windows 2000")
#define WXPSTR _T("Windows XP")
#define W2003STR _T("Windows Server 2003")
@ -39,9 +71,6 @@ int GetSessionId()
#define W7STR _T("Windows 7")
#define W8STR _T("Windows 8")
#define WCESTR _T("Windows CE")
//metodo per provare a trovare la versione di windows
bool GetWinVer(LPTSTR lpszVersion, int nVersionSize, int& nVersion, bool& bIsServer)
{
@ -212,11 +241,11 @@ size_t ListNetworkDisks(wxArrayString& asList)
//
// Call the GlobalFree function to free the memory.
//
GlobalFree((HGLOBAL)lpnrLocal);
::GlobalFree((HGLOBAL)lpnrLocal);
//
// Call WNetCloseEnum to end the enumeration.
//
dwResult = WNetCloseEnum(hEnum);
dwResult = ::WNetCloseEnum(hEnum);
if(dwResult != NO_ERROR)
{
@ -462,39 +491,27 @@ CampoProgressDialog::CampoProgressDialog(const wxString& strTitle, int nMaximum,
//gestione filesystem
//--------------------------------------------------------------------------------------
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg)
bool CheckAndMakeDir(const wxString& strDir, const wxString& strMsg)
{
if (!wxDir::Exists(strDir))
{
const wxFileName fname(strDir + "\\*.*");
const wxArrayString& asDirs = fname.GetDirs();
wxString strCartella = fname.GetVolume();
strCartella += fname.GetVolumeSeparator();
for (size_t i = 0; i < asDirs.GetCount(); i++)
{
strCartella += "\\";
strCartella += asDirs[i];
if (!wxDir::Exists(strCartella) && !wxMkdir(strCartella, 0777))
{
wxString strError = "Impossibile creare la cartella ";
strError += strMsg;
strError += " ";
strError += strCartella;
strError += "\nAssicurarsi di avere i permessi di scrittura e che vi sia spazio a sufficienza";
ErrorBox(strMsg);
return;
}
if (!wxFileName::Mkdir(strDir, 0x777, wxPATH_MKDIR_FULL))
{
wxString strError = "Impossibile creare la cartella ";
strError += strMsg;
strError += " ";
strError += strDir;
strError += "\nAssicurarsi di avere i permessi di scrittura e che vi sia spazio a sufficienza";
return ErrorBox(strMsg);
}
}
if (!strMsg.IsEmpty()) //se il messaggio e' vuoto NON deve fare alcun controllo (installazione sistema)
{
wxDir dirDir(strDir);
if(dirDir.HasFiles()) //se la dir di destinazione dovesse esistere gia' (installazione abortita) almeno sia vuota
{
ErrorBox("La cartella di destinazione non e' vuota!\nInstallazione interrotta!");
return;
}
if (dirDir.HasFiles()) //se la dir di destinazione dovesse esistere già (installazione abortita) almeno sia vuota
return ErrorBox("La cartella di destinazione non e' vuota!\nInstallazione interrotta!");
}
return true;
}
bool CopiaFile(const wxString& strFileSrc, const wxString& strFileDest)
@ -505,7 +522,7 @@ bool CopiaFile(const wxString& strFileSrc, const wxString& strFileDest)
fnFileDest.Mkdir(0777, wxPATH_MKDIR_FULL);
bool ok = ::wxCopyFile(strFileSrc, strFileDest);
if(ok)
if (ok)
{
DWORD dwFileAttribs = ::GetFileAttributes(strFileDest);
if (dwFileAttribs & FILE_ATTRIBUTE_READONLY)
@ -602,7 +619,6 @@ bool UnzipFile(const wxString& strSrcFile, const wxString& strDestDir)
}
else
{
//wxZipInputStream fin(strZipFile, strFileName); // 2.6 compatibility is gone!
wxFFileInputStream fstr(strZipFile);
wxZipInputStream fin(fstr);
@ -648,7 +664,6 @@ static const char* const encryption_key = "QSECOFR-";
static wxString CampoDecode(const wxString& data)
{
wxString tmp;
for (size_t i = 0; data[i]; i++)
tmp << wxChar(data[i] - (i < 8 ? encryption_key[i] : tmp[i - 8]));
@ -672,7 +687,7 @@ int FindReseller()
{
CampoIniFile iniOemMain(FindOemIniPath(), "MAIN");
const int nOem = iniOemMain.GetInt("OEM");
return nOem;
return nOem > 0 ? nOem : 0;
}
//stringhe globali per avere sempre a disposizione Reseller, Product e Appname in ogni momento (vanno sulle finestre)
@ -684,9 +699,7 @@ static void ReadOemIni()
//si basa sul reseller che è la guida di ogni parametro
if (_strReseller.IsEmpty())
{
int oem = FindReseller();
if (oem < 0)
oem = 0;
const int oem = FindReseller();
//trovato il numero del reseller legge il paragrafo corrispondente in oem.ini
const wxString strOemIniPath = FindOemIniPath();
@ -701,14 +714,10 @@ static void ReadOemIni()
const wxString strCriptedProduct = iniOem.Get("Product");
const wxString strCriptedReseller = iniOem.Get("Reseller");
//adesso viene il bello!deve decrittarle....ci vuole ENIGMA!
//usiamo una stringa del cazzo di appoggio per debuggare in tranquillità
wxString strCaz = CampoDecode(strCriptedAppname);
_strAppname = strCaz;
strCaz = CampoDecode(strCriptedProduct);
_strProduct = strCaz;
strCaz = CampoDecode(strCriptedReseller);
_strReseller = strCaz;
//adesso viene il bello! Deve decrittarle...ci vuole ENIGMA!
_strAppname = CampoDecode(strCriptedAppname);
_strProduct = CampoDecode(strCriptedProduct);
_strReseller = CampoDecode(strCriptedReseller);
//dati non crittati (a disposizione di cani e porci insomma...)
_strIcon = iniOem.Get("Icon");
@ -719,52 +728,31 @@ static void ReadOemIni()
}
}
//metodi per ritornare la stringa di competenza;si basano tutti su ReadOemIni
wxString Reseller()
static wxString ReturnOrLoad(const wxString& var)
{
if (_strReseller.IsEmpty())
if (var.IsEmpty())
ReadOemIni();
return _strReseller;
return var;
}
//metodi per ritornare la stringa di competenza; si basano tutti su ReadOemIni
wxString Reseller()
{ return ReturnOrLoad(_strReseller); }
wxString Product()
{
if (_strProduct.IsEmpty())
ReadOemIni();
return _strProduct;
}
{ return ReturnOrLoad(_strProduct); }
wxString Appname()
{
if (_strAppname.IsEmpty())
ReadOemIni();
return _strAppname;
}
{ return ReturnOrLoad(_strAppname); }
wxString Licence()
{
if (_strLicence.IsEmpty())
ReadOemIni();
return _strLicence;
}
{ return ReturnOrLoad(_strLicence); }
wxString Logo()
{
if (_strLogo.IsEmpty())
ReadOemIni();
return _strLogo;
}
{ return ReturnOrLoad(_strLogo); }
wxString Icon()
{
if (_strIcon.IsEmpty())
ReadOemIni();
return _strIcon;
}
{ return ReturnOrLoad(_strIcon); }
wxString Theme()
{
if (_strTheme.IsEmpty())
ReadOemIni();
return _strTheme;
}
{ return ReturnOrLoad(_strTheme); }

View File

@ -4,7 +4,8 @@
// lista dei tipi di installazione 0=non si sa, 1=standalone, 2=server, 3=client
enum InstallationType { it_none, it_standalone, it_server, it_client, it_upgrade = 9 };
enum LurchMode { lm_none, lm_service, lm_autostart };
enum LurchMode { lm_none, lm_service };
////////////////////////////////////////////////////////////////////////////////////////////
//Classe per la gestione dei files di configurazione tipo campo.ini
class CampoIniFile : public wxObject
@ -39,16 +40,6 @@ public:
//numeri delle versioni di windows
#define WUNKNOWN 0
#define W9XFIRST 1
#define W95 1
#define W95SP1 2
#define W95OSR2 3
#define W98 4
#define W98SP1 5
#define W98SE 6
#define WME 7
#define W9XLAST 99
#define WNTFIRST 101
#define WNT351 101
#define WNT4 102
@ -61,10 +52,6 @@ public:
#define W8 109
#define WNTLAST 199
#define WCEFIRST 201
#define WCE 201
#define WCELAST 299
//metodi generici
//finestre messaggio,errore,ecc...
bool ErrorBox(const wxString str);
@ -73,7 +60,7 @@ bool WarningBox(const wxString str);
bool YesNoBox(const wxString str);
//trattamento files
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg);
bool CheckAndMakeDir(const wxString& strDir, const wxString& strMsg);
bool UnzipFile(const wxString& strZipFile, const wxString& strDestdir);
bool CopiaFile(const wxString& file1, const wxString& file2);
void NormalizeSlash(wxString& strFileName);
@ -81,6 +68,7 @@ void NormalizeSlash(wxString& strFileName);
//interfaccia con windows
wxString GetWindowsProgramDirectory();
wxString GetWindowsDesktopDirectory();
unsigned long FindProcessId(LPCTSTR strProcess);
int GetSessionId();
bool GetWinVer(LPTSTR lpszVersion, int nVersionSize, int& nVersion, bool& bIsServer);

View File

@ -353,14 +353,9 @@ public:
//metodo per cercare se c'e' una chiave fisicamente collegata (serve per abilitare l'installazione demo)
bool CampoWizardPage3::LocalDongleTest() const
{
unsigned short serno = 0xFFFF;
int yearKey = 0;
serno = HardlockLogin(yearKey);
if (serno == 0xFFFF)
serno = EutronLogin(yearKey);
return serno != 0xFFFF && yearKey > 0;
const wxString ssa = wxFindFirstFile("*.ssa");
return !ssa.IsEmpty();
}
@ -643,8 +638,6 @@ public:
//metodi per la gestione dei bottoni per l'esecuzione dei programmi di installazione delle chiavi
BEGIN_EVENT_TABLE(CampoWizardPage4, CampoWizardPage)
EVT_BUTTON(401, OnHLPick)
EVT_BUTTON(402, OnEUPick)
EVT_BUTTON(403, OnSRPick)
EVT_BUTTON(405, OnSSAPick)
END_EVENT_TABLE()
@ -688,38 +681,32 @@ static wxString GetSetupDir()
void CampoWizardPage4::OnSSAPick(wxCommandEvent& e)
{
wxString strSerial;
strSerial = ::wxGetTextFromUser(_T("Inserire il numero di serie assegnato da Sirio"),
_T("Richiesta numero di serie"), strSerial, this);
const int nSerial = wxAtoi(strSerial);
if (nSerial > 1000 && nSerial < 65000)
wxString strSSA = wxFindFirstFile("*.ssa");
if (strSSA.IsEmpty())
{
wxString ssax = "C:"; // GetWindowsDesktopDirectory();
ssax += "\\";
ssax += strSerial;
wxString path = GetSetupDir();
path += "\\SSAGetInfo.exe -nome ";
path += ssax;
path += "\\SSAGetInfo.exe";
const long err = wxExecute(path, wxEXEC_SYNC);
if (err >= 0)
{
ssax += wxT(".ssax");
if (wxFileName::FileExists(ssax))
path = GetSetupDir();
path += "\\*.ssax";
strSSA = wxFindFirstFile(path);
if (wxFileName::FileExists(strSSA))
{
wxString msg = _T("Spedire il file \"");
msg += ssax;
msg += strSSA;
msg += _T("\" ad \"abilitazioni_software@sirio-is.it\" per ottenere la licenza da copiare nella cartella di destinazione.");
WarningBox(msg);
}
else
ErrorBox(_T("Non è stato possibile generare il file di richiesta licenza ") + ssax);
ErrorBox(_T("Non è stato possibile generare il file di richiesta licenza ") + strSSA);
}
else
ErrorBox(_T("Impossibile eseguire ") + path);
}
else
ErrorBox(_T("Numero di serie non valido"));
MessageBox(_T("Chiave sofwtare rilevata ") + strSSA);
}
@ -764,8 +751,6 @@ bool CampoWizardPage4::ForwardValidate()
bool CampoWizardPage4::TransferDataToWindow()
{
FindWindowById(401)->Disable();
FindWindowById(402)->Disable();
FindWindowById(403)->Disable();
FindWindowById(404)->Disable();
FindWindowById(405)->Disable();
@ -775,20 +760,10 @@ bool CampoWizardPage4::TransferDataToWindow()
const int nDongleType = DongleTest(serno);
GetWizard().SetDongleType(nDongleType);
wxString strTitle = wxT("Controllo della chiave hardware di protezione");
wxString strBody = wxT("<p>La versione commerciale del software richiede l'installazione e la presenza della chiave hardware di protezione</p>");
wxString strTitle = wxT("Controllo della chiave software di protezione");
wxString strBody = wxT("<p>La versione commerciale del software richiede l'installazione e la presenza della chiave software di protezione</p>");
switch (nDongleType)
{
case 1:
strBody += wxT("<p>E' stata rilevata la chiave #SERNO di tipo <b>Hardlock</b>:</p>");
strBody += wxT("<p align=center><img src=\"hardlock.gif\" /></p>");
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>PRODUCT</i></b>. Premere il pulsante \"Avanti\".</p>");
break;
case 2:
strBody += wxT("<p>E' stata rilevata la chiave #SERNO di tipo <b>Eutron</b>:</p>");
strBody += wxT("<p align=center><img src=\"eutron.gif\" /></p>");
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>PRODUCT</i></b>. Premere il pulsante \"Avanti\".</p>");
break;
case 3:
strBody += wxT("<p>E' stato rilevata una chiave remota condivisa in rete con il servizio di gestione autorizzazioni:</p>");
strBody += wxT("<p align=center><img src=\"autho.gif\" /></p>");
@ -801,13 +776,10 @@ bool CampoWizardPage4::TransferDataToWindow()
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>PRODUCT</i></b>. Premere il pulsante \"Avanti\".</p>");
break;
default:
strBody += wxT("<p><b>Non è stata rilevata alcuna chiave hardware installata sul computer!</b></p>");
strBody += wxT("<p>Per procedere all'installazione della chiave hardware, <b>collegarla al computer e premere il bottone corrispondente</b> alla tipologia della chiave stessa per installarne i driver.</p>");
strBody += wxT("<p>Se si utilizza una chiave remota collegata ad un altro computer e condivisa in rete attraverso il servizio gestione di autorizzazioni ");
strBody += wxT("premere il bottone <u>Cerca</u> per attivare la ricerca automatica della chiave remota. Qualora tale ricerca fallisse digitare il nome del computer ");
strBody += wxT("(o l'indirizzo IP) cui è collegata la chiave di rete e su cui è <b>installato e attivo</b> il gestore di autorizzazioni. ");
FindWindowById(401)->Enable();
FindWindowById(402)->Enable();
strBody += wxT("<p><b>Non è stata rilevata alcuna chiave software installata sul computer!</b></p>");
strBody += wxT("<p>Per procedere all'installazione della chiave, copiare il file con estensione '.ssa' ricevuto da Sirio nella cartella di destinazione.</p>");
strBody += wxT("<p>Se si utilizza una chiave remota, digitare il nome del computer ");
strBody += wxT("(o l'indirizzo IP) su cui è <b>installato e attivo</b> il gestore di autorizzazioni. ");
FindWindowById(403)->Enable();
FindWindowById(404)->Enable();
FindWindowById(405)->Enable();
@ -847,7 +819,7 @@ wxString CampoWizardPage4::DecodeString(const wxString& data)
int CampoWizardPage4::VersionYear()
{
char ver[32];
GetPrivateProfileString("ba", "Versione", "", ver, sizeof(ver), "../install.ini");
::GetPrivateProfileString("ba", "Versione", "", ver, sizeof(ver), "../install.ini");
ver[4] = '\0';
return atoi(ver);
}
@ -869,21 +841,7 @@ int CampoWizardPage4::DongleTest(unsigned short& serno)
if (serno == 0xFFFF)
{
serno = HardlockLogin(yearKey);
if (serno != 0xFFFF)
dongle_type = 1; //chiave hardlock
}
if (serno == 0xFFFF)
{
serno = EutronLogin(yearKey);
if (serno != 0xFFFF)
dongle_type = 2; //chiave eutron
}
if (serno == 0xFFFF)
{
serno = SSALogin(yearKey);
serno = DongleLogin(yearKey);
if (serno != 0xFFFF)
dongle_type = 4; //chiave software
}
@ -900,28 +858,6 @@ CampoWizardPage4::CampoWizardPage4(wxWizard* parent) : CampoWizardPage(parent)
wxGridBagSizer* gbsButtSizer = new wxGridBagSizer(VGAP, HGAP);
GetSizer()->Add(gbsButtSizer);
//prima riga della griglia
//Hardlock label
AddLabel(gbsButtSizer, "Installa chiave locale di tipo Hardlock", 0, 0);
//Hardlock image
wxBitmap bmp_HL("hardlock.gif", wxBITMAP_TYPE_GIF);
wxStaticBitmap* s_bmp_HL = new wxStaticBitmap(this, wxID_ANY, bmp_HL);
gbsButtSizer->Add(s_bmp_HL, wxGBPosition(0, 1));
//bottone Hardlock
wxButton* bHlButton = new wxButton(this, 401, wxT("Hardlock"), wxDefaultPosition, wxSize(64, -1));
gbsButtSizer->Add(bHlButton, wxGBPosition(0, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
//seconda riga della griglia
//Eutron label
AddLabel(gbsButtSizer, "Installa chiave locale di tipo Eutron", 1, 0);
//Eutron image
wxBitmap bmp_EU("eutron.gif", wxBITMAP_TYPE_GIF);
wxStaticBitmap* s_bmp_EU = new wxStaticBitmap(this, wxID_ANY, bmp_EU);
gbsButtSizer->Add(s_bmp_EU, wxGBPosition(1, 1));
//bottone Eutron
wxButton* bEuButton = new wxButton(this, 402, wxT("Eutron"), wxDefaultPosition, wxSize(64, -1));
gbsButtSizer->Add(bEuButton, wxGBPosition(1, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
//terza riga della griglia
//SSA label
AddLabel(gbsButtSizer, "Installa licenza software", 2, 0);
@ -1473,18 +1409,6 @@ bool CampoWizardPage8::ForwardValidate()
GetWizard().SetPrgNetPath(strPrgNetPath);
GetWizard().SetDataPath(strDataPath);
//...compresi eventuali stupidi servers!
const wxString strSrvDict = Get(807);
//se c'e' un nome di dictionary server e non lo trova si incazza
if (!strSrvDict.IsEmpty() && !DictionaryLogin(strSrvDict))
{
wxString strMsg;
strMsg << "Impossibile contattare il server " << strSrvDict << " per la gestione dei dizionari!";
return ErrorBox(strMsg);
}
else
GetWizard().SetSrvDict(strSrvDict);
return true;
}

View File

@ -22,14 +22,13 @@
#include <wx/wxprec.h>
#include <wx/dir.h>
#include <wx/fileconf.h>
#include <wx/filepicker.h>
#include <wx/gbsizer.h>
#include <wx/html/htmlwin.h>
#include <wx/mimetype.h>
#include <wx/progdlg.h>
#include <wx/radiobox.h>
#include <wx/txtstrm.h>
#include <wx/textfile.h>
#include <wx/wfstream.h>
#include <wx/wizard.h>
#include <wx/zipstrm.h>
@ -46,4 +45,4 @@ wxString Theme();
#define PRODUCT Product()
#define RESELLER Reseller()
#define APPNAME Appname()
#define APPVERSION wxT("11.0")
#define APPVERSION wxT("12.0")