Patch level : 10.0

Files correlati     : authoriz.exe lurch.exe
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione processi in autorun


git-svn-id: svn://10.65.10.50/trunk@20092 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-09 15:32:59 +00:00
parent 197a61c2ac
commit c79bb716e9
4 changed files with 52 additions and 38 deletions

View File

@ -946,7 +946,7 @@ bool TAuthorizationServer::Initialization()
if (m_MaxTries < 8) if (m_MaxTries < 8)
m_MaxTries = 8; m_MaxTries = 8;
const bool bTestAll = GetOemInt("OEM") == 0; const bool bTestAll = IsAdvanced();
for (unsigned int i = 0; i < m_MaxTries; i++) for (unsigned int i = 0; i < m_MaxTries; i++)
{ {
if (m_Dongle.Login(bTestAll)) if (m_Dongle.Login(bTestAll))

View File

@ -526,7 +526,7 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
case wxSOCKET_LOST: case wxSOCKET_LOST:
if (m_bLogVerbose) if (m_bLogVerbose)
WriteLog("--- Socket lost."); WriteLog("--- Socket lost.");
if (GetOemInt("OEM") == 0) if (IsAdvanced())
sock->Destroy(); sock->Destroy();
break; break;
default: default:
@ -637,52 +637,62 @@ bool TBaseServerApp::GetConfigBool(const wxChar* key, bool def, const wxChar* ap
const wxString str = GetConfigString(key, "*", app); const wxString str = GetConfigString(key, "*", app);
if (str != "*") if (str != "*")
val = (str[0u] == '1') || (str[0u] == 'X') || (str[0u] == 'Y') || (str.CmpNoCase("On") == 0); val = (str[0u] == '1') || (str[0u] == 'X') || (str[0u] == 'Y') || (str.CmpNoCase("On") == 0);
return val; return val;
} }
int TBaseServerApp::GetDefaultPort() const int TBaseServerApp::GetDefaultPort() const
{ return GetConfigInt("Port", 3883); }
#define OEM_INI wxT("../setup/oem.ini")
int TBaseServerApp::GetOemInt(const wxChar* key, int def) const
{ {
return GetConfigInt("Port", 3883); static int _oem = -1;
#ifdef __WXMSW__
if (_oem < 0)
_oem = ::GetPrivateProfileInt("MAIN", "OEM", -1, OEM_INI);
if (_oem >= 0)
{
if (wxStrcmp(key, wxT("OEM")) != 0)
{
wxString str; str.Printf(wxT("OEM_%d"), _oem);
def = ::GetPrivateProfileInt(str, key, def, OEM_INI);
}
else
def = _oem;
}
#endif
return def;
} }
wxString TBaseServerApp::GetOemString(const wxChar* key, const wxChar* def) const wxString TBaseServerApp::GetOemString(const wxChar* key, const wxChar* def) const
{ {
static int _oem = -1; const int oem = GetOemInt("OEM", -1);
wxString str; wxString str = def;
#ifdef __WXMSW__ if (oem >= 0)
if (_oem < 0)
_oem = ::GetPrivateProfileInt("MAIN", "OEM", 0, wxT("../setup/oem.ini"));
if (wxStrcmp(key, "OEM") != 0)
{ {
wxChar value[512]; memset(value, 0, sizeof(value)); if (wxStrcmp(key, "OEM") != 0)
str.Printf("OEM_%d", _oem); {
::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, wxT("../setup/oem.ini")); #ifdef __WXMSW__
str = value; wxChar value[512]; memset(value, 0, sizeof(value));
} str.Printf("OEM_%d", oem);
else ::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, OEM_INI);
str.Printf("%d", _oem); str = value;
#endif #endif
}
else
str.Printf("%d", oem);
}
return str; return str;
} }
int TBaseServerApp::GetOemInt(const wxChar* key, int def) const
{
wxString strDef;
if (def != 0) strDef.Printf("%d", def);
const wxString strVal = GetOemString(key, strDef);
return wxAtoi(strVal);
}
wxString TBaseServerApp::GetLogFileName() const wxString TBaseServerApp::GetLogFileName() const
{ { return GetConfigString("LogFile"); }
return GetConfigString("LogFile");
}
wxString TBaseServerApp::GetDocumentRoot() const wxString TBaseServerApp::GetDocumentRoot() const
{ { return GetConfigString("DocumentRoot", m_strPath); }
return GetConfigString("DocumentRoot", m_strPath);
}
bool TBaseServerApp::OnInit() bool TBaseServerApp::OnInit()
{ {

View File

@ -115,6 +115,7 @@ protected:
wxString GetOemString(const wxChar* key, const wxChar* def = wxEmptyString) const; wxString GetOemString(const wxChar* key, const wxChar* def = wxEmptyString) const;
int GetOemInt(const wxChar* key, int def = 0) const; int GetOemInt(const wxChar* key, int def = 0) const;
bool IsAdvanced() const { return GetOemInt(wxT("OEM"), -1) == 0; }
public: public:
// Utilities // Utilities

View File

@ -296,7 +296,7 @@ void TLurchServer::GenerateFile(wxString& strFilename)
wxString strHost; strHost << wxGetHostName() << wxT(":") << GetDefaultPort(); wxString strHost; strHost << wxGetHostName() << wxT(":") << GetDefaultPort();
tr1.AddChild("td").AddEnclosedText(strHost); tr1.AddChild("td").AddEnclosedText(strHost);
if (GetOemInt("OEM") == 0) if (IsAdvanced())
{ {
TXmlItem& tr2 = panel.AddChild("tr"); TXmlItem& tr2 = panel.AddChild("tr");
tr2.AddChild("td").AddEnclosedText("Ping Frequency"); tr2.AddChild("td").AddEnclosedText("Ping Frequency");
@ -650,15 +650,18 @@ bool TLurchServer::Initialization()
{ {
const wxArrayString& arr = GetAutoRunList(); const wxArrayString& arr = GetAutoRunList();
const size_t nAuto = arr.GetCount(); const size_t nAuto = arr.GetCount();
if (nAuto > 0 && GetOemInt("OEM") == 0) if (nAuto > 0)
{ {
for (size_t i = 0; i < nAuto; i++) for (size_t i = 0; i < nAuto; i++)
StartProcess(arr[i]); StartProcess(arr[i]);
const int nFreq = GetConfigInt("PingFreq"); if (IsAdvanced())
if (nFreq > 0)
{ {
m_PingTimer.Start(nFreq * 1000); // sec to msec const int nFreq = GetConfigInt("PingFreq");
m_Semaphore.Post(); // GREEN! if (nFreq > 0)
{
m_PingTimer.Start(nFreq * 1000); // sec to msec
m_Semaphore.Post(); // GREEN!
}
} }
} }
return true; return true;