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:
parent
197a61c2ac
commit
c79bb716e9
@ -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))
|
||||||
|
@ -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)
|
if (wxStrcmp(key, "OEM") != 0)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
wxChar value[512]; memset(value, 0, sizeof(value));
|
wxChar value[512]; memset(value, 0, sizeof(value));
|
||||||
str.Printf("OEM_%d", _oem);
|
str.Printf("OEM_%d", oem);
|
||||||
::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, wxT("../setup/oem.ini"));
|
::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, OEM_INI);
|
||||||
str = value;
|
str = value;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
str.Printf("%d", _oem);
|
str.Printf("%d", oem);
|
||||||
#endif
|
}
|
||||||
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()
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
@ -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,16 +650,19 @@ 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]);
|
||||||
|
if (IsAdvanced())
|
||||||
|
{
|
||||||
const int nFreq = GetConfigInt("PingFreq");
|
const int nFreq = GetConfigInt("PingFreq");
|
||||||
if (nFreq > 0)
|
if (nFreq > 0)
|
||||||
{
|
{
|
||||||
m_PingTimer.Start(nFreq * 1000); // sec to msec
|
m_PingTimer.Start(nFreq * 1000); // sec to msec
|
||||||
m_Semaphore.Post(); // GREEN!
|
m_Semaphore.Post(); // GREEN!
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user