1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 20:29:57 +00:00
openmw/components/crashcatcher/windows_crashshm.hpp
AnyOldName3 1bdcb5d6d9 Share the dump directory for crash and freeze dumps
This means the shared memory struct is just 255 bytes longer than a few
commits ago instead of 32K.

Also introduce a function for putting path strings in the shared memory
as there was too much copied and pasted code and it was error-prone.

Also free some handles once we're done with them so they don't leak.
2023-07-11 22:22:26 +01:00

47 lines
1.1 KiB
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;
static constexpr const int MAX_FILENAME = 0xff;
struct CrashSHM
{
enum class Event
{
None,
Startup,
Crashed,
Shutdown
};
Event mEvent;
struct Startup
{
HANDLE mAppProcessHandle;
DWORD mAppMainThreadId;
HANDLE mSignalApp;
HANDLE mSignalMonitor;
HANDLE mShmMutex;
char mDumpDirectoryPath[MAX_LONG_PATH];
char mCrashDumpFileName[MAX_FILENAME];
char mFreezeDumpFileName[MAX_FILENAME];
} mStartup;
struct Crashed
{
DWORD mThreadId;
CONTEXT mContext;
EXCEPTION_RECORD mExceptionRecord;
} mCrashed;
};
} // namespace Crash
#endif // WINDOWS_CRASHSHM_HPP