diff --git a/setup/Setup.cpp b/setup/Setup.cpp index 07c09ee03..32886c482 100755 --- a/setup/Setup.cpp +++ b/setup/Setup.cpp @@ -90,6 +90,7 @@ class CampoSetup : public wxApp CampoFrame* m_pMainFrame; wxLocale m_locale; wxString m_strSetupPath; + bool m_bLurchWasRunning; CampoWizard* m_pWizard; @@ -118,6 +119,7 @@ protected: bool CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath); bool StopLurch() const; bool StartLurch(const wxString& strPrgLocPath) const; + bool LurchWasRunning() const { return m_bLurchWasRunning; } //metodi di interfaccia con il registry di Windows wxString ReadRootRegistryKey(const wxString strKey) const; @@ -350,20 +352,21 @@ bool CampoSetup::StopLurch() const 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"; - wxExecute(strExecService, wxEXEC_SYNC); + ok = wxExecute(strExecService, wxEXEC_SYNC) > 0; } else { wxString strPath = strPrgLocPath; strPath += "/servers/lurch.exe"; - wxExecute(strPath, wxEXEC_ASYNC); + ok = wxExecute(strPath, wxEXEC_ASYNC) > 0; } - return true; + return ok; } bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath) @@ -483,12 +486,6 @@ void CampoSetup::UpdateInstallIni(const wxString strSourcePath, const wxString s bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strSrc, const wxString& strModule) const { - //Attenzione! Se c'e' il server di chiavi in funzione va fermato prima di procedere!!!! - const bool bLurch = strModule == "sr" && LurchRunning(); - - if (bLurch) - StopLurch(); - bool ok = false; wxArrayString asFilesList; size_t uFilesToCopy; @@ -522,6 +519,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) StartLurch(strPrgLocPath); @@ -1397,7 +1395,8 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) } //controllo di eventuali Campo o servers attivi e conseguente interruzione dell'installazione - if (LurchRunning()) + m_bLurchWasRunning = LurchRunning(); + if (m_bLurchWasRunning) { wxString msg; msg << "Per poter aggiornare/installare il programma " << PRODUCT diff --git a/setup/tetra_logo.jpg b/setup/tetra_logo.jpg index 3df567e29..700887d6b 100755 Binary files a/setup/tetra_logo.jpg and b/setup/tetra_logo.jpg differ diff --git a/setup/utils.cpp b/setup/utils.cpp index 79add150c..e91454638 100755 --- a/setup/utils.cpp +++ b/setup/utils.cpp @@ -679,12 +679,22 @@ static wxString CampoDecode(const wxString& data) return tmp; } +static wxString FindOemIniPath() +{ + wxString strWorkingDir = wxFileName::GetCwd(); + strWorkingDir.MakeLower(); + if (!strWorkingDir.EndsWith("setup")) + strWorkingDir << "/setup"; + + strWorkingDir << "/oem.ini"; + + return strWorkingDir; +} + //trova il numero del reseller int FindReseller() { - wxString strWorkingDir = wxFileName::GetCwd(); - strWorkingDir << "/oem.ini"; - CampoIniFile iniOemMain(strWorkingDir, "MAIN"); + CampoIniFile iniOemMain(FindOemIniPath(), "MAIN"); const int nOem = iniOemMain.GetInt("OEM"); return nOem; } @@ -703,11 +713,11 @@ static void ReadOemIni() oem = 0; //trovato il numero del reseller legge il paragrafo corrispondente in oem.ini - wxString strWorkingDir = wxFileName::GetCwd(); - strWorkingDir << "/oem.ini"; + const wxString strOemIniPath = FindOemIniPath(); + wxString strParagraph; strParagraph << "OEM_" << oem; - CampoIniFile iniOem(strWorkingDir, strParagraph); + CampoIniFile iniOem(strOemIniPath, strParagraph); //raccatta le informazioni dal paragrafo corretto del produttore //prima quelle crittate