1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00

Handle case where the log path has more that MAX_PATH characters

This commit is contained in:
CedricMocquillon 2020-12-13 14:10:44 +01:00
parent f400116bcd
commit adeb4fe02f

View file

@ -152,10 +152,13 @@ namespace Crash
if (miniDumpWriteDump == NULL)
return;
const std::wstring utf16Path = utf8ToUtf16(mShm->mStartup.mLogFilePath);
std::wstring utf16Path = utf8ToUtf16(mShm->mStartup.mLogFilePath);
if (utf16Path.empty())
return;
if (utf16Path.length() > MAX_PATH)
utf16Path = LR"(\\?\)" + utf16Path;
HANDLE hCrashLog = CreateFileW(utf16Path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hCrashLog == NULL || hCrashLog == INVALID_HANDLE_VALUE)
return;