mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-25 02:10:53 +00:00
Changed: Remove commented old crash report code
--HG-- branch : develop
This commit is contained in:
parent
7237736922
commit
ded0b3a252
1 changed files with 3 additions and 207 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
|
#include "user_agent.h"
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// INCLUDES //
|
// INCLUDES //
|
||||||
|
@ -141,213 +141,9 @@ INT_PTR CALLBACK MyDialogProc(
|
||||||
|
|
||||||
HWND SlashScreen = NULL;
|
HWND SlashScreen = NULL;
|
||||||
HINSTANCE HInstance;
|
HINSTANCE HInstance;
|
||||||
/*
|
|
||||||
static bool connect()
|
|
||||||
{
|
|
||||||
string server = "crashcounter.nevrax.com";
|
|
||||||
|
|
||||||
if(CrashCounterSock.connected())
|
// make it global if other classes/functions want to access to it
|
||||||
return true;
|
NLMISC::CCmdArgs Args;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// add the default port if no port in the cfg
|
|
||||||
if(server.find(':') == string::npos)
|
|
||||||
server+=":80";
|
|
||||||
CrashCounterSock.connect(CInetAddress(server));
|
|
||||||
if(!CrashCounterSock.connected())
|
|
||||||
{
|
|
||||||
nlwarning("Can't connect to web server '%s'", server.c_str());
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(const Exception &e)
|
|
||||||
{
|
|
||||||
nlwarning("Can't connect to web server '%s': %s", server.c_str(), e.what());
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
end:
|
|
||||||
|
|
||||||
if(CrashCounterSock.connected())
|
|
||||||
CrashCounterSock.close ();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
static bool send(const string &url)
|
|
||||||
{
|
|
||||||
if (CrashCounterSock.connected())
|
|
||||||
{
|
|
||||||
string buffer = "GET " + url +
|
|
||||||
" HTTP/1.0\n"
|
|
||||||
"Host: crashcounter.nevrax.com\n"
|
|
||||||
"User-agent: Ryzom\n"
|
|
||||||
"\n";
|
|
||||||
uint32 size = (uint32)buffer.size();
|
|
||||||
if(!url.empty())
|
|
||||||
{
|
|
||||||
if(CrashCounterSock.send((uint8 *)buffer.c_str(), size, false) != CSock::Ok)
|
|
||||||
{
|
|
||||||
nlwarning ("Can't send data to the server");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
static bool receive(string &res)
|
|
||||||
{
|
|
||||||
if (CrashCounterSock.connected())
|
|
||||||
{
|
|
||||||
uint32 size;
|
|
||||||
res = "";
|
|
||||||
|
|
||||||
uint8 buf[1024];
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
size = 1023;
|
|
||||||
|
|
||||||
if (CrashCounterSock.receive((uint8*)buf, size, false) == CSock::Ok)
|
|
||||||
{
|
|
||||||
buf[1023] = '\0';
|
|
||||||
res += (char*)buf;
|
|
||||||
//nlinfo("block received '%s'", buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf[size] = '\0';
|
|
||||||
res += (char*)buf;
|
|
||||||
//nlwarning ("server connection closed");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//nlinfo("all received '%s'", res.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CrashFeedback = "CRASHED";
|
|
||||||
|
|
||||||
INT_PTR CALLBACK ReportDialogProc(
|
|
||||||
HWND hwndDlg, // handle to dialog box
|
|
||||||
UINT uMsg, // message
|
|
||||||
WPARAM wParam, // first message parameter
|
|
||||||
LPARAM lParam // second message parameter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
|
||||||
RECT rect;
|
|
||||||
RECT rectDesktop;
|
|
||||||
GetWindowRect (hwndDlg, &rect);
|
|
||||||
GetWindowRect (GetDesktopWindow (), &rectDesktop);
|
|
||||||
SetWindowPos (hwndDlg, HWND_TOPMOST, (rectDesktop.right-rectDesktop.left-rect.right+rect.left)/2, (rectDesktop.bottom-rectDesktop.top-rect.bottom+rect.top)/2, 0, 0, SWP_NOSIZE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_COMMAND:
|
|
||||||
switch (LOWORD(wParam))
|
|
||||||
{
|
|
||||||
case FROZEN:
|
|
||||||
CrashFeedback = "USER_FROZEN";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case REBOOTED:
|
|
||||||
CrashFeedback = "USER_REBOOTED";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case WINDOWED:
|
|
||||||
CrashFeedback = "USER_WINDOWED";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case NO_WINDOW:
|
|
||||||
CrashFeedback = "USER_NO_WINDOW";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case KILLED:
|
|
||||||
CrashFeedback = "USER_KILLED";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case NOT_CRASHED:
|
|
||||||
CrashFeedback = "USER_NOT_CRASHED";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
case CRASHED:
|
|
||||||
CrashFeedback = "CRASHED";
|
|
||||||
EndDialog (hwndDlg, IDOK);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initCrashReport ()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool crashed = CFile::isExists (getLogDirectory() + "ryzom_started");
|
|
||||||
bool during_release = false;
|
|
||||||
bool exception_catched = false;
|
|
||||||
bool breakpointed = false;
|
|
||||||
bool dumped = false;
|
|
||||||
bool report_failed = false;
|
|
||||||
bool report_refused = false;
|
|
||||||
bool report_sent = false;
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "during_release"))
|
|
||||||
during_release = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "during_release");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "exception_catched"))
|
|
||||||
exception_catched = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "exception_catched");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "breakpointed"))
|
|
||||||
breakpointed = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "breakpointed");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "nel_debug.dmp"))
|
|
||||||
dumped = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "nel_debug.dmp");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "report_failed"))
|
|
||||||
report_failed = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_failed");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "report_refused"))
|
|
||||||
report_refused = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_refused");
|
|
||||||
if (crashed && CFile::isExists (getLogDirectory() + "report_sent"))
|
|
||||||
report_sent = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_sent");
|
|
||||||
CFile::createEmptyFile(getLogDirectory() + "ryzom_started");
|
|
||||||
connect();
|
|
||||||
if (report_sent)
|
|
||||||
send("/?crashtype=REPORT_SENT");
|
|
||||||
else if (report_refused)
|
|
||||||
send("/?crashtype=REPORT_REFUSED");
|
|
||||||
else if (report_failed)
|
|
||||||
send("/?crashtype=REPORT_FAILED");
|
|
||||||
else if (dumped)
|
|
||||||
send("/?crashtype=DUMPED");
|
|
||||||
else if (breakpointed)
|
|
||||||
send("/?crashtype=BREAKPOINTED");
|
|
||||||
else if (exception_catched)
|
|
||||||
send("/?crashtype=EXCEPTION_CATCHED");
|
|
||||||
else if (during_release)
|
|
||||||
send("/?crashtype=DURING_RELEASE");
|
|
||||||
else if (crashed)
|
|
||||||
{
|
|
||||||
//DialogBox (HInstance, MAKEINTRESOURCE(IDD_CRASH_INFORMATION), NULL, ReportDialogProc);
|
|
||||||
//send("/?crashtype="+CrashFeedback);
|
|
||||||
send("/?crashtype=CRASHED");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
send("/?crashtype=NOT_CRASHED");
|
|
||||||
string res;
|
|
||||||
receive(res);
|
|
||||||
#ifdef TEST_CRASH_COUNTER
|
|
||||||
MessageBox (NULL, res.c_str(), res.c_str(), MB_OK);
|
|
||||||
#endif // TEST_CRASH_COUNTER
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */)
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue