Use the incremental approach to handle long path

pull/2937/head^2
CedricMocquillon 4 years ago
parent 73afc55462
commit e2041de969

@ -126,8 +126,13 @@ namespace Crash
void CrashCatcher::startMonitorProcess(const std::string& crashLogPath)
{
WCHAR executablePath[MAX_PATH + 1];
GetModuleFileNameW(NULL, executablePath, MAX_PATH + 1);
std::wstring executablePath;
DWORD copied = 0;
do {
executablePath.resize(executablePath.size() + MAX_PATH);
copied = GetModuleFileNameW(nullptr, &executablePath[0], executablePath.size());
} while (copied >= executablePath.size());
executablePath.resize(copied);
memset(mShm->mStartup.mLogFilePath, 0, sizeof(mShm->mStartup.mLogFilePath));
int length = crashLogPath.length();
@ -152,7 +157,7 @@ namespace Crash
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
if (!CreateProcessW(executablePath, &argumetns[0], NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
if (!CreateProcessW(&executablePath[0], &argumetns[0], NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
throw std::runtime_error("Could not start crash monitor process");
waitMonitor();

Loading…
Cancel
Save