mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
@ -1638,24 +1638,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// log stackdump.log text if the log exists
|
|
||||||
char stackDumpText[1024];
|
|
||||||
wchar_t stackDumpTextW[1024];
|
|
||||||
memset(stackDumpText, 0, arrsize(stackDumpText));
|
|
||||||
memset(stackDumpTextW, 0, arrsize(stackDumpTextW) * sizeof(wchar_t));
|
|
||||||
wchar_t fileAndPath[MAX_PATH];
|
|
||||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
|
||||||
PathAddFilename(fileAndPath, fileAndPath, L"stackDump.log", arrsize(fileAndPath));
|
|
||||||
FILE *stackDumpLog = _wfopen(fileAndPath, L"r");
|
|
||||||
if(stackDumpLog)
|
|
||||||
{
|
|
||||||
fread(stackDumpText, 1, arrsize(stackDumpText) - 1, stackDumpLog);
|
|
||||||
StrToUnicode(stackDumpTextW, stackDumpText, arrsize(stackDumpText));
|
|
||||||
NetCliAuthLogStackDump (stackDumpTextW);
|
|
||||||
fclose(stackDumpLog);
|
|
||||||
plFileUtils::RemoveFile(fileAndPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Create Window
|
// Create Window
|
||||||
if (!WinInit(hInst, nCmdShow) || gClient->GetDone())
|
if (!WinInit(hInst, nCmdShow) || gClient->GetDone())
|
||||||
|
@ -115,7 +115,11 @@ class hsMutex {
|
|||||||
public:
|
public:
|
||||||
hsMutex();
|
hsMutex();
|
||||||
virtual ~hsMutex();
|
virtual ~hsMutex();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fMutexH; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void Lock();
|
void Lock();
|
||||||
hsBool TryLock();
|
hsBool TryLock();
|
||||||
void Unlock();
|
void Unlock();
|
||||||
@ -157,6 +161,10 @@ public:
|
|||||||
hsSemaphore(int initialValue=0, const char* name=nil);
|
hsSemaphore(int initialValue=0, const char* name=nil);
|
||||||
~hsSemaphore();
|
~hsSemaphore();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fSemaH; }
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool TryWait();
|
hsBool TryWait();
|
||||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||||
void Signal();
|
void Signal();
|
||||||
@ -183,6 +191,10 @@ public:
|
|||||||
hsEvent();
|
hsEvent();
|
||||||
~hsEvent();
|
~hsEvent();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fEvent; }
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||||
void Signal();
|
void Signal();
|
||||||
};
|
};
|
||||||
|
@ -134,5 +134,7 @@ void plCrashCli::ReportCrash(PEXCEPTION_POINTERS e)
|
|||||||
|
|
||||||
void plCrashCli::WaitForHandle()
|
void plCrashCli::WaitForHandle()
|
||||||
{
|
{
|
||||||
fHandled->Wait();
|
// Don't deadlock... Only wait if the CrashSrv is attached
|
||||||
|
if (fLink && fLink->fSrvReady)
|
||||||
|
fHandled->Wait();
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,20 @@ void plCrashSrv::IHandleCrash()
|
|||||||
|
|
||||||
void plCrashSrv::HandleCrash()
|
void plCrashSrv::HandleCrash()
|
||||||
{
|
{
|
||||||
fCrashed->Wait(); // Wait for a crash
|
|
||||||
if (!fLink)
|
if (!fLink)
|
||||||
FATAL("plCrashMemLink is nil!");
|
FATAL("plCrashMemLink is nil!");
|
||||||
else if (fLink->fCrashed)
|
fLink->fSrvReady = true; // mark us as ready to receive crashes
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
// In Win32 land we have to hackily handle the client process exiting, so we'll wait on both
|
||||||
|
// the crashed semaphore and the client process...
|
||||||
|
HANDLE hack[2] = { fLink->fClientProcess, fCrashed->GetHandle() };
|
||||||
|
DWORD result = WaitForMultipleObjects(arrsize(hack), hack, FALSE, INFINITE);
|
||||||
|
hsAssert(result != WAIT_FAILED, "WaitForMultipleObjects failed");
|
||||||
|
#else
|
||||||
|
fCrashed->Wait();
|
||||||
|
#endif
|
||||||
|
if (fLink->fCrashed)
|
||||||
IHandleCrash();
|
IHandleCrash();
|
||||||
fHandled->Signal(); // Tell CrashCli we handled it
|
fHandled->Signal(); // Tell CrashCli we handled it
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
struct plCrashMemLink
|
struct plCrashMemLink
|
||||||
{
|
{
|
||||||
bool fCrashed;
|
bool fCrashed;
|
||||||
|
bool fSrvReady;
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
HANDLE fClientProcess;
|
HANDLE fClientProcess;
|
||||||
uint32_t fClientProcessID;
|
uint32_t fClientProcessID;
|
||||||
|
Reference in New Issue
Block a user