mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
Silence Win7 Error
This commit is contained in:
parent
9e6df6da0e
commit
8cb4553165
1 changed files with 13 additions and 4 deletions
|
|
@ -62,12 +62,20 @@ static void CockatriceLogger(QtMsgType type, const QMessageLogContext &ctx, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
// clang-format off
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
|
#include <tchar.h>
|
||||||
#pragma comment(lib, "DbgHelp.lib") // Link the DbgHelp library
|
#pragma comment(lib, "DbgHelp.lib") // Link the DbgHelp library
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
LONG WINAPI CockatriceUnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionPointers) {
|
LONG WINAPI CockatriceUnhandledExceptionFilter(EXCEPTION_POINTERS *pExceptionPointers)
|
||||||
HANDLE hDumpFile = CreateFile(L"CockatriceCrashDump.dmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
{
|
||||||
|
const auto fileNameString = "cockatrice.crash." + std::to_string(std::time(0)) + ".dmp";
|
||||||
|
const auto fileNameWString = std::wstring(fileNameString.begin(), fileNameString.end());
|
||||||
|
|
||||||
|
HANDLE hDumpFile =
|
||||||
|
CreateFile(fileNameWString.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
|
||||||
if (hDumpFile != INVALID_HANDLE_VALUE) {
|
if (hDumpFile != INVALID_HANDLE_VALUE) {
|
||||||
MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
|
MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
|
||||||
|
|
@ -75,7 +83,8 @@ LONG WINAPI CockatriceUnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionPoi
|
||||||
dumpInfo.ThreadId = GetCurrentThreadId();
|
dumpInfo.ThreadId = GetCurrentThreadId();
|
||||||
dumpInfo.ClientPointers = TRUE;
|
dumpInfo.ClientPointers = TRUE;
|
||||||
|
|
||||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithFullMemory, &dumpInfo, NULL, NULL);
|
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithFullMemory, &dumpInfo,
|
||||||
|
NULL, NULL);
|
||||||
CloseHandle(hDumpFile);
|
CloseHandle(hDumpFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue