Use GlobalFree & more
This commit is contained in:
parent
e3278840e9
commit
4fea4b4479
@ -68,19 +68,22 @@ namespace Components
|
|||||||
EmptyClipboard();
|
EmptyClipboard();
|
||||||
auto* hMem = GlobalAlloc(GMEM_MOVEABLE, error.size() + 1);
|
auto* hMem = GlobalAlloc(GMEM_MOVEABLE, error.size() + 1);
|
||||||
|
|
||||||
if (hMem != nullptr)
|
if (hMem == nullptr)
|
||||||
{
|
{
|
||||||
auto lock = reinterpret_cast<char*>(GlobalLock(hMem));
|
CloseClipboard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = GlobalLock(hMem);
|
||||||
if (lock != nullptr)
|
if (lock != nullptr)
|
||||||
{
|
{
|
||||||
std::strcpy(lock, error.data()); // Should be okay since we allocated size + 1
|
std::memcpy(lock, error.data(), error.size() + 1);
|
||||||
GlobalUnlock(hMem);
|
GlobalUnlock(hMem);
|
||||||
SetClipboardData(1, hMem);
|
SetClipboardData(1, hMem);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
GlobalFree(hMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG WINAPI Exception::ExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
|
LONG WINAPI Exception::ExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
|
||||||
@ -104,22 +107,10 @@ namespace Components
|
|||||||
|
|
||||||
//Exception::SuspendProcess();
|
//Exception::SuspendProcess();
|
||||||
|
|
||||||
bool doFullDump = Flags::HasFlag("bigdumps") || Flags::HasFlag("reallybigdumps");
|
Exception::CopyMessageToClipboard(Utils::String::VA("0x%08X", ExceptionInfo->ExceptionRecord->ExceptionAddress));
|
||||||
/*if (!doFullDump)
|
|
||||||
{
|
|
||||||
if (MessageBoxA(nullptr,
|
|
||||||
Utils::String::VA("%s\n\n" // errorStr
|
|
||||||
"Would you like to create a full crash dump for the developers (this can be 100mb or more)?\nNo will create small dumps that are automatically uploaded.", errorStr),
|
|
||||||
"IW4x Error!", MB_YESNO | MB_ICONERROR) == IDYES)
|
|
||||||
{
|
|
||||||
doFullDump = true;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Exception::CopyMessageToClipboard(errorStr);
|
|
||||||
MessageBoxA(nullptr, errorStr.data(), "ERROR", MB_ICONERROR);
|
MessageBoxA(nullptr, errorStr.data(), "ERROR", MB_ICONERROR);
|
||||||
|
|
||||||
if (doFullDump)
|
if ( Flags::HasFlag("bigminidumps"))
|
||||||
{
|
{
|
||||||
Exception::SetMiniDumpType(true, false);
|
Exception::SetMiniDumpType(true, false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user