From 144a07f64695b71bfa22da54ee88b87dae391898 Mon Sep 17 00:00:00 2001
From: luca
Digitare nel campo 'Cartella remota dati da utilizzare' il percorso completo della cartella di rete dove sono i dati. "); strBody += wxT("E' la cartella dei dati condivisa dal server precedentemente installato.
"); - strBody += wxT("Gestore autorizzazioni: e' il computer gestore di una chiave di protezione hardware multiutenza condivisa in rete. "); - strBody += wxT("Generalmente e' il computer agente da server di APPNAME e su cui deve essere presente la chiave di protezione multiutenza.
"); - strBody += wxT("Gestore dizionari: e' il computer gestore dei dizionari di APPNAME in lingue diverse dall'italiano. "); - strBody += wxT("Generalmente e' il computer che agente da server di APPNAME.
"); - + strBody += wxT("Gestore dizionari: e' il computer gestore dei dizionari di APPNAME in lingue diverse dall'italiano. Generalmente e' il computer agente da server di APPNAME in rete. "); + strBody += wxT("Premere il bottone Cerca per attivare la ricerca automatica di tale computer. Qualora tale ricerca fallisse digitare il nome del computer gestore dei dizionari
"); + SetHTMLText(strTitle, strBody); //griglia per sistemare i campi @@ -1346,7 +1324,7 @@ CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) wxString strPath; strPath = "C:\\"; strPath += APPNAME; - wxTextCtrl* tcDestPrgPath = new wxTextCtrl(this, 801, strPath, wxDefaultPosition, wxSize(320,-1)); + wxTextCtrl* tcDestPrgPath = new wxTextCtrl(this, 801, strPath, wxDefaultPosition, wxSize(256,-1)); gbsSizer->Add(tcDestPrgPath, wxGBPosition(0, 1)); //bottone 'sfoglia' wxButton* bDestPrgButton = new wxButton(this, 802, wxT("Sfoglia"), wxDefaultPosition, wxSize(48, -1)); @@ -1358,7 +1336,7 @@ CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) //campo testo strPath = "Z:\\"; strPath += APPNAME; - wxTextCtrl* tcSrcPrgPath = new wxTextCtrl(this, 803, strPath, wxDefaultPosition, wxSize(320,-1)); + wxTextCtrl* tcSrcPrgPath = new wxTextCtrl(this, 803, strPath, wxDefaultPosition, wxSize(256,-1)); gbsSizer->Add(tcSrcPrgPath, wxGBPosition(1, 1)); //bottone 'sfoglia' wxButton* bSrcPrgButton = new wxButton(this, 804, wxT("Sfoglia"), wxDefaultPosition, wxSize(48, -1)); @@ -1369,31 +1347,21 @@ CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) AddLabel(gbsSizer, "Cartella remota dati da utilizzare", 2, 0); //campo testo strPath += "/dati"; - wxTextCtrl* tcDataPath = new wxTextCtrl(this, 805, strPath, wxDefaultPosition, wxSize(320,-1)); + wxTextCtrl* tcDataPath = new wxTextCtrl(this, 805, strPath, wxDefaultPosition, wxSize(256,-1)); gbsSizer->Add(tcDataPath, wxGBPosition(2, 1)); //bottone 'sfoglia' wxButton* bDataButton = new wxButton(this, 806, wxT("Sfoglia"), wxDefaultPosition, wxSize(48, -1)); gbsSizer->Add(bDataButton, wxGBPosition(2, 2)); - //quarta riga della griglia - //check usa authoriz - wxCheckBox* chAuthoriz = new wxCheckBox(this, 807, wxT("Utilizza il gestore delle autorizzazioni")); - chAuthoriz->SetValue(false); - gbsSizer->Add(chAuthoriz, wxGBPosition(3, 1)); - //quale e' il server authoriz - wxTextCtrl* tcAuthoriz = new wxTextCtrl(this, 808, "nomeserverautorizzazioni", wxDefaultPosition, wxSize(96,-1)); - tcAuthoriz->Disable(); - gbsSizer->Add(tcAuthoriz, wxGBPosition(3, 2)); - - //quarta riga della griglia - //check usa diction - wxCheckBox* chDictionary = new wxCheckBox(this, 809, wxT("Utilizza il gestore dei dizionari")); - chDictionary->SetValue(false); - gbsSizer->Add(chDictionary, wxGBPosition(4, 1)); - //quale e' il server diction - wxTextCtrl* tcDiction = new wxTextCtrl(this, 810, "nomeserverdizionario", wxDefaultPosition, wxSize(96,-1)); - tcDiction->Disable(); - gbsSizer->Add(tcDiction, wxGBPosition(4, 2)); + //terza riga della griglia + //Server dizionari label + AddLabel(gbsSizer, "Nome o indirizzo IP del server dei dizionari", 3, 0); + //nome Server dizionari + wxTextCtrl* tcSrvName = new wxTextCtrl(this, 807, "", wxDefaultPosition, wxSize(256,-1)); + gbsSizer->Add(tcSrvName, wxGBPosition(3, 1)); + //bottone Cerca + wxButton* bSrvButton = new wxButton(this, 808, wxT("Cerca"), wxDefaultPosition, wxSize(48, -1)); + gbsSizer->Add(bSrvButton, wxGBPosition(3, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); } @@ -1883,6 +1851,8 @@ class CampoSetup : public wxApp CampoFrame* m_pMainFrame; wxLocale m_locale; + CampoWizard* m_pWizard; + private: bool WriteRegistryKey(HKEY hBaseKey, const wxString strKey, const wxString& strValue) const; wxString ReadRegistryKey(HKEY hBaseKey, const wxString strKey) const; @@ -1891,6 +1861,7 @@ private: protected: DECLARE_EVENT_TABLE() void OnTimer(wxTimerEvent& e); +// void OnSocketEvent(wxSocketEvent& se); bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile) const; bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath); void AssociateExtension(const wxFileName& strExeFile, const wxString strExt); @@ -1913,8 +1884,19 @@ IMPLEMENT_APP(CampoSetup) BEGIN_EVENT_TABLE(CampoSetup, wxApp) EVT_TIMER(883, OnTimer) + //EVT_SOCKET(1001, CampoSetup::OnSocketEvent(wxSocketEvent& se)) END_EVENT_TABLE() + +/*void CampoSetup::OnSocketEvent(wxSocketEvent& se) +{ + if (se.GetSocketEvent() == wxSOCKET_CONNECTION) + { + m_pWizard + } +}*/ + + //metodi di lettura/scrittura registry di windows (fantastici!) wxString CampoSetup::ReadRegistryKey(HKEY hBaseKey, const wxString strKey) const { @@ -2255,9 +2237,9 @@ void CampoSetup::UnzipSystem(const wxString& strPrgLocPath) const //metodo principale dell'applicazione che gestisce l'ordine degli eventi nella installazione vera e propria void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) { - CampoWizard* pWizard = new CampoWizard(m_pMainFrame); + m_pWizard = new CampoWizard(m_pMainFrame); - if (pWizard->Run()) + if (m_pWizard->Run()) { wxFileName strPath = argv[0]; strPath.SetCwd(); @@ -2265,15 +2247,15 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) // 1) RACCOLTA PARAMETRI GENERALI INSTALLAZIONE (tipo,path,cartelle,servers,...) //------------------------------------------------------------------------------ //tipo di installazione/aggiornamento - const unsigned int uInstallationType = pWizard->GetInstallationType(); + const unsigned int uInstallationType = m_pWizard->GetInstallationType(); const bool bNewInstallation = uInstallationType < 3; //installazione servers? - const bool bInstallLurch = uInstallationType == 1 && (pWizard->GetInstUseAuth() || pWizard->GetInstUseDict()); + const bool bInstallLurch = uInstallationType == 1 && (m_pWizard->GetInstUseAuth() || m_pWizard->GetInstUseDict()); //installazione datidemo? (oddio speriamo di no!; comunque vale solo per installazione standard) - const bool bInstallDemoData = uInstallationType == 0 && pWizard->GetInstDemoData(); + const bool bInstallDemoData = uInstallationType == 0 && m_pWizard->GetInstDemoData(); //cartelle selezionate dall'utente - const wxString& strPrgLocPath = pWizard->GetPrgLocPath(); - const wxString& strDataPath = pWizard->GetDataPath(); + const wxString& strPrgLocPath = m_pWizard->GetPrgLocPath(); + const wxString& strDataPath = m_pWizard->GetDataPath(); //se nuova installazione deve anche creare la directory di destinazione if (bNewInstallation) @@ -2430,7 +2412,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) { //parentesi necessaria per la scrittura immediata (non cancellare! serve per debug) //paragrafo [Main] CampoIniFile CampoIniMain(strPrgLocPath + "/campo.ini", "Main"); - const unsigned int uDongleType = pWizard->GetDongleType(); + const unsigned int uDongleType = m_pWizard->GetDongleType(); CampoIniMain.Set("Donglehw", uDongleType); CampoIniMain.Set("Study", strDataPath); CampoIniMain.Set("Firm", "com"); @@ -2450,10 +2432,10 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) if (bInstallLurch) { CampoIniFile CampoIniSrv(strPrgLocPath + "/campo.ini", "Server"); - if (pWizard->GetInstUseAuth()) - CampoIniSrv.Set("Authoriz", pWizard->GetSrvAuth()); - if (pWizard->GetInstUseDict()) - CampoIniSrv.Set("Dictionary", pWizard->GetSrvDict()); + if (m_pWizard->GetInstUseAuth()) + CampoIniSrv.Set("Authoriz", m_pWizard->GetSrvAuth()); + if (m_pWizard->GetInstUseDict()) + CampoIniSrv.Set("Dictionary", m_pWizard->GetSrvDict()); } } //if(bNewInstallation... @@ -2465,7 +2447,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) { CampoIniFile CampoInstall(strPrgLocPath + "/install.ini", "Main"); if (uInstallationType == 2) //client: directory origine sul server - CampoInstall.Set("DiskPath", pWizard->GetPrgNetPath()); + CampoInstall.Set("DiskPath", m_pWizard->GetPrgNetPath()); else //e' il path assoluto dell'install.ini che sta in 'program' (es. D:\program) { wxFileName strSourcePath(wxGetCwd()); @@ -2483,7 +2465,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) //..avvia la procedura della creazione dell'autostart(un casino) if (bInstallLurch) { - const int iSrvAutostartMode = pWizard->GetSrvAutostartMode(); + const int iSrvAutostartMode = m_pWizard->GetSrvAutostartMode(); CreateAutostartMode(iSrvAutostartMode, strPrgLocPath); } @@ -2498,7 +2480,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) // 8) CREAZIONE DELL'ICONA SUL DESKTOP //------------------------------------ const wxFileName strExe(strPrgLocPath, wxT("ba0.exe")); - const bool bDesktopShortcut = pWizard->GetDesktopShortcut(); + const bool bDesktopShortcut = m_pWizard->GetDesktopShortcut(); if (bDesktopShortcut) CreateIcon(CSIDL_COMMON_DESKTOPDIRECTORY, strExe); @@ -2529,8 +2511,8 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) wxSetWorkingDirectory(strPrgLocPath); wxExecute("ba1 -6 /uADMIN"); - } //if (pWizard->Run())... - pWizard->Destroy(); + } //if (m_pWizard->Run())... + m_pWizard->Destroy(); //finestrina x chiudere a mano il programma (sconsigliata causa lancio ba1.exe) // ::wxMessageBox(wxT("Installazione terminata"), APPNAME, wxOK | wxICON_INFORMATION); diff --git a/setup/setupkey.cpp b/setup/setupkey.cpp index 9122b23a6..1c9bca06f 100755 --- a/setup/setupkey.cpp +++ b/setup/setupkey.cpp @@ -68,6 +68,8 @@ unsigned short HardlockLogin(int& year) memcpy(data, &eprom[60], sizeof(data)); if (HardlockGarble(data)) year = (int)data[0]; + + HL_LOGOUT(); } return serno; } @@ -117,6 +119,7 @@ unsigned short EutronLogin(int& year) 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) { @@ -130,6 +133,9 @@ unsigned short EutronLogin(int& year) else year = ThisYear(); + eutron_key.net_command = NET_KEY_CLOSE; + smartlink(&eutron_key); + break; } } @@ -152,18 +158,26 @@ static unsigned short InquireSocketNumber(wxSocketClient& sc, const wxString& st static unsigned short InquireServer(const wxString& strSrvName, int& year, const bool bMsg) { + unsigned short serno = 0xFFFF; + year = 0; + wxIPV4address ip; if (!ip.Hostname(strSrvName) || !ip.Service("1883")) //indirizzo NON valido o porta scazzata! { if (bMsg) ErrorBox("Indirizzo IP errato!"); - return 0xFFFF; + return serno; } - wxSocketClient sc; - sc.SetTimeout(2); - sc.SetFlags(sc.GetFlags() | wxSOCKET_REUSEADDR); - if (!sc.Connect(ip)) //il computer remoto risponde ma il server no (non c'e' o e' spento) + wxSocketClient* sc = new wxSocketClient; + sc->SetTimeout(2); + if (sc->Connect(ip)) //il computer remoto risponde ma il server no (non c'e' o e' spento) + { + serno = InquireSocketNumber(*sc, "DongleNumber()"); + year = InquireSocketNumber(*sc, "DongleYear()"); + sc->Discard(); + } + else { if (bMsg) { @@ -171,13 +185,9 @@ static unsigned short InquireServer(const wxString& strSrvName, int& year, const strMsg << "Il server " << strSrvName << " non e' raggiungibile!"; ErrorBox(strMsg); } - return 0xFFFF; } - - unsigned short serno = InquireSocketNumber(sc, "DongleNumber()"); - year = InquireSocketNumber(sc, "DongleYear()"); - sc.Destroy(); + sc->Destroy(); return serno; } @@ -197,14 +207,15 @@ unsigned short ServerLogin(int& year, wxString& strSrvName) if (strMyIP.Len() > 7) { - const unsigned short MaxSck = 6; - for (int j = 3; j < 256 && serno == 0xFFFF; j += MaxSck) + const unsigned short MaxSck = 256; +// for (int j = 3; j < 256 && serno == 0xFFFF; j += MaxSck) { - wxSocketClient sc[MaxSck]; + wxSocketClient* sc[MaxSck]; + memset(sc, 0, sizeof(sc)); wxIPV4address ipRemote[MaxSck]; for (int i = 0; i < MaxSck; i++) { - const int n = i+j; + const int n = i; //+j; if (n < 256) { //deve sostituire l'ultima cifra dell'IP con tutti i numeri che vanno da 0 a 255 alla ricerca del server @@ -214,28 +225,30 @@ unsigned short ServerLogin(int& year, wxString& strSrvName) continue; if (ipRemote[i].Hostname(strSrvIP) && ipRemote[i].Service("1883")) { - sc[i].SetTimeout(2); - sc[i].SetFlags(sc[i].GetFlags() | wxSOCKET_REUSEADDR); - sc[i].Connect(ipRemote[i], false); + sc[i] = new wxSocketClient; + sc[i]->SetTimeout(2); + sc[i]->Connect(ipRemote[i], false); } } } wxMilliSleep(100); - for (int i = 0; i < MaxSck; i++) + for (int i = 0; i < MaxSck; i++) if (sc[i]) { - sc[i].WaitOnConnect(0, 1); - if (sc[i].IsConnected()) + sc[i]->WaitOnConnect(0, 1); + if (sc[i]->IsConnected()) { - sc[i].GetPeer(ipRemote[i]); + sc[i]->GetPeer(ipRemote[i]); strSrvName = ipRemote[i].Hostname(); - serno = InquireSocketNumber(sc[i], "DongleNumber()"); - year = InquireSocketNumber(sc[i], "DongleYear()"); + serno = InquireSocketNumber(*sc[i], "DongleNumber()"); + year = InquireSocketNumber(*sc[i], "DongleYear()"); + sc[i]->Discard(); if (year > 0) break; } + sc[i]->Close(); } //for (inti =0... - for (int i = 0; i < MaxSck; i++) - sc[i].Destroy(); + for (int i = 0; i < MaxSck; i++) if (sc[i]) + sc[i]->Destroy(); } //for(int j=0... } //if(strMyIP.Len()... } //if(strSrvName.Is... @@ -244,3 +257,9 @@ unsigned short ServerLogin(int& year, wxString& strSrvName) return serno; } + + +bool DictionaryLogin(const wxString& strSrvName) +{ + return false; +} diff --git a/setup/setupkey.h b/setup/setupkey.h index cac64b252..9206a4ed2 100755 --- a/setup/setupkey.h +++ b/setup/setupkey.h @@ -11,5 +11,6 @@ void EncodeEutronPassword(char* str); unsigned short EutronLogin(int& year); unsigned short ServerLogin(int& year, wxString& strSrvName); +bool DictionaryLogin(const wxString& strSrvName); #endif \ No newline at end of file