From edd1a66d5e06aa5ea95c04abd5462886394d7660 Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 20 Dec 2007 10:44:31 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15930 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- setup/Setup.cpp | 6 +- setup/utils.cpp | 168 ++++++++++++++++++++++++------------------------ 2 files changed, 88 insertions(+), 86 deletions(-) diff --git a/setup/Setup.cpp b/setup/Setup.cpp index 0dcac533f..fa91d6a4a 100755 --- a/setup/Setup.cpp +++ b/setup/Setup.cpp @@ -232,16 +232,18 @@ bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wx //stringa path della cartella Servers in base alle scelte dell'utente const wxString strSrvPath = strExe.GetPath(); - //Eliminatore di precedenti servers installati come servizi + //1) Eliminatore di precedenti servers installati come servizi //cerca se non esiste per caso gia' da una precedente installazione.. //..non serve piu' a un cazzo ma si e' tenuto come prova in debug di lettura del registry! wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application"); - //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) Eliminatore di precedenti servers installati come programmi in esecuzione automatica + + switch (iSrvAutostartMode) { //esecuzione server come servizi (magia!) diff --git a/setup/utils.cpp b/setup/utils.cpp index 2243fede8..1f743d85d 100755 --- a/setup/utils.cpp +++ b/setup/utils.cpp @@ -212,107 +212,107 @@ bool WarningBox(const wxString str) //classe per gestire i .Ini di campo //----------------------------------------------------------------------------------- - bool CampoIniFile::GetFirstGroup(wxString& strGroup, long& nIndex) - { - m_asGroups.Clear(); +bool CampoIniFile::GetFirstGroup(wxString& strGroup, long& nIndex) +{ + m_asGroups.Clear(); - char bufferone[1024*16]; - ::GetPrivateProfileSectionNames(bufferone, sizeof(bufferone), m_strIniName); - const char* inizio = bufferone; - for (const char* b = bufferone; ; b++) if (*b == '\0') + char bufferone[1024*16]; + ::GetPrivateProfileSectionNames(bufferone, sizeof(bufferone), m_strIniName); + const char* inizio = bufferone; + for (const char* b = bufferone; ; b++) if (*b == '\0') + { + if (*inizio) { - if (*inizio) - { - m_asGroups.Add(inizio); - inizio = b+1; - } - else - break; + m_asGroups.Add(inizio); + inizio = b+1; } - - nIndex = 0; - return GetNextGroup(strGroup, nIndex); + else + break; } - bool CampoIniFile::GetNextGroup(wxString& strGroup, long& nIndex) - { - const bool ok = nIndex >= 0 && nIndex < (long)m_asGroups.GetCount(); - if (ok) - strGroup = m_asGroups[nIndex++]; - return ok; - } + nIndex = 0; + return GetNextGroup(strGroup, nIndex); +} - bool CampoIniFile::DeleteGroup(const wxString strGroup) - { - return WritePrivateProfileString(m_strGroup, NULL, NULL, m_strIniName) != 0; - } +bool CampoIniFile::GetNextGroup(wxString& strGroup, long& nIndex) +{ + const bool ok = nIndex >= 0 && nIndex < (long)m_asGroups.GetCount(); + if (ok) + strGroup = m_asGroups[nIndex++]; + return ok; +} - bool CampoIniFile::GetFirstEntry(wxString& strEntry, long& nIndex) - { - m_asEntries.Clear(); +bool CampoIniFile::DeleteGroup(const wxString strGroup) +{ + return WritePrivateProfileString(m_strGroup, NULL, NULL, m_strIniName) != 0; +} - char bufferone[1024*32]; - ::GetPrivateProfileSection(m_strGroup, bufferone, sizeof(bufferone), m_strIniName); - const char* pInizio = bufferone; - for (const char* b = bufferone; ; b++) if (*b == '\0') +bool CampoIniFile::GetFirstEntry(wxString& strEntry, long& nIndex) +{ + m_asEntries.Clear(); + + char bufferone[1024*32]; + ::GetPrivateProfileSection(m_strGroup, bufferone, sizeof(bufferone), m_strIniName); + const char* pInizio = bufferone; + for (const char* b = bufferone; ; b++) if (*b == '\0') + { + if (*pInizio) { - if (*pInizio) - { - wxString strWrk = pInizio; - strWrk = strWrk.BeforeFirst('='); - strWrk.Trim(); - //prende solo il nome della variabile per completare la lista! dopo l'= ci sarebbe il valore - m_asEntries.Add(strWrk); - pInizio = b+1; - } - else - break; + wxString strWrk = pInizio; + strWrk = strWrk.BeforeFirst('='); + strWrk.Trim(); + //prende solo il nome della variabile per completare la lista! dopo l'= ci sarebbe il valore + m_asEntries.Add(strWrk); + pInizio = b+1; } - - nIndex = 0; - return GetNextEntry(strEntry, nIndex); + else + break; } - bool CampoIniFile::GetNextEntry(wxString& strEntry, long& nIndex) - { - const bool ok = nIndex >= 0 && nIndex < (long)m_asEntries.GetCount(); - if (ok) - strEntry = m_asEntries[nIndex++]; - return ok; - } + nIndex = 0; + return GetNextEntry(strEntry, nIndex); +} - wxString CampoIniFile::Get(const wxString strVariable) const - { - wxString strOutString; - char* buffer = strOutString.GetWriteBuf(256); - GetPrivateProfileString(m_strGroup, strVariable, "", buffer, 256, m_strIniName); - strOutString.UngetWriteBuf(); //sblocca la memoria senno' la stringa resta per sempre!!! +bool CampoIniFile::GetNextEntry(wxString& strEntry, long& nIndex) +{ + const bool ok = nIndex >= 0 && nIndex < (long)m_asEntries.GetCount(); + if (ok) + strEntry = m_asEntries[nIndex++]; + return ok; +} - return strOutString; - } +wxString CampoIniFile::Get(const wxString strVariable) const +{ + wxString strOutString; + char* buffer = strOutString.GetWriteBuf(256); + GetPrivateProfileString(m_strGroup, strVariable, "", buffer, 256, m_strIniName); + strOutString.UngetWriteBuf(); //sblocca la memoria senno' la stringa resta per sempre!!! - bool CampoIniFile::GetBool(const wxString strVariable) const - { - const char chVal = Get(strVariable)[0]; - return chVal == 'X' || chVal == 'Y' || chVal == '1'; - } + return strOutString; +} - int CampoIniFile::GetInt(const wxString strVariable) const - { - return atoi(Get(strVariable)); - } +bool CampoIniFile::GetBool(const wxString strVariable) const +{ + const char chVal = Get(strVariable)[0]; + return chVal == 'X' || chVal == 'Y' || chVal == '1'; +} - bool CampoIniFile::Set(const wxString strVariable, const wxString strValue) - { - return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0; - } - - bool CampoIniFile::Set(const wxString strVariable, const int uValue) - { - wxString strValue; - strValue << uValue; - return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0; - } +int CampoIniFile::GetInt(const wxString strVariable) const +{ + return atoi(Get(strVariable)); +} + +bool CampoIniFile::Set(const wxString strVariable, const wxString strValue) +{ + return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0; +} + +bool CampoIniFile::Set(const wxString strVariable, const int uValue) +{ + wxString strValue; + strValue << uValue; + return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0; +} //costruttore CampoIniFile::CampoIniFile(const wxString strIniPath, wxString strGroup)