Files
UnrealEngineUWP/Engine/Source/Programs/CrashReportClient/Private/Windows/CrashReportClientMainWindows.cpp
patrick laflamme 62d60da7d8 Fix CIS reporting 'CRASH_REPORT_WITH_MTBF' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
#rb trivial
#rnx
#jira none

#ROBOMERGE-SOURCE: CL 12762568 in //UE4/Release-4.25/... via CL 12762575 via CL 12784299
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v681-12776863)

[CL 12786526 by patrick laflamme in Main branch]
2020-04-14 16:55:01 -04:00

48 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CrashReportClientApp.h"
#include "Windows/WindowsHWrapper.h"
#if defined(CRASH_REPORT_WITH_MTBF)
#include "EditorAnalyticsSession.h"
#endif
/**
* WinMain, called when the application is started
*/
int WINAPI WinMain(_In_ HINSTANCE hInInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR, _In_ int nCmdShow)
{
hInstance = hInInstance;
#if defined(CRASH_REPORT_WITH_MTBF) && !PLATFORM_SEH_EXCEPTIONS_DISABLED
// Try to record if CrashReportClientEditor is crashing. Analytics shows that good number of Editor exit code are reported delayed, hinting
// that CRCEditor was not running anymore. Try figuring out if it crashed. Suspecting that the Editor crash reporter/handler code is crashing could also
// inadvertedly cause a crash in CRCEditor.
__try
{
RunCrashReportClient(GetCommandLineW());
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
uint64 MonitoredEditorPid;
if (FParse::Value(GetCommandLineW(), TEXT("-MONITOR="), MonitoredEditorPid))
{
FTimespan Timeout = FTimespan::FromSeconds(5);
if (FEditorAnalyticsSession::Lock(Timeout))
{
FEditorAnalyticsSession MonitoredSession;
if (FEditorAnalyticsSession::FindSession(MonitoredEditorPid, MonitoredSession))
{
MonitoredSession.SaveMonitorExceptCode(GetExceptionCode());
}
FEditorAnalyticsSession::Unlock();
}
}
}
#else
RunCrashReportClient(GetCommandLineW());
#endif
return 0;
}