mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 01:15:33 +00:00
3bb3f58c73
Well... unless we fail to get the user profile directory.
Also put freeze dumps in a more appropriately-named file.
Discussed in https://gitlab.com/OpenMW/openmw/-/issues/7455
Manual rewrite of c21695c951
As well as that, I found a bug where the crash dump path was being converted from a std::filesystem::path to a utf8-encoded std::string, then passed to the crash catcher, which converted it to a std::filesystem::path implicitly, but using the system eight-bit code page, which wouldn't usually be UTF-8. That's now fixed by passing the function that expects a path a path instead of a string.
45 lines
998 B
C++
45 lines
998 B
C++
#ifndef WINDOWS_CRASHSHM_HPP
|
|
#define WINDOWS_CRASHSHM_HPP
|
|
|
|
#include <components/windows.hpp>
|
|
|
|
namespace Crash
|
|
{
|
|
|
|
// Used to communicate between the app and the monitor, fields are is overwritten with each event.
|
|
static constexpr const int MAX_LONG_PATH = 0x7fff;
|
|
|
|
struct CrashSHM
|
|
{
|
|
enum class Event
|
|
{
|
|
None,
|
|
Startup,
|
|
Crashed,
|
|
Shutdown
|
|
};
|
|
|
|
Event mEvent;
|
|
|
|
struct Startup
|
|
{
|
|
HANDLE mAppProcessHandle;
|
|
DWORD mAppMainThreadId;
|
|
HANDLE mSignalApp;
|
|
HANDLE mSignalMonitor;
|
|
HANDLE mShmMutex;
|
|
char mCrashDumpFilePath[MAX_LONG_PATH];
|
|
char mFreezeDumpFilePath[MAX_LONG_PATH];
|
|
} mStartup;
|
|
|
|
struct Crashed
|
|
{
|
|
DWORD mThreadId;
|
|
CONTEXT mContext;
|
|
EXCEPTION_RECORD mExceptionRecord;
|
|
} mCrashed;
|
|
};
|
|
|
|
} // namespace Crash
|
|
|
|
#endif // WINDOWS_CRASHSHM_HPP
|